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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()); | |
115 eventInit.setIsReload(webRequest.isReload()); | 114 eventInit.setIsReload(webRequest.isReload()); |
116 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames:
:fetch, eventInit, observer)); | 115 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(EventTypeNames:
:fetch, eventInit, observer)); |
117 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; | 116 defaultPrevented = !workerGlobalScope()->dispatchEvent(fetchEvent.release())
; |
118 observer->didDispatchEvent(defaultPrevented); | 117 observer->didDispatchEvent(defaultPrevented); |
119 } | 118 } |
120 | 119 |
121 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) |
122 { | 121 { |
123 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 122 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
124 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); | 123 workerGlobalScope()->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 return *m_document; | 268 return *m_document; |
270 } | 269 } |
271 | 270 |
272 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st | 271 ServiceWorkerGlobalScope* ServiceWorkerGlobalScopeProxy::workerGlobalScope() con
st |
273 { | 272 { |
274 ASSERT(m_workerGlobalScope); | 273 ASSERT(m_workerGlobalScope); |
275 return m_workerGlobalScope; | 274 return m_workerGlobalScope; |
276 } | 275 } |
277 | 276 |
278 } // namespace blink | 277 } // namespace blink |
OLD | NEW |