Real instance methods for BrowserContext: remaining 5 methods.
This CL refactors non-overridable (i.e. implemented only within
//content) methods of `BrowserContext`, so that they are implemented as
instance methods (rather than as `static` methods taking a `self`
argument). This particular CL refactors the following methods:
- GetMountPoints
- GetSharedCorsOriginAccessList
- EnsureResourceContextInitialized
- NotifyWillBeDestroyed
- SaveSessionState
For the rationale/motivation for this change, please see the CL
description of an earlier CL in this series - r877482.
Bug: 1179776
Change-Id: Ia72acf439e857685592193618baa6d4167983c9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2892048
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Charlie Reis <creis@chromium.org>
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Trent Apted <tapted@chromium.org>
Owners-Override: Charlie Reis <creis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#884783}
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index 41493cd..dc4935c1 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -173,7 +173,7 @@
form_database_service_ =
std::make_unique<AwFormDatabaseService>(context_storage_path_);
- EnsureResourceContextInitialized(this);
+ EnsureResourceContextInitialized();
// This constructor is entered during the creation of ContentBrowserClient,
// before browser threads are created. Therefore any checks to enforce
@@ -182,7 +182,7 @@
AwBrowserContext::~AwBrowserContext() {
DCHECK_EQ(this, g_browser_context);
- BrowserContext::NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
SimpleKeyMap::GetInstance()->Dissociate(this);
ShutdownStoragePartitions();
diff --git a/android_webview/browser/aw_content_browser_client.cc b/android_webview/browser/aw_content_browser_client.cc
index d6bee0db..ae17246 100644
--- a/android_webview/browser/aw_content_browser_client.cc
+++ b/android_webview/browser/aw_content_browser_client.cc
@@ -835,8 +835,7 @@
url::kFileScheme,
content::CreateFileURLLoaderFactory(
aw_browser_context->GetPath(),
- content::BrowserContext::GetSharedCorsOriginAccessList(
- aw_browser_context)));
+ aw_browser_context->GetSharedCorsOriginAccessList()));
}
}
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 4b4d66f..7f0f00c6 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -3717,7 +3717,7 @@
additional_backends) {
#if BUILDFLAG(IS_CHROMEOS_ASH)
storage::ExternalMountPoints* external_mount_points =
- content::BrowserContext::GetMountPoints(browser_context);
+ browser_context->GetMountPoints();
DCHECK(external_mount_points);
auto backend = std::make_unique<chromeos::FileSystemBackend>(
Profile::FromBrowserContext(browser_context),
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
index 7ff9744..e7484962 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc
@@ -181,10 +181,9 @@
// Creates new, test mount point.
void AddTmpMountPoint(const std::string& extension_id) {
- BrowserContext::GetMountPoints(browser()->profile())
- ->RegisterFileSystem("tmp", storage::kFileSystemTypeLocal,
- storage::FileSystemMountOption(),
- tmp_mount_point_);
+ browser()->profile()->GetMountPoints()->RegisterFileSystem(
+ "tmp", storage::kFileSystemTypeLocal, storage::FileSystemMountOption(),
+ tmp_mount_point_);
}
base::FilePath GetFullPathOnTmpMountPoint(
diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
index 6e79975..58c82c07 100644
--- a/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
+++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_private_apitest.cc
@@ -158,10 +158,9 @@
kTestFileContent));
}
- ASSERT_TRUE(
- content::BrowserContext::GetMountPoints(profile)->RegisterFileSystem(
- kLocalMountPointName, storage::kFileSystemTypeLocal,
- storage::FileSystemMountOption(), root));
+ ASSERT_TRUE(profile->GetMountPoints()->RegisterFileSystem(
+ kLocalMountPointName, storage::kFileSystemTypeLocal,
+ storage::FileSystemMountOption(), root));
file_manager::VolumeManager::Get(profile)->AddVolumeForTesting(
root, file_manager::VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN,
false /* read_only */);
diff --git a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
index 6b978f4..62279d6 100644
--- a/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
+++ b/chrome/browser/chromeos/file_manager/external_filesystem_apitest.cc
@@ -425,10 +425,9 @@
// FileSystemExtensionApiTestBase override.
void AddTestMountPoint() override {
- EXPECT_TRUE(
- content::BrowserContext::GetMountPoints(profile())->RegisterFileSystem(
- kLocalMountPointName, storage::kFileSystemTypeLocal,
- storage::FileSystemMountOption(), mount_point_dir_));
+ EXPECT_TRUE(profile()->GetMountPoints()->RegisterFileSystem(
+ kLocalMountPointName, storage::kFileSystemTypeLocal,
+ storage::FileSystemMountOption(), mount_point_dir_));
VolumeManager::Get(profile())->AddVolumeForTesting(
mount_point_dir_, VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN,
false /* read_only */);
@@ -456,10 +455,9 @@
// FileSystemExtensionApiTestBase override.
void AddTestMountPoint() override {
- EXPECT_TRUE(
- content::BrowserContext::GetMountPoints(profile())->RegisterFileSystem(
- kRestrictedMountPointName, storage::kFileSystemTypeRestrictedLocal,
- storage::FileSystemMountOption(), mount_point_dir_));
+ EXPECT_TRUE(profile()->GetMountPoints()->RegisterFileSystem(
+ kRestrictedMountPointName, storage::kFileSystemTypeRestrictedLocal,
+ storage::FileSystemMountOption(), mount_point_dir_));
VolumeManager::Get(profile())->AddVolumeForTesting(
mount_point_dir_, VOLUME_TYPE_TESTING, chromeos::DEVICE_TYPE_UNKNOWN,
true /* read_only */);
@@ -663,10 +661,9 @@
// FileSystemExtensionApiTestBase override.
void AddTestMountPoint() override {
- EXPECT_TRUE(
- content::BrowserContext::GetMountPoints(profile())->RegisterFileSystem(
- kLocalMountPointName, storage::kFileSystemTypeLocal,
- storage::FileSystemMountOption(), local_mount_point_dir_));
+ EXPECT_TRUE(profile()->GetMountPoints()->RegisterFileSystem(
+ kLocalMountPointName, storage::kFileSystemTypeLocal,
+ storage::FileSystemMountOption(), local_mount_point_dir_));
VolumeManager::Get(profile())->AddVolumeForTesting(
local_mount_point_dir_, VOLUME_TYPE_TESTING,
chromeos::DEVICE_TYPE_UNKNOWN, false /* read_only */);
diff --git a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
index a443710..c48ce9d 100644
--- a/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_apitest_chromeos.cc
@@ -274,10 +274,9 @@
ASSERT_TRUE(base::CreateDirectory(mount_point_path));
ASSERT_TRUE(
base::CreateDirectory(mount_point_path.Append(kChildDirectory)));
- ASSERT_TRUE(content::BrowserContext::GetMountPoints(browser()->profile())
- ->RegisterFileSystem(
- mount_point_name, storage::kFileSystemTypeLocal,
- storage::FileSystemMountOption(), mount_point_path));
+ ASSERT_TRUE(browser()->profile()->GetMountPoints()->RegisterFileSystem(
+ mount_point_name, storage::kFileSystemTypeLocal,
+ storage::FileSystemMountOption(), mount_point_path));
VolumeManager* const volume_manager =
VolumeManager::Get(browser()->profile());
ASSERT_TRUE(volume_manager);
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index f12891c..3824ae3 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -144,7 +144,7 @@
// TODO(beng): Can this use ProfileManager::GetLoadedProfiles instead?
// TODO(crbug.com/1205798): Unset SaveSessionState if the restart fails.
for (auto* browser : *BrowserList::GetInstance()) {
- content::BrowserContext::SaveSessionState(browser->profile());
+ browser->profile()->SaveSessionState();
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
auto* session_data_service =
SessionDataServiceFactory::GetForProfile(browser->profile());
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc
index d0555514..99455d0c 100644
--- a/chrome/browser/net/profile_network_context_service.cc
+++ b/chrome/browser/net/profile_network_context_service.cc
@@ -840,7 +840,7 @@
// Should be initialized with existing per-profile CORS access lists.
network_context_params->cors_origin_access_list =
- content::BrowserContext::GetSharedCorsOriginAccessList(profile_)
+ profile_->GetSharedCorsOriginAccessList()
->GetOriginAccessList()
.CreateCorsOriginAccessPatternsList();
diff --git a/chrome/browser/platform_util_unittest.cc b/chrome/browser/platform_util_unittest.cc
index 5212e4f..4456b23 100644
--- a/chrome/browser/platform_util_unittest.cc
+++ b/chrome/browser/platform_util_unittest.cc
@@ -54,7 +54,7 @@
std::vector<std::unique_ptr<storage::FileSystemBackend>>*
additional_backends) override {
storage::ExternalMountPoints* external_mount_points =
- content::BrowserContext::GetMountPoints(browser_context);
+ browser_context->GetMountPoints();
// New FileSystemBackend that uses our MockSpecialStoragePolicy.
additional_backends->push_back(
@@ -81,9 +81,9 @@
content::SetBrowserClientForTesting(content_browser_client_.get());
// The test_directory needs to be mounted for it to be accessible.
- content::BrowserContext::GetMountPoints(GetProfile())
- ->RegisterFileSystem("test", storage::kFileSystemTypeLocal,
- storage::FileSystemMountOption(), test_directory);
+ GetProfile()->GetMountPoints()->RegisterFileSystem(
+ "test", storage::kFileSystemTypeLocal, storage::FileSystemMountOption(),
+ test_directory);
// To test opening a file, we are going to register a mock extension that
// handles .txt files. The extension doesn't actually need to exist due to
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index 7f6c64b..7ee045c 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -457,7 +457,7 @@
if (!sent_destroyed_notification_) {
sent_destroyed_notification_ = true;
- NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
for (auto& observer : observers_)
observer.OnProfileWillBeDestroyed(this);
diff --git a/chrome/browser/sessions/better_session_restore_browsertest.cc b/chrome/browser/sessions/better_session_restore_browsertest.cc
index 11d21a2..18a1f133 100644
--- a/chrome/browser/sessions/better_session_restore_browsertest.cc
+++ b/chrome/browser/sessions/better_session_restore_browsertest.cc
@@ -561,7 +561,7 @@
void Restart() {
// Simulate restarting the browser, but let the test exit peacefully.
for (auto* browser : *BrowserList::GetInstance()) {
- content::BrowserContext::SaveSessionState(browser->profile());
+ browser->profile()->SaveSessionState();
SessionDataServiceFactory::GetForProfile(browser->profile())
->SetForceKeepSessionState();
}
@@ -731,7 +731,7 @@
// Disable cookie and storage deletion on shutdown to simulate the
// process being killed before cleanup is finished.
- content::BrowserContext::SaveSessionState(browser()->profile());
+ browser()->profile()->SaveSessionState();
}
IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, CookiesClearedOnStartup) {
@@ -748,7 +748,7 @@
// Disable cookie and storage deletion on shutdown to simulate the
// process being killed before cleanup is finished.
- content::BrowserContext::SaveSessionState(browser()->profile());
+ browser()->profile()->SaveSessionState();
}
IN_PROC_BROWSER_TEST_F(NoSessionRestoreTest, LocalStorageClearedOnStartup) {
@@ -778,7 +778,7 @@
// Disable cookie and storage deletion handling on shutdown to simulate the
// process being killed before cleanup is finished.
- content::BrowserContext::SaveSessionState(browser()->profile());
+ browser()->profile()->SaveSessionState();
}
IN_PROC_BROWSER_TEST_F(NoSessionRestoreTestWithStartupDeletionDisabled,
@@ -797,7 +797,7 @@
// Disable cookie and storage deletion handling on shutdown to simulate the
// process being killed before cleanup is finished.
- content::BrowserContext::SaveSessionState(browser()->profile());
+ browser()->profile()->SaveSessionState();
}
IN_PROC_BROWSER_TEST_F(NoSessionRestoreTestWithStartupDeletionDisabled,
diff --git a/chromecast/browser/cast_browser_context.cc b/chromecast/browser/cast_browser_context.cc
index 205a340..f7a73bc 100644
--- a/chromecast/browser/cast_browser_context.cc
+++ b/chromecast/browser/cast_browser_context.cc
@@ -52,7 +52,7 @@
CastBrowserContext::~CastBrowserContext() {
SimpleKeyMap::GetInstance()->Dissociate(this);
- BrowserContext::NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
ShutdownStoragePartitions();
content::GetIOThreadTaskRunner({})->DeleteSoon(FROM_HERE,
resource_context_.release());
diff --git a/chromecast/browser/webview/webview_browser_context.cc b/chromecast/browser/webview/webview_browser_context.cc
index 616e1774..51414ee 100644
--- a/chromecast/browser/webview/webview_browser_context.cc
+++ b/chromecast/browser/webview/webview_browser_context.cc
@@ -30,7 +30,7 @@
}
WebviewBrowserContext::~WebviewBrowserContext() {
- BrowserContext::NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
ShutdownStoragePartitions();
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index ec825b66..a7734981 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -111,13 +111,10 @@
return impl()->GetDownloadManager();
}
-// static
-storage::ExternalMountPoints* BrowserContext::GetMountPoints(
- BrowserContext* self) {
- return self->impl()->GetMountPoints();
+storage::ExternalMountPoints* BrowserContext::GetMountPoints() {
+ return impl()->GetMountPoints();
}
-// static
BrowsingDataRemover* BrowserContext::GetBrowsingDataRemover() {
return impl()->GetBrowsingDataRemover();
}
@@ -246,13 +243,11 @@
std::move(old_subscription), std::move(callback));
}
-// static
-void BrowserContext::NotifyWillBeDestroyed(BrowserContext* self) {
- self->impl()->NotifyWillBeDestroyed();
+void BrowserContext::NotifyWillBeDestroyed() {
+ impl()->NotifyWillBeDestroyed();
}
-// static
-void BrowserContext::EnsureResourceContextInitialized(BrowserContext* self) {
+void BrowserContext::EnsureResourceContextInitialized() {
// This will be enough to tickle initialization of BrowserContext if
// necessary, which initializes ResourceContext. The reason we don't call
// ResourceContext::InitializeResourceContext() directly here is that
@@ -261,12 +256,11 @@
// end up rewriting the same value but this still causes a race condition.
//
// See http://crbug.com/115678.
- self->GetDefaultStoragePartition();
+ GetDefaultStoragePartition();
}
-// static
-void BrowserContext::SaveSessionState(BrowserContext* self) {
- StoragePartition* storage_partition = self->GetDefaultStoragePartition();
+void BrowserContext::SaveSessionState() {
+ StoragePartition* storage_partition = GetDefaultStoragePartition();
storage::DatabaseTracker* database_tracker =
storage_partition->GetDatabaseTracker();
@@ -310,10 +304,8 @@
std::move(permission_controller));
}
-// static
-SharedCorsOriginAccessList* BrowserContext::GetSharedCorsOriginAccessList(
- BrowserContext* self) {
- return self->impl()->shared_cors_origin_access_list();
+SharedCorsOriginAccessList* BrowserContext::GetSharedCorsOriginAccessList() {
+ return impl()->shared_cors_origin_access_list();
}
void BrowserContext::ShutdownStoragePartitions() {
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 049f1ef..d62a36a 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -1300,7 +1300,7 @@
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
FileURLLoaderFactory::Create(
browser_context_->GetPath(),
- BrowserContext::GetSharedCorsOriginAccessList(browser_context_),
+ browser_context_->GetSharedCorsOriginAccessList(),
// USER_VISIBLE because download should progress
// even when there is high priority work to do.
base::TaskPriority::USER_VISIBLE));
diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc
index 0a6f1b0..bb32282 100644
--- a/content/browser/download/save_file_manager.cc
+++ b/content/browser/download/save_file_manager.cc
@@ -266,8 +266,7 @@
factory = factory_remote.get();
} else if (url.SchemeIsFile()) {
factory_remote.Bind(FileURLLoaderFactory::Create(
- context->GetPath(),
- BrowserContext::GetSharedCorsOriginAccessList(context),
+ context->GetPath(), context->GetSharedCorsOriginAccessList(),
base::TaskPriority::USER_VISIBLE));
factory = factory_remote.get();
} else if (url.SchemeIsFileSystem() && rfh) {
diff --git a/content/browser/file_system/browser_file_system_helper.cc b/content/browser/file_system/browser_file_system_helper.cc
index 4ed9e3a..c55a873 100644
--- a/content/browser/file_system/browser_file_system_helper.cc
+++ b/content/browser/file_system/browser_file_system_helper.cc
@@ -137,7 +137,7 @@
scoped_refptr<storage::FileSystemContext> file_system_context =
new storage::FileSystemContext(
GetIOThreadTaskRunner({}).get(), g_fileapi_task_runner.Get().get(),
- BrowserContext::GetMountPoints(browser_context),
+ browser_context->GetMountPoints(),
browser_context->GetSpecialStoragePolicy(), quota_manager_proxy,
std::move(additional_backends), url_request_auto_mount_handlers,
profile_path, options);
diff --git a/content/browser/loader/cors_origin_pattern_setter_unittest.cc b/content/browser/loader/cors_origin_pattern_setter_unittest.cc
index 343752c..43ba7bb 100644
--- a/content/browser/loader/cors_origin_pattern_setter_unittest.cc
+++ b/content/browser/loader/cors_origin_pattern_setter_unittest.cc
@@ -44,8 +44,7 @@
{
content::TestBrowserContext browser_context;
- shared_list = content::BrowserContext::GetSharedCorsOriginAccessList(
- &browser_context);
+ shared_list = browser_context.GetSharedCorsOriginAccessList();
ASSERT_TRUE(shared_list);
// The list is empty (in absence of calls to CorsOriginPatternSetter::Set).
@@ -108,8 +107,7 @@
run_loop.Run();
// Verify that the results got properly stored.
- shared_list = content::BrowserContext::GetSharedCorsOriginAccessList(
- &browser_context);
+ shared_list = browser_context.GetSharedCorsOriginAccessList();
ASSERT_TRUE(shared_list);
std::vector<network::mojom::CorsOriginAccessPatternsPtr> patterns =
shared_list->GetOriginAccessList().CreateCorsOriginAccessPatternsList();
diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc
index 54d5a879..178a234 100644
--- a/content/browser/loader/navigation_url_loader_impl.cc
+++ b/content/browser/loader/navigation_url_loader_impl.cc
@@ -1241,11 +1241,10 @@
// Loading and rendering a web page after the user clicks a link.
base::TaskPriority file_factory_priority = base::TaskPriority::USER_BLOCKING;
non_network_url_loader_factories_.emplace(
- url::kFileScheme,
- FileURLLoaderFactory::Create(
- browser_context_->GetPath(),
- BrowserContext::GetSharedCorsOriginAccessList(browser_context_),
- file_factory_priority));
+ url::kFileScheme, FileURLLoaderFactory::Create(
+ browser_context_->GetPath(),
+ browser_context_->GetSharedCorsOriginAccessList(),
+ file_factory_priority));
#if defined(OS_ANDROID)
non_network_url_loader_factories_.emplace(url::kContentScheme,
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc
index 77062f0c..7f4dc27 100644
--- a/content/browser/renderer_host/render_frame_host_impl.cc
+++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -7068,7 +7068,7 @@
url::kFileScheme,
FileURLLoaderFactory::Create(
browser_context->GetPath(),
- BrowserContext::GetSharedCorsOriginAccessList(browser_context),
+ browser_context->GetSharedCorsOriginAccessList(),
file_factory_priority));
}
diff --git a/content/browser/worker_host/worker_script_fetch_initiator.cc b/content/browser/worker_host/worker_script_fetch_initiator.cc
index 07a2e4e0..dd7fa0c 100644
--- a/content/browser/worker_host/worker_script_fetch_initiator.cc
+++ b/content/browser/worker_host/worker_script_fetch_initiator.cc
@@ -230,8 +230,8 @@
non_network_factories.emplace(
url::kFileScheme, FileURLLoaderFactory::Create(
storage_partition->browser_context()->GetPath(),
- BrowserContext::GetSharedCorsOriginAccessList(
- storage_partition->browser_context()),
+ storage_partition->browser_context()
+ ->GetSharedCorsOriginAccessList(),
file_factory_priority));
}
diff --git a/content/public/browser/browser_context.h b/content/public/browser/browser_context.h
index b96752c4..e42b740 100644
--- a/content/public/browser/browser_context.h
+++ b/content/public/browser/browser_context.h
@@ -100,11 +100,6 @@
// The currently recommended practice is to make the methods in this section
// non-virtual instance methods.
//
- // TODO(https://crbug.com/1179776): Finish converting the methods in this
- // section into non-virtual instance methods. (The old, abandoned practice
- // was to make the methods in this section `static` and have them take
- // `BrowserContext* self` as the first parameter.)
- //
// TODO(https://crbug.com/1179776): Consider moving these methods to
// BrowserContext::Impl or (in the future) BrowserContextImpl class.
@@ -116,7 +111,7 @@
// Returns BrowserContext specific external mount points. It may return
// nullptr if the context doesn't have any BrowserContext specific external
// mount points. Currently, non-nullptr value is returned only on ChromeOS.
- static storage::ExternalMountPoints* GetMountPoints(BrowserContext* self);
+ storage::ExternalMountPoints* GetMountPoints();
// Returns a BrowsingDataRemover that can schedule data deletion tasks
// for this |context|.
@@ -207,18 +202,18 @@
blink::mojom::PushSubscriptionPtr old_subscription,
base::OnceCallback<void(blink::mojom::PushEventStatus)> callback);
- static void NotifyWillBeDestroyed(BrowserContext* self);
+ void NotifyWillBeDestroyed();
// Ensures that the corresponding ResourceContext is initialized. Normally the
// BrowserContext initializs the corresponding getters when its objects are
// created, but if the embedder wants to pass the ResourceContext to another
// thread before they use BrowserContext, they should call this to make sure
// that the ResourceContext is ready.
- static void EnsureResourceContextInitialized(BrowserContext* self);
+ void EnsureResourceContextInitialized();
// Tells the HTML5 objects on this context to persist their session state
// across the next restart.
- static void SaveSessionState(BrowserContext* self);
+ void SaveSessionState();
void SetDownloadManagerForTesting(
std::unique_ptr<DownloadManager> download_manager);
@@ -231,8 +226,7 @@
// network::mojom::NetworkContextParams::cors_origin_access_list) and 2)
// consulted by CORS-aware factories (e.g. passed when constructing
// FileURLLoaderFactory).
- static SharedCorsOriginAccessList* GetSharedCorsOriginAccessList(
- BrowserContext* self);
+ SharedCorsOriginAccessList* GetSharedCorsOriginAccessList();
// Shuts down the storage partitions associated to this browser context.
// This must be called before the browser context is actually destroyed
diff --git a/content/public/browser/cors_origin_pattern_setter.cc b/content/public/browser/cors_origin_pattern_setter.cc
index a1ea156..1d2ad94 100644
--- a/content/public/browser/cors_origin_pattern_setter.cc
+++ b/content/public/browser/cors_origin_pattern_setter.cc
@@ -60,9 +60,9 @@
// Keep the per-profile access list up to date so that we can use this to
// restore NetworkContext settings at anytime, e.g. on restarting the
// network service.
- content::BrowserContext::GetSharedCorsOriginAccessList(browser_context)
- ->SetForOrigin(source_origin, std::move(allow_patterns),
- std::move(block_patterns), barrier_closure);
+ browser_context->GetSharedCorsOriginAccessList()->SetForOrigin(
+ source_origin, std::move(allow_patterns), std::move(block_patterns),
+ barrier_closure);
}
} // namespace content
diff --git a/content/public/test/test_browser_context.cc b/content/public/test/test_browser_context.cc
index 44fa38f..d4f572a 100644
--- a/content/public/test/test_browser_context.cc
+++ b/content/public/test/test_browser_context.cc
@@ -40,7 +40,7 @@
<< "the BrowserTaskEnvironment instance. "
<< BrowserThread::GetDCheckCurrentlyOnErrorMessage(BrowserThread::UI);
- NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
ShutdownStoragePartitions();
// Various things that were just torn down above post tasks to other
diff --git a/content/shell/browser/shell_browser_context.cc b/content/shell/browser/shell_browser_context.cc
index 815f995..91eb6df 100644
--- a/content/shell/browser/shell_browser_context.cc
+++ b/content/shell/browser/shell_browser_context.cc
@@ -59,7 +59,7 @@
}
ShellBrowserContext::~ShellBrowserContext() {
- NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
// The SimpleDependencyManager should always be passed after the
// BrowserContextDependencyManager. This is because the KeyedService instances
diff --git a/content/web_test/browser/web_test_browser_context.cc b/content/web_test/browser/web_test_browser_context.cc
index eab5c7e..5c278ee4e 100644
--- a/content/web_test/browser/web_test_browser_context.cc
+++ b/content/web_test/browser/web_test_browser_context.cc
@@ -45,7 +45,7 @@
}
WebTestBrowserContext::~WebTestBrowserContext() {
- BrowserContext::NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
}
DownloadManagerDelegate* WebTestBrowserContext::GetDownloadManagerDelegate() {
diff --git a/extensions/shell/browser/shell_browser_context.cc b/extensions/shell/browser/shell_browser_context.cc
index 665bd9b..f625fd2 100644
--- a/extensions/shell/browser/shell_browser_context.cc
+++ b/extensions/shell/browser/shell_browser_context.cc
@@ -21,7 +21,7 @@
storage_policy_(new ShellSpecialStoragePolicy) {}
ShellBrowserContext::~ShellBrowserContext() {
- content::BrowserContext::NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
}
content::BrowserPluginGuestManager* ShellBrowserContext::GetGuestManager() {
diff --git a/fuchsia/engine/browser/web_engine_browser_context.cc b/fuchsia/engine/browser/web_engine_browser_context.cc
index 47ac7e7e..f9a725e7 100644
--- a/fuchsia/engine/browser/web_engine_browser_context.cc
+++ b/fuchsia/engine/browser/web_engine_browser_context.cc
@@ -71,7 +71,7 @@
WebEngineBrowserContext::~WebEngineBrowserContext() {
SimpleKeyMap::GetInstance()->Dissociate(this);
- NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
if (resource_context_) {
content::GetIOThreadTaskRunner({})->DeleteSoon(
diff --git a/headless/lib/browser/headless_browser_context_impl.cc b/headless/lib/browser/headless_browser_context_impl.cc
index 45caa59..e7e650a 100644
--- a/headless/lib/browser/headless_browser_context_impl.cc
+++ b/headless/lib/browser/headless_browser_context_impl.cc
@@ -61,7 +61,7 @@
HeadlessBrowserContextImpl::~HeadlessBrowserContextImpl() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
SimpleKeyMap::GetInstance()->Dissociate(this);
- NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
// Destroy all web contents before shutting down storage partitions.
web_contents_map_.clear();
diff --git a/ui/views/examples/examples_with_content_main.cc b/ui/views/examples/examples_with_content_main.cc
index b8dd433..7fca765e 100644
--- a/ui/views/examples/examples_with_content_main.cc
+++ b/ui/views/examples/examples_with_content_main.cc
@@ -48,7 +48,7 @@
// dlsym search path, which breaks (usually valid) assumptions made in
// sandbox::InitLibcUrandomOverrides(). See http://crbug.com/374712.
if (!browser_context) {
- content::BrowserContext::SaveSessionState(nullptr);
+ browser_context->SaveSessionState();
NOTREACHED();
}
}
diff --git a/weblayer/browser/browser_context_impl.cc b/weblayer/browser/browser_context_impl.cc
index 431ae2b..4a933a9 100644
--- a/weblayer/browser/browser_context_impl.cc
+++ b/weblayer/browser/browser_context_impl.cc
@@ -124,7 +124,7 @@
}
BrowserContextImpl::~BrowserContextImpl() {
- NotifyWillBeDestroyed(this);
+ NotifyWillBeDestroyed();
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
this);