[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 5 | #include "content/shell/browser/shell_browser_context.h" |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 6 | |
dcheng | f63a125 | 2015-12-26 20:43:13 | [diff] [blame] | 7 | #include <utility> |
| 8 | |
[email protected] | 037edb5 | 2011-11-15 21:14:06 | [diff] [blame] | 9 | #include "base/bind.h" |
[email protected] | 2f2b951 | 2012-06-08 17:31:00 | [diff] [blame] | 10 | #include "base/command_line.h" |
[email protected] | 5cba3bf | 2012-01-14 02:40:35 | [diff] [blame] | 11 | #include "base/environment.h" |
thestig | b7aad54f | 2014-09-05 18:25:39 | [diff] [blame] | 12 | #include "base/files/file_util.h" |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 13 | #include "base/logging.h" |
| 14 | #include "base/path_service.h" |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 15 | #include "base/task/post_task.h" |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 16 | #include "base/threading/thread.h" |
avi | 66a0772 | 2015-12-25 23:38:12 | [diff] [blame] | 17 | #include "build/build_config.h" |
juliatuttle | ca57a11b | 2016-11-15 19:07:53 | [diff] [blame] | 18 | #include "components/keyed_service/content/browser_context_dependency_manager.h" |
Henrique Nakashima | dd1cdd1 | 2019-04-25 15:47:04 | [diff] [blame] | 19 | #include "components/keyed_service/core/simple_dependency_manager.h" |
Xi Han | 720a2a2 | 2019-05-21 17:39:59 | [diff] [blame^] | 20 | #include "components/keyed_service/core/simple_factory_key.h" |
Henrique Nakashima | 7bb9d52 | 2019-04-16 20:57:36 | [diff] [blame] | 21 | #include "components/keyed_service/core/simple_key_map.h" |
mmenke | 68a5021 | 2017-06-12 20:20:31 | [diff] [blame] | 22 | #include "components/network_session_configurator/common/network_switches.h" |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 23 | #include "content/public/browser/browser_task_traits.h" |
[email protected] | c38831a1 | 2011-10-28 12:44:49 | [diff] [blame] | 24 | #include "content/public/browser/browser_thread.h" |
Sam Goto | 0230b71 | 2019-05-14 00:30:51 | [diff] [blame] | 25 | #include "content/public/browser/sms_service.h" |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 26 | #include "content/public/browser/storage_partition.h" |
| 27 | #include "content/public/common/content_switches.h" |
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 28 | #include "content/shell/browser/shell_download_manager_delegate.h" |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 29 | #include "content/shell/browser/shell_permission_manager.h" |
[email protected] | b7c504c | 2013-05-07 14:42:12 | [diff] [blame] | 30 | #include "content/shell/common/shell_switches.h" |
nsatragno | db7b65c64 | 2016-02-16 20:14:02 | [diff] [blame] | 31 | #include "content/test/mock_background_sync_controller.h" |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 32 | |
| 33 | #if defined(OS_WIN) |
| 34 | #include "base/base_paths_win.h" |
[email protected] | 5cba3bf | 2012-01-14 02:40:35 | [diff] [blame] | 35 | #elif defined(OS_LINUX) |
| 36 | #include "base/nix/xdg_util.h" |
[email protected] | 80ec0b7 | 2012-03-22 22:45:27 | [diff] [blame] | 37 | #elif defined(OS_MACOSX) |
| 38 | #include "base/base_paths_mac.h" |
Kevin Marshall | ec64321f | 2018-05-22 03:17:41 | [diff] [blame] | 39 | #elif defined(OS_FUCHSIA) |
| 40 | #include "base/base_paths_fuchsia.h" |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 41 | #endif |
| 42 | |
[email protected] | 810ddc5 | 2012-01-24 01:00:35 | [diff] [blame] | 43 | namespace content { |
| 44 | |
John Abd-El-Malek | 8104d67 | 2018-11-28 20:27:03 | [diff] [blame] | 45 | ShellBrowserContext::ShellResourceContext::ShellResourceContext() {} |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 46 | |
hanxi | 3328d99 | 2014-10-09 13:27:11 | [diff] [blame] | 47 | ShellBrowserContext::ShellResourceContext::~ShellResourceContext() { |
| 48 | } |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 49 | |
[email protected] | d5869bf | 2013-07-03 16:21:47 | [diff] [blame] | 50 | ShellBrowserContext::ShellBrowserContext(bool off_the_record, |
Michael Giuffrida | c5571960 | 2018-02-09 17:10:35 | [diff] [blame] | 51 | net::NetLog* net_log, |
| 52 | bool delay_services_creation) |
hanxi | 3328d99 | 2014-10-09 13:27:11 | [diff] [blame] | 53 | : resource_context_(new ShellResourceContext), |
mkwst | d993d06a | 2014-10-10 11:44:38 | [diff] [blame] | 54 | ignore_certificate_errors_(false), |
hanxi | 3328d99 | 2014-10-09 13:27:11 | [diff] [blame] | 55 | off_the_record_(off_the_record), |
[email protected] | d5869bf | 2013-07-03 16:21:47 | [diff] [blame] | 56 | net_log_(net_log), |
Ivan Kotenkov | 2c0d2bb3 | 2017-11-01 15:41:28 | [diff] [blame] | 57 | guest_manager_(nullptr) { |
[email protected] | 11a65b69 | 2012-03-30 11:29:16 | [diff] [blame] | 58 | InitWhileIOAllowed(); |
Michael Giuffrida | c5571960 | 2018-02-09 17:10:35 | [diff] [blame] | 59 | if (!delay_services_creation) { |
| 60 | BrowserContextDependencyManager::GetInstance() |
| 61 | ->CreateBrowserContextServices(this); |
| 62 | } |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | ShellBrowserContext::~ShellBrowserContext() { |
Lukasz Anforowicz | 58d0dac | 2018-03-23 15:48:10 | [diff] [blame] | 66 | NotifyWillBeDestroyed(this); |
| 67 | |
Henrique Nakashima | dd1cdd1 | 2019-04-25 15:47:04 | [diff] [blame] | 68 | // The SimpleDependencyManager should always be passed after the |
| 69 | // BrowserContextDependencyManager. This is because the KeyedService instances |
| 70 | // in the BrowserContextDependencyManager's dependency graph can depend on the |
| 71 | // ones in the SimpleDependencyManager's graph. |
| 72 | DependencyManager::PerformInterlockedTwoPhaseShutdown( |
| 73 | BrowserContextDependencyManager::GetInstance(), this, |
| 74 | SimpleDependencyManager::GetInstance(), key_.get()); |
Henrique Nakashima | 7bb9d52 | 2019-04-16 20:57:36 | [diff] [blame] | 75 | |
| 76 | SimpleKeyMap::GetInstance()->Dissociate(this); |
| 77 | |
jam | 21e62ae | 2017-03-21 19:57:48 | [diff] [blame] | 78 | // Need to destruct the ResourceContext before posting tasks which may delete |
| 79 | // the URLRequestContext because ResourceContext's destructor will remove any |
| 80 | // outstanding request while URLRequestContext's destructor ensures that there |
| 81 | // are no more outstanding requests. |
[email protected] | 59383c78 | 2013-04-17 16:43:27 | [diff] [blame] | 82 | if (resource_context_) { |
[email protected] | e99ca511 | 2011-09-26 17:22:54 | [diff] [blame] | 83 | BrowserThread::DeleteSoon( |
| 84 | BrowserThread::IO, FROM_HERE, resource_context_.release()); |
| 85 | } |
jam | 21e62ae | 2017-03-21 19:57:48 | [diff] [blame] | 86 | ShutdownStoragePartitions(); |
Maks Orlovich | 4a89010e | 2017-08-25 01:49:44 | [diff] [blame] | 87 | if (url_request_getter_) { |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 88 | base::PostTaskWithTraits( |
| 89 | FROM_HERE, {BrowserThread::IO}, |
Maks Orlovich | 4a89010e | 2017-08-25 01:49:44 | [diff] [blame] | 90 | base::BindOnce(&ShellURLRequestContextGetter::NotifyContextShuttingDown, |
| 91 | url_request_getter_)); |
| 92 | } |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 93 | } |
| 94 | |
[email protected] | 11a65b69 | 2012-03-30 11:29:16 | [diff] [blame] | 95 | void ShellBrowserContext::InitWhileIOAllowed() { |
avi | 83883c8 | 2014-12-23 00:08:49 | [diff] [blame] | 96 | base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
mkwst | d993d06a | 2014-10-10 11:44:38 | [diff] [blame] | 97 | if (cmd_line->HasSwitch(switches::kIgnoreCertificateErrors)) |
[email protected] | c2dad29 | 2012-09-07 21:27:35 | [diff] [blame] | 98 | ignore_certificate_errors_ = true; |
[email protected] | e1cf85a2 | 2012-08-17 22:39:23 | [diff] [blame] | 99 | if (cmd_line->HasSwitch(switches::kContentShellDataPath)) { |
| 100 | path_ = cmd_line->GetSwitchValuePath(switches::kContentShellDataPath); |
michaelpg | 49a54b59 | 2016-10-04 02:07:21 | [diff] [blame] | 101 | if (base::DirectoryExists(path_) || base::CreateDirectory(path_)) { |
| 102 | // BrowserContext needs an absolute path, which we would normally get via |
| 103 | // PathService. In this case, manually ensure the path is absolute. |
| 104 | if (!path_.IsAbsolute()) |
| 105 | path_ = base::MakeAbsoluteFilePath(path_); |
| 106 | if (!path_.empty()) { |
Henrique Nakashima | 7bb9d52 | 2019-04-16 20:57:36 | [diff] [blame] | 107 | FinishInitWhileIOAllowed(); |
michaelpg | 49a54b59 | 2016-10-04 02:07:21 | [diff] [blame] | 108 | return; |
| 109 | } |
| 110 | } else { |
| 111 | LOG(WARNING) << "Unable to create data-path directory: " << path_.value(); |
| 112 | } |
[email protected] | e1cf85a2 | 2012-08-17 22:39:23 | [diff] [blame] | 113 | } |
michaelpg | 49a54b59 | 2016-10-04 02:07:21 | [diff] [blame] | 114 | |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 115 | #if defined(OS_WIN) |
Avi Drissman | 1cb5e9f | 2018-05-01 15:53:28 | [diff] [blame] | 116 | CHECK(base::PathService::Get(base::DIR_LOCAL_APP_DATA, &path_)); |
[email protected] | e99ca511 | 2011-09-26 17:22:54 | [diff] [blame] | 117 | path_ = path_.Append(std::wstring(L"content_shell")); |
[email protected] | 5cba3bf | 2012-01-14 02:40:35 | [diff] [blame] | 118 | #elif defined(OS_LINUX) |
dcheng | 6003e0b | 2016-04-09 18:42:34 | [diff] [blame] | 119 | std::unique_ptr<base::Environment> env(base::Environment::Create()); |
[email protected] | d30a36f | 2013-02-07 04:16:26 | [diff] [blame] | 120 | base::FilePath config_dir( |
[email protected] | 9528c9a | 2012-06-13 23:20:22 | [diff] [blame] | 121 | base::nix::GetXDGDirectory(env.get(), |
| 122 | base::nix::kXdgConfigHomeEnvVar, |
| 123 | base::nix::kDotConfigDir)); |
[email protected] | 5cba3bf | 2012-01-14 02:40:35 | [diff] [blame] | 124 | path_ = config_dir.Append("content_shell"); |
[email protected] | 80ec0b7 | 2012-03-22 22:45:27 | [diff] [blame] | 125 | #elif defined(OS_MACOSX) |
Avi Drissman | 1cb5e9f | 2018-05-01 15:53:28 | [diff] [blame] | 126 | CHECK(base::PathService::Get(base::DIR_APP_DATA, &path_)); |
[email protected] | 80ec0b7 | 2012-03-22 22:45:27 | [diff] [blame] | 127 | path_ = path_.Append("Chromium Content Shell"); |
[email protected] | 70a7f119 | 2012-06-08 01:31:34 | [diff] [blame] | 128 | #elif defined(OS_ANDROID) |
Avi Drissman | 1cb5e9f | 2018-05-01 15:53:28 | [diff] [blame] | 129 | CHECK(base::PathService::Get(base::DIR_ANDROID_APP_DATA, &path_)); |
[email protected] | 70a7f119 | 2012-06-08 01:31:34 | [diff] [blame] | 130 | path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); |
Kevin Marshall | ec64321f | 2018-05-22 03:17:41 | [diff] [blame] | 131 | #elif defined(OS_FUCHSIA) |
| 132 | CHECK(base::PathService::Get(base::DIR_APP_DATA, &path_)); |
| 133 | path_ = path_.Append(FILE_PATH_LITERAL("content_shell")); |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 134 | #else |
| 135 | NOTIMPLEMENTED(); |
| 136 | #endif |
| 137 | |
[email protected] | 756748414 | 2013-07-11 17:36:07 | [diff] [blame] | 138 | if (!base::PathExists(path_)) |
[email protected] | 426d1c9 | 2013-12-03 20:08:54 | [diff] [blame] | 139 | base::CreateDirectory(path_); |
Henrique Nakashima | 7bb9d52 | 2019-04-16 20:57:36 | [diff] [blame] | 140 | |
| 141 | FinishInitWhileIOAllowed(); |
| 142 | } |
| 143 | |
| 144 | void ShellBrowserContext::FinishInitWhileIOAllowed() { |
erg | e69130f5 | 2016-03-02 00:13:28 | [diff] [blame] | 145 | BrowserContext::Initialize(this, path_); |
Xi Han | 720a2a2 | 2019-05-21 17:39:59 | [diff] [blame^] | 146 | key_ = std::make_unique<SimpleFactoryKey>(path_, off_the_record_); |
Henrique Nakashima | 7bb9d52 | 2019-04-16 20:57:36 | [diff] [blame] | 147 | SimpleKeyMap::GetInstance()->Associate(this, key_.get()); |
[email protected] | 11a65b69 | 2012-03-30 11:29:16 | [diff] [blame] | 148 | } |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 149 | |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 150 | #if !defined(OS_ANDROID) |
dcheng | 6003e0b | 2016-04-09 18:42:34 | [diff] [blame] | 151 | std::unique_ptr<ZoomLevelDelegate> ShellBrowserContext::CreateZoomLevelDelegate( |
wjmaclean | caa7d6d | 2014-11-12 16:42:11 | [diff] [blame] | 152 | const base::FilePath&) { |
dcheng | 6003e0b | 2016-04-09 18:42:34 | [diff] [blame] | 153 | return std::unique_ptr<ZoomLevelDelegate>(); |
wjmaclean | caa7d6d | 2014-11-12 16:42:11 | [diff] [blame] | 154 | } |
mcnee | 336ea2c | 2017-05-23 22:50:59 | [diff] [blame] | 155 | #endif // !defined(OS_ANDROID) |
wjmaclean | caa7d6d | 2014-11-12 16:42:11 | [diff] [blame] | 156 | |
[email protected] | 4251165a | 2013-07-17 04:33:40 | [diff] [blame] | 157 | base::FilePath ShellBrowserContext::GetPath() const { |
[email protected] | e99ca511 | 2011-09-26 17:22:54 | [diff] [blame] | 158 | return path_; |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 159 | } |
| 160 | |
[email protected] | 27d6e85 | 2012-03-02 21:31:32 | [diff] [blame] | 161 | bool ShellBrowserContext::IsOffTheRecord() const { |
[email protected] | 71d504f | 2012-07-25 17:15:28 | [diff] [blame] | 162 | return off_the_record_; |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 163 | } |
| 164 | |
[email protected] | b441a849 | 2012-06-06 14:55:57 | [diff] [blame] | 165 | DownloadManagerDelegate* ShellBrowserContext::GetDownloadManagerDelegate() { |
[email protected] | fc72bb1 | 2013-06-02 21:13:46 | [diff] [blame] | 166 | if (!download_manager_delegate_.get()) { |
[email protected] | 7cef8217 | 2013-12-17 06:58:37 | [diff] [blame] | 167 | download_manager_delegate_.reset(new ShellDownloadManagerDelegate()); |
mkwst | d993d06a | 2014-10-10 11:44:38 | [diff] [blame] | 168 | download_manager_delegate_->SetDownloadManager( |
| 169 | BrowserContext::GetDownloadManager(this)); |
[email protected] | 5900209 | 2012-08-27 19:42:56 | [diff] [blame] | 170 | } |
[email protected] | 08c92ac | 2012-08-21 23:41:40 | [diff] [blame] | 171 | |
[email protected] | b441a849 | 2012-06-06 14:55:57 | [diff] [blame] | 172 | return download_manager_delegate_.get(); |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 173 | } |
| 174 | |
mkwst | 94388f79 | 2014-10-16 07:36:52 | [diff] [blame] | 175 | ShellURLRequestContextGetter* |
| 176 | ShellBrowserContext::CreateURLRequestContextGetter( |
[email protected] | 7571263c | 2014-03-10 22:57:09 | [diff] [blame] | 177 | ProtocolHandlerMap* protocol_handlers, |
[email protected] | 3b90aab | 2014-05-30 17:56:15 | [diff] [blame] | 178 | URLRequestInterceptorScopedVector request_interceptors) { |
mkwst | 94388f79 | 2014-10-16 07:36:52 | [diff] [blame] | 179 | return new ShellURLRequestContextGetter( |
Maks Orlovich | 05651bf | 2017-07-24 15:20:26 | [diff] [blame] | 180 | ignore_certificate_errors_, off_the_record_, GetPath(), |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 181 | base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}), |
dcheng | f63a125 | 2015-12-26 20:43:13 | [diff] [blame] | 182 | protocol_handlers, std::move(request_interceptors), net_log_); |
mkwst | 94388f79 | 2014-10-16 07:36:52 | [diff] [blame] | 183 | } |
| 184 | |
| 185 | net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( |
| 186 | ProtocolHandlerMap* protocol_handlers, |
| 187 | URLRequestInterceptorScopedVector request_interceptors) { |
| 188 | DCHECK(!url_request_getter_.get()); |
| 189 | url_request_getter_ = CreateURLRequestContextGetter( |
dcheng | f63a125 | 2015-12-26 20:43:13 | [diff] [blame] | 190 | protocol_handlers, std::move(request_interceptors)); |
[email protected] | 6bd3007 | 2013-02-08 18:17:11 | [diff] [blame] | 191 | return url_request_getter_.get(); |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | net::URLRequestContextGetter* |
[email protected] | 7571263c | 2014-03-10 22:57:09 | [diff] [blame] | 195 | ShellBrowserContext::CreateRequestContextForStoragePartition( |
| 196 | const base::FilePath& partition_path, |
| 197 | bool in_memory, |
| 198 | ProtocolHandlerMap* protocol_handlers, |
[email protected] | 3b90aab | 2014-05-30 17:56:15 | [diff] [blame] | 199 | URLRequestInterceptorScopedVector request_interceptors) { |
Lukasz Anforowicz | 5d7e145f | 2018-04-11 01:37:05 | [diff] [blame] | 200 | scoped_refptr<ShellURLRequestContextGetter>& context_getter = |
| 201 | isolated_url_request_getters_[partition_path]; |
| 202 | if (!context_getter) { |
| 203 | context_getter = CreateURLRequestContextGetter( |
| 204 | protocol_handlers, std::move(request_interceptors)); |
| 205 | } |
| 206 | return context_getter.get(); |
jam | 2503f93 | 2016-04-15 20:08:30 | [diff] [blame] | 207 | } |
| 208 | |
| 209 | net::URLRequestContextGetter* |
| 210 | ShellBrowserContext::CreateMediaRequestContext() { |
| 211 | DCHECK(url_request_getter_.get()); |
| 212 | return url_request_getter_.get(); |
| 213 | } |
| 214 | |
| 215 | net::URLRequestContextGetter* |
| 216 | ShellBrowserContext::CreateMediaRequestContextForStoragePartition( |
| 217 | const base::FilePath& partition_path, |
| 218 | bool in_memory) { |
| 219 | return nullptr; |
[email protected] | 55c0eca | 2012-09-15 05:12:34 | [diff] [blame] | 220 | } |
| 221 | |
[email protected] | df02aca | 2012-02-09 21:03:20 | [diff] [blame] | 222 | ResourceContext* ShellBrowserContext::GetResourceContext() { |
[email protected] | df02aca | 2012-02-09 21:03:20 | [diff] [blame] | 223 | return resource_context_.get(); |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 224 | } |
| 225 | |
[email protected] | 139355f | 2014-05-11 14:21:28 | [diff] [blame] | 226 | BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() { |
| 227 | return guest_manager_; |
[email protected] | 2456926 | 2014-05-06 03:31:30 | [diff] [blame] | 228 | } |
| 229 | |
[email protected] | cd501a7 | 2014-08-22 19:58:31 | [diff] [blame] | 230 | storage::SpecialStoragePolicy* ShellBrowserContext::GetSpecialStoragePolicy() { |
Ivan Kotenkov | 2c0d2bb3 | 2017-11-01 15:41:28 | [diff] [blame] | 231 | return nullptr; |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 232 | } |
| 233 | |
[email protected] | c5c89d04 | 2014-06-13 14:43:37 | [diff] [blame] | 234 | PushMessagingService* ShellBrowserContext::GetPushMessagingService() { |
Ivan Kotenkov | 2c0d2bb3 | 2017-11-01 15:41:28 | [diff] [blame] | 235 | return nullptr; |
[email protected] | c5c89d04 | 2014-06-13 14:43:37 | [diff] [blame] | 236 | } |
| 237 | |
[email protected] | c5bbe0e | 2014-08-01 23:23:30 | [diff] [blame] | 238 | SSLHostStateDelegate* ShellBrowserContext::GetSSLHostStateDelegate() { |
Ivan Kotenkov | 2c0d2bb3 | 2017-11-01 15:41:28 | [diff] [blame] | 239 | return nullptr; |
[email protected] | c5bbe0e | 2014-08-01 23:23:30 | [diff] [blame] | 240 | } |
| 241 | |
Andrey Lushnikov | f350010 | 2018-07-16 19:55:22 | [diff] [blame] | 242 | PermissionControllerDelegate* |
| 243 | ShellBrowserContext::GetPermissionControllerDelegate() { |
mlamouri | 4e37202 | 2015-03-29 14:51:06 | [diff] [blame] | 244 | if (!permission_manager_.get()) |
| 245 | permission_manager_.reset(new ShellPermissionManager()); |
| 246 | return permission_manager_.get(); |
| 247 | } |
| 248 | |
Tarun Bansal | 1ff665c | 2019-01-09 16:35:52 | [diff] [blame] | 249 | ClientHintsControllerDelegate* |
| 250 | ShellBrowserContext::GetClientHintsControllerDelegate() { |
| 251 | return nullptr; |
| 252 | } |
| 253 | |
Dan Elphick | 97521318 | 2017-09-22 10:37:47 | [diff] [blame] | 254 | BackgroundFetchDelegate* ShellBrowserContext::GetBackgroundFetchDelegate() { |
| 255 | return nullptr; |
| 256 | } |
| 257 | |
jkarlin | 6f5078ed | 2015-10-06 15:13:35 | [diff] [blame] | 258 | BackgroundSyncController* ShellBrowserContext::GetBackgroundSyncController() { |
jkarlin | 428a4a3 | 2016-01-08 16:13:24 | [diff] [blame] | 259 | if (!background_sync_controller_) |
nsatragno | db7b65c64 | 2016-02-16 20:14:02 | [diff] [blame] | 260 | background_sync_controller_.reset(new MockBackgroundSyncController()); |
jkarlin | 428a4a3 | 2016-01-08 16:13:24 | [diff] [blame] | 261 | return background_sync_controller_.get(); |
jkarlin | 6f5078ed | 2015-10-06 15:13:35 | [diff] [blame] | 262 | } |
| 263 | |
msramek | 86b6bc7 | 2017-05-31 12:21:10 | [diff] [blame] | 264 | BrowsingDataRemoverDelegate* |
| 265 | ShellBrowserContext::GetBrowsingDataRemoverDelegate() { |
| 266 | return nullptr; |
| 267 | } |
| 268 | |
Sam Goto | 0230b71 | 2019-05-14 00:30:51 | [diff] [blame] | 269 | SmsService* ShellBrowserContext::GetSmsService() { |
| 270 | if (!sms_service_) |
| 271 | sms_service_ = content::SmsService::Create(); |
| 272 | return sms_service_.get(); |
| 273 | } |
| 274 | |
[email protected] | b0f146f | 2011-09-15 22:14:25 | [diff] [blame] | 275 | } // namespace content |