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

Unified Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 720873002: Expose the notificationclick and notificationerror events on ServiceWorkerGlobalScope (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 7ec351264510c662e970a194a3fbe2fe85e73683..fd82f64a5bb4826290eb89e8ebadd72f7e368e3b 100644
--- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -41,6 +41,7 @@
#include "core/workers/WorkerGlobalScope.h"
#include "modules/geofencing/CircularGeofencingRegion.h"
#include "modules/geofencing/GeofencingEvent.h"
+#include "modules/notifications/NotificationEvent.h"
#include "modules/push_messaging/PushEvent.h"
#include "modules/serviceworkers/ExtendableEvent.h"
#include "modules/serviceworkers/FetchEvent.h"
@@ -48,6 +49,7 @@
#include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
#include "modules/serviceworkers/WaitUntilObserver.h"
#include "platform/RuntimeEnabledFeatures.h"
+#include "public/platform/WebNotificationData.h"
#include "public/platform/WebServiceWorkerEventResult.h"
#include "public/platform/WebServiceWorkerRequest.h"
#include "public/web/WebSerializedScriptValue.h"
@@ -125,6 +127,26 @@ void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebStri
ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandlePushEvent(eventID, WebServiceWorkerEventResultCompleted);
}
+void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID, const WebNotificationData& data)
+{
+ ASSERT(m_workerGlobalScope);
+ WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::NotificationClick, eventID);
+ // FIXME: Initialize a Notification object based on |data|.
+ NotificationEventInit eventInit;
+ RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationclick, eventInit, observer));
+ m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
+}
+
+void ServiceWorkerGlobalScopeProxy::dispatchNotificationErrorEvent(int eventID, const WebNotificationData& data)
+{
+ ASSERT(m_workerGlobalScope);
+ WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope, WaitUntilObserver::NotificationError, eventID);
+ // FIXME: Initialize a Notification object based on |data|.
+ NotificationEventInit eventInit;
+ RefPtrWillBeRawPtr<Event> event(NotificationEvent::create(EventTypeNames::notificationerror, eventInit, observer));
+ m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer);
+}
+
void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID)
{
ASSERT(m_workerGlobalScope);

Powered by Google App Engine
This is Rietveld 408576698