| Index: chrome/browser/notifications/desktop_notification_service.cc
|
| diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
|
| index b55c573771abc259efbf23efe582336e4029b024..1b3df09c899061a43c64599c5432270a59f819e4 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();
|
| }
|
| }
|
|
|
|
|