Chromium Code Reviews| Index: chrome/browser/notifications/non_persistent_notification_handler.cc |
| diff --git a/chrome/browser/notifications/non_persistent_notification_handler.cc b/chrome/browser/notifications/non_persistent_notification_handler.cc |
| index 9a33f5360089a844572c0c027f1722defb9f2b20..f9cd4cb53bcbd93f5c39a95c20bb03f9e1e5a1cc 100644 |
| --- a/chrome/browser/notifications/non_persistent_notification_handler.cc |
| +++ b/chrome/browser/notifications/non_persistent_notification_handler.cc |
| @@ -5,8 +5,8 @@ |
| #include "chrome/browser/notifications/non_persistent_notification_handler.h" |
| #include "base/strings/nullable_string16.h" |
| -#include "chrome/browser/notifications/notification_delegate.h" |
| #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| +#include "content/public/browser/notification_event_dispatcher.h" |
| NonPersistentNotificationHandler::NonPersistentNotificationHandler() = default; |
| NonPersistentNotificationHandler::~NonPersistentNotificationHandler() = default; |
| @@ -16,10 +16,8 @@ void NonPersistentNotificationHandler::OnClose( |
| const std::string& origin, |
| const std::string& notification_id, |
| bool by_user) { |
| - if (notifications_.find(notification_id) != notifications_.end()) { |
| - notifications_[notification_id]->Close(by_user); |
| - notifications_.erase(notification_id); |
| - } |
| + content::NotificationEventDispatcher::GetInstance() |
| + ->DispatchNonPersistentCloseEvent(notification_id); |
| } |
| void NonPersistentNotificationHandler::OnClick( |
|
Peter Beverloo
2017/05/31 17:52:42
Should OnShow() be added to the handlers?
Miguel Garcia
2017/06/01 17:00:53
Not sure I get this, what would OnShow do?
Peter Beverloo
2017/06/01 17:56:27
You're now special casing non-persistent notificat
|
| @@ -30,21 +28,13 @@ void NonPersistentNotificationHandler::OnClick( |
| const base::NullableString16& reply) { |
| DCHECK(reply.is_null()); |
| - if (notifications_.find(notification_id) != notifications_.end()) { |
| - if (action_index >= 0) |
| - notifications_[notification_id]->ButtonClick(action_index); |
| - else |
| - notifications_[notification_id]->Click(); |
| - } |
| + // Non persistent notifications don't allow buttons. |
|
Peter Beverloo
2017/05/31 17:52:42
nit: refer to https://notifications.spec.whatwg.or
Miguel Garcia
2017/06/01 17:00:53
Done.
|
| + DCHECK_EQ(-1, action_index); |
| + |
| + content::NotificationEventDispatcher::GetInstance() |
| + ->DispatchNonPersistentClickEvent(notification_id); |
| } |
| void NonPersistentNotificationHandler::OpenSettings(Profile* profile) { |
| NotificationCommon::OpenNotificationSettings(profile); |
| } |
| - |
| -void NonPersistentNotificationHandler::RegisterNotification( |
| - const std::string& notification_id, |
| - NotificationDelegate* delegate) { |
| - notifications_[notification_id] = |
| - scoped_refptr<NotificationDelegate>(delegate); |
| -} |