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

Unified Diff: chrome/browser/notifications/notification_ui_manager_impl.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
« no previous file with comments | « chrome/browser/notifications/message_center_notification_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/notification_ui_manager_impl.cc
diff --git a/chrome/browser/notifications/notification_ui_manager_impl.cc b/chrome/browser/notifications/notification_ui_manager_impl.cc
index 324530f2e2a16c965d78d7532948327f16c718ae..e91d470e5ee7c201a3d64eba0559de0fab0cf37f 100644
--- a/chrome/browser/notifications/notification_ui_manager_impl.cc
+++ b/chrome/browser/notifications/notification_ui_manager_impl.cc
@@ -13,7 +13,9 @@
#include "chrome/browser/idle.h"
#include "chrome/browser/notifications/balloon_collection.h"
#include "chrome/browser/notifications/notification.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_service.h"
@@ -50,6 +52,10 @@ NotificationUIManagerImpl::NotificationUIManagerImpl()
: is_user_active_(true) {
registrar_.Add(this, chrome::NOTIFICATION_APP_TERMINATING,
content::NotificationService::AllSources());
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::NotificationService::AllSources());
+ registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
+ content::NotificationService::AllSources());
}
NotificationUIManagerImpl::~NotificationUIManagerImpl() {
@@ -200,6 +206,17 @@ void NotificationUIManagerImpl::Observe(
const content::NotificationDetails& details) {
if (type == chrome::NOTIFICATION_APP_TERMINATING) {
CancelAll();
+ } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
+ if (!content::Source<Profile>(source)->IsOffTheRecord()) {
+ extensions::UnloadedExtensionInfo* extension_info =
+ content::Details<extensions::UnloadedExtensionInfo>(details).ptr();
+ const extensions::Extension* extension = extension_info->extension;
+ CancelAllBySourceOrigin(extension->url());
+ }
+ } else if (type == chrome::NOTIFICATION_PROFILE_DESTROYED) {
+ // We only want to remove the incognito notifications.
+ if (content::Source<Profile>(source)->IsOffTheRecord())
+ CancelAllByProfile(content::Source<Profile>(source).ptr());
} else {
NOTREACHED();
}
« no previous file with comments | « chrome/browser/notifications/message_center_notification_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698