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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 #include "modules/serviceworkers/ExtendableEvent.h" | 55 #include "modules/serviceworkers/ExtendableEvent.h" |
56 #include "modules/serviceworkers/ExtendableMessageEvent.h" | 56 #include "modules/serviceworkers/ExtendableMessageEvent.h" |
57 #include "modules/serviceworkers/FetchEvent.h" | 57 #include "modules/serviceworkers/FetchEvent.h" |
58 #include "modules/serviceworkers/InstallEvent.h" | 58 #include "modules/serviceworkers/InstallEvent.h" |
59 #include "modules/serviceworkers/ServiceWorkerClient.h" | 59 #include "modules/serviceworkers/ServiceWorkerClient.h" |
60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 60 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
61 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" | 61 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" |
62 #include "modules/serviceworkers/WaitUntilObserver.h" | 62 #include "modules/serviceworkers/WaitUntilObserver.h" |
63 #include "platform/RuntimeEnabledFeatures.h" | 63 #include "platform/RuntimeEnabledFeatures.h" |
64 #include "public/platform/WebCrossOriginServiceWorkerClient.h" | 64 #include "public/platform/WebCrossOriginServiceWorkerClient.h" |
65 #include "public/platform/modules/background_sync/WebSyncRegistration.h" | |
66 #include "public/platform/modules/notifications/WebNotificationData.h" | 65 #include "public/platform/modules/notifications/WebNotificationData.h" |
67 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" | 66 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" |
68 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" | 67 #include "public/platform/modules/serviceworker/WebServiceWorkerRequest.h" |
69 #include "public/web/WebSerializedScriptValue.h" | 68 #include "public/web/WebSerializedScriptValue.h" |
70 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" | 69 #include "public/web/modules/serviceworker/WebServiceWorkerContextClient.h" |
71 #include "web/WebEmbeddedWorkerImpl.h" | 70 #include "web/WebEmbeddedWorkerImpl.h" |
72 #include "wtf/Assertions.h" | 71 #include "wtf/Assertions.h" |
73 #include "wtf/Functional.h" | 72 #include "wtf/Functional.h" |
74 #include "wtf/PassOwnPtr.h" | 73 #include "wtf/PassOwnPtr.h" |
75 | 74 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 201 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
203 } | 202 } |
204 | 203 |
205 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) | 204 void ServiceWorkerGlobalScopeProxy::dispatchServicePortConnectEvent(WebServicePo
rtConnectEventCallbacks* rawCallbacks, const WebURL& targetURL, const WebString&
origin, WebServicePortID portID) |
206 { | 205 { |
207 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); | 206 OwnPtr<WebServicePortConnectEventCallbacks> callbacks = adoptPtr(rawCallback
s); |
208 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); | 207 ServicePortCollection* collection = WorkerNavigatorServices::services(worker
GlobalScope(), *workerGlobalScope()->navigator()); |
209 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); | 208 collection->dispatchConnectEvent(callbacks.release(), targetURL, origin, por
tID); |
210 } | 209 } |
211 | 210 |
212 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebSync
Registration& registration, LastChanceOption lastChance) | 211 void ServiceWorkerGlobalScopeProxy::dispatchSyncEvent(int eventID, const WebStri
ng& tag, LastChanceOption lastChance) |
213 { | 212 { |
214 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { | 213 if (!RuntimeEnabledFeatures::backgroundSyncEnabled()) { |
215 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); | 214 ServiceWorkerGlobalScopeClient::from(workerGlobalScope())->didHandleSync
Event(eventID, WebServiceWorkerEventResultCompleted); |
216 return; | 215 return; |
217 } | 216 } |
218 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); | 217 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(),
WaitUntilObserver::Sync, eventID); |
219 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, regi
stration.tag, lastChance == IsLastChance, observer)); | 218 RefPtrWillBeRawPtr<Event> event(SyncEvent::create(EventTypeNames::sync, tag,
lastChance == IsLastChance, observer)); |
220 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 219 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
221 } | 220 } |
222 | 221 |
223 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) | 222 void ServiceWorkerGlobalScopeProxy::dispatchCrossOriginMessageEvent(const WebCro
ssOriginServiceWorkerClient& webClient, const WebString& message, const WebMessa
gePortChannelArray& webChannels) |
224 { | 223 { |
225 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); | 224 MessagePortArray* ports = MessagePort::toMessagePortArray(workerGlobalScope(
), webChannels); |
226 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); | 225 WebSerializedScriptValue value = WebSerializedScriptValue::fromString(messag
e); |
227 // FIXME: Have proper source for this MessageEvent. | 226 // FIXME: Have proper source for this MessageEvent. |
228 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); | 227 RefPtrWillBeRawPtr<MessageEvent> event = MessageEvent::create(ports, value,
webClient.origin.string()); |
229 event->setType(EventTypeNames::crossoriginmessage); | 228 event->setType(EventTypeNames::crossoriginmessage); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 eventInit.setCancelable(true); | 324 eventInit.setCancelable(true); |
326 eventInit.setRequest(request); | 325 eventInit.setRequest(request); |
327 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); | 326 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq
uest.clientId()); |
328 eventInit.setIsReload(webRequest.isReload()); | 327 eventInit.setIsReload(webRequest.isReload()); |
329 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); | 328 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(eventTypeName,
eventInit, observer)); |
330 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent.release()); | 329 DispatchEventResult dispatchResult = workerGlobalScope()->dispatchEvent(fetc
hEvent.release()); |
331 observer->didDispatchEvent(dispatchResult); | 330 observer->didDispatchEvent(dispatchResult); |
332 } | 331 } |
333 | 332 |
334 } // namespace blink | 333 } // namespace blink |
OLD | NEW |