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

Unified Diff: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1619703002: Implement notificationclose event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed nits 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: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
index 75d9a5445d24ef1183af5e1cdaec49119810eb03..59443420fdb5e52ce8d5a5ac9a4710a5ef93ebe6 100644
--- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -152,13 +152,23 @@ void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
{
WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClick, eventID);
NotificationEventInit eventInit;
- eventInit.setNotification(Notification::create(workerGlobalScope(), notificationID, data));
+ eventInit.setNotification(Notification::create(workerGlobalScope(), notificationID, data, true /* showing */));
if (0 <= actionIndex && actionIndex < static_cast<int>(data.actions.size()))
eventInit.setAction(data.actions[actionIndex].action);
RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationclick, eventInit, observer));
workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
}
+void ServiceWorkerGlobalScopeProxy::dispatchNotificationCloseEvent(int eventID, int64_t notificationID, const WebNotificationData& data)
+{
+ WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::NotificationClose, eventID);
+ NotificationEventInit eventInit;
+ eventInit.setAction(WTF::String()); // initialize as null.
+ eventInit.setNotification(Notification::create(workerGlobalScope(), notificationID, data, false /* showing */));
+ RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationclose, eventInit, observer));
+ workerGlobalScope()->dispatchExtendableEvent(event.release(), observer);
+}
+
void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebString& data)
{
WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Push, eventID);

Powered by Google App Engine
This is Rietveld 408576698