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

Unified Diff: content/browser/notifications/notification_event_dispatcher_impl.cc

Issue 2906883003: Deprecate per notification type delegates. (Closed)
Patch Set: review Created 3 years, 6 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 | « content/browser/BUILD.gn ('k') | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/notifications/notification_event_dispatcher_impl.cc
diff --git a/content/browser/notifications/notification_event_dispatcher_impl.cc b/content/browser/notifications/notification_event_dispatcher_impl.cc
index 47779cfe660c259a18820b5b7e469975679d9d59..a02d71944405b1bafc3d5407280234138b4bfd77 100644
--- a/content/browser/notifications/notification_event_dispatcher_impl.cc
+++ b/content/browser/notifications/notification_event_dispatcher_impl.cc
@@ -394,6 +394,15 @@ void NotificationEventDispatcherImpl::RegisterNonPersistentNotification(
const std::string& notification_id,
int renderer_id,
int non_persistent_id) {
+ if (non_persistent_ids_.count(notification_id) &&
+ non_persistent_ids_[notification_id] != non_persistent_id) {
+ // Notify close for a previously displayed notification with the same id,
+ // this can happen when replacing a non-persistent notification with the
+ // same tag since from the JS point of view there will be two notification
+ // objects and the old one needs to receive the close event.
+ // TODO(miguelg) this is probably not the right layer to do this.
+ DispatchNonPersistentCloseEvent(notification_id);
+ }
renderer_ids_[notification_id] = renderer_id;
non_persistent_ids_[notification_id] = non_persistent_id;
}
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/notifications/notification_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698