diff options
Diffstat (limited to 'chrome/browser/notifications/desktop_notification_service.cc')
-rw-r--r-- | chrome/browser/notifications/desktop_notification_service.cc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index b55c573..1b3df09 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -210,6 +210,7 @@ DesktopNotificationService::DesktopNotificationService(Profile* profile, NotificationUIManager* ui_manager) : profile_(profile), ui_manager_(ui_manager) { + registrar_.Init(profile_->GetPrefs()); InitPrefs(); StartObserving(); } @@ -254,21 +255,15 @@ void DesktopNotificationService::InitPrefs() { void DesktopNotificationService::StartObserving() { if (!profile_->IsOffTheRecord()) { - PrefService* prefs = profile_->GetPrefs(); - prefs->AddPrefObserver(prefs::kDesktopNotificationDefaultContentSetting, - this); - prefs->AddPrefObserver(prefs::kDesktopNotificationAllowedOrigins, this); - prefs->AddPrefObserver(prefs::kDesktopNotificationDeniedOrigins, this); + registrar_.Add(prefs::kDesktopNotificationDefaultContentSetting, this); + registrar_.Add(prefs::kDesktopNotificationAllowedOrigins, this); + registrar_.Add(prefs::kDesktopNotificationDeniedOrigins, this); } } void DesktopNotificationService::StopObserving() { if (!profile_->IsOffTheRecord()) { - PrefService* prefs = profile_->GetPrefs(); - prefs->RemovePrefObserver(prefs::kDesktopNotificationDefaultContentSetting, - this); - prefs->RemovePrefObserver(prefs::kDesktopNotificationAllowedOrigins, this); - prefs->RemovePrefObserver(prefs::kDesktopNotificationDeniedOrigins, this); + registrar_.RemoveAll(); } } |