| Index: third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| diff --git a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| index b64b6fc17ba2567fc04caada969023b1df37e358..6dc2da9690376baceb3ab95f746eb523f61b4212 100644
|
| --- a/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| +++ b/third_party/WebKit/Source/web/ServiceWorkerGlobalScopeProxy.cpp
|
| @@ -42,6 +42,10 @@
|
| #include "core/workers/ParentFrameTaskRunners.h"
|
| #include "core/workers/WorkerGlobalScope.h"
|
| #include "core/workers/WorkerThread.h"
|
| +#include "modules/background_fetch/BackgroundFetchClickEvent.h"
|
| +#include "modules/background_fetch/BackgroundFetchClickEventInit.h"
|
| +#include "modules/background_fetch/BackgroundFetchEvent.h"
|
| +#include "modules/background_fetch/BackgroundFetchEventInit.h"
|
| #include "modules/background_sync/SyncEvent.h"
|
| #include "modules/fetch/Headers.h"
|
| #include "modules/notifications/Notification.h"
|
| @@ -98,6 +102,49 @@ void ServiceWorkerGlobalScopeProxy::setRegistration(
|
| workerGlobalScope()->setRegistration(std::move(handle));
|
| }
|
|
|
| +void ServiceWorkerGlobalScopeProxy::dispatchBackgroundFetchAbortEvent(
|
| + int eventID,
|
| + const WebString& tag) {
|
| + WaitUntilObserver* observer = WaitUntilObserver::create(
|
| + workerGlobalScope(), WaitUntilObserver::BackgroundFetchAbort, eventID);
|
| +
|
| + BackgroundFetchClickEventInit init;
|
| + init.setTag(tag);
|
| +
|
| + BackgroundFetchEvent* event = BackgroundFetchEvent::create(
|
| + EventTypeNames::backgroundfetchabort, init, observer);
|
| +
|
| + workerGlobalScope()->dispatchExtendableEvent(event, observer);
|
| +}
|
| +
|
| +void ServiceWorkerGlobalScopeProxy::dispatchBackgroundFetchClickEvent(
|
| + int eventID,
|
| + const WebString& tag,
|
| + BackgroundFetchState status) {
|
| + WaitUntilObserver* observer = WaitUntilObserver::create(
|
| + workerGlobalScope(), WaitUntilObserver::BackgroundFetchClick, eventID);
|
| +
|
| + BackgroundFetchClickEventInit init;
|
| + init.setTag(tag);
|
| +
|
| + switch (status) {
|
| + case BackgroundFetchState::Pending:
|
| + init.setState("pending");
|
| + break;
|
| + case BackgroundFetchState::Succeeded:
|
| + init.setState("succeeded");
|
| + break;
|
| + case BackgroundFetchState::Failed:
|
| + init.setState("failed");
|
| + break;
|
| + }
|
| +
|
| + BackgroundFetchClickEvent* event = BackgroundFetchClickEvent::create(
|
| + EventTypeNames::backgroundfetchclick, init, observer);
|
| +
|
| + workerGlobalScope()->dispatchExtendableEvent(event, observer);
|
| +}
|
| +
|
| void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) {
|
| WaitUntilObserver* observer = WaitUntilObserver::create(
|
| workerGlobalScope(), WaitUntilObserver::Activate, eventID);
|
|
|