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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 ASSERT(m_workerGlobalScope); | 75 ASSERT(m_workerGlobalScope); |
76 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Activate, eventID); | 76 WaitUntilObserver* observer = WaitUntilObserver::create(m_workerGlobalScope,
WaitUntilObserver::Activate, eventID); |
77 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); | 77 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti
vate, ExtendableEventInit(), observer)); |
78 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); | 78 m_workerGlobalScope->dispatchExtendableEvent(event.release(), observer); |
79 } | 79 } |
80 | 80 |
81 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) | 81 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer
viceWorkerRequest& webRequest) |
82 { | 82 { |
83 ASSERT(m_workerGlobalScope); | 83 ASSERT(m_workerGlobalScope); |
84 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc
ope, eventID, webRequest.mode(), webRequest.frameType()); | 84 RespondWithObserver* observer = RespondWithObserver::create(m_workerGlobalSc
ope, eventID, webRequest.mode(), webRequest.frameType()); |
| 85 bool defaultPrevented = false; |
85 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { | 86 if (!RuntimeEnabledFeatures::serviceWorkerOnFetchEnabled()) { |
86 observer->didDispatchEvent(); | 87 observer->didDispatchEvent(defaultPrevented); |
87 return; | 88 return; |
88 } | 89 } |
89 | 90 |
90 Request* request = Request::create(m_workerGlobalScope, webRequest); | 91 Request* request = Request::create(m_workerGlobalScope, webRequest); |
91 request->headers()->setGuard(Headers::ImmutableGuard); | 92 request->headers()->setGuard(Headers::ImmutableGuard); |
92 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(observer, reque
st)); | 93 RefPtrWillBeRawPtr<FetchEvent> fetchEvent(FetchEvent::create(observer, reque
st)); |
93 fetchEvent->setIsReload(webRequest.isReload()); | 94 fetchEvent->setIsReload(webRequest.isReload()); |
94 m_workerGlobalScope->dispatchEvent(fetchEvent.release()); | 95 defaultPrevented = !m_workerGlobalScope->dispatchEvent(fetchEvent.release())
; |
95 observer->didDispatchEvent(); | 96 observer->didDispatchEvent(defaultPrevented); |
96 } | 97 } |
97 | 98 |
98 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) | 99 void ServiceWorkerGlobalScopeProxy::dispatchGeofencingEvent(int eventID, WebGeof
encingEventType eventType, const WebString& regionID, const WebCircularGeofencin
gRegion& region) |
99 { | 100 { |
100 ASSERT(m_workerGlobalScope); | 101 ASSERT(m_workerGlobalScope); |
101 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; | 102 const AtomicString& type = eventType == WebGeofencingEventTypeEnter ? EventT
ypeNames::geofenceenter : EventTypeNames::geofenceleave; |
102 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); | 103 m_workerGlobalScope->dispatchEvent(GeofencingEvent::create(type, regionID, C
ircularGeofencingRegion::create(regionID, region))); |
103 } | 104 } |
104 | 105 |
105 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 106 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 201 |
201 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) | 202 ServiceWorkerGlobalScopeProxy::ServiceWorkerGlobalScopeProxy(WebEmbeddedWorkerIm
pl& embeddedWorker, Document& document, WebServiceWorkerContextClient& client) |
202 : m_embeddedWorker(embeddedWorker) | 203 : m_embeddedWorker(embeddedWorker) |
203 , m_document(document) | 204 , m_document(document) |
204 , m_client(client) | 205 , m_client(client) |
205 , m_workerGlobalScope(0) | 206 , m_workerGlobalScope(0) |
206 { | 207 { |
207 } | 208 } |
208 | 209 |
209 } // namespace blink | 210 } // namespace blink |
OLD | NEW |