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

Unified Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 285403002: Push API: define push event on Service Worker. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase. Avoid modifying modules/serviceworkers/. Created 6 years, 7 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 efca3f24f7e617003f9dd23d08e1e2c78ae230ab..0d8c6b07661de7a30334cd44dc52e19c9950bbe8 100644
--- a/Source/web/ServiceWorkerGlobalScopeProxy.cpp
+++ b/Source/web/ServiceWorkerGlobalScopeProxy.cpp
@@ -36,6 +36,7 @@
#include "core/dom/MessagePort.h"
#include "core/events/MessageEvent.h"
#include "core/workers/WorkerGlobalScope.h"
+#include "modules/push_messaging/PushEvent.h"
#include "modules/serviceworkers/FetchEvent.h"
#include "modules/serviceworkers/InstallEvent.h"
#include "modules/serviceworkers/InstallPhaseEvent.h"
@@ -43,6 +44,7 @@
#include "platform/NotImplemented.h"
#include "public/web/WebSerializedScriptValue.h"
#include "public/web/WebServiceWorkerContextClient.h"
+#include "public/web/WebServiceWorkerPushEventCallback.h"
#include "web/WebEmbeddedWorkerImpl.h"
#include "wtf/Functional.h"
#include "wtf/PassOwnPtr.h"
@@ -102,6 +104,13 @@ void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID)
ServiceWorkerGlobalScopeClient::from(m_workerGlobalScope)->didHandleSyncEvent(eventID);
}
+void ServiceWorkerGlobalScopeProxy::dispatchPushEvent(int eventID, const WebString& data, const WebServiceWorkerPushEventCallback& callback)
+{
+ ASSERT(m_workerGlobalScope);
+ m_workerGlobalScope->dispatchEvent(PushEvent::create(EventTypeNames::push, data));
+ callback.didHandlePushEvent(eventID);
+}
+
void ServiceWorkerGlobalScopeProxy::reportException(const String& errorMessage, int lineNumber, int columnNumber, const String& sourceURL)
{
m_client.reportException(errorMessage, lineNumber, columnNumber, sourceURL);

Powered by Google App Engine
This is Rietveld 408576698