Chromium Code Reviews| Index: Source/web/ServiceWorkerGlobalScopeProxy.cpp |
| diff --git a/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/Source/web/ServiceWorkerGlobalScopeProxy.cpp |
| index e02289e5ac86750fbbde703a183f7b7eae367de7..7cc3efae451ac5579661617314c39f59063aa1f8 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 (actionIndex >= 0) |
|
Peter Beverloo
2015/08/04 21:01:23
Make sure that it's in bounds (upper-bound as well
johnme
2015/08/05 11:56:22
Done.
|
| + eventInit.setAction(data.actions[actionIndex].action); |
| RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationclick, eventInit, observer)); |
| m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
| } |