Chromium Code Reviews| 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; |
| } |