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(); |