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

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

Issue 2906883003: Deprecate per notification type delegates. (Closed)
Patch Set: rebase 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
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..843c77a8fadfaee7845968926503d508c7a828c1 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.
+ DCHECK(renderer_ids_[notification_id] == renderer_id);
Peter Beverloo 2017/06/08 06:48:11 I don't think this DCHECK is valid. What if an ori
Miguel Garcia 2017/06/09 12:24:51 Good point. Removed
+ DispatchNonPersistentCloseEvent(notification_id);
Peter Beverloo 2017/06/08 06:48:11 This feels like the wrong layer. Right now the Mes
Miguel Garcia 2017/06/09 12:24:51 Done.
+ }
renderer_ids_[notification_id] = renderer_id;
non_persistent_ids_[notification_id] = non_persistent_id;
}

Powered by Google App Engine
This is Rietveld 408576698