blob: 4443306678c7058f24eab311774cb408a9437ede [file] [log] [blame]
Avi Drissman4e1b7bc32022-09-15 14:03:501// Copyright 2013 The Chromium Authors
[email protected]b0f146f2011-09-15 22:14:252// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]de7d61ff2013-08-20 11:30:415#ifndef CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
6#define CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_
[email protected]b0f146f2011-09-15 22:14:257
dcheng6003e0b2016-04-09 18:42:348#include <memory>
9
[email protected]57999812013-02-24 05:40:5210#include "base/files/file_path.h"
Keishi Hattori0e45c022021-11-27 09:25:5211#include "base/memory/raw_ptr.h"
[email protected]ccb797302011-12-15 16:55:1112#include "content/public/browser/browser_context.h"
[email protected]b0f146f2011-09-15 22:14:2513
Henrique Nakashima7bb9d522019-04-16 20:57:3614class SimpleFactoryKey;
15
[email protected]b0f146f2011-09-15 22:14:2516namespace content {
17
jkarlin6f5078ed2015-10-06 15:13:3518class BackgroundSyncController;
Rayan Kanso4f753a672019-08-12 17:30:0719class ContentIndexProvider;
Yoav Weiss8c9688d2019-11-07 17:21:0420class ClientHintsControllerDelegate;
[email protected]1bd0ef12011-10-20 05:24:1721class DownloadManagerDelegate;
Peter Birk Pakkenbergd927c942022-11-17 14:30:4222class OriginTrialsControllerDelegate;
Andrey Lushnikovf3500102018-07-16 19:55:2223class PermissionControllerDelegate;
Victor Tan10d93aca2022-08-12 16:46:2824class ReduceAcceptLanguageControllerDelegate;
[email protected]98d6f152011-09-29 19:35:5125class ShellDownloadManagerDelegate;
wjmacleancaa7d6d2014-11-12 16:42:1126class ZoomLevelDelegate;
[email protected]b0f146f2011-09-15 22:14:2527
28class ShellBrowserContext : public BrowserContext {
29 public:
Michael Giuffridac55719602018-02-09 17:10:3530 // If |delay_services_creation| is true, the owner is responsible for calling
31 // CreateBrowserContextServices() for this BrowserContext.
32 ShellBrowserContext(bool off_the_record,
Michael Giuffridac55719602018-02-09 17:10:3533 bool delay_services_creation = false);
Peter Boström828b9022021-09-21 02:28:4334
35 ShellBrowserContext(const ShellBrowserContext&) = delete;
36 ShellBrowserContext& operator=(const ShellBrowserContext&) = delete;
37
dchenge933b3e2014-10-21 11:44:0938 ~ShellBrowserContext() override;
[email protected]b0f146f2011-09-15 22:14:2539
Scott Violet3cd8d362020-04-30 22:18:2440 void set_client_hints_controller_delegate(
41 ClientHintsControllerDelegate* delegate) {
42 client_hints_controller_delegate_ = delegate;
43 }
44
[email protected]b0f146f2011-09-15 22:14:2545 // BrowserContext implementation.
Lucas Furukawa Gadanif45223862019-06-21 23:11:1446 base::FilePath GetPath() override;
dcheng6003e0b2016-04-09 18:42:3447 std::unique_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate(
wjmacleancaa7d6d2014-11-12 16:42:1148 const base::FilePath& partition_path) override;
Lucas Furukawa Gadanif45223862019-06-21 23:11:1449 bool IsOffTheRecord() override;
dchenge933b3e2014-10-21 11:44:0950 DownloadManagerDelegate* GetDownloadManagerDelegate() override;
dchenge933b3e2014-10-21 11:44:0951 BrowserPluginGuestManager* GetGuestManager() override;
52 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
Richard Knoll77b8b2b2021-09-08 09:29:0153 PlatformNotificationService* GetPlatformNotificationService() override;
dchenge933b3e2014-10-21 11:44:0954 PushMessagingService* GetPushMessagingService() override;
Jarryd20733d32019-10-02 23:27:1755 StorageNotificationService* GetStorageNotificationService() override;
dchenge933b3e2014-10-21 11:44:0956 SSLHostStateDelegate* GetSSLHostStateDelegate() override;
Andrey Lushnikovf3500102018-07-16 19:55:2257 PermissionControllerDelegate* GetPermissionControllerDelegate() override;
Dan Elphick975213182017-09-22 10:37:4758 BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
jkarlin6f5078ed2015-10-06 15:13:3559 BackgroundSyncController* GetBackgroundSyncController() override;
msramek86b6bc72017-05-31 12:21:1060 BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate() override;
Rayan Kanso4f753a672019-08-12 17:30:0761 ContentIndexProvider* GetContentIndexProvider() override;
Yoav Weiss8c9688d2019-11-07 17:21:0462 ClientHintsControllerDelegate* GetClientHintsControllerDelegate() override;
Victor Tan10d93aca2022-08-12 16:46:2863 ReduceAcceptLanguageControllerDelegate*
64 GetReduceAcceptLanguageControllerDelegate() override;
Peter Birk Pakkenbergd927c942022-11-17 14:30:4265 OriginTrialsControllerDelegate* GetOriginTrialsControllerDelegate() override;
[email protected]6bd30072013-02-08 18:17:1166
hanxi3328d992014-10-09 13:27:1167 protected:
mkwst94388f792014-10-16 07:36:5268 bool ignore_certificate_errors() const { return ignore_certificate_errors_; }
mkwst94388f792014-10-16 07:36:5269
dcheng6003e0b2016-04-09 18:42:3470 std::unique_ptr<ShellDownloadManagerDelegate> download_manager_delegate_;
Andrey Lushnikovf3500102018-07-16 19:55:2271 std::unique_ptr<PermissionControllerDelegate> permission_manager_;
dcheng6003e0b2016-04-09 18:42:3472 std::unique_ptr<BackgroundSyncController> background_sync_controller_;
Rayan Kanso4f753a672019-08-12 17:30:0773 std::unique_ptr<ContentIndexProvider> content_index_provider_;
Victor Tan10d93aca2022-08-12 16:46:2874 std::unique_ptr<ReduceAcceptLanguageControllerDelegate>
75 reduce_accept_lang_controller_delegate_;
Peter Birk Pakkenbergd927c942022-11-17 14:30:4276 std::unique_ptr<OriginTrialsControllerDelegate>
77 origin_trials_controller_delegate_;
mkwst98ce5ad2014-10-10 06:51:4578
79 private:
apavlov297746b2014-10-10 08:25:2680 // Performs initialization of the ShellBrowserContext while IO is still
81 // allowed on the current thread.
82 void InitWhileIOAllowed();
Henrique Nakashima7bb9d522019-04-16 20:57:3683 void FinishInitWhileIOAllowed();
apavlov297746b2014-10-10 08:25:2684
Kevin McNee6f0513b2020-09-29 19:37:0185 const bool off_the_record_;
86 bool ignore_certificate_errors_ = false;
[email protected]d30a36f2013-02-07 04:16:2687 base::FilePath path_;
Henrique Nakashima7bb9d522019-04-16 20:57:3688 std::unique_ptr<SimpleFactoryKey> key_;
Keishi Hattori0e45c022021-11-27 09:25:5289 raw_ptr<ClientHintsControllerDelegate> client_hints_controller_delegate_ =
90 nullptr;
[email protected]b0f146f2011-09-15 22:14:2591};
92
93} // namespace content
94
[email protected]de7d61ff2013-08-20 11:30:4195#endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_