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

Unified Diff: chrome/browser/profile_impl.cc

Issue 3304015: Use PrefChangeRegistrar everywhere (Closed)
Patch Set: final version for commit Created 10 years, 3 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
« no previous file with comments | « chrome/browser/profile_impl.h ('k') | chrome/browser/sync/glue/preference_change_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profile_impl.cc
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc
index 5a61e1cac131334c778beb95e32dac0c19a628b8..f72a6a5f0f28ca6e264f681218d1388665f43fc2 100644
--- a/chrome/browser/profile_impl.cc
+++ b/chrome/browser/profile_impl.cc
@@ -292,9 +292,10 @@ ProfileImpl::ProfileImpl(const FilePath& path)
&ProfileImpl::EnsureSessionServiceCreated);
PrefService* prefs = GetPrefs();
- prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this);
- prefs->AddPrefObserver(prefs::kEnableSpellCheck, this);
- prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this);
+ pref_change_registrar_.Init(prefs);
+ pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this);
+ pref_change_registrar_.Add(prefs::kEnableSpellCheck, this);
+ pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this);
#if defined(OS_MACOSX)
// If the profile directory doesn't already have a cache directory and it
@@ -390,7 +391,6 @@ void ProfileImpl::InitExtensions() {
extensions_service_ = new ExtensionsService(
this,
CommandLine::ForCurrentProcess(),
- GetPrefs(),
GetPath().AppendASCII(ExtensionsService::kInstallDirectoryName),
true);
@@ -501,11 +501,8 @@ ProfileImpl::~ProfileImpl() {
// The theme provider provides bitmaps to whoever wants them.
theme_provider_.reset();
- // Remove pref observers.
- PrefService* prefs = GetPrefs();
- prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this);
- prefs->RemovePrefObserver(prefs::kEnableSpellCheck, this);
- prefs->RemovePrefObserver(prefs::kEnableAutoSpellCorrect, this);
+ // Remove pref observers
+ pref_change_registrar_.RemoveAll();
// Delete the NTP resource cache so we can unregister pref observers.
ntp_resource_cache_.reset();
« no previous file with comments | « chrome/browser/profile_impl.h ('k') | chrome/browser/sync/glue/preference_change_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698