Chromium Code Reviews| 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" |
| 55 #include "modules/serviceworkers/WaitUntilObserver.h" | 56 #include "modules/serviceworkers/WaitUntilObserver.h" |
| 56 #include "platform/RuntimeEnabledFeatures.h" | 57 #include "platform/RuntimeEnabledFeatures.h" |
| 57 #include "public/platform/WebCrossOriginServiceWorkerClient.h" | 58 #include "public/platform/WebCrossOriginServiceWorkerClient.h" |
| 58 #include "public/platform/WebServiceWorkerEventResult.h" | 59 #include "public/platform/WebServiceWorkerEventResult.h" |
| 59 #include "public/platform/WebServiceWorkerRequest.h" | 60 #include "public/platform/WebServiceWorkerRequest.h" |
| 60 #include "public/platform/modules/notifications/WebNotificationData.h" | 61 #include "public/platform/modules/notifications/WebNotificationData.h" |
| 61 #include "public/web/WebSerializedScriptValue.h" | 62 #include "public/web/WebSerializedScriptValue.h" |
| 62 #include "public/web/WebServiceWorkerContextClient.h" | 63 #include "public/web/WebServiceWorkerContextClient.h" |
| 63 #include "web/WebEmbeddedWorkerImpl.h" | 64 #include "web/WebEmbeddedWorkerImpl.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { | 98 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { |
| 98 observer->didDispatchEvent(defaultPrevented); | 99 observer->didDispatchEvent(defaultPrevented); |
| 99 return; | 100 return; |
| 100 } | 101 } |
| 101 | 102 |
| 102 Request* request = Request::create(m_workerGlobalScope, webRequest); | 103 Request* request = Request::create(m_workerGlobalScope, webRequest); |
| 103 request->headers()->setGuard(Headers::ImmutableGuard); | 104 request->headers()->setGuard(Headers::ImmutableGuard); |
| 104 FetchEventInit eventInit; | 105 FetchEventInit eventInit; |
| 105 eventInit.setRequest(request); | 106 eventInit.setRequest(request); |
| 106 eventInit.setIsReload(webRequest.isReload()); | 107 eventInit.setIsReload(webRequest.isReload()); |
| 108 eventInit.setClient(ServiceWorkerClient::create(webRequest.client())); | |
|
jsbell
2015/04/27 23:32:47
This should create a ServiceWorkerWindowClient if
Paritosh Kumar
2015/05/05 14:22:24
Yes.. Done.
| |
| 107 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); | 109 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); |
| 108 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; | 110 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; |
| 109 observer->didDispatchEvent(defaultPrevented); | 111 observer->didDispatchEvent(defaultPrevented); |
| 110 } | 112 } |
| 111 | 113 |
| 112 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) | 114 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) |
| 113 { | 115 { |
| 114 ASSERT(m_workerGlobalScope); | 116 ASSERT(m_workerGlobalScope); |
| 115 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 117 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
| 116 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region))); | 118 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 | 226 |
| 225 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 227 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
| 226 : m_embeddedWorker(embeddedWorker) | 228 : m_embeddedWorker(embeddedWorker) |
| 227 , m_document(document) | 229 , m_document(document) |
| 228 , m_client(client) | 230 , m_client(client) |
| 229 , m_workerGlobalScope(0) | 231 , m_workerGlobalScope(0) |
| 230 { | 232 { |
| 231 } | 233 } |
| 232 | 234 |
| 233 } // namespace blink | 235 } // namespace blink |
| OLD | NEW |