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

Unified Diff: chrome/browser/tab_contents/tab_contents.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/tab_contents/tab_contents.h ('k') | chrome/browser/translate/translate_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 086d1f17798954ca32e7acecc1094c4be74b3bc5..b33f3d833d218bf6ca2006adaa113b3ed6a91fb1 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -400,9 +400,10 @@ TabContents::TabContents(Profile* profile,
// Register for notifications about all interested prefs change.
PrefService* prefs = profile->GetPrefs();
+ pref_change_registrar_.Init(prefs);
if (prefs) {
for (int i = 0; i < kPrefsToObserveLength; ++i)
- prefs->AddPrefObserver(kPrefsToObserve[i], this);
+ pref_change_registrar_.Add(kPrefsToObserve[i], this);
}
// Register for notifications about URL starredness changing on any profile.
@@ -442,13 +443,7 @@ TabContents::~TabContents() {
// We don't want any notifications while we're running our destructor.
registrar_.RemoveAll();
-
- // Unregister the notifications of all observed prefs change.
- PrefService* prefs = profile()->GetPrefs();
- if (prefs) {
- for (int i = 0; i < kPrefsToObserveLength; ++i)
- prefs->RemovePrefObserver(kPrefsToObserve[i], this);
- }
+ pref_change_registrar_.RemoveAll();
NotifyDisconnected();
hung_renderer_dialog::HideForTabContents(this);
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/translate/translate_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698