blob: 9797767f88ea8ba6545f6bd13854dc7c962fa097 [file] [log] [blame]
[email protected]55eb70e762012-02-20 17:38:391// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "content/public/browser/browser_context.h"
6
avib7348942015-12-25 20:57:107#include <stddef.h>
8#include <stdint.h>
avi1ed4a4372017-04-25 05:39:419
erge69130f52016-03-02 00:13:2810#include <algorithm>
11#include <limits>
rockot963ad3e82016-04-13 16:33:2312#include <memory>
dcheng36b6aec92015-12-26 06:16:3613#include <utility>
rockot963ad3e82016-04-13 16:33:2314#include <vector>
avib7348942015-12-25 20:57:1015
mmenkec0b2b8b12017-04-21 16:27:5216#include "base/base64.h"
Takashi Toyoshimaa12ecf42018-09-25 07:46:0117#include "base/bind.h"
rockot963ad3e82016-04-13 16:33:2318#include "base/command_line.h"
Takashi Toyoshimaa12ecf42018-09-25 07:46:0119#include "base/feature_list.h"
Chris Cunninghama5b38012017-10-28 07:27:1820#include "base/files/file_path.h"
bencccfe2a2016-03-05 16:54:1421#include "base/guid.h"
erge69130f52016-03-02 00:13:2822#include "base/lazy_instance.h"
mmenkec0b2b8b12017-04-21 16:27:5223#include "base/logging.h"
rockot963ad3e82016-04-13 16:33:2324#include "base/macros.h"
avi1ed4a4372017-04-25 05:39:4125#include "base/memory/ptr_util.h"
erge69130f52016-03-02 00:13:2826#include "base/rand_util.h"
Takashi Toyoshima621e2bf2018-09-18 08:05:1627#include "base/supports_user_data.h"
Gabriel Charette44db1422018-08-06 11:19:3328#include "base/task/post_task.h"
Ken Rockot84f58fd2018-06-22 21:54:1429#include "base/threading/sequenced_task_runner_handle.h"
ben21a34c252016-06-29 22:24:3730#include "base/threading/thread_task_runner_handle.h"
Andrey Lushnikovd39d9062018-04-24 17:33:3531#include "base/unguessable_token.h"
avib7348942015-12-25 20:57:1032#include "build/build_config.h"
dmurph7ac019a2016-05-13 00:13:1733#include "content/browser/blob_storage/chrome_blob_storage_context.h"
msrameke169ccb2017-04-26 05:21:4134#include "content/browser/browsing_data/browsing_data_remover_impl.h"
Ken Rockot84f58fd2018-06-22 21:54:1435#include "content/browser/content_service_delegate_impl.h"
[email protected]b441a8492012-06-06 14:55:5736#include "content/browser/download/download_manager_impl.h"
[email protected]c4d281662013-03-31 00:35:0837#include "content/browser/indexed_db/indexed_db_context_impl.h"
[email protected]678c0362012-12-05 08:02:4438#include "content/browser/loader/resource_dispatcher_host_impl.h"
Takashi Toyoshima621e2bf2018-09-18 08:05:1639#include "content/browser/loader/shared_cors_origin_access_list_impl.h"
Andrey Lushnikovebff0442018-07-12 20:02:5840#include "content/browser/permissions/permission_controller_impl.h"
mvanouwerkerk17205ea2014-11-07 17:30:1541#include "content/browser/push_messaging/push_messaging_router.h"
Ken Rockotc7a279c2017-05-04 23:51:4542#include "content/browser/service_manager/common_browser_interfaces.h"
[email protected]4c3a23582012-08-18 08:54:3443#include "content/browser/storage_partition_impl_map.h"
[email protected]d7c7c98a2012-07-12 21:27:4444#include "content/common/child_process_host_impl.h"
[email protected]393b6cb2014-05-15 00:55:1245#include "content/public/browser/blob_handle.h"
Eric Seckler8652dcd52018-09-20 10:42:2846#include "content/public/browser/browser_task_traits.h"
[email protected]55eb70e762012-02-20 17:38:3947#include "content/public/browser/browser_thread.h"
[email protected]b441a8492012-06-06 14:55:5748#include "content/public/browser/content_browser_client.h"
falken04a6912a2016-09-23 21:06:2949#include "content/public/browser/render_process_host.h"
[email protected]536fd0b2013-03-14 17:41:5750#include "content/public/browser/site_instance.h"
rockot963ad3e82016-04-13 16:33:2351#include "content/public/common/content_switches.h"
bend32292b2016-10-07 00:21:5852#include "content/public/common/service_manager_connection.h"
ben51bb6c62016-11-17 20:15:5753#include "content/public/common/service_names.mojom.h"
Chris Cunningham9e669472017-11-15 21:03:1154#include "media/capabilities/video_decode_stats_db_impl.h"
Chris Cunninghama5b38012017-10-28 07:27:1855#include "media/mojo/services/video_decode_perf_history.h"
[email protected]4d7c4ef2012-03-16 01:47:1256#include "net/cookies/cookie_store.h"
[email protected]6b8a3c742014-07-25 00:25:3557#include "net/ssl/channel_id_service.h"
58#include "net/ssl/channel_id_store.h"
[email protected]6e2d3d22012-02-24 18:10:3659#include "net/url_request/url_request_context.h"
[email protected]6939075a2012-08-28 08:35:5360#include "net/url_request/url_request_context_getter.h"
Ken Rockot84f58fd2018-06-22 21:54:1461#include "services/content/public/mojom/constants.mojom.h"
62#include "services/content/service.h"
ben768c8dc2016-08-12 00:26:5063#include "services/file/file_service.h"
Ken Rockot21142de2018-02-10 01:45:3064#include "services/file/public/mojom/constants.mojom.h"
ben768c8dc2016-08-12 00:26:5065#include "services/file/user_id_map.h"
Takashi Toyoshimaa12ecf42018-09-25 07:46:0166#include "services/network/public/cpp/features.h"
rockot734fb662016-10-15 16:41:3067#include "services/service_manager/public/cpp/connector.h"
Ken Rockot543f5e32018-02-04 02:13:5068#include "services/service_manager/public/mojom/service.mojom.h"
Xing Liu89860472018-02-09 20:07:0269#include "storage/browser/blob/blob_storage_context.h"
pilgrime92c5fcd2014-09-10 23:31:2370#include "storage/browser/database/database_tracker.h"
71#include "storage/browser/fileapi/external_mount_points.h"
[email protected]55eb70e762012-02-20 17:38:3972
[email protected]314c3e22012-02-21 03:57:4273using base::UserDataAdapter;
[email protected]55eb70e762012-02-20 17:38:3974
[email protected]55eb70e762012-02-20 17:38:3975namespace content {
76
[email protected]735e20c2012-03-20 01:16:5977namespace {
78
scottmg5e65e3a2017-03-08 08:48:4679base::LazyInstance<std::map<std::string, BrowserContext*>>::DestructorAtExit
ben6c85c4492016-06-16 20:40:5180 g_user_id_to_context = LAZY_INSTANCE_INITIALIZER;
81
bend32292b2016-10-07 00:21:5882class ServiceUserIdHolder : public base::SupportsUserData::Data {
ben6c85c4492016-06-16 20:40:5183 public:
bend32292b2016-10-07 00:21:5884 explicit ServiceUserIdHolder(const std::string& user_id)
85 : user_id_(user_id) {}
86 ~ServiceUserIdHolder() override {}
ben6c85c4492016-06-16 20:40:5187
88 const std::string& user_id() const { return user_id_; }
89
90 private:
91 std::string user_id_;
92
bend32292b2016-10-07 00:21:5893 DISALLOW_COPY_AND_ASSIGN(ServiceUserIdHolder);
ben6c85c4492016-06-16 20:40:5194};
erge69130f52016-03-02 00:13:2895
Ken Rockot84f58fd2018-06-22 21:54:1496class ContentServiceDelegateHolder : public base::SupportsUserData::Data {
97 public:
98 explicit ContentServiceDelegateHolder(BrowserContext* browser_context)
99 : delegate_(browser_context) {}
100 ~ContentServiceDelegateHolder() override = default;
101
102 ContentServiceDelegateImpl* delegate() { return &delegate_; }
103
104 private:
105 ContentServiceDelegateImpl delegate_;
106
107 DISALLOW_COPY_AND_ASSIGN(ContentServiceDelegateHolder);
108};
109
Takashi Toyoshimaa12ecf42018-09-25 07:46:01110// A class used to make an asynchronous Mojo call with cloned patterns for each
111// StoragePartition iteration. |this| instance will be destructed when all
112// existing asynchronous Mojo calls made in SetLists() are done, and |closure|
113// will be invoked on destructing |this|.
114class CorsOriginPatternSetter
115 : public base::RefCounted<CorsOriginPatternSetter> {
116 public:
117 CorsOriginPatternSetter(
118 const url::Origin& source_origin,
119 std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
120 std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
121 base::OnceClosure closure)
122 : source_origin_(source_origin),
123 allow_patterns_(std::move(allow_patterns)),
124 block_patterns_(std::move(block_patterns)),
125 closure_(std::move(closure)) {}
126
127 void SetLists(StoragePartition* partition) {
128 partition->GetNetworkContext()->SetCorsOriginAccessListsForOrigin(
129 source_origin_, ClonePatterns(allow_patterns_),
130 ClonePatterns(block_patterns_),
131 base::BindOnce([](scoped_refptr<CorsOriginPatternSetter> setter) {},
132 base::RetainedRef(this)));
133 }
134
135 private:
136 friend class base::RefCounted<CorsOriginPatternSetter>;
137
138 static std::vector<network::mojom::CorsOriginPatternPtr> ClonePatterns(
139 const std::vector<network::mojom::CorsOriginPatternPtr>& patterns) {
140 std::vector<network::mojom::CorsOriginPatternPtr> cloned_patterns;
141 cloned_patterns.reserve(patterns.size());
142 for (const auto& item : patterns)
143 cloned_patterns.push_back(item.Clone());
144 return cloned_patterns;
145 }
146
147 ~CorsOriginPatternSetter() { std::move(closure_).Run(); }
148
149 const url::Origin source_origin_;
150 const std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns_;
151 const std::vector<network::mojom::CorsOriginPatternPtr> block_patterns_;
152
153 base::OnceClosure closure_;
154};
155
[email protected]e0ce8a1e2012-09-18 10:26:36156// Key names on BrowserContext.
msrameke169ccb2017-04-26 05:21:41157const char kBrowsingDataRemoverKey[] = "browsing-data-remover";
Ken Rockot84f58fd2018-06-22 21:54:14158const char kContentServiceDelegateKey[] = "content-service-delegate";
[email protected]6ef0c3912013-01-25 22:46:34159const char kDownloadManagerKeyName[] = "download_manager";
erge69130f52016-03-02 00:13:28160const char kMojoWasInitialized[] = "mojo-was-initialized";
Takashi Toyoshima621e2bf2018-09-18 08:05:16161const char kPermissionControllerKey[] = "permission-controller";
bend32292b2016-10-07 00:21:58162const char kServiceManagerConnection[] = "service-manager-connection";
163const char kServiceUserId[] = "service-user-id";
Takashi Toyoshima621e2bf2018-09-18 08:05:16164const char kSharedCorsOriginAccessListKey[] = "shared-cors-origin-access-list";
rockot963ad3e82016-04-13 16:33:23165const char kStoragePartitionMapKeyName[] = "content_storage_partition_map";
Chris Cunninghama5b38012017-10-28 07:27:18166const char kVideoDecodePerfHistoryId[] = "video-decode-perf-history";
erge69130f52016-03-02 00:13:28167
[email protected]9afc14e22013-09-25 22:34:14168#if defined(OS_CHROMEOS)
169const char kMountPointsKey[] = "mount_points";
170#endif // defined(OS_CHROMEOS)
171
ben6c85c4492016-06-16 20:40:51172void RemoveBrowserContextFromUserIdMap(BrowserContext* browser_context) {
bend32292b2016-10-07 00:21:58173 ServiceUserIdHolder* holder = static_cast<ServiceUserIdHolder*>(
174 browser_context->GetUserData(kServiceUserId));
ben6c85c4492016-06-16 20:40:51175 if (holder) {
176 auto it = g_user_id_to_context.Get().find(holder->user_id());
177 if (it != g_user_id_to_context.Get().end())
178 g_user_id_to_context.Get().erase(it);
179 }
180}
181
[email protected]14acc642012-11-17 12:20:10182StoragePartitionImplMap* GetStoragePartitionMap(
183 BrowserContext* browser_context) {
[email protected]4c3a23582012-08-18 08:54:34184 StoragePartitionImplMap* partition_map =
185 static_cast<StoragePartitionImplMap*>(
a.cavalcantiffab73762015-08-15 02:55:48186 browser_context->GetUserData(kStoragePartitionMapKeyName));
[email protected]d7c7c98a2012-07-12 21:27:44187 if (!partition_map) {
avi1ed4a4372017-04-25 05:39:41188 auto partition_map_owned =
Jeremy Roman04f27c372017-10-27 15:20:55189 std::make_unique<StoragePartitionImplMap>(browser_context);
avi1ed4a4372017-04-25 05:39:41190 partition_map = partition_map_owned.get();
191 browser_context->SetUserData(kStoragePartitionMapKeyName,
192 std::move(partition_map_owned));
[email protected]d7c7c98a2012-07-12 21:27:44193 }
[email protected]14acc642012-11-17 12:20:10194 return partition_map;
195}
196
197StoragePartition* GetStoragePartitionFromConfig(
198 BrowserContext* browser_context,
199 const std::string& partition_domain,
200 const std::string& partition_name,
Dan Elphick6c0d8492017-09-12 09:35:38201 bool in_memory,
202 bool can_create) {
[email protected]14acc642012-11-17 12:20:10203 StoragePartitionImplMap* partition_map =
204 GetStoragePartitionMap(browser_context);
[email protected]d7c7c98a2012-07-12 21:27:44205
[email protected]1bc28312012-11-08 08:31:53206 if (browser_context->IsOffTheRecord())
207 in_memory = true;
208
Dan Elphick6c0d8492017-09-12 09:35:38209 return partition_map->Get(partition_domain, partition_name, in_memory,
210 can_create);
[email protected]d1198fd2012-08-13 22:50:19211}
212
[email protected]6939075a2012-08-28 08:35:53213void SaveSessionStateOnIOThread(
214 const scoped_refptr<net::URLRequestContextGetter>& context_getter,
[email protected]98d6d4562014-06-25 20:57:55215 AppCacheServiceImpl* appcache_service) {
[email protected]6939075a2012-08-28 08:35:53216 net::URLRequestContext* context = context_getter->GetURLRequestContext();
mmenkeded79da2016-02-06 08:28:51217 context->cookie_store()->SetForceKeepSessionState();
Reid Klecknerc1148882018-05-11 00:04:07218 context->channel_id_service()->GetChannelIDStore()->
219 SetForceKeepSessionState();
[email protected]6939075a2012-08-28 08:35:53220 appcache_service->set_force_keep_session_state();
[email protected]6e2d3d22012-02-24 18:10:36221}
222
[email protected]89acda82013-06-25 20:52:50223void SaveSessionStateOnIndexedDBThread(
[email protected]6e2d3d22012-02-24 18:10:36224 scoped_refptr<IndexedDBContextImpl> indexed_db_context) {
[email protected]bf510ed2012-06-05 08:31:43225 indexed_db_context->SetForceKeepSessionState();
[email protected]6e2d3d22012-02-24 18:10:36226}
227
falken41f4175162014-10-29 07:03:41228void ShutdownServiceWorkerContext(StoragePartition* partition) {
229 ServiceWorkerContextWrapper* wrapper =
230 static_cast<ServiceWorkerContextWrapper*>(
231 partition->GetServiceWorkerContext());
232 wrapper->process_manager()->Shutdown();
233}
234
avi1ed4a4372017-04-25 05:39:41235void SetDownloadManager(
236 BrowserContext* context,
237 std::unique_ptr<content::DownloadManager> download_manager) {
ttr31481dc54b2015-08-06 20:11:26238 DCHECK_CURRENTLY_ON(BrowserThread::UI);
239 DCHECK(download_manager);
avi1ed4a4372017-04-25 05:39:41240 context->SetUserData(kDownloadManagerKeyName, std::move(download_manager));
ttr31481dc54b2015-08-06 20:11:26241}
242
bend32292b2016-10-07 00:21:58243class BrowserContextServiceManagerConnectionHolder
rockot963ad3e82016-04-13 16:33:23244 : public base::SupportsUserData::Data {
245 public:
benaad37ecd2017-04-12 22:08:20246 explicit BrowserContextServiceManagerConnectionHolder(
rockot400ea35b2016-10-15 19:15:32247 service_manager::mojom::ServiceRequest request)
benaad37ecd2017-04-12 22:08:20248 : service_manager_connection_(ServiceManagerConnection::Create(
rockotcef38272016-07-15 22:47:47249 std::move(request),
Eric Seckler8652dcd52018-09-20 10:42:28250 base::CreateSingleThreadTaskRunnerWithTraits(
251 {BrowserThread::IO}))) {}
bend32292b2016-10-07 00:21:58252 ~BrowserContextServiceManagerConnectionHolder() override {}
rockot963ad3e82016-04-13 16:33:23253
bend32292b2016-10-07 00:21:58254 ServiceManagerConnection* service_manager_connection() {
255 return service_manager_connection_.get();
256 }
rockot963ad3e82016-04-13 16:33:23257
258 private:
bend32292b2016-10-07 00:21:58259 std::unique_ptr<ServiceManagerConnection> service_manager_connection_;
rockot963ad3e82016-04-13 16:33:23260
bend32292b2016-10-07 00:21:58261 DISALLOW_COPY_AND_ASSIGN(BrowserContextServiceManagerConnectionHolder);
rockot963ad3e82016-04-13 16:33:23262};
263
Jens Widell7ca8fb42018-02-21 14:11:54264base::WeakPtr<storage::BlobStorageContext> BlobStorageContextGetterForBrowser(
Xing Liu89860472018-02-09 20:07:02265 scoped_refptr<ChromeBlobStorageContext> blob_context) {
266 DCHECK_CURRENTLY_ON(BrowserThread::IO);
267 return blob_context->context()->AsWeakPtr();
268}
269
[email protected]735e20c2012-03-20 01:16:59270} // namespace
271
[email protected]14acc642012-11-17 12:20:10272// static
273void BrowserContext::AsyncObliterateStoragePartition(
274 BrowserContext* browser_context,
[email protected]399583b2012-12-11 09:33:42275 const GURL& site,
276 const base::Closure& on_gc_required) {
277 GetStoragePartitionMap(browser_context)->AsyncObliterate(site,
278 on_gc_required);
279}
280
281// static
282void BrowserContext::GarbageCollectStoragePartitions(
dcheng59716272016-04-09 05:19:08283 BrowserContext* browser_context,
284 std::unique_ptr<base::hash_set<base::FilePath>> active_paths,
285 const base::Closure& done) {
dcheng36b6aec92015-12-26 06:16:36286 GetStoragePartitionMap(browser_context)
287 ->GarbageCollect(std::move(active_paths), done);
[email protected]14acc642012-11-17 12:20:10288}
289
[email protected]b441a8492012-06-06 14:55:57290DownloadManager* BrowserContext::GetDownloadManager(
291 BrowserContext* context) {
mostynbfbcdc27a2015-03-13 17:58:52292 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]b441a8492012-06-06 14:55:57293 if (!context->GetUserData(kDownloadManagerKeyName)) {
Min Qinddb40ce2017-10-28 03:38:26294 DownloadManager* download_manager = new DownloadManagerImpl(context);
[email protected]d25fda12012-06-12 17:05:03295
avi1ed4a4372017-04-25 05:39:41296 SetDownloadManager(context, base::WrapUnique(download_manager));
[email protected]b441a8492012-06-06 14:55:57297 download_manager->SetDelegate(context->GetDownloadManagerDelegate());
[email protected]b441a8492012-06-06 14:55:57298 }
299
[email protected]eba4a4d2013-05-29 02:18:06300 return static_cast<DownloadManager*>(
301 context->GetUserData(kDownloadManagerKeyName));
[email protected]b441a8492012-06-06 14:55:57302}
303
[email protected]6ef0c3912013-01-25 22:46:34304// static
[email protected]cd501a72014-08-22 19:58:31305storage::ExternalMountPoints* BrowserContext::GetMountPoints(
[email protected]6ef0c3912013-01-25 22:46:34306 BrowserContext* context) {
307 // Ensure that these methods are called on the UI thread, except for
308 // unittests where a UI thread might not have been created.
309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
Gabriel Charette2983181c2018-03-28 17:01:09310 !BrowserThread::IsThreadInitialized(BrowserThread::UI));
[email protected]6ef0c3912013-01-25 22:46:34311
312#if defined(OS_CHROMEOS)
313 if (!context->GetUserData(kMountPointsKey)) {
[email protected]cd501a72014-08-22 19:58:31314 scoped_refptr<storage::ExternalMountPoints> mount_points =
315 storage::ExternalMountPoints::CreateRefCounted();
[email protected]6ef0c3912013-01-25 22:46:34316 context->SetUserData(
317 kMountPointsKey,
Jeremy Roman04f27c372017-10-27 15:20:55318 std::make_unique<UserDataAdapter<storage::ExternalMountPoints>>(
avicb129c02017-05-03 06:49:29319 mount_points.get()));
[email protected]6ef0c3912013-01-25 22:46:34320 }
321
[email protected]cd501a72014-08-22 19:58:31322 return UserDataAdapter<storage::ExternalMountPoints>::Get(context,
323 kMountPointsKey);
[email protected]6ef0c3912013-01-25 22:46:34324#else
Ivan Kotenkov2c0d2bb32017-11-01 15:41:28325 return nullptr;
[email protected]6ef0c3912013-01-25 22:46:34326#endif
327}
328
msrameke169ccb2017-04-26 05:21:41329// static
330content::BrowsingDataRemover* content::BrowserContext::GetBrowsingDataRemover(
331 BrowserContext* context) {
332 DCHECK_CURRENTLY_ON(BrowserThread::UI);
333
334 if (!context->GetUserData(kBrowsingDataRemoverKey)) {
335 std::unique_ptr<BrowsingDataRemoverImpl> remover =
Jeremy Roman04f27c372017-10-27 15:20:55336 std::make_unique<BrowsingDataRemoverImpl>(context);
msrameke169ccb2017-04-26 05:21:41337 remover->SetEmbedderDelegate(context->GetBrowsingDataRemoverDelegate());
338 context->SetUserData(kBrowsingDataRemoverKey, std::move(remover));
339 }
340
341 return static_cast<BrowsingDataRemoverImpl*>(
342 context->GetUserData(kBrowsingDataRemoverKey));
343}
344
Andrey Lushnikovebff0442018-07-12 20:02:58345// static
346content::PermissionController* content::BrowserContext::GetPermissionController(
347 BrowserContext* context) {
348 DCHECK_CURRENTLY_ON(BrowserThread::UI);
349
350 if (!context->GetUserData(kPermissionControllerKey)) {
351 context->SetUserData(kPermissionControllerKey,
352 std::make_unique<PermissionControllerImpl>(context));
353 }
354
355 return static_cast<PermissionControllerImpl*>(
356 context->GetUserData(kPermissionControllerKey));
357}
358
[email protected]4c3a23582012-08-18 08:54:34359StoragePartition* BrowserContext::GetStoragePartition(
360 BrowserContext* browser_context,
Dan Elphick6c0d8492017-09-12 09:35:38361 SiteInstance* site_instance,
362 bool can_create) {
[email protected]1bc28312012-11-08 08:31:53363 std::string partition_domain;
364 std::string partition_name;
365 bool in_memory = false;
[email protected]4c3a23582012-08-18 08:54:34366
[email protected]4c3a23582012-08-18 08:54:34367 if (site_instance) {
[email protected]1bc28312012-11-08 08:31:53368 GetContentClient()->browser()->GetStoragePartitionConfigForSite(
[email protected]14acc642012-11-17 12:20:10369 browser_context, site_instance->GetSiteURL(), true,
[email protected]1bc28312012-11-08 08:31:53370 &partition_domain, &partition_name, &in_memory);
[email protected]4c3a23582012-08-18 08:54:34371 }
372
Dan Elphick6c0d8492017-09-12 09:35:38373 return GetStoragePartitionFromConfig(browser_context, partition_domain,
374 partition_name, in_memory, can_create);
[email protected]4c3a23582012-08-18 08:54:34375}
376
[email protected]e94bbcb2012-09-07 05:33:57377StoragePartition* BrowserContext::GetStoragePartitionForSite(
378 BrowserContext* browser_context,
Dan Elphick6c0d8492017-09-12 09:35:38379 const GURL& site,
380 bool can_create) {
[email protected]1bc28312012-11-08 08:31:53381 std::string partition_domain;
382 std::string partition_name;
383 bool in_memory;
[email protected]e94bbcb2012-09-07 05:33:57384
[email protected]1bc28312012-11-08 08:31:53385 GetContentClient()->browser()->GetStoragePartitionConfigForSite(
[email protected]14acc642012-11-17 12:20:10386 browser_context, site, true, &partition_domain, &partition_name,
387 &in_memory);
[email protected]1bc28312012-11-08 08:31:53388
Dan Elphick6c0d8492017-09-12 09:35:38389 return GetStoragePartitionFromConfig(browser_context, partition_domain,
390 partition_name, in_memory, can_create);
[email protected]e94bbcb2012-09-07 05:33:57391}
392
[email protected]4c3a23582012-08-18 08:54:34393void BrowserContext::ForEachStoragePartition(
394 BrowserContext* browser_context,
395 const StoragePartitionCallback& callback) {
396 StoragePartitionImplMap* partition_map =
397 static_cast<StoragePartitionImplMap*>(
a.cavalcantiffab73762015-08-15 02:55:48398 browser_context->GetUserData(kStoragePartitionMapKeyName));
[email protected]4c3a23582012-08-18 08:54:34399 if (!partition_map)
400 return;
401
402 partition_map->ForEach(callback);
403}
404
405StoragePartition* BrowserContext::GetDefaultStoragePartition(
406 BrowserContext* browser_context) {
Ivan Kotenkov2c0d2bb32017-11-01 15:41:28407 return GetStoragePartition(browser_context, nullptr);
[email protected]55eb70e762012-02-20 17:38:39408}
409
tbarzicdb712682015-03-06 06:05:41410// static
[email protected]393b6cb2014-05-15 00:55:12411void BrowserContext::CreateMemoryBackedBlob(BrowserContext* browser_context,
Marijn Kruisselbrink604fd7e72017-10-26 16:31:05412 const char* data,
413 size_t length,
414 const std::string& content_type,
415 BlobCallback callback) {
mostynbfbcdc27a2015-03-13 17:58:52416 DCHECK_CURRENTLY_ON(BrowserThread::UI);
[email protected]393b6cb2014-05-15 00:55:12417
418 ChromeBlobStorageContext* blob_context =
419 ChromeBlobStorageContext::GetFor(browser_context);
Eric Seckler8652dcd52018-09-20 10:42:28420 base::PostTaskWithTraitsAndReplyWithResult(
421 FROM_HERE, {BrowserThread::IO},
Marijn Kruisselbrink604fd7e72017-10-26 16:31:05422 base::BindOnce(&ChromeBlobStorageContext::CreateMemoryBackedBlob,
423 base::WrapRefCounted(blob_context), data, length,
424 content_type),
425 std::move(callback));
[email protected]393b6cb2014-05-15 00:55:12426}
427
[email protected]66e53d0282014-08-07 10:04:35428// static
Xing Liu89860472018-02-09 20:07:02429BrowserContext::BlobContextGetter BrowserContext::GetBlobStorageContext(
430 BrowserContext* browser_context) {
431 DCHECK_CURRENTLY_ON(BrowserThread::UI);
432 scoped_refptr<ChromeBlobStorageContext> chrome_blob_context =
433 ChromeBlobStorageContext::GetFor(browser_context);
Jens Widell7ca8fb42018-02-21 14:11:54434 return base::BindRepeating(&BlobStorageContextGetterForBrowser,
435 chrome_blob_context);
Xing Liu89860472018-02-09 20:07:02436}
437
438// static
Marijn Kruisselbrink9e073a82018-06-18 17:48:58439blink::mojom::BlobPtr BrowserContext::GetBlobPtr(
440 BrowserContext* browser_context,
441 const std::string& uuid) {
442 DCHECK_CURRENTLY_ON(BrowserThread::UI);
443 return ChromeBlobStorageContext::GetBlobPtr(browser_context, uuid);
444}
445
446// static
[email protected]66e53d0282014-08-07 10:04:35447void BrowserContext::DeliverPushMessage(
448 BrowserContext* browser_context,
449 const GURL& origin,
avib7348942015-12-25 20:57:10450 int64_t service_worker_registration_id,
Han Leonc1deace2018-08-03 03:52:53451 base::Optional<std::string> payload,
Peter Beverloo7815db1e02017-07-12 19:03:21452 const base::Callback<void(mojom::PushDeliveryStatus)>& callback) {
mostynbfbcdc27a2015-03-13 17:58:52453 DCHECK_CURRENTLY_ON(BrowserThread::UI);
harknessdd4d2b22016-01-27 19:26:43454 PushMessagingRouter::DeliverMessage(browser_context, origin,
Han Leonc1deace2018-08-03 03:52:53455 service_worker_registration_id,
456 std::move(payload), callback);
[email protected]66e53d0282014-08-07 10:04:35457}
458
falken41f4175162014-10-29 07:03:41459// static
460void BrowserContext::NotifyWillBeDestroyed(BrowserContext* browser_context) {
Lukasz Anforowicz58d0dac2018-03-23 15:48:10461 // Make sure NotifyWillBeDestroyed is idempotent. This helps facilitate the
462 // pattern where NotifyWillBeDestroyed is called from *both*
463 // ShellBrowserContext and its derived classes (e.g.
464 // LayoutTestBrowserContext).
465 if (browser_context->was_notify_will_be_destroyed_called_)
466 return;
467 browser_context->was_notify_will_be_destroyed_called_ = true;
468
Ken Rockot99c5bc742018-07-12 15:36:56469 // Subclasses of BrowserContext may expect there to be no more
470 // RenderProcessHosts using them by the time this function returns. We
471 // therefore explicitly tear down embedded Content Service instances now to
472 // ensure that all their WebContents (and therefore RPHs) are torn down too.
473 browser_context->RemoveUserData(kContentServiceDelegateKey);
474
falken41f4175162014-10-29 07:03:41475 // Service Workers must shutdown before the browser context is destroyed,
476 // since they keep render process hosts alive and the codebase assumes that
477 // render process hosts die before their profile (browser context) dies.
478 ForEachStoragePartition(browser_context,
479 base::Bind(ShutdownServiceWorkerContext));
falken04a6912a2016-09-23 21:06:29480
481 // Shared workers also keep render process hosts alive, and are expected to
Darin Fisherd3768b2f62017-10-07 01:00:16482 // return ref counts to 0 after documents close. However, to ensure that
483 // hosts are destructed now, forcibly release their ref counts here.
falken04a6912a2016-09-23 21:06:29484 for (RenderProcessHost::iterator host_iterator =
485 RenderProcessHost::AllHostsIterator();
486 !host_iterator.IsAtEnd(); host_iterator.Advance()) {
487 RenderProcessHost* host = host_iterator.GetCurrentValue();
Benoit Lizeab08362c2017-07-19 14:50:54488 if (host->GetBrowserContext() == browser_context) {
489 // This will also clean up spare RPH references.
Yutaka Hirano09a9afb92017-08-16 09:11:45490 host->DisableKeepAliveRefCount();
Benoit Lizeab08362c2017-07-19 14:50:54491 }
falken04a6912a2016-09-23 21:06:29492 }
falken41f4175162014-10-29 07:03:41493}
494
[email protected]314c3e22012-02-21 03:57:42495void BrowserContext::EnsureResourceContextInitialized(BrowserContext* context) {
[email protected]7e26ac92012-02-27 20:15:05496 // This will be enough to tickle initialization of BrowserContext if
497 // necessary, which initializes ResourceContext. The reason we don't call
[email protected]4c3a23582012-08-18 08:54:34498 // ResourceContext::InitializeResourceContext() directly here is that
499 // ResourceContext initialization may call back into BrowserContext
500 // and when that call returns it'll end rewriting its UserData map. It will
501 // end up rewriting the same value but this still causes a race condition.
502 //
503 // See http://crbug.com/115678.
504 GetDefaultStoragePartition(context);
[email protected]55eb70e762012-02-20 17:38:39505}
506
[email protected]6e2d3d22012-02-24 18:10:36507void BrowserContext::SaveSessionState(BrowserContext* browser_context) {
[email protected]b1b502e2012-09-16 07:31:43508 StoragePartition* storage_partition =
509 BrowserContext::GetDefaultStoragePartition(browser_context);
[email protected]6e2d3d22012-02-24 18:10:36510
Joshua Bell607cb142017-07-24 19:17:16511 storage::DatabaseTracker* database_tracker =
512 storage_partition->GetDatabaseTracker();
513 database_tracker->task_runner()->PostTask(
514 FROM_HERE,
515 base::BindOnce(&storage::DatabaseTracker::SetForceKeepSessionState,
kylecharda69d882017-10-04 05:49:52516 base::WrapRefCounted(database_tracker)));
Joshua Bell607cb142017-07-24 19:17:16517
Gabriel Charette2983181c2018-03-28 17:01:09518 if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) {
Eric Seckler8652dcd52018-09-20 10:42:28519 base::PostTaskWithTraits(
520 FROM_HERE, {BrowserThread::IO},
tzik4fea24af2017-08-23 11:41:47521 base::BindOnce(
[email protected]6939075a2012-08-28 08:35:53522 &SaveSessionStateOnIOThread,
Clark DuVall385b5a52018-06-14 21:33:32523 base::WrapRefCounted(storage_partition->GetURLRequestContext()),
[email protected]98d6d4562014-06-25 20:57:55524 static_cast<AppCacheServiceImpl*>(
[email protected]63ef85512014-06-05 14:21:26525 storage_partition->GetAppCacheService())));
[email protected]6e2d3d22012-02-24 18:10:36526 }
527
Clark DuVall385b5a52018-06-14 21:33:32528 storage_partition->GetCookieManagerForBrowserProcess()
529 ->SetForceKeepSessionState();
530
[email protected]5f2aa722013-08-07 16:59:41531 DOMStorageContextWrapper* dom_storage_context_proxy =
532 static_cast<DOMStorageContextWrapper*>(
[email protected]b1b502e2012-09-16 07:31:43533 storage_partition->GetDOMStorageContext());
[email protected]5f2aa722013-08-07 16:59:41534 dom_storage_context_proxy->SetForceKeepSessionState();
[email protected]735e20c2012-03-20 01:16:59535
[email protected]89acda82013-06-25 20:52:50536 IndexedDBContextImpl* indexed_db_context_impl =
537 static_cast<IndexedDBContextImpl*>(
[email protected]b1b502e2012-09-16 07:31:43538 storage_partition->GetIndexedDBContext());
[email protected]89acda82013-06-25 20:52:50539 // No task runner in unit tests.
540 if (indexed_db_context_impl->TaskRunner()) {
541 indexed_db_context_impl->TaskRunner()->PostTask(
kylecharda69d882017-10-04 05:49:52542 FROM_HERE,
543 base::BindOnce(&SaveSessionStateOnIndexedDBThread,
544 base::WrapRefCounted(indexed_db_context_impl)));
[email protected]6e2d3d22012-02-24 18:10:36545 }
546}
547
ttr31481dc54b2015-08-06 20:11:26548void BrowserContext::SetDownloadManagerForTesting(
549 BrowserContext* browser_context,
avi1ed4a4372017-04-25 05:39:41550 std::unique_ptr<content::DownloadManager> download_manager) {
551 SetDownloadManager(browser_context, std::move(download_manager));
ttr31481dc54b2015-08-06 20:11:26552}
553
rockot963ad3e82016-04-13 16:33:23554// static
erge69130f52016-03-02 00:13:28555void BrowserContext::Initialize(
556 BrowserContext* browser_context,
557 const base::FilePath& path) {
ben6c85c4492016-06-16 20:40:51558 std::string new_id;
559 if (GetContentClient() && GetContentClient()->browser()) {
bend32292b2016-10-07 00:21:58560 new_id = GetContentClient()->browser()->GetServiceUserIdForBrowserContext(
ben6c85c4492016-06-16 20:40:51561 browser_context);
562 } else {
563 // Some test scenarios initialize a BrowserContext without a content client.
bencccfe2a2016-03-05 16:54:14564 new_id = base::GenerateGUID();
ben6c85c4492016-06-16 20:40:51565 }
erge69130f52016-03-02 00:13:28566
bend32292b2016-10-07 00:21:58567 ServiceUserIdHolder* holder = static_cast<ServiceUserIdHolder*>(
568 browser_context->GetUserData(kServiceUserId));
ben6c85c4492016-06-16 20:40:51569 if (holder)
bend32292b2016-10-07 00:21:58570 file::ForgetServiceUserIdUserDirAssociation(holder->user_id());
571 file::AssociateServiceUserIdWithUserDir(new_id, path);
ben6c85c4492016-06-16 20:40:51572 RemoveBrowserContextFromUserIdMap(browser_context);
573 g_user_id_to_context.Get()[new_id] = browser_context;
bend32292b2016-10-07 00:21:58574 browser_context->SetUserData(kServiceUserId,
Jeremy Roman04f27c372017-10-27 15:20:55575 std::make_unique<ServiceUserIdHolder>(new_id));
erge69130f52016-03-02 00:13:28576
avi1ed4a4372017-04-25 05:39:41577 browser_context->SetUserData(
Jeremy Roman04f27c372017-10-27 15:20:55578 kMojoWasInitialized, std::make_unique<base::SupportsUserData::Data>());
rockot963ad3e82016-04-13 16:33:23579
bend32292b2016-10-07 00:21:58580 ServiceManagerConnection* service_manager_connection =
581 ServiceManagerConnection::GetForProcess();
fdoray4f155f02016-10-12 11:28:50582 if (service_manager_connection && base::ThreadTaskRunnerHandle::IsSet()) {
rockot963ad3e82016-04-13 16:33:23583 // NOTE: Many unit tests create a TestBrowserContext without initializing
bend32292b2016-10-07 00:21:58584 // Mojo or the global service manager connection.
rockot963ad3e82016-04-13 16:33:23585
rockot400ea35b2016-10-15 19:15:32586 service_manager::mojom::ServicePtr service;
Ken Rockotf4d8a942017-05-13 00:10:37587 auto service_request = mojo::MakeRequest(&service);
rockot963ad3e82016-04-13 16:33:23588
rockot400ea35b2016-10-15 19:15:32589 service_manager::mojom::PIDReceiverPtr pid_receiver;
bene6a9f012017-01-07 00:43:43590 service_manager::Identity identity(mojom::kBrowserServiceName, new_id);
benbd3c2482017-01-07 05:48:21591 service_manager_connection->GetConnector()->StartService(
bene6a9f012017-01-07 00:43:43592 identity, std::move(service), mojo::MakeRequest(&pid_receiver));
rockot963ad3e82016-04-13 16:33:23593 pid_receiver->SetPID(base::GetCurrentProcId());
594
benaad37ecd2017-04-12 22:08:20595 service_manager_connection->GetConnector()->StartService(identity);
bend32292b2016-10-07 00:21:58596 BrowserContextServiceManagerConnectionHolder* connection_holder =
597 new BrowserContextServiceManagerConnectionHolder(
bend32292b2016-10-07 00:21:58598 std::move(service_request));
avi1ed4a4372017-04-25 05:39:41599 browser_context->SetUserData(kServiceManagerConnection,
600 base::WrapUnique(connection_holder));
rockot963ad3e82016-04-13 16:33:23601
bend32292b2016-10-07 00:21:58602 ServiceManagerConnection* connection =
603 connection_holder->service_manager_connection();
rockot963ad3e82016-04-13 16:33:23604
ben146248de2016-06-14 15:24:59605 // New embedded service factories should be added to |connection| here.
rockot963ad3e82016-04-13 16:33:23606
Ken Rockot84f58fd2018-06-22 21:54:14607 {
608 service_manager::EmbeddedServiceInfo info;
609 info.factory = base::BindRepeating(&file::CreateFileService);
610 connection->AddEmbeddedService(file::mojom::kServiceName, info);
611 }
612
613 browser_context->SetUserData(
614 kContentServiceDelegateKey,
615 std::make_unique<ContentServiceDelegateHolder>(browser_context));
616
617 {
618 service_manager::EmbeddedServiceInfo info;
619 info.task_runner = base::SequencedTaskRunnerHandle::Get();
620 info.factory = base::BindRepeating(
621 [](BrowserContext* context)
622 -> std::unique_ptr<service_manager::Service> {
623 auto* holder = static_cast<ContentServiceDelegateHolder*>(
624 context->GetUserData(kContentServiceDelegateKey));
625 auto* delegate = holder->delegate();
626 auto service = std::make_unique<content::Service>(delegate);
627 delegate->AddService(service.get());
628 return service;
629 },
630 browser_context);
631 connection->AddEmbeddedService(content::mojom::kServiceName, info);
632 }
tibellab3d36b2017-03-10 02:57:25633
634 ContentBrowserClient::StaticServiceMap services;
635 browser_context->RegisterInProcessServices(&services);
636 for (const auto& entry : services) {
637 connection->AddEmbeddedService(entry.first, entry.second);
638 }
Ken Rockotc7a279c2017-05-04 23:51:45639
640 RegisterCommonBrowserInterfaces(connection);
sammc030f5012017-03-13 02:28:45641 connection->Start();
rockot963ad3e82016-04-13 16:33:23642 }
erge69130f52016-03-02 00:13:28643}
644
rockot963ad3e82016-04-13 16:33:23645// static
bend32292b2016-10-07 00:21:58646const std::string& BrowserContext::GetServiceUserIdFor(
bencccfe2a2016-03-05 16:54:14647 BrowserContext* browser_context) {
erge69130f52016-03-02 00:13:28648 CHECK(browser_context->GetUserData(kMojoWasInitialized))
649 << "Attempting to get the mojo user id for a BrowserContext that was "
650 << "never Initialize()ed.";
651
bend32292b2016-10-07 00:21:58652 ServiceUserIdHolder* holder = static_cast<ServiceUserIdHolder*>(
653 browser_context->GetUserData(kServiceUserId));
ben6c85c4492016-06-16 20:40:51654 return holder->user_id();
erge69130f52016-03-02 00:13:28655}
656
rockot963ad3e82016-04-13 16:33:23657// static
bend32292b2016-10-07 00:21:58658BrowserContext* BrowserContext::GetBrowserContextForServiceUserId(
ben6c85c4492016-06-16 20:40:51659 const std::string& user_id) {
660 auto it = g_user_id_to_context.Get().find(user_id);
661 return it != g_user_id_to_context.Get().end() ? it->second : nullptr;
662}
663
664// static
rockot400ea35b2016-10-15 19:15:32665service_manager::Connector* BrowserContext::GetConnectorFor(
rockot963ad3e82016-04-13 16:33:23666 BrowserContext* browser_context) {
bend32292b2016-10-07 00:21:58667 ServiceManagerConnection* connection =
668 GetServiceManagerConnectionFor(browser_context);
ben5be0b9132016-08-03 00:17:18669 return connection ? connection->GetConnector() : nullptr;
670}
671
672// static
bend32292b2016-10-07 00:21:58673ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor(
ben5be0b9132016-08-03 00:17:18674 BrowserContext* browser_context) {
bend32292b2016-10-07 00:21:58675 BrowserContextServiceManagerConnectionHolder* connection_holder =
676 static_cast<BrowserContextServiceManagerConnectionHolder*>(
677 browser_context->GetUserData(kServiceManagerConnection));
678 return connection_holder ? connection_holder->service_manager_connection()
679 : nullptr;
rockot963ad3e82016-04-13 16:33:23680}
681
Takashi Toyoshima621e2bf2018-09-18 08:05:16682// static
Takashi Toyoshimaa12ecf42018-09-25 07:46:01683const SharedCorsOriginAccessList* BrowserContext::GetSharedCorsOriginAccessList(
Takashi Toyoshima621e2bf2018-09-18 08:05:16684 BrowserContext* browser_context) {
685 return UserDataAdapter<SharedCorsOriginAccessList>::Get(
686 browser_context, kSharedCorsOriginAccessListKey);
687}
688
Takashi Toyoshimaa12ecf42018-09-25 07:46:01689// static
690void BrowserContext::SetCorsOriginAccessListsForOrigin(
691 BrowserContext* browser_context,
692 const url::Origin& source_origin,
693 std::vector<network::mojom::CorsOriginPatternPtr> allow_patterns,
694 std::vector<network::mojom::CorsOriginPatternPtr> block_patterns,
695 base::OnceClosure closure) {
696 if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
697 UserDataAdapter<SharedCorsOriginAccessList>::Get(
698 browser_context, kSharedCorsOriginAccessListKey)
699 ->SetForOrigin(source_origin, std::move(allow_patterns),
700 std::move(block_patterns), std::move(closure));
701 } else {
702 auto setter = base::MakeRefCounted<CorsOriginPatternSetter>(
703 source_origin, std::move(allow_patterns), std::move(block_patterns),
704 std::move(closure));
705 ForEachStoragePartition(
706 browser_context, base::BindRepeating(&CorsOriginPatternSetter::SetLists,
707 base::RetainedRef(setter.get())));
708 }
709}
710
mmenkec0b2b8b12017-04-21 16:27:52711BrowserContext::BrowserContext()
Takashi Toyoshima621e2bf2018-09-18 08:05:16712 : unique_id_(base::UnguessableToken::Create().ToString()) {
713 SetUserData(kSharedCorsOriginAccessListKey,
714 std::make_unique<UserDataAdapter<SharedCorsOriginAccessList>>(
715 new SharedCorsOriginAccessListImpl()));
716}
mmenkec0b2b8b12017-04-21 16:27:52717
[email protected]55eb70e762012-02-20 17:38:39718BrowserContext::~BrowserContext() {
erge69130f52016-03-02 00:13:28719 CHECK(GetUserData(kMojoWasInitialized))
720 << "Attempting to destroy a BrowserContext that never called "
721 << "Initialize()";
722
kinukof6ed359c2016-07-26 13:27:21723 DCHECK(!GetUserData(kStoragePartitionMapKeyName))
724 << "StoragePartitionMap is not shut down properly";
725
Lukasz Anforowicz58d0dac2018-03-23 15:48:10726 DCHECK(was_notify_will_be_destroyed_called_);
727
ben6c85c4492016-06-16 20:40:51728 RemoveBrowserContextFromUserIdMap(this);
729
[email protected]b441a8492012-06-06 14:55:57730 if (GetUserData(kDownloadManagerKeyName))
731 GetDownloadManager(this)->Shutdown();
[email protected]55eb70e762012-02-20 17:38:39732}
733
kinukof6ed359c2016-07-26 13:27:21734void BrowserContext::ShutdownStoragePartitions() {
735 if (GetUserData(kStoragePartitionMapKeyName))
736 RemoveUserData(kStoragePartitionMapKeyName);
737}
738
mmenkec0b2b8b12017-04-21 16:27:52739std::string BrowserContext::GetMediaDeviceIDSalt() {
Andrey Lushnikovd39d9062018-04-24 17:33:35740 return unique_id_;
mmenkec0b2b8b12017-04-21 16:27:52741}
742
743// static
744std::string BrowserContext::CreateRandomMediaDeviceIDSalt() {
Andrey Lushnikovd39d9062018-04-24 17:33:35745 return base::UnguessableToken::Create().ToString();
746}
747
748const std::string& BrowserContext::UniqueId() const {
749 return unique_id_;
mmenkec0b2b8b12017-04-21 16:27:52750}
751
Chris Cunninghama5b38012017-10-28 07:27:18752media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() {
753 media::VideoDecodePerfHistory* decode_history =
754 static_cast<media::VideoDecodePerfHistory*>(
755 GetUserData(kVideoDecodePerfHistoryId));
756
757 // Lazily created. Note, this does not trigger loading the DB from disk. That
758 // occurs later upon first VideoDecodePerfHistory API request that requires DB
759 // access. DB operations will not block the UI thread.
760 if (!decode_history) {
chcunningham06b81092018-09-24 20:20:51761 std::unique_ptr<media::VideoDecodeStatsDBImpl> stats_db =
762 media::VideoDecodeStatsDBImpl::Create(
763 GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats")));
764 auto new_decode_history =
765 std::make_unique<media::VideoDecodePerfHistory>(std::move(stats_db));
766 decode_history = new_decode_history.get();
767
768 SetUserData(kVideoDecodePerfHistoryId, std::move(new_decode_history));
Chris Cunninghama5b38012017-10-28 07:27:18769 }
770
771 return decode_history;
772}
773
Min Qind3ff2ed62018-07-21 06:46:59774download::InProgressDownloadManager*
775BrowserContext::RetriveInProgressDownloadManager() {
776 return nullptr;
777}
778
[email protected]55eb70e762012-02-20 17:38:39779} // namespace content