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

Unified Diff: chrome/browser/notifications/native_notification_display_service.cc

Issue 2888303004: Minimize the delegate dependencies for non persistent notifications. (Closed)
Patch Set: format Created 3 years, 7 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: chrome/browser/notifications/native_notification_display_service.cc
diff --git a/chrome/browser/notifications/native_notification_display_service.cc b/chrome/browser/notifications/native_notification_display_service.cc
index 2ffcd75fd3929c32998c54c28a73145fdbef9796..86b095d33e9add9c5fcd522b43e7496953f2620e 100644
--- a/chrome/browser/notifications/native_notification_display_service.cc
+++ b/chrome/browser/notifications/native_notification_display_service.cc
@@ -21,6 +21,7 @@
#include "chrome/browser/notifications/persistent_notification_handler.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_event_dispatcher.h"
#include "extensions/features/features.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
@@ -93,9 +94,12 @@ void NativeNotificationDisplayService::Display(
notification_bridge_->Display(notification_type, notification_id,
GetProfileId(profile_),
profile_->IsOffTheRecord(), notification);
- notification.delegate()->Display();
- NotificationHandler* handler = GetNotificationHandler(notification_type);
- handler->RegisterNotification(notification_id, notification.delegate());
+ // Unlike all other notifications non persistent notifications require
+ // an event after the notification has been displayed.
+ if (notification_type == NotificationCommon::NON_PERSISTENT) {
Peter Beverloo 2017/06/01 17:56:27 This is where OnShow() could be fired. (Or maybe i
Miguel Garcia 2017/06/02 12:37:13 Yeah makes sense, I will add it to the next patch.
+ content::NotificationEventDispatcher::GetInstance()
+ ->DispatchNonPersistentShowEvent(notification_id);
+ }
} else if (message_center_display_service_) {
message_center_display_service_->Display(notification_type, notification_id,
notification);

Powered by Google App Engine
This is Rietveld 408576698