Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: Source/web/ServiceWorkerGlobalScopeProxy.cpp

Issue 1102363002: Add Client Attribute to FetchEvent- Blink Side. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
107 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); 114 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer));
108 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; 115 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ;
109 observer->didDispatchEvent(defaultPrevented); 116 observer->didDispatchEvent(defaultPrevented);
110 } 117 }
111 118
112 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) 119 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region)
113 { 120 {
114 ASSERT(m_workerGlobalScope); 121 ASSERT(m_workerGlobalScope);
115 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; 122 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave;
116 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region))); 123 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region)));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 231
225 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 232 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
226 : m_embeddedWorker(embeddedWorker) 233 : m_embeddedWorker(embeddedWorker)
227 , m_document(document) 234 , m_document(document)
228 , m_client(client) 235 , m_client(client)
229 , m_workerGlobalScope(0) 236 , m_workerGlobalScope(0)
230 { 237 {
231 } 238 }
232 239
233 } // namespace blink 240 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/exported/WebServiceWorkerRequest.cpp ('k') | public/platform/WebServiceWorkerRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698