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

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

Issue 1597383002: Service Worker: (Re-commit) Add FetchEvent.clientId (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 11 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest) 105 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest)
106 { 106 {
107 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe quest.requestContext()); 107 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe quest.requestContext());
108 bool defaultPrevented = false; 108 bool defaultPrevented = false;
109 Request* request = Request::create(workerGlobalScope(), webRequest); 109 Request* request = Request::create(workerGlobalScope(), webRequest);
110 request->headers()->setGuard(Headers::ImmutableGuard); 110 request->headers()->setGuard(Headers::ImmutableGuard);
111 FetchEventInit eventInit; 111 FetchEventInit eventInit;
112 eventInit.setCancelable(true); 112 eventInit.setCancelable(true);
113 eventInit.setRequest(request); 113 eventInit.setRequest(request);
114 eventInit.setClientId(webRequest.isMainResourceLoad() ? WebString() : webReq uest.clientId());
114 eventInit.setIsReload(webRequest.isReload()); 115 eventInit.setIsReload(webRequest.isReload());
115 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer)); 116 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames: :fetch, eventInit, observer));
116 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release()) ; 117 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release()) ;
117 observer->didDispatchEvent(defaultPrevented); 118 observer->didDispatchEvent(defaultPrevented);
118 } 119 }
119 120
120 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region) 121 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof encingEventType eventType, const WebString& regionID, const WebCircularGeofencin gRegion& region)
121 { 122 {
122 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave; 123 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT ypeNames::geofenceenter : EventTypeNames::geofenceleave;
123 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region))); 124 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C ircularGeofencingRegion::create(regionID, region)));
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 return *m_document; 269 return *m_document;
269 } 270 }
270 271
271 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st 272 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con st
272 { 273 {
273 ASSERT(m_workerGlobalScope); 274 ASSERT(m_workerGlobalScope);
274 return m_workerGlobalScope; 275 return m_workerGlobalScope;
275 } 276 }
276 277
277 } // namespace blink 278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698