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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) | 99 void ServiceWorkerGlobalScopeProxy::dispatchActivateEvent(int eventID) |
100 { | 100 { |
101 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Activate, eventID); | 101 WaitUntilObserver* observer = WaitUntilObserver::create(workerGlobalScope(), WaitUntilObserver::Activate, eventID); |
102 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti vate, ExtendableEventInit(), observer)); | 102 RefPtrWillBeRawPtr<Event> event(ExtendableEvent::create(EventTypeNames::acti vate, ExtendableEventInit(), observer)); |
103 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); | 103 workerGlobalScope()->dispatchExtendableEvent(event.release(), observer); |
104 } | 104 } |
105 | 105 |
106 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest) | 106 void ServiceWorkerGlobalScopeProxy::dispatchFetchEvent(int eventID, const WebSer viceWorkerRequest& webRequest) |
107 { | 107 { |
108 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe quest.requestContext()); | 108 RespondWithObserver* observer = RespondWithObserver::create(workerGlobalScop e(), eventID, webRequest.url(), webRequest.mode(), webRequest.frameType(), webRe quest.requestContext()); |
109 bool defaultPrevented = false; | |
110 Request* request = Request::create(workerGlobalScope(), webRequest); | 109 Request* request = Request::create(workerGlobalScope(), webRequest); |
111 request->headers()->setGuard(Headers::ImmutableGuard); | 110 request->headers()->setGuard(Headers::ImmutableGuard); |
112 FetchEventInit eventInit; | 111 FetchEventInit eventInit; |
113 eventInit.setCancelable(true); | 112 eventInit.setCancelable(true); |
114 eventInit.setRequest(request); | 113 eventInit.setRequest(request); |
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 WebInputEventResult eventResult = workerGlobalScope()->dispatchEvent(fetchEv ent.release()); |
118 observer->didDispatchEvent(defaultPrevented); | 117 observer->didDispatchEvent(eventResult != WebInputEventResult::NotHandled); |
tkent
2015/12/03 00:36:25
Can we change the argument of RespondWithObserver
dtapuska
2015/12/03 02:00:53
Done.
| |
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))); |
125 } | 124 } |
126 | 125 |
127 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) | 126 void ServiceWorkerGlobalScopeProxy::dispatchInstallEvent(int eventID) |
128 { | 127 { |
(...skipping 140 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 |