| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "web/ServiceWorkerGlobalScopeProxy.h" | 31 #include "web/ServiceWorkerGlobalScopeProxy.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/SourceLocation.h" | 33 #include "bindings/core/v8/SourceLocation.h" |
| 34 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 34 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| 35 #include "core/dom/CrossThreadTask.h" | 35 #include "core/dom/CrossThreadTask.h" |
| 36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
| 37 #include "core/dom/ExecutionContext.h" | 37 #include "core/dom/ExecutionContext.h" |
| 38 #include "core/dom/MessagePort.h" | 38 #include "core/dom/MessagePort.h" |
| 39 #include "core/inspector/ConsoleMessage.h" | 39 #include "core/inspector/ConsoleMessage.h" |
| 40 #include "core/origin_trials/OriginTrials.h" |
| 40 #include "core/workers/WorkerGlobalScope.h" | 41 #include "core/workers/WorkerGlobalScope.h" |
| 41 #include "core/workers/WorkerThread.h" | 42 #include "core/workers/WorkerThread.h" |
| 42 #include "modules/background_sync/SyncEvent.h" | 43 #include "modules/background_sync/SyncEvent.h" |
| 43 #include "modules/fetch/Headers.h" | 44 #include "modules/fetch/Headers.h" |
| 44 #include "modules/notifications/Notification.h" | 45 #include "modules/notifications/Notification.h" |
| 45 #include "modules/notifications/NotificationEvent.h" | 46 #include "modules/notifications/NotificationEvent.h" |
| 46 #include "modules/notifications/NotificationEventInit.h" | 47 #include "modules/notifications/NotificationEventInit.h" |
| 47 #include "modules/push_messaging/PushEvent.h" | 48 #include "modules/push_messaging/PushEvent.h" |
| 48 #include "modules/push_messaging/PushMessageData.h" | 49 #include "modules/push_messaging/PushMessageData.h" |
| 49 #include "modules/serviceworkers/ExtendableEvent.h" | 50 #include "modules/serviceworkers/ExtendableEvent.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 respondWithObserver->didDispatchEvent(dispatchResult); | 169 respondWithObserver->didDispatchEvent(dispatchResult); |
| 169 // false is okay because waitUntil for foreign fetch event doesn't care | 170 // false is okay because waitUntil for foreign fetch event doesn't care |
| 170 // about the promise rejection or an uncaught runtime script error. | 171 // about the promise rejection or an uncaught runtime script error. |
| 171 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); | 172 waitUntilObserver->didDispatchEvent(false /* errorOccurred */); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 175 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
| 175 { | 176 { |
| 176 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); | 177 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Install, eventID); |
| 177 Event* event; | 178 Event* event; |
| 178 if (RuntimeEnabledFeatures::foreignFetchEnabled()) | 179 if (OriginTrials::foreignFetchEnabled(workerGlobalScope())) |
| 179 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); | 180 event = InstallEvent::create(EventTypeNames::install, ExtendableEventIni
t(), observer); |
| 180 else | 181 else |
| 181 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); | 182 event = ExtendableEvent::create(EventTypeNames::install, ExtendableEvent
Init(), observer); |
| 182 workerGlobalScope()->dispatchExtendableEvent(event, observer); | 183 workerGlobalScope()->dispatchExtendableEvent(event, observer); |
| 183 } | 184 } |
| 184 | 185 |
| 185 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) | 186 void ServiceWorkerGlobalScopeProxy::dispatchNotificationClickEvent(int eventID,
int64_t notificationID, const WebNotificationData& data, int actionIndex) |
| 186 { | 187 { |
| 187 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); | 188 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::NotificationClick, eventID); |
| 188 NotificationEventInit eventInit; | 189 NotificationEventInit eventInit; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 return *m_document; | 309 return *m_document; |
| 309 } | 310 } |
| 310 | 311 |
| 311 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 312 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
| 312 { | 313 { |
| 313 DCHECK(m_workerGlobalScope); | 314 DCHECK(m_workerGlobalScope); |
| 314 return m_workerGlobalScope; | 315 return m_workerGlobalScope; |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace blink | 318 } // namespace blink |
| OLD | NEW |