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

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

Issue 1149163004: Revert "Add Client Attribute to FetchEvent- Blink Side." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix merge Created 5 years, 6 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 | Annotate | Revision Log
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"
55 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h" 54 #include "modules/serviceworkers/ServiceWorkerGlobalScope.h"
56 #include "modules/serviceworkers/ServiceWorkerWindowClient.h"
57 #include "modules/serviceworkers/StashedMessagePort.h" 55 #include "modules/serviceworkers/StashedMessagePort.h"
58 #include "modules/serviceworkers/StashedPortCollection.h" 56 #include "modules/serviceworkers/StashedPortCollection.h"
59 #include "modules/serviceworkers/WaitUntilObserver.h" 57 #include "modules/serviceworkers/WaitUntilObserver.h"
60 #include "platform/RuntimeEnabledFeatures.h" 58 #include "platform/RuntimeEnabledFeatures.h"
61 #include "public/platform/WebCrossOriginServiceWorkerClient.h" 59 #include "public/platform/WebCrossOriginServiceWorkerClient.h"
62 #include "public/platform/WebServiceWorkerEventResult.h" 60 #include "public/platform/WebServiceWorkerEventResult.h"
63 #include "public/platform/WebServiceWorkerRequest.h" 61 #include "public/platform/WebServiceWorkerRequest.h"
64 #include "public/platform/modules/notifications/WebNotificationData.h" 62 #include "public/platform/modules/notifications/WebNotificationData.h"
65 #include "public/web/WebSerializedScriptValue.h" 63 #include "public/web/WebSerializedScriptValue.h"
66 #include "public/web/WebServiceWorkerContextClient.h" 64 #include "public/web/WebServiceWorkerContextClient.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool defaultPrevented = false; 98 bool defaultPrevented = false;
101 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { 99 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) {
102 observer->didDispatchEvent(defaultPrevented); 100 observer->didDispatchEvent(defaultPrevented);
103 return; 101 return;
104 } 102 }
105 103
106 Request* request = Request::create(m_workerGlobalScope, webRequest); 104 Request* request = Request::create(m_workerGlobalScope, webRequest);
107 request->headers()->setGuard(Headers::ImmutableGuard); 105 request->headers()->setGuard(Headers::ImmutableGuard);
108 FetchEventInit eventInit; 106 FetchEventInit eventInit;
109 eventInit.setRequest(request); 107 eventInit.setRequest(request);
110 if (webRequest.client().clientType == WebServiceWorkerClientTypeWindow) { 108 eventInit.setIsReload(webRequest.isReload());
111 eventInit.setClient(ServiceWorkerWindowClient::create(webRequest.client( )));
112 eventInit.setIsReload(webRequest.isReload());
113 } else {
114 eventInit.setClient(ServiceWorkerClient::create(webRequest.client()));
115 }
116 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); 109 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer));
117 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ; 110 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release()) ;
118 observer->didDispatchEvent(defaultPrevented); 111 observer->didDispatchEvent(defaultPrevented);
119 } 112 }
120 113
121 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)
122 { 115 {
123 ASSERT(m_workerGlobalScope); 116 ASSERT(m_workerGlobalScope);
124 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; 117 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave;
125 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 233
241 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) 234 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client)
242 : m_embeddedWorker(embeddedWorker) 235 : m_embeddedWorker(embeddedWorker)
243 , m_document(document) 236 , m_document(document)
244 , m_client(client) 237 , m_client(client)
245 , m_workerGlobalScope(0) 238 , m_workerGlobalScope(0)
246 { 239 {
247 } 240 }
248 241
249 } // namespace blink 242 } // 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