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

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

Issue 1619703002: Implement notificationclose event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some logging statements Created 4 years, 11 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 d48491ce2b8601fec05914a56db6f459fb435cf5..bc510dd57d046742fe8d8f4b7af2489f711b6cc2 100644
--- a/content/browser/notifications/notification_event_dispatcher_impl.cc
+++ b/content/browser/notifications/notification_event_dispatcher_impl.cc
@@ -95,10 +95,21 @@ void DispatchNotificationClickEventOnRegistration(
service_worker_registration);
DCHECK(service_worker_registration->active_version());
- service_worker_registration->active_version()
- ->DispatchNotificationClickEvent(
- dispatch_event_callback, notification_database_data.notification_id,
- notification_database_data.notification_data, action_index);
+ // TODO(nsatragno): refactor this class to avoid passing whether it's a
+ // close or click notification through the action_index.
+ if (action_index == -2) {
Nina 2016/01/21 13:55:36 This is the thing I like the least about my CL. Th
+ service_worker_registration->active_version()
+ ->DispatchNotificationCloseEvent(
+ dispatch_event_callback,
+ notification_database_data.notification_id,
+ notification_database_data.notification_data);
+ } else {
+ service_worker_registration->active_version()
+ ->DispatchNotificationClickEvent(
+ dispatch_event_callback,
+ notification_database_data.notification_id,
+ notification_database_data.notification_data, action_index);
+ }
return;
}
@@ -230,4 +241,14 @@ void NotificationEventDispatcherImpl::DispatchNotificationClickEvent(
service_worker_context, notification_context));
}
+void NotificationEventDispatcherImpl::DispatchNotificationCloseEvent(
+ BrowserContext* browser_context,
+ int64_t persistent_notification_id,
+ const GURL& origin,
+ const NotificationClickDispatchCompleteCallback&
+ dispatch_complete_callback) {
+ DispatchNotificationClickEvent(browser_context, persistent_notification_id,
+ origin, -2, dispatch_complete_callback);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698