blob: ffe1696597696120cbd7004eb018940b2b884ae2 [file] [log] [blame]
[email protected]de7d61ff2013-08-20 11:30:411// Copyright 2013 The Chromium Authors. All rights reserved.
[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]b0f146f2011-09-15 22:14:2510#include "base/compiler_specific.h"
[email protected]57999812013-02-24 05:40:5211#include "base/files/file_path.h"
avi66a07722015-12-25 23:38:1212#include "base/macros.h"
[email protected]b0f146f2011-09-15 22:14:2513#include "base/memory/ref_counted.h"
[email protected]ccb797302011-12-15 16:55:1114#include "content/public/browser/browser_context.h"
[email protected]672c8c12013-03-07 12:30:0615#include "content/public/browser/content_browser_client.h"
hanxi3328d992014-10-09 13:27:1116#include "content/public/browser/resource_context.h"
[email protected]b0f146f2011-09-15 22:14:2517
Henrique Nakashima7bb9d522019-04-16 20:57:3618class SimpleFactoryKey;
19
[email protected]b0f146f2011-09-15 22:14:2520namespace content {
21
jkarlin6f5078ed2015-10-06 15:13:3522class BackgroundSyncController;
Rayan Kanso4f753a672019-08-12 17:30:0723class ContentIndexProvider;
[email protected]1bd0ef12011-10-20 05:24:1724class DownloadManagerDelegate;
Andrey Lushnikovf3500102018-07-16 19:55:2225class PermissionControllerDelegate;
[email protected]98d6f152011-09-29 19:35:5126class ShellDownloadManagerDelegate;
mcnee336ea2c2017-05-23 22:50:5927#if !defined(OS_ANDROID)
wjmacleancaa7d6d2014-11-12 16:42:1128class ZoomLevelDelegate;
mcnee336ea2c2017-05-23 22:50:5929#endif // !defined(OS_ANDROID)
[email protected]b0f146f2011-09-15 22:14:2530
31class ShellBrowserContext : public BrowserContext {
32 public:
Michael Giuffridac55719602018-02-09 17:10:3533 // If |delay_services_creation| is true, the owner is responsible for calling
34 // CreateBrowserContextServices() for this BrowserContext.
35 ShellBrowserContext(bool off_the_record,
Michael Giuffridac55719602018-02-09 17:10:3536 bool delay_services_creation = false);
dchenge933b3e2014-10-21 11:44:0937 ~ShellBrowserContext() override;
[email protected]b0f146f2011-09-15 22:14:2538
[email protected]139355f2014-05-11 14:21:2839 void set_guest_manager_for_testing(
40 BrowserPluginGuestManager* guest_manager) {
41 guest_manager_ = guest_manager;
[email protected]24569262014-05-06 03:31:3042 }
43
[email protected]b0f146f2011-09-15 22:14:2544 // BrowserContext implementation.
Lucas Furukawa Gadanif45223862019-06-21 23:11:1445 base::FilePath GetPath() override;
mcnee336ea2c2017-05-23 22:50:5946#if !defined(OS_ANDROID)
dcheng6003e0b2016-04-09 18:42:3447 std::unique_ptr<ZoomLevelDelegate> CreateZoomLevelDelegate(
wjmacleancaa7d6d2014-11-12 16:42:1148 const base::FilePath& partition_path) override;
mcnee336ea2c2017-05-23 22:50:5949#endif // !defined(OS_ANDROID)
Lucas Furukawa Gadanif45223862019-06-21 23:11:1450 bool IsOffTheRecord() override;
dchenge933b3e2014-10-21 11:44:0951 DownloadManagerDelegate* GetDownloadManagerDelegate() override;
dchenge933b3e2014-10-21 11:44:0952 ResourceContext* GetResourceContext() override;
53 BrowserPluginGuestManager* GetGuestManager() override;
54 storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
55 PushMessagingService* GetPushMessagingService() override;
Jarryd20733d32019-10-02 23:27:1756 StorageNotificationService* GetStorageNotificationService() override;
dchenge933b3e2014-10-21 11:44:0957 SSLHostStateDelegate* GetSSLHostStateDelegate() override;
Andrey Lushnikovf3500102018-07-16 19:55:2258 PermissionControllerDelegate* GetPermissionControllerDelegate() override;
Tarun Bansal1ff665c2019-01-09 16:35:5259 ClientHintsControllerDelegate* GetClientHintsControllerDelegate() override;
Dan Elphick975213182017-09-22 10:37:4760 BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
jkarlin6f5078ed2015-10-06 15:13:3561 BackgroundSyncController* GetBackgroundSyncController() override;
msramek86b6bc72017-05-31 12:21:1062 BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate() override;
Rayan Kanso4f753a672019-08-12 17:30:0763 ContentIndexProvider* GetContentIndexProvider() override;
[email protected]6bd30072013-02-08 18:17:1164
hanxi3328d992014-10-09 13:27:1165 protected:
66 // Contains URLRequestContextGetter required for resource loading.
67 class ShellResourceContext : public ResourceContext {
68 public:
69 ShellResourceContext();
dchenge933b3e2014-10-21 11:44:0970 ~ShellResourceContext() override;
hanxi3328d992014-10-09 13:27:1171
hanxi3328d992014-10-09 13:27:1172 private:
hanxi3328d992014-10-09 13:27:1173 DISALLOW_COPY_AND_ASSIGN(ShellResourceContext);
74 };
75
mkwst94388f792014-10-16 07:36:5276 bool ignore_certificate_errors() const { return ignore_certificate_errors_; }
mkwst94388f792014-10-16 07:36:5277
dcheng6003e0b2016-04-09 18:42:3478 std::unique_ptr<ShellResourceContext> resource_context_;
dcheng6003e0b2016-04-09 18:42:3479 std::unique_ptr<ShellDownloadManagerDelegate> download_manager_delegate_;
Andrey Lushnikovf3500102018-07-16 19:55:2280 std::unique_ptr<PermissionControllerDelegate> permission_manager_;
dcheng6003e0b2016-04-09 18:42:3481 std::unique_ptr<BackgroundSyncController> background_sync_controller_;
Rayan Kanso4f753a672019-08-12 17:30:0782 std::unique_ptr<ContentIndexProvider> content_index_provider_;
mkwst98ce5ad2014-10-10 06:51:4583
84 private:
apavlov297746b2014-10-10 08:25:2685 // Performs initialization of the ShellBrowserContext while IO is still
86 // allowed on the current thread.
87 void InitWhileIOAllowed();
Henrique Nakashima7bb9d522019-04-16 20:57:3688 void FinishInitWhileIOAllowed();
apavlov297746b2014-10-10 08:25:2689
John Abd-El-Malek4987e1c2017-07-11 17:27:2390 bool ignore_certificate_errors_;
[email protected]71d504f2012-07-25 17:15:2891 bool off_the_record_;
[email protected]d30a36f2013-02-07 04:16:2692 base::FilePath path_;
[email protected]139355f2014-05-11 14:21:2893 BrowserPluginGuestManager* guest_manager_;
Henrique Nakashima7bb9d522019-04-16 20:57:3694 std::unique_ptr<SimpleFactoryKey> key_;
[email protected]b0f146f2011-09-15 22:14:2595
[email protected]b0f146f2011-09-15 22:14:2596 DISALLOW_COPY_AND_ASSIGN(ShellBrowserContext);
97};
98
99} // namespace content
100
[email protected]de7d61ff2013-08-20 11:30:41101#endif // CONTENT_SHELL_BROWSER_SHELL_BROWSER_CONTEXT_H_