Index: components/browser_context_keyed_service/browser_context_keyed_base_factory.cc |
diff --git a/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc b/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc |
index 9228400edf9be44a865e4d2884f335fde70c7b61..3276f419449acfa4c932cd943dbdcd8e8c306544 100644 |
--- a/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc |
+++ b/components/browser_context_keyed_service/browser_context_keyed_base_factory.cc |
@@ -10,8 +10,8 @@ |
#include "components/user_prefs/user_prefs.h" |
#include "content/public/browser/browser_context.h" |
-ProfileKeyedBaseFactory::ProfileKeyedBaseFactory( |
- const char* name, ProfileDependencyManager* manager) |
+BrowserContextKeyedBaseFactory::BrowserContextKeyedBaseFactory( |
+ const char* name, BrowserContextDependencyManager* manager) |
: dependency_manager_(manager) |
#ifndef NDEBUG |
, service_name_(name) |
@@ -20,20 +20,21 @@ ProfileKeyedBaseFactory::ProfileKeyedBaseFactory( |
dependency_manager_->AddComponent(this); |
} |
-ProfileKeyedBaseFactory::~ProfileKeyedBaseFactory() { |
+BrowserContextKeyedBaseFactory::~BrowserContextKeyedBaseFactory() { |
dependency_manager_->RemoveComponent(this); |
} |
-void ProfileKeyedBaseFactory::DependsOn(ProfileKeyedBaseFactory* rhs) { |
+void BrowserContextKeyedBaseFactory::DependsOn( |
+ BrowserContextKeyedBaseFactory* rhs) { |
dependency_manager_->AddEdge(rhs, this); |
} |
-content::BrowserContext* ProfileKeyedBaseFactory::GetBrowserContextToUse( |
+content::BrowserContext* BrowserContextKeyedBaseFactory::GetBrowserContextToUse( |
content::BrowserContext* context) const { |
DCHECK(CalledOnValidThread()); |
#ifndef NDEBUG |
- dependency_manager_->AssertProfileWasntDestroyed(context); |
+ dependency_manager_->AssertBrowserContextWasntDestroyed(context); |
#endif |
// Safe default for the Incognito mode: no service. |
@@ -43,68 +44,70 @@ content::BrowserContext* ProfileKeyedBaseFactory::GetBrowserContextToUse( |
return context; |
} |
-void ProfileKeyedBaseFactory::RegisterUserPrefsOnProfile( |
- content::BrowserContext* profile) { |
- // Safe timing for pref registration is hard. Previously, we made Profile |
- // responsible for all pref registration on every service that used |
- // Profile. Now we don't and there are timing issues. |
+void BrowserContextKeyedBaseFactory::RegisterUserPrefsOnBrowserContext( |
+ content::BrowserContext* context) { |
+ // Safe timing for pref registration is hard. Previously, we made |
+ // BrowserContext responsible for all pref registration on every service |
+ // that used BrowserContext. Now we don't and there are timing issues. |
// |
- // With normal profiles, prefs can simply be registered at |
- // ProfileDependencyManager::CreateProfileServices time. With incognito |
- // profiles, we just never register since incognito profiles share the same |
- // pref services with their parent profiles. |
+ // With normal contexts, prefs can simply be registered at |
+ // BrowserContextDependencyManager::CreateBrowserContextServices time. |
+ // With incognito contexts, we just never register since incognito contexts |
+ // share the same pref services with their parent contexts. |
// |
- // TestingProfiles throw a wrench into the mix, in that some tests will |
+ // TestingBrowserContexts throw a wrench into the mix, in that some tests will |
// swap out the PrefService after we've registered user prefs on the original |
// PrefService. Test code that does this is responsible for either manually |
- // invoking RegisterUserPrefs() on the appropriate ProfileKeyedServiceFactory |
- // associated with the prefs they need, or they can use SetTestingFactory() |
- // and create a service (since service creation with a factory method causes |
- // registration to happen at service creation time). |
+ // invoking RegisterUserPrefs() on the appropriate |
+ // BrowserContextKeyedServiceFactory associated with the prefs they need, |
+ // or they can use SetTestingFactory() and create a service (since service |
+ // creation with a factory method causes registration to happen at service |
+ // creation time). |
// |
// Now that services are responsible for declaring their preferences, we have |
- // to enforce a uniquenes check here because some tests create one profile and |
- // multiple services of the same type attached to that profile (serially, not |
- // parallel) and we don't want to register multiple times on the same profile. |
- DCHECK(!profile->IsOffTheRecord()); |
+ // to enforce a uniquenes check here because some tests create one context and |
+ // multiple services of the same type attached to that context (serially, not |
+ // parallel) and we don't want to register multiple times on the same context. |
+ DCHECK(!context->IsOffTheRecord()); |
std::set<content::BrowserContext*>::iterator it = |
- registered_preferences_.find(profile); |
+ registered_preferences_.find(context); |
if (it == registered_preferences_.end()) { |
- PrefService* prefs = components::UserPrefs::Get(profile); |
+ PrefService* prefs = components::UserPrefs::Get(context); |
user_prefs::PrefRegistrySyncable* registry = |
static_cast<user_prefs::PrefRegistrySyncable*>( |
prefs->DeprecatedGetPrefRegistry()); |
RegisterUserPrefs(registry); |
- registered_preferences_.insert(profile); |
+ registered_preferences_.insert(context); |
} |
} |
-bool ProfileKeyedBaseFactory::ServiceIsCreatedWithProfile() const { |
+bool |
+BrowserContextKeyedBaseFactory::ServiceIsCreatedWithBrowserContext() const { |
return false; |
} |
-bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const { |
+bool BrowserContextKeyedBaseFactory::ServiceIsNULLWhileTesting() const { |
return false; |
} |
-void ProfileKeyedBaseFactory::ProfileDestroyed( |
- content::BrowserContext* profile) { |
+void BrowserContextKeyedBaseFactory::BrowserContextDestroyed( |
+ content::BrowserContext* context) { |
// While object destruction can be customized in ways where the object is |
// only dereferenced, this still must run on the UI thread. |
DCHECK(CalledOnValidThread()); |
- registered_preferences_.erase(profile); |
+ registered_preferences_.erase(context); |
} |
-bool ProfileKeyedBaseFactory::ArePreferencesSetOn( |
- content::BrowserContext* profile) const { |
- return registered_preferences_.find(profile) != |
+bool BrowserContextKeyedBaseFactory::ArePreferencesSetOn( |
+ content::BrowserContext* context) const { |
+ return registered_preferences_.find(context) != |
registered_preferences_.end(); |
} |
-void ProfileKeyedBaseFactory::MarkPreferencesSetOn( |
- content::BrowserContext* profile) { |
- DCHECK(!ArePreferencesSetOn(profile)); |
- registered_preferences_.insert(profile); |
+void BrowserContextKeyedBaseFactory::MarkPreferencesSetOn( |
+ content::BrowserContext* context) { |
+ DCHECK(!ArePreferencesSetOn(context)); |
+ registered_preferences_.insert(context); |
} |