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

Unified Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 12631017: Remove notifications when apps and OTR Profiles are removed. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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/notifications/desktop_notification_service.cc
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index d170b68bd77ef28fd85af9c71449ee7d9038a9b5..bd50875168e35dc8bdc834835ef45a0317e47204 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -314,20 +314,6 @@ DesktopNotificationService::DesktopNotificationService(
NotificationUIManager* ui_manager)
: profile_(profile),
ui_manager_(ui_manager) {
- StartObserving();
-}
-
-DesktopNotificationService::~DesktopNotificationService() {
- StopObserving();
-}
-
-void DesktopNotificationService::StartObserving() {
- if (!profile_->IsOffTheRecord()) {
- notification_registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
- content::Source<Profile>(profile_));
- }
- notification_registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
- content::Source<Profile>(profile_));
#if defined(ENABLE_MESSAGE_CENTER)
OnDisabledExtensionIdsChanged();
disabled_extension_id_pref_.Init(
@@ -339,8 +325,7 @@ void DesktopNotificationService::StartObserving() {
#endif
}
-void DesktopNotificationService::StopObserving() {
- notification_registrar_.RemoveAll();
+DesktopNotificationService::~DesktopNotificationService() {
#if defined(ENABLE_MESSAGE_CENTER)
disabled_extension_id_pref_.Destroy();
#endif
@@ -368,34 +353,6 @@ void DesktopNotificationService::DenyPermission(const GURL& origin) {
CONTENT_SETTING_BLOCK);
}
-void DesktopNotificationService::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- // This may get called during shutdown, so don't use GetUIManager() here,
- // and don't do anything if ui_manager_ hasn't already been set.
- if (!ui_manager_)
- return;
-
- if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
- // Remove all notifications currently shown or queued by the extension
- // which was unloaded.
- const extensions::Extension* extension =
- content::Details<extensions::UnloadedExtensionInfo>(details)->extension;
- if (extension &&
- g_browser_process && g_browser_process->notification_ui_manager()) {
- g_browser_process->notification_ui_manager()->
- CancelAllBySourceOrigin(extension->url());
- }
- } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) {
- if (g_browser_process && g_browser_process->notification_ui_manager()) {
- g_browser_process->notification_ui_manager()->
- CancelAllByProfile(profile_);
- }
- StopObserving();
- }
-}
-
ContentSetting DesktopNotificationService::GetDefaultContentSetting(
std::string* provider_id) {
return profile_->GetHostContentSettingsMap()->GetDefaultContentSetting(

Powered by Google App Engine
This is Rietveld 408576698