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

Unified Diff: chrome/browser/translate/translate_manager.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
Index: chrome/browser/translate/translate_manager.cc
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 6f649fd2f78e56ebd8253e71ef26e24fb72754dd..1c70dd4416963be21f44cc91d750b9c422bd4af3 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -249,7 +249,7 @@ void TranslateManager::Observe(NotificationType type,
// We should know about this profile since we are listening for
// notifications on it.
DCHECK(count > 0);
- profile->GetPrefs()->RemovePrefObserver(prefs::kAcceptLanguages, this);
+ pref_change_registrar_.Remove(prefs::kAcceptLanguages, this);
break;
}
case NotificationType::PREF_CHANGED: {
@@ -342,6 +342,8 @@ void TranslateManager::InitiateTranslation(TabContents* tab,
if (!prefs->GetBoolean(prefs::kEnableTranslate))
return;
+ pref_change_registrar_.Init(prefs);
+
// Allow disabling of translate from the command line to assist with
// automated browser testing.
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableTranslate))
@@ -534,7 +536,7 @@ bool TranslateManager::IsAcceptLanguage(TabContents* tab,
notification_registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
Source<Profile>(tab->profile()));
// Also start listening for changes in the accept languages.
- tab->profile()->GetPrefs()->AddPrefObserver(prefs::kAcceptLanguages, this);
+ pref_change_registrar_.Add(prefs::kAcceptLanguages, this);
iter = accept_languages_.find(pref_service);
}
« no previous file with comments | « chrome/browser/translate/translate_manager.h ('k') | chrome/browser/translate/translate_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698