Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(316)

Unified Diff: chrome/browser/profiles/profile_keyed_base_factory.cc

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..40f286ef93a18812728fc438fec9aafad6392c74 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)
@@ -52,7 +53,7 @@ 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 +77,9 @@ 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 +103,7 @@ 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 +111,12 @@ 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);
}

Powered by Google App Engine
This is Rietveld 408576698