Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [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 | |
| 5 | #include "content/public/browser/browser_context.h" |
| 6 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 7 | #include <stddef.h> |
| 8 | #include <stdint.h> |
avi | 1ed4a437 | 2017-04-25 05:39:41 | [diff] [blame] | 9 | |
erg | e69130f5 | 2016-03-02 00:13:28 | [diff] [blame] | 10 | #include <algorithm> |
| 11 | #include <limits> |
rockot | 963ad3e8 | 2016-04-13 16:33:23 | [diff] [blame] | 12 | #include <memory> |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 13 | #include <optional> |
Takuto Ikuta | 8332bf9d | 2019-01-05 03:58:00 | [diff] [blame] | 14 | #include <unordered_set> |
dcheng | 36b6aec9 | 2015-12-26 06:16:36 | [diff] [blame] | 15 | #include <utility> |
rockot | 963ad3e8 | 2016-04-13 16:33:23 | [diff] [blame] | 16 | #include <vector> |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 17 | |
mmenke | c0b2b8b1 | 2017-04-21 16:27:52 | [diff] [blame] | 18 | #include "base/base64.h" |
Hans Wennborg | 0917de89 | 2020-04-28 20:21:15 | [diff] [blame] | 19 | #include "base/check_op.h" |
rockot | 963ad3e8 | 2016-04-13 16:33:23 | [diff] [blame] | 20 | #include "base/command_line.h" |
Chris Cunningham | a5b3801 | 2017-10-28 07:27:18 | [diff] [blame] | 21 | #include "base/files/file_path.h" |
Avi Drissman | adac2199 | 2023-01-11 23:46:39 | [diff] [blame] | 22 | #include "base/functional/bind.h" |
erg | e69130f5 | 2016-03-02 00:13:28 | [diff] [blame] | 23 | #include "base/lazy_instance.h" |
avi | 1ed4a437 | 2017-04-25 05:39:41 | [diff] [blame] | 24 | #include "base/memory/ptr_util.h" |
Ken Rockot | 43513269 | 2018-11-20 21:46:10 | [diff] [blame] | 25 | #include "base/memory/weak_ptr.h" |
Chris Cunningham | 4507edfa | 2019-05-30 20:15:54 | [diff] [blame] | 26 | #include "base/metrics/field_trial_params.h" |
Hans Wennborg | 0917de89 | 2020-04-28 20:21:15 | [diff] [blame] | 27 | #include "base/notreached.h" |
Lei Zhang | 19c1df0 | 2025-04-17 01:53:56 | [diff] [blame] | 28 | #include "base/trace_event/trace_event.h" |
Andrey Lushnikov | d39d906 | 2018-04-24 17:33:35 | [diff] [blame] | 29 | #include "base/unguessable_token.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 30 | #include "build/build_config.h" |
Stephan Hartmann | 63027c6 | 2022-12-19 13:56:17 | [diff] [blame] | 31 | #include "components/download/public/common/in_progress_download_manager.h" |
Ari Chivukula | d1cf518c | 2022-05-06 23:14:22 | [diff] [blame] | 32 | #include "components/services/storage/privileged/mojom/indexed_db_control.mojom.h" |
dmurph | 7ac019a | 2016-05-13 00:13:17 | [diff] [blame] | 33 | #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 34 | #include "content/browser/browser_context_impl.h" |
Etienne Noel | 2ac27c2 | 2022-12-06 04:28:46 | [diff] [blame] | 35 | #include "content/browser/browsing_data/browsing_data_remover_impl.h" |
Will Harris | cd57b83 | 2023-01-05 20:03:10 | [diff] [blame] | 36 | #include "content/browser/child_process_host_impl.h" |
Alex Moshchuk | 99b79542 | 2019-03-07 00:27:32 | [diff] [blame] | 37 | #include "content/browser/child_process_security_policy_impl.h" |
Christian Biesinger | c59336f | 2024-07-26 17:08:22 | [diff] [blame] | 38 | #include "content/browser/in_memory_federated_permission_context.h" |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 39 | #include "content/browser/preloading/prefetch/prefetch_container.h" |
| 40 | #include "content/browser/preloading/prefetch/prefetch_service.h" |
| 41 | #include "content/browser/preloading/prefetch/prefetch_type.h" |
mvanouwerkerk | 17205ea | 2014-11-07 17:30:15 | [diff] [blame] | 42 | #include "content/browser/push_messaging/push_messaging_router.h" |
Sharon Yang | d70a539 | 2021-10-26 23:06:32 | [diff] [blame] | 43 | #include "content/browser/site_info.h" |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 44 | #include "content/browser/storage_partition_impl_map.h" |
[email protected] | 393b6cb | 2014-05-15 00:55:12 | [diff] [blame] | 45 | #include "content/public/browser/blob_handle.h" |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 46 | #include "content/public/browser/browser_task_traits.h" |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [diff] [blame] | 47 | #include "content/public/browser/browser_thread.h" |
[email protected] | b441a849 | 2012-06-06 14:55:57 | [diff] [blame] | 48 | #include "content/public/browser/content_browser_client.h" |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 49 | #include "content/public/browser/download_manager.h" |
| 50 | #include "content/public/browser/permission_controller.h" |
Wayne Jackson Jr. | 3dfcf947 | 2025-01-31 14:07:16 | [diff] [blame] | 51 | #include "content/public/browser/prefetch_service_delegate.h" |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 52 | #include "content/public/browser/preloading_trigger_type.h" |
falken | 04a6912a | 2016-09-23 21:06:29 | [diff] [blame] | 53 | #include "content/public/browser/render_process_host.h" |
[email protected] | 536fd0b | 2013-03-14 17:41:57 | [diff] [blame] | 54 | #include "content/public/browser/site_instance.h" |
Bret Sepulveda | 5665215 | 2020-06-24 14:47:13 | [diff] [blame] | 55 | #include "content/public/browser/storage_partition_config.h" |
Hans Wennborg | 5ffd139 | 2019-10-16 11:00:02 | [diff] [blame] | 56 | #include "content/public/common/content_client.h" |
rockot | 963ad3e8 | 2016-04-13 16:33:23 | [diff] [blame] | 57 | #include "content/public/common/content_switches.h" |
Lukasz Anforowicz | 287ec63c | 2021-04-07 22:07:39 | [diff] [blame] | 58 | #include "media/base/media_switches.h" |
| 59 | #include "media/capabilities/in_memory_video_decode_stats_db_impl.h" |
| 60 | #include "media/capabilities/video_decode_stats_db_impl.h" |
| 61 | #include "media/mojo/services/video_decode_perf_history.h" |
Johannes Kron | 3318267 | 2022-05-20 09:52:03 | [diff] [blame] | 62 | #include "media/mojo/services/webrtc_video_perf_history.h" |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 63 | #include "net/http/http_request_headers.h" |
Xing Liu | 8986047 | 2018-02-09 20:07:02 | [diff] [blame] | 64 | #include "storage/browser/blob/blob_storage_context.h" |
DongJun Kim | febb3c2 | 2019-10-21 02:08:06 | [diff] [blame] | 65 | #include "storage/browser/file_system/external_mount_points.h" |
David Sanders | b4b4870 | 2025-01-08 02:29:18 | [diff] [blame] | 66 | #include "third_party/blink/public/mojom/loader/referrer.mojom.h" |
Hans Wennborg | 78b5218 | 2021-06-15 13:42:15 | [diff] [blame] | 67 | #include "third_party/blink/public/mojom/push_messaging/push_messaging.mojom.h" |
Hans Wennborg | 0e47211 | 2021-06-16 21:36:32 | [diff] [blame] | 68 | #include "third_party/perfetto/include/perfetto/tracing/traced_proto.h" |
Alexander Timin | f785f34 | 2021-03-18 00:00:56 | [diff] [blame] | 69 | #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 70 | #include "url/gurl.h" |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [diff] [blame] | 71 | |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [diff] [blame] | 72 | namespace content { |
| 73 | |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 74 | class PrefetchService; |
Wayne Jackson Jr. | 3dfcf947 | 2025-01-31 14:07:16 | [diff] [blame] | 75 | class PrefetchServiceDelegate; |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 76 | |
[email protected] | 735e20c | 2012-03-20 01:16:59 | [diff] [blame] | 77 | namespace { |
| 78 | |
ssid | 6bedaa9 | 2021-06-16 10:25:24 | [diff] [blame] | 79 | using perfetto::protos::pbzero::ChromeBrowserContext; |
| 80 | using perfetto::protos::pbzero::ChromeTrackEvent; |
| 81 | |
Jens Widell | 7ca8fb4 | 2018-02-21 14:11:54 | [diff] [blame] | 82 | base::WeakPtr<storage::BlobStorageContext> BlobStorageContextGetterForBrowser( |
Xing Liu | 8986047 | 2018-02-09 20:07:02 | [diff] [blame] | 83 | scoped_refptr<ChromeBlobStorageContext> blob_context) { |
| 84 | DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 85 | return blob_context->context()->AsWeakPtr(); |
| 86 | } |
| 87 | |
[email protected] | 735e20c | 2012-03-20 01:16:59 | [diff] [blame] | 88 | } // namespace |
| 89 | |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 90 | BrowserContext::BrowserContext() { |
Arthur Sonzogni | 61cb46d1 | 2022-02-15 17:25:28 | [diff] [blame] | 91 | impl_ = base::WrapUnique(new BrowserContextImpl(this)); |
ssid | 6bedaa9 | 2021-06-16 10:25:24 | [diff] [blame] | 92 | TRACE_EVENT("shutdown", "BrowserContext::BrowserContext", |
| 93 | ChromeTrackEvent::kChromeBrowserContext, *this); |
| 94 | TRACE_EVENT_BEGIN("shutdown", "Browser.BrowserContext", |
| 95 | perfetto::Track::FromPointer(this), |
| 96 | ChromeTrackEvent::kChromeBrowserContext, *this); |
[email protected] | 399583b | 2012-12-11 09:33:42 | [diff] [blame] | 97 | } |
| 98 | |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 99 | BrowserContext::~BrowserContext() { |
| 100 | TRACE_EVENT("shutdown", "BrowserContext::~BrowserContext", |
ssid | 6bedaa9 | 2021-06-16 10:25:24 | [diff] [blame] | 101 | ChromeTrackEvent::kChromeBrowserContext, *this); |
| 102 | |
| 103 | // End for ASYNC event "Browser.BrowserContext". |
| 104 | TRACE_EVENT_END("shutdown", perfetto::Track::FromPointer(this), |
| 105 | ChromeTrackEvent::kChromeBrowserContext, *this); |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 106 | |
| 107 | impl_.reset(); |
[email protected] | 14acc64 | 2012-11-17 12:20:10 | [diff] [blame] | 108 | } |
| 109 | |
Lukasz Anforowicz | 48d8345 | 2021-05-12 02:58:20 | [diff] [blame] | 110 | DownloadManager* BrowserContext::GetDownloadManager() { |
mostynb | fbcdc27a | 2015-03-13 17:58:52 | [diff] [blame] | 111 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
Lukasz Anforowicz | 48d8345 | 2021-05-12 02:58:20 | [diff] [blame] | 112 | return impl()->GetDownloadManager(); |
[email protected] | b441a849 | 2012-06-06 14:55:57 | [diff] [blame] | 113 | } |
| 114 | |
Lukasz Anforowicz | eda637d2 | 2021-05-20 00:32:23 | [diff] [blame] | 115 | storage::ExternalMountPoints* BrowserContext::GetMountPoints() { |
| 116 | return impl()->GetMountPoints(); |
[email protected] | 6ef0c391 | 2013-01-25 22:46:34 | [diff] [blame] | 117 | } |
| 118 | |
Lukasz Anforowicz | 8b6a932 | 2021-05-13 02:16:32 | [diff] [blame] | 119 | BrowsingDataRemover* BrowserContext::GetBrowsingDataRemover() { |
| 120 | return impl()->GetBrowsingDataRemover(); |
msramek | e169ccb | 2017-04-26 05:21:41 | [diff] [blame] | 121 | } |
| 122 | |
Lukasz Anforowicz | 8206115 | 2021-05-14 02:14:26 | [diff] [blame] | 123 | PermissionController* BrowserContext::GetPermissionController() { |
Andrey Lushnikov | ebff044 | 2018-07-12 20:02:58 | [diff] [blame] | 124 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
Lukasz Anforowicz | 8206115 | 2021-05-14 02:14:26 | [diff] [blame] | 125 | return impl()->GetPermissionController(); |
Andrey Lushnikov | ebff044 | 2018-07-12 20:02:58 | [diff] [blame] | 126 | } |
| 127 | |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 128 | StoragePartition* BrowserContext::GetStoragePartition( |
Dan Elphick | 6c0d849 | 2017-09-12 09:35:38 | [diff] [blame] | 129 | SiteInstance* site_instance, |
| 130 | bool can_create) { |
Aaron Colwell | 364199b | 2021-03-24 05:25:39 | [diff] [blame] | 131 | if (site_instance) |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 132 | DCHECK_EQ(this, site_instance->GetBrowserContext()); |
Aaron Colwell | 364199b | 2021-03-24 05:25:39 | [diff] [blame] | 133 | |
Alex Moshchuk | a03a6e8 | 2021-11-15 19:09:42 | [diff] [blame] | 134 | auto partition_config = site_instance |
| 135 | ? site_instance->GetStoragePartitionConfig() |
| 136 | : StoragePartitionConfig::CreateDefault(this); |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 137 | return GetStoragePartition(partition_config, can_create); |
Bret Sepulveda | 5665215 | 2020-06-24 14:47:13 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | StoragePartition* BrowserContext::GetStoragePartition( |
Bret Sepulveda | 5665215 | 2020-06-24 14:47:13 | [diff] [blame] | 141 | const StoragePartitionConfig& storage_partition_config, |
| 142 | bool can_create) { |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 143 | if (IsOffTheRecord()) { |
Aaron Colwell | 1501311 | 2021-03-10 17:06:26 | [diff] [blame] | 144 | // An off the record profile MUST only use in memory storage partitions. |
| 145 | CHECK(storage_partition_config.in_memory()); |
| 146 | } |
Bret Sepulveda | 5665215 | 2020-06-24 14:47:13 | [diff] [blame] | 147 | |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 148 | return impl()->GetOrCreateStoragePartitionMap()->Get(storage_partition_config, |
| 149 | can_create); |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 150 | } |
| 151 | |
Aaron Colwell | b54ca39 | 2021-03-18 23:20:56 | [diff] [blame] | 152 | StoragePartition* BrowserContext::GetStoragePartitionForUrl( |
Aaron Colwell | b54ca39 | 2021-03-18 23:20:56 | [diff] [blame] | 153 | const GURL& url, |
Dan Elphick | 6c0d849 | 2017-09-12 09:35:38 | [diff] [blame] | 154 | bool can_create) { |
Alex Moshchuk | e1f71d3a | 2023-03-28 19:36:39 | [diff] [blame] | 155 | auto storage_partition_config = |
| 156 | SiteInfo::GetStoragePartitionConfigForUrl(this, url); |
[email protected] | e94bbcb | 2012-09-07 05:33:57 | [diff] [blame] | 157 | |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 158 | return GetStoragePartition(storage_partition_config, can_create); |
[email protected] | e94bbcb | 2012-09-07 05:33:57 | [diff] [blame] | 159 | } |
| 160 | |
Robbie McElrath | 785b5e0 | 2023-01-18 00:32:46 | [diff] [blame] | 161 | void BrowserContext::ForEachLoadedStoragePartition( |
Daniel Cheng | cb3ab64 | 2023-11-22 06:41:59 | [diff] [blame] | 162 | base::FunctionRef<void(StoragePartition*)> fn) { |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 163 | StoragePartitionImplMap* partition_map = impl()->storage_partition_map(); |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 164 | if (!partition_map) |
| 165 | return; |
| 166 | |
Daniel Cheng | cb3ab64 | 2023-11-22 06:41:59 | [diff] [blame] | 167 | partition_map->ForEach(fn); |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 168 | } |
| 169 | |
Robbie McElrath | 785b5e0 | 2023-01-18 00:32:46 | [diff] [blame] | 170 | size_t BrowserContext::GetLoadedStoragePartitionCount() { |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 171 | StoragePartitionImplMap* partition_map = impl()->storage_partition_map(); |
Brandon Maslen | dd4ba9e0 | 2020-02-19 21:52:37 | [diff] [blame] | 172 | return partition_map ? partition_map->size() : 0; |
| 173 | } |
| 174 | |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 175 | void BrowserContext::AsyncObliterateStoragePartition( |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 176 | const std::string& partition_domain, |
Maria Petrisor | 2d611d6 | 2021-09-02 22:44:15 | [diff] [blame] | 177 | base::OnceClosure on_gc_required, |
| 178 | base::OnceClosure done_callback) { |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 179 | impl()->GetOrCreateStoragePartitionMap()->AsyncObliterate( |
Maria Petrisor | 2d611d6 | 2021-09-02 22:44:15 | [diff] [blame] | 180 | partition_domain, std::move(on_gc_required), std::move(done_callback)); |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [diff] [blame] | 181 | } |
| 182 | |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 183 | void BrowserContext::GarbageCollectStoragePartitions( |
Lei Zhang | 3ea7594 | 2022-01-20 16:57:03 | [diff] [blame] | 184 | std::unordered_set<base::FilePath> active_paths, |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 185 | base::OnceClosure done) { |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 186 | impl()->GetOrCreateStoragePartitionMap()->GarbageCollect( |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 187 | std::move(active_paths), std::move(done)); |
| 188 | } |
| 189 | |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 190 | StoragePartition* BrowserContext::GetDefaultStoragePartition() { |
| 191 | return GetStoragePartition(StoragePartitionConfig::CreateDefault(this)); |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 192 | } |
| 193 | |
elabadysayed | ab1b97c0 | 2025-02-13 11:06:26 | [diff] [blame] | 194 | std::unique_ptr<content::PrefetchHandle> |
| 195 | BrowserContext::StartBrowserPrefetchRequest( |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 196 | const GURL& url, |
Taiyo Mizuhashi | 49959d0 | 2025-04-22 16:07:54 | [diff] [blame] | 197 | const std::string& embedder_histogram_suffix, |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 198 | bool javascript_enabled, |
Rulong Chen(陈汝龙) | bf12169c | 2024-12-16 05:38:16 | [diff] [blame] | 199 | std::optional<net::HttpNoVarySearchData> no_vary_search_hint, |
Taiyo Mizuhashi | d7c85699 | 2025-06-23 08:56:02 | [diff] [blame] | 200 | std::optional<PrefetchPriority> priority, |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 201 | const net::HttpRequestHeaders& additional_headers, |
elabadysayed | f7d6b00f | 2025-02-05 11:27:00 | [diff] [blame] | 202 | std::unique_ptr<PrefetchRequestStatusListener> request_status_listener, |
kenoss | 70bfbfe | 2025-06-10 08:04:42 | [diff] [blame] | 203 | base::TimeDelta ttl, |
Taiyo Mizuhashi | cd08a8f | 2025-06-10 17:27:32 | [diff] [blame] | 204 | bool should_append_variations_header, |
| 205 | bool should_disable_block_until_head_timeout) { |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 206 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
Wayne Jackson Jr. | 679a6e7 | 2024-12-10 17:02:40 | [diff] [blame] | 207 | TRACE_EVENT0("loading", "BrowserContext::StartBrowserPrefetchRequest"); |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 208 | |
| 209 | PrefetchService* prefetch_service = |
| 210 | BrowserContextImpl::From(this)->GetPrefetchService(); |
| 211 | if (!prefetch_service) { |
Wayne Jackson Jr. | b22d53b2 | 2024-11-15 11:40:06 | [diff] [blame] | 212 | if (request_status_listener) { |
Wayne Jackson Jr. | 0118d2a | 2025-02-21 10:53:46 | [diff] [blame] | 213 | request_status_listener->OnPrefetchStartFailedGeneric(); |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 214 | } |
elabadysayed | ab1b97c0 | 2025-02-13 11:06:26 | [diff] [blame] | 215 | return nullptr; |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 216 | } |
| 217 | |
| 218 | PrefetchType prefetch_type(PreloadingTriggerType::kEmbedder, |
| 219 | /*use_prefetch_proxy=*/false); |
| 220 | auto container = std::make_unique<PrefetchContainer>( |
Taiyo Mizuhashi | 49959d0 | 2025-04-22 16:07:54 | [diff] [blame] | 221 | this, url, prefetch_type, embedder_histogram_suffix, |
| 222 | blink::mojom::Referrer(), javascript_enabled, |
Rulong Chen(陈汝龙) | bf12169c | 2024-12-16 05:38:16 | [diff] [blame] | 223 | /*referring_origin=*/std::nullopt, std::move(no_vary_search_hint), |
Taiyo Mizuhashi | d7c85699 | 2025-06-23 08:56:02 | [diff] [blame] | 224 | std::move(priority), |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 225 | /*attempt=*/nullptr, additional_headers, |
Taiyo Mizuhashi | cd08a8f | 2025-06-10 17:27:32 | [diff] [blame] | 226 | std::move(request_status_listener), ttl, should_append_variations_header, |
| 227 | should_disable_block_until_head_timeout); |
elabadysayed | ab1b97c0 | 2025-02-13 11:06:26 | [diff] [blame] | 228 | return prefetch_service->AddPrefetchContainerWithHandle(std::move(container)); |
Wayne Jackson Jr. | 1b732247 | 2024-10-29 13:08:51 | [diff] [blame] | 229 | } |
| 230 | |
Wayne Jackson Jr. | 3dfcf947 | 2025-01-31 14:07:16 | [diff] [blame] | 231 | void BrowserContext::UpdatePrefetchServiceDelegateAcceptLanguageHeader( |
| 232 | std::string accept_language_header) { |
| 233 | PrefetchService* prefetch_service = |
| 234 | BrowserContextImpl::From(this)->GetPrefetchService(); |
| 235 | if (!prefetch_service) { |
| 236 | return; |
| 237 | } |
| 238 | prefetch_service->GetPrefetchServiceDelegate()->SetAcceptLanguageHeader( |
| 239 | accept_language_header); |
| 240 | } |
| 241 | |
Wayne Jackson Jr. | 0118d2a | 2025-02-21 10:53:46 | [diff] [blame] | 242 | bool BrowserContext::IsPrefetchDuplicate( |
| 243 | GURL& url, |
| 244 | std::optional<net::HttpNoVarySearchData> no_vary_search_hint) { |
| 245 | PrefetchService* prefetch_service = |
| 246 | BrowserContextImpl::From(this)->GetPrefetchService(); |
| 247 | // `CHECK` is used here because this method should not be called unless there |
| 248 | // is a `prefetch_service` created for `this` browser context. |
| 249 | CHECK(prefetch_service); |
| 250 | return prefetch_service->IsPrefetchDuplicate(url, no_vary_search_hint); |
| 251 | } |
| 252 | |
Lukasz Anforowicz | 7ef1cfd | 2021-05-04 02:18:37 | [diff] [blame] | 253 | void BrowserContext::CreateMemoryBackedBlob(base::span<const uint8_t> data, |
Marijn Kruisselbrink | 604fd7e7 | 2017-10-26 16:31:05 | [diff] [blame] | 254 | const std::string& content_type, |
| 255 | BlobCallback callback) { |
mostynb | fbcdc27a | 2015-03-13 17:58:52 | [diff] [blame] | 256 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
[email protected] | 393b6cb | 2014-05-15 00:55:12 | [diff] [blame] | 257 | |
| 258 | ChromeBlobStorageContext* blob_context = |
Lukasz Anforowicz | 7ef1cfd | 2021-05-04 02:18:37 | [diff] [blame] | 259 | ChromeBlobStorageContext::GetFor(this); |
Gabriel Charette | e7cdc5cd | 2020-05-27 23:35:05 | [diff] [blame] | 260 | GetIOThreadTaskRunner({})->PostTaskAndReplyWithResult( |
| 261 | FROM_HERE, |
Marijn Kruisselbrink | 604fd7e7 | 2017-10-26 16:31:05 | [diff] [blame] | 262 | base::BindOnce(&ChromeBlobStorageContext::CreateMemoryBackedBlob, |
Adrienne Walker | ac6a9e5 | 2019-10-28 20:59:33 | [diff] [blame] | 263 | base::WrapRefCounted(blob_context), data, content_type), |
Marijn Kruisselbrink | 604fd7e7 | 2017-10-26 16:31:05 | [diff] [blame] | 264 | std::move(callback)); |
[email protected] | 393b6cb | 2014-05-15 00:55:12 | [diff] [blame] | 265 | } |
| 266 | |
Lukasz Anforowicz | 7ef1cfd | 2021-05-04 02:18:37 | [diff] [blame] | 267 | BrowserContext::BlobContextGetter BrowserContext::GetBlobStorageContext() { |
Xing Liu | 8986047 | 2018-02-09 20:07:02 | [diff] [blame] | 268 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 269 | scoped_refptr<ChromeBlobStorageContext> chrome_blob_context = |
Lukasz Anforowicz | 7ef1cfd | 2021-05-04 02:18:37 | [diff] [blame] | 270 | ChromeBlobStorageContext::GetFor(this); |
Jens Widell | 7ca8fb4 | 2018-02-21 14:11:54 | [diff] [blame] | 271 | return base::BindRepeating(&BlobStorageContextGetterForBrowser, |
| 272 | chrome_blob_context); |
Xing Liu | 8986047 | 2018-02-09 20:07:02 | [diff] [blame] | 273 | } |
| 274 | |
Julie Jeongeun Kim | bc4a76d | 2019-09-11 02:28:23 | [diff] [blame] | 275 | mojo::PendingRemote<blink::mojom::Blob> BrowserContext::GetBlobRemote( |
Marijn Kruisselbrink | 9e073a8 | 2018-06-18 17:48:58 | [diff] [blame] | 276 | const std::string& uuid) { |
| 277 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
Lukasz Anforowicz | 7ef1cfd | 2021-05-04 02:18:37 | [diff] [blame] | 278 | return ChromeBlobStorageContext::GetBlobRemote(this, uuid); |
Marijn Kruisselbrink | 9e073a8 | 2018-06-18 17:48:58 | [diff] [blame] | 279 | } |
| 280 | |
[email protected] | 66e53d028 | 2014-08-07 10:04:35 | [diff] [blame] | 281 | void BrowserContext::DeliverPushMessage( |
[email protected] | 66e53d028 | 2014-08-07 10:04:35 | [diff] [blame] | 282 | const GURL& origin, |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 283 | int64_t service_worker_registration_id, |
Rayan Kanso | 3b68620 | 2019-05-10 17:41:55 | [diff] [blame] | 284 | const std::string& message_id, |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 285 | std::optional<std::string> payload, |
Nwokedi Idika | 5aaefbb | 2025-08-06 21:18:33 | [diff] [blame] | 286 | bool record_network_requests, |
Viviane Yang | d125aad | 2020-08-07 07:38:25 | [diff] [blame] | 287 | base::OnceCallback<void(blink::mojom::PushEventStatus)> callback) { |
mostynb | fbcdc27a | 2015-03-13 17:58:52 | [diff] [blame] | 288 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
Matt Falkenhagen | b5f46c45 | 2019-12-02 05:25:58 | [diff] [blame] | 289 | PushMessagingRouter::DeliverMessage( |
Lukasz Anforowicz | 5389590e | 2021-05-11 02:20:06 | [diff] [blame] | 290 | this, origin, service_worker_registration_id, message_id, |
Nwokedi Idika | 5aaefbb | 2025-08-06 21:18:33 | [diff] [blame] | 291 | std::move(payload), record_network_requests, std::move(callback)); |
[email protected] | 66e53d028 | 2014-08-07 10:04:35 | [diff] [blame] | 292 | } |
| 293 | |
Viviane Yang | 7e3680c | 2020-08-05 12:20:57 | [diff] [blame] | 294 | void BrowserContext::FirePushSubscriptionChangeEvent( |
Viviane Yang | 7e3680c | 2020-08-05 12:20:57 | [diff] [blame] | 295 | const GURL& origin, |
| 296 | int64_t service_worker_registration_id, |
| 297 | blink::mojom::PushSubscriptionPtr new_subscription, |
| 298 | blink::mojom::PushSubscriptionPtr old_subscription, |
Viviane Yang | d125aad | 2020-08-07 07:38:25 | [diff] [blame] | 299 | base::OnceCallback<void(blink::mojom::PushEventStatus)> callback) { |
Viviane Yang | 7e3680c | 2020-08-05 12:20:57 | [diff] [blame] | 300 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 301 | PushMessagingRouter::FireSubscriptionChangeEvent( |
Lukasz Anforowicz | 5389590e | 2021-05-11 02:20:06 | [diff] [blame] | 302 | this, origin, service_worker_registration_id, std::move(new_subscription), |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 303 | std::move(old_subscription), std::move(callback)); |
Viviane Yang | 7e3680c | 2020-08-05 12:20:57 | [diff] [blame] | 304 | } |
| 305 | |
Lukasz Anforowicz | eda637d2 | 2021-05-20 00:32:23 | [diff] [blame] | 306 | void BrowserContext::NotifyWillBeDestroyed() { |
| 307 | impl()->NotifyWillBeDestroyed(); |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 308 | } |
Lukasz Anforowicz | 58d0dac | 2018-03-23 15:48:10 | [diff] [blame] | 309 | |
Lukasz Anforowicz | eda637d2 | 2021-05-20 00:32:23 | [diff] [blame] | 310 | void BrowserContext::EnsureResourceContextInitialized() { |
[email protected] | 7e26ac9 | 2012-02-27 20:15:05 | [diff] [blame] | 311 | // This will be enough to tickle initialization of BrowserContext if |
| 312 | // necessary, which initializes ResourceContext. The reason we don't call |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 313 | // ResourceContext::InitializeResourceContext() directly here is that |
| 314 | // ResourceContext initialization may call back into BrowserContext |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 315 | // and when that call returns it'll end rewriting its Impl. It will |
[email protected] | 4c3a2358 | 2012-08-18 08:54:34 | [diff] [blame] | 316 | // end up rewriting the same value but this still causes a race condition. |
| 317 | // |
| 318 | // See http://crbug.com/115678. |
Lukasz Anforowicz | eda637d2 | 2021-05-20 00:32:23 | [diff] [blame] | 319 | GetDefaultStoragePartition(); |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [diff] [blame] | 320 | } |
| 321 | |
Lukasz Anforowicz | eda637d2 | 2021-05-20 00:32:23 | [diff] [blame] | 322 | void BrowserContext::SaveSessionState() { |
| 323 | StoragePartition* storage_partition = GetDefaultStoragePartition(); |
[email protected] | 6e2d3d2 | 2012-02-24 18:10:36 | [diff] [blame] | 324 | |
Clark DuVall | 385b5a5 | 2018-06-14 21:33:32 | [diff] [blame] | 325 | storage_partition->GetCookieManagerForBrowserProcess() |
| 326 | ->SetForceKeepSessionState(); |
| 327 | |
[email protected] | 5f2aa72 | 2013-08-07 16:59:41 | [diff] [blame] | 328 | DOMStorageContextWrapper* dom_storage_context_proxy = |
| 329 | static_cast<DOMStorageContextWrapper*>( |
[email protected] | b1b502e | 2012-09-16 07:31:43 | [diff] [blame] | 330 | storage_partition->GetDOMStorageContext()); |
[email protected] | 5f2aa72 | 2013-08-07 16:59:41 | [diff] [blame] | 331 | dom_storage_context_proxy->SetForceKeepSessionState(); |
[email protected] | 735e20c | 2012-03-20 01:16:59 | [diff] [blame] | 332 | |
Evan Stade | 1fd200c | 2024-03-26 21:06:00 | [diff] [blame] | 333 | storage_partition->GetIndexedDBControl().SetForceKeepSessionState(); |
[email protected] | 6e2d3d2 | 2012-02-24 18:10:36 | [diff] [blame] | 334 | } |
| 335 | |
ttr314 | 81dc54b | 2015-08-06 20:11:26 | [diff] [blame] | 336 | void BrowserContext::SetDownloadManagerForTesting( |
Lukasz Anforowicz | 223d253 | 2021-03-09 17:04:07 | [diff] [blame] | 337 | std::unique_ptr<DownloadManager> download_manager) { |
Lukasz Anforowicz | 48d8345 | 2021-05-12 02:58:20 | [diff] [blame] | 338 | impl()->SetDownloadManagerForTesting(std::move(download_manager)); // IN-TEST |
ttr314 | 81dc54b | 2015-08-06 20:11:26 | [diff] [blame] | 339 | } |
| 340 | |
Mario Sanchez Prada | fa6dda8c | 2019-11-25 18:20:19 | [diff] [blame] | 341 | void BrowserContext::SetPermissionControllerForTesting( |
Mario Sanchez Prada | fa6dda8c | 2019-11-25 18:20:19 | [diff] [blame] | 342 | std::unique_ptr<PermissionController> permission_controller) { |
| 343 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 344 | DCHECK(permission_controller); |
Lukasz Anforowicz | 8206115 | 2021-05-14 02:14:26 | [diff] [blame] | 345 | impl()->SetPermissionControllerForTesting( // IN-TEST |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 346 | std::move(permission_controller)); |
Mario Sanchez Prada | fa6dda8c | 2019-11-25 18:20:19 | [diff] [blame] | 347 | } |
| 348 | |
Lukasz Anforowicz | eda637d2 | 2021-05-20 00:32:23 | [diff] [blame] | 349 | SharedCorsOriginAccessList* BrowserContext::GetSharedCorsOriginAccessList() { |
| 350 | return impl()->shared_cors_origin_access_list(); |
Lukasz Anforowicz | 223d253 | 2021-03-09 17:04:07 | [diff] [blame] | 351 | } |
| 352 | |
kinuko | f6ed359c | 2016-07-26 13:27:21 | [diff] [blame] | 353 | void BrowserContext::ShutdownStoragePartitions() { |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 354 | impl()->ShutdownStoragePartitions(); |
kinuko | f6ed359c | 2016-07-26 13:27:21 | [diff] [blame] | 355 | } |
| 356 | |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 357 | bool BrowserContext::ShutdownStarted() { |
| 358 | return impl()->ShutdownStarted(); |
Andrey Lushnikov | d39d906 | 2018-04-24 17:33:35 | [diff] [blame] | 359 | } |
| 360 | |
Lucas Furukawa Gadani | f4522386 | 2019-06-21 23:11:14 | [diff] [blame] | 361 | const std::string& BrowserContext::UniqueId() { |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 362 | return impl()->UniqueId(); |
mmenke | c0b2b8b1 | 2017-04-21 16:27:52 | [diff] [blame] | 363 | } |
| 364 | |
Chris Cunningham | a5b3801 | 2017-10-28 07:27:18 | [diff] [blame] | 365 | media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() { |
Lukasz Anforowicz | 729a9e1 | 2021-03-31 17:44:01 | [diff] [blame] | 366 | return impl()->GetVideoDecodePerfHistory(); |
Chris Cunningham | a5b3801 | 2017-10-28 07:27:18 | [diff] [blame] | 367 | } |
| 368 | |
Johannes Kron | 3318267 | 2022-05-20 09:52:03 | [diff] [blame] | 369 | media::WebrtcVideoPerfHistory* BrowserContext::GetWebrtcVideoPerfHistory() { |
| 370 | return impl()->GetWebrtcVideoPerfHistory(); |
| 371 | } |
| 372 | |
Tom Sepez | 70ae889 | 2022-12-07 21:19:49 | [diff] [blame] | 373 | std::unique_ptr<download::InProgressDownloadManager> |
| 374 | BrowserContext::RetrieveInProgressDownloadManager() { |
Min Qin | d3ff2ed6 | 2018-07-21 06:46:59 | [diff] [blame] | 375 | return nullptr; |
| 376 | } |
| 377 | |
ssid | 6bedaa9 | 2021-06-16 10:25:24 | [diff] [blame] | 378 | void BrowserContext::WriteIntoTrace( |
Alexander Timin | 074cd18 | 2022-03-23 18:11:22 | [diff] [blame] | 379 | perfetto::TracedProto<ChromeBrowserContext> proto) const { |
| 380 | perfetto::WriteIntoTracedProto(std::move(proto), impl()); |
ssid | 6bedaa9 | 2021-06-16 10:25:24 | [diff] [blame] | 381 | } |
| 382 | |
Arthur Sonzogni | ff83758 | 2023-12-22 10:05:45 | [diff] [blame] | 383 | ResourceContext* BrowserContext::GetResourceContext() const { |
| 384 | return impl()->GetResourceContext(); |
| 385 | } |
| 386 | |
Ryan Tarpine | 35c4db2 | 2024-12-26 21:56:02 | [diff] [blame] | 387 | void BrowserContext::BackfillPopupHeuristicGrants( |
| 388 | base::OnceCallback<void(bool)> callback) { |
| 389 | return impl_->BackfillPopupHeuristicGrants(std::move(callback)); |
| 390 | } |
| 391 | |
Fred Shih | f00e12a | 2023-12-12 01:49:31 | [diff] [blame] | 392 | base::WeakPtr<BrowserContext> BrowserContext::GetWeakPtr() { |
| 393 | return weak_factory_.GetWeakPtr(); |
| 394 | } |
| 395 | |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 396 | ////////////////////////////////////////////////////////////////////////////// |
| 397 | // The //content embedder can override the methods below to change or extend |
| 398 | // how the //content layer interacts with a BrowserContext. The code below |
| 399 | // provides default implementations where appropriate. |
| 400 | // |
Alison Gale | 770f3fc | 2024-04-27 00:39:58 | [diff] [blame] | 401 | // TODO(crbug.com/40169693): Migrate method definitions from this |
Lukasz Anforowicz | b680244 | 2021-04-02 20:47:51 | [diff] [blame] | 402 | // section into a separate BrowserContextDelegate class and a separate |
| 403 | // browser_context_delegate.cc source file. |
| 404 | |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 405 | FileSystemAccessPermissionContext* |
| 406 | BrowserContext::GetFileSystemAccessPermissionContext() { |
Marijn Kruisselbrink | 83e5cdb | 2019-06-20 00:06:28 | [diff] [blame] | 407 | return nullptr; |
| 408 | } |
| 409 | |
Rayan Kanso | 03a847b | 2019-06-27 21:00:09 | [diff] [blame] | 410 | ContentIndexProvider* BrowserContext::GetContentIndexProvider() { |
| 411 | return nullptr; |
| 412 | } |
| 413 | |
Marijn Kruisselbrink | 2ba0ef32 | 2019-11-27 19:12:41 | [diff] [blame] | 414 | bool BrowserContext::CanUseDiskWhenOffTheRecord() { |
| 415 | return false; |
| 416 | } |
| 417 | |
Alex Clarke | 3ebd977 | 2020-02-28 10:50:27 | [diff] [blame] | 418 | variations::VariationsClient* BrowserContext::GetVariationsClient() { |
| 419 | return nullptr; |
| 420 | } |
| 421 | |
Lukasz Anforowicz | 287ec63c | 2021-04-07 22:07:39 | [diff] [blame] | 422 | std::unique_ptr<media::VideoDecodePerfHistory> |
| 423 | BrowserContext::CreateVideoDecodePerfHistory() { |
| 424 | DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 425 | |
| 426 | const char kUseInMemoryDBParamName[] = "db_in_memory"; |
| 427 | const bool kUseInMemoryDBDefault = false; |
| 428 | bool use_in_memory_db = base::GetFieldTrialParamByFeatureAsBool( |
| 429 | media::kMediaCapabilitiesWithParameters, kUseInMemoryDBParamName, |
| 430 | kUseInMemoryDBDefault); |
| 431 | |
| 432 | std::unique_ptr<media::VideoDecodeStatsDB> stats_db; |
| 433 | if (use_in_memory_db) { |
| 434 | stats_db = std::make_unique<media::InMemoryVideoDecodeStatsDBImpl>(nullptr); |
| 435 | } else { |
Lukasz Anforowicz | b9a969a | 2021-04-29 15:26:25 | [diff] [blame] | 436 | auto* db_provider = |
| 437 | GetDefaultStoragePartition()->GetProtoDatabaseProvider(); |
Lukasz Anforowicz | 287ec63c | 2021-04-07 22:07:39 | [diff] [blame] | 438 | |
| 439 | stats_db = media::VideoDecodeStatsDBImpl::Create( |
| 440 | GetPath().Append(FILE_PATH_LITERAL("VideoDecodeStats")), db_provider); |
| 441 | } |
| 442 | |
Henrique Ferreiro | b39856e8 | 2025-08-04 12:13:56 | [diff] [blame] | 443 | return std::make_unique<media::VideoDecodePerfHistory>(std::move(stats_db)); |
Lukasz Anforowicz | 287ec63c | 2021-04-07 22:07:39 | [diff] [blame] | 444 | } |
| 445 | |
Peter Kotwicz | 90c0dc22 | 2022-03-09 18:24:45 | [diff] [blame] | 446 | FederatedIdentityApiPermissionContextDelegate* |
| 447 | BrowserContext::GetFederatedIdentityApiPermissionContext() { |
Christian Biesinger | c59336f | 2024-07-26 17:08:22 | [diff] [blame] | 448 | return impl()->GetFederatedPermissionContext(); |
Peter Kotwicz | 90c0dc22 | 2022-03-09 18:24:45 | [diff] [blame] | 449 | } |
| 450 | |
Zachary Tan | cef87242 | 2023-02-17 14:45:49 | [diff] [blame] | 451 | FederatedIdentityAutoReauthnPermissionContextDelegate* |
| 452 | BrowserContext::GetFederatedIdentityAutoReauthnPermissionContext() { |
Christian Biesinger | c59336f | 2024-07-26 17:08:22 | [diff] [blame] | 453 | return impl()->GetFederatedPermissionContext(); |
Zachary Tan | 3d1c32c | 2023-01-31 16:50:54 | [diff] [blame] | 454 | } |
| 455 | |
Peter Kotwicz | c18ea67 | 2022-11-30 23:58:27 | [diff] [blame] | 456 | FederatedIdentityPermissionContextDelegate* |
| 457 | BrowserContext::GetFederatedIdentityPermissionContext() { |
Christian Biesinger | c59336f | 2024-07-26 17:08:22 | [diff] [blame] | 458 | return impl()->GetFederatedPermissionContext(); |
Ken Buchanan | e677836 | 2021-04-27 16:00:54 | [diff] [blame] | 459 | } |
| 460 | |
Russ Hamilton | f61b3b5c | 2022-09-16 15:35:43 | [diff] [blame] | 461 | KAnonymityServiceDelegate* BrowserContext::GetKAnonymityServiceDelegate() { |
Russ Hamilton | abc8ce03 | 2022-08-27 14:48:05 | [diff] [blame] | 462 | return nullptr; |
| 463 | } |
| 464 | |
Peter Birk Pakkenberg | 73e07b6 | 2022-09-21 11:20:30 | [diff] [blame] | 465 | OriginTrialsControllerDelegate* |
| 466 | BrowserContext::GetOriginTrialsControllerDelegate() { |
| 467 | return nullptr; |
| 468 | } |
| 469 | |
Hiroki Nakagawa | 8348bc4 | 2024-12-13 16:24:42 | [diff] [blame] | 470 | #if BUILDFLAG(IS_ANDROID) |
Doug Turner | 7ce58cf | 2025-08-04 22:03:25 | [diff] [blame] | 471 | net::HttpRequestHeaders BrowserContext::GetExtraHeadersForUrl(const GURL& url) { |
| 472 | return net::HttpRequestHeaders(); |
Hiroki Nakagawa | 8348bc4 | 2024-12-13 16:24:42 | [diff] [blame] | 473 | } |
| 474 | #endif // BUILDFLAG(IS_ANDROID) |
| 475 | |
[email protected] | 55eb70e76 | 2012-02-20 17:38:39 | [diff] [blame] | 476 | } // namespace content |