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

Unified Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1262893005: Add NotificationEvent.action property in SW events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@actions3_fix
Patch Set: Address review comments Created 5 years, 4 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: 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);
}
« no previous file with comments | « Source/web/ServiceWorkerGlobalScopeProxy.h ('k') | public/platform/modules/notifications/WebNotificationData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698