| Index: chrome/browser/profiles/profile_keyed_base_factory.cc
|
| diff --git a/chrome/browser/profiles/profile_keyed_base_factory.cc b/chrome/browser/profiles/profile_keyed_base_factory.cc
|
| index 7f52e3d0c9b4303f1977692b4abb42c520033028..daa24e2735affa1a3b0b7056bc143b20a02b939b 100644
|
| --- a/chrome/browser/profiles/profile_keyed_base_factory.cc
|
| +++ b/chrome/browser/profiles/profile_keyed_base_factory.cc
|
| @@ -8,6 +8,7 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/profiles/profile_dependency_manager.h"
|
| #include "components/user_prefs/pref_registry_syncable.h"
|
| +#include "components/user_prefs/user_prefs.h"
|
|
|
| ProfileKeyedBaseFactory::ProfileKeyedBaseFactory(
|
| const char* name, ProfileDependencyManager* manager)
|
| @@ -27,9 +28,12 @@ void ProfileKeyedBaseFactory::DependsOn(ProfileKeyedBaseFactory* rhs) {
|
| dependency_manager_->AddEdge(rhs, this);
|
| }
|
|
|
| -Profile* ProfileKeyedBaseFactory::GetProfileToUse(Profile* profile) {
|
| +content::BrowserContext* ProfileKeyedBaseFactory::GetProfileToUse(
|
| + content::BrowserContext* context) {
|
| DCHECK(CalledOnValidThread());
|
|
|
| + Profile* profile = static_cast<Profile*>(context);
|
| +
|
| #ifndef NDEBUG
|
| dependency_manager_->AssertProfileWasntDestroyed(profile);
|
| #endif
|
| @@ -52,7 +56,8 @@ Profile* ProfileKeyedBaseFactory::GetProfileToUse(Profile* profile) {
|
| return profile;
|
| }
|
|
|
| -void ProfileKeyedBaseFactory::RegisterUserPrefsOnProfile(Profile* profile) {
|
| +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.
|
| @@ -76,9 +81,10 @@ void ProfileKeyedBaseFactory::RegisterUserPrefsOnProfile(Profile* profile) {
|
| // parallel) and we don't want to register multiple times on the same profile.
|
| DCHECK(!profile->IsOffTheRecord());
|
|
|
| - std::set<Profile*>::iterator it = registered_preferences_.find(profile);
|
| + std::set<content::BrowserContext*>::iterator it =
|
| + registered_preferences_.find(profile);
|
| if (it == registered_preferences_.end()) {
|
| - PrefService* prefs = profile->GetPrefs();
|
| + PrefService* prefs = components::UserPrefs::Get(profile);
|
| PrefRegistrySyncable* registry = static_cast<PrefRegistrySyncable*>(
|
| prefs->DeprecatedGetPrefRegistry());
|
| RegisterUserPrefs(registry);
|
| @@ -102,7 +108,8 @@ bool ProfileKeyedBaseFactory::ServiceIsNULLWhileTesting() const {
|
| return false;
|
| }
|
|
|
| -void ProfileKeyedBaseFactory::ProfileDestroyed(Profile* profile) {
|
| +void ProfileKeyedBaseFactory::ProfileDestroyed(
|
| + content::BrowserContext* profile) {
|
| // While object destruction can be customized in ways where the object is
|
| // only dereferenced, this still must run on the UI thread.
|
| DCHECK(CalledOnValidThread());
|
| @@ -110,12 +117,14 @@ void ProfileKeyedBaseFactory::ProfileDestroyed(Profile* profile) {
|
| registered_preferences_.erase(profile);
|
| }
|
|
|
| -bool ProfileKeyedBaseFactory::ArePreferencesSetOn(Profile* profile) const {
|
| +bool ProfileKeyedBaseFactory::ArePreferencesSetOn(
|
| + content::BrowserContext* profile) const {
|
| return registered_preferences_.find(profile) !=
|
| registered_preferences_.end();
|
| }
|
|
|
| -void ProfileKeyedBaseFactory::MarkPreferencesSetOn(Profile* profile) {
|
| +void ProfileKeyedBaseFactory::MarkPreferencesSetOn(
|
| + content::BrowserContext* profile) {
|
| DCHECK(!ArePreferencesSetOn(profile));
|
| registered_preferences_.insert(profile);
|
| }
|
|
|