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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 #include "modules/geofencing/GeofencingEvent.h" | 44 #include "modules/geofencing/GeofencingEvent.h" |
45 #include "modules/navigatorconnect/AcceptConnectionObserver.h" | 45 #include "modules/navigatorconnect/AcceptConnectionObserver.h" |
46 #include "modules/navigatorconnect/CrossOriginConnectEvent.h" | 46 #include "modules/navigatorconnect/CrossOriginConnectEvent.h" |
47 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" | 47 #include "modules/navigatorconnect/CrossOriginServiceWorkerClient.h" |
48 #include "modules/notifications/Notification.h" | 48 #include "modules/notifications/Notification.h" |
49 #include "modules/notifications/NotificationEvent.h" | 49 #include "modules/notifications/NotificationEvent.h" |
50 #include "modules/push_messaging/PushEvent.h" | 50 #include "modules/push_messaging/PushEvent.h" |
51 #include "modules/push_messaging/PushMessageData.h" | 51 #include "modules/push_messaging/PushMessageData.h" |
52 #include "modules/serviceworkers/ExtendableEvent.h" | 52 #include "modules/serviceworkers/ExtendableEvent.h" |
53 #include "modules/serviceworkers/FetchEvent.h" | 53 #include "modules/serviceworkers/FetchEvent.h" |
54 #include "modules/serviceworkers/ServiceWorkerClient.h" | |
54 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" | 55 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" |
56 #include "modules/serviceworkers/ServiceWorkerWindowClient.h" | |
55 #include "modules/serviceworkers/WaitUntilObserver.h" | 57 #include "modules/serviceworkers/WaitUntilObserver.h" |
56 #include "platform/RuntimeEnabledFeatures.h" | 58 #include "platform/RuntimeEnabledFeatures.h" |
57 #include "public/platform/WebCrossOriginServiceWorkerClient.h" | 59 #include "public/platform/WebCrossOriginServiceWorkerClient.h" |
58 #include "public/platform/WebServiceWorkerEventResult.h" | 60 #include "public/platform/WebServiceWorkerEventResult.h" |
59 #include "public/platform/WebServiceWorkerRequest.h" | 61 #include "public/platform/WebServiceWorkerRequest.h" |
60 #include "public/platform/modules/notifications/WebNotificationData.h" | 62 #include "public/platform/modules/notifications/WebNotificationData.h" |
61 #include "public/web/WebSerializedScriptValue.h" | 63 #include "public/web/WebSerializedScriptValue.h" |
62 #include "public/web/WebServiceWorkerContextClient.h" | 64 #include "public/web/WebServiceWorkerContextClient.h" |
63 #include "web/WebEmbeddedWorkerImpl.h" | 65 #include "web/WebEmbeddedWorkerImpl.h" |
64 #include "wtf/Functional.h" | 66 #include "wtf/Functional.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 bool defaultPrevented = false; | 98 bool defaultPrevented = false; |
97 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { | 99 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { |
98 observer->didDispatchEvent(defaultPrevented); | 100 observer->didDispatchEvent(defaultPrevented); |
99 return; | 101 return; |
100 } | 102 } |
101 | 103 |
102 Request* request = Request::create(m_workerGlobalScope, webRequest); | 104 Request* request = Request::create(m_workerGlobalScope, webRequest); |
103 request->headers()->setGuard(Headers::ImmutableGuard); | 105 request->headers()->setGuard(Headers::ImmutableGuard); |
104 FetchEventInit eventInit; | 106 FetchEventInit eventInit; |
105 eventInit.setRequest(request); | 107 eventInit.setRequest(request); |
106 eventInit.setIsReload(webRequest.isReload()); | 108 if (webRequest.client().clientType == WebServiceWorkerClientTypeWindow) { |
109 eventInit.setClient(ServiceWorkerWindowClient::create(webRequest.client( ))); | |
110 eventInit.setIsReload(webRequest.isReload()); | |
111 } else { | |
112 eventInit.setClient(ServiceWorkerClient::create(webRequest.client())); | |
113 eventInit.setIsReload(false); | |
jsbell
2015/05/05 17:45:42
Is this necessary, or will it default to false?
Paritosh Kumar
2015/05/06 11:42:36
Yes, default will be false only. Not necessary. Th
| |
114 } | |
107 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); | 115 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); |
108 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; | 116 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; |
109 observer->didDispatchEvent(defaultPrevented); | 117 observer->didDispatchEvent(defaultPrevented); |
110 } | 118 } |
111 | 119 |
112 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) | 120 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) |
113 { | 121 { |
114 ASSERT(m_workerGlobalScope); | 122 ASSERT(m_workerGlobalScope); |
115 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 123 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
116 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region))); | 124 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region))); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 | 232 |
225 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 233 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
226 : m_embeddedWorker(embeddedWorker) | 234 : m_embeddedWorker(embeddedWorker) |
227 , m_document(document) | 235 , m_document(document) |
228 , m_client(client) | 236 , m_client(client) |
229 , m_workerGlobalScope(0) | 237 , m_workerGlobalScope(0) |
230 { | 238 { |
231 } | 239 } |
232 | 240 |
233 } // namespace blink | 241 } // namespace blink |
OLD | NEW |