Index: Source/web/ServiceWorkerGlobalScopeProxy.cpp |
diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
index e02289e5ac86750fbbde703a183f7b7eae367de7..b09b3425e1431ead87fb6f1479d471f11954ddcc 100644 |
--- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
+++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
@@ -64,6 +64,7 @@ |
#include "public/web/WebSerializedScriptValue.h" |
#include "public/web/WebServiceWorkerContextClient.h" |
#include "web/WebEmbeddedWorkerImpl.h" |
+#include "wtf/Assertions.h" |
#include "wtf/Functional.h" |
#include "wtf/PassOwnPtr.h" |
@@ -134,10 +135,17 @@ void ServiceWorkerGlobalScopeProxy::dispatchMessageEvent(const WebString& messag |
void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data) |
{ |
+ dispatchNotificationClickEvent(eventID, notificationID, data, -1 /* actionIndex */); |
+} |
+ |
+void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, int64_t notificationID, const WebNotificationData& data, int actionIndex) |
+{ |
ASSERT(m_workerGlobalScope); |
WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::NotificationClick, eventID); |
NotificationEventInit eventInit; |
eventInit.setNotification(Notification::create(m_workerGlobalScope, notificationID, data)); |
+ 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)); |
m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
} |