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

Unified Diff: chrome/browser/background_mode_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
« no previous file with comments | « chrome/browser/background_mode_manager.h ('k') | chrome/browser/cocoa/content_settings_dialog_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/background_mode_manager.cc
diff --git a/chrome/browser/background_mode_manager.cc b/chrome/browser/background_mode_manager.cc
index 01a9a36bf6b8d0fdc5852ee1af044aa7dcad18ec..b0110a13b58fab779ff41989dceadde6d10e9e61 100644
--- a/chrome/browser/background_mode_manager.cc
+++ b/chrome/browser/background_mode_manager.cc
@@ -163,7 +163,8 @@ BackgroundModeManager::BackgroundModeManager(Profile* profile,
NotificationService::AllSources());
// Listen for changes to the background mode preference.
- profile_->GetPrefs()->AddPrefObserver(prefs::kBackgroundModeEnabled, this);
+ pref_registrar_.Init(profile_->GetPrefs());
+ pref_registrar_.Add(prefs::kBackgroundModeEnabled, this);
}
BackgroundModeManager::~BackgroundModeManager() {
@@ -172,10 +173,6 @@ BackgroundModeManager::~BackgroundModeManager() {
// because in an actual running system we'd get an APP_TERMINATING
// notification before being destroyed.
EndBackgroundMode();
- // Manually remove our pref observer so we don't get notified for prefs
- // changes (have to do it manually because we can't use the registrar for
- // prefs notifications).
- profile_->GetPrefs()->RemovePrefObserver(prefs::kBackgroundModeEnabled, this);
}
bool BackgroundModeManager::IsBackgroundModeEnabled() {
« no previous file with comments | « chrome/browser/background_mode_manager.h ('k') | chrome/browser/cocoa/content_settings_dialog_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698