OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 #include "modules/serviceworkers/RespondWithObserver.h" | 6 #include "modules/serviceworkers/RespondWithObserver.h" |
7 | 7 |
8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
10 #include "bindings/core/v8/ScriptValue.h" | 10 #include "bindings/core/v8/ScriptValue.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 { | 139 { |
140 return new RespondWithObserver(context, eventID, requestURL, requestMode, fr
ameType, requestContext); | 140 return new RespondWithObserver(context, eventID, requestURL, requestMode, fr
ameType, requestContext); |
141 } | 141 } |
142 | 142 |
143 void RespondWithObserver::contextDestroyed() | 143 void RespondWithObserver::contextDestroyed() |
144 { | 144 { |
145 ContextLifecycleObserver::contextDestroyed(); | 145 ContextLifecycleObserver::contextDestroyed(); |
146 m_state = Done; | 146 m_state = Done; |
147 } | 147 } |
148 | 148 |
149 void RespondWithObserver::didDispatchEvent(bool defaultPrevented) | 149 void RespondWithObserver::didDispatchEvent(WebInputEventResult dispatchResult) |
150 { | 150 { |
151 ASSERT(executionContext()); | 151 ASSERT(executionContext()); |
152 if (m_state != Initial) | 152 if (m_state != Initial) |
153 return; | 153 return; |
154 | 154 |
155 if (defaultPrevented) { | 155 if (dispatchResult != WebInputEventResult::NotHandled) { |
156 responseWasRejected(WebServiceWorkerResponseErrorDefaultPrevented); | 156 responseWasRejected(WebServiceWorkerResponseErrorDefaultPrevented); |
157 return; | 157 return; |
158 } | 158 } |
159 | 159 |
160 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven
t(m_eventID); | 160 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven
t(m_eventID); |
161 m_state = Done; | 161 m_state = Done; |
162 } | 162 } |
163 | 163 |
164 void RespondWithObserver::respondWith(ScriptState* scriptState, ScriptPromise sc
riptPromise, ExceptionState& exceptionState) | 164 void RespondWithObserver::respondWith(ScriptState* scriptState, ScriptPromise sc
riptPromise, ExceptionState& exceptionState) |
165 { | 165 { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 , m_state(Initial) | 261 , m_state(Initial) |
262 { | 262 { |
263 } | 263 } |
264 | 264 |
265 DEFINE_TRACE(RespondWithObserver) | 265 DEFINE_TRACE(RespondWithObserver) |
266 { | 266 { |
267 ContextLifecycleObserver::trace(visitor); | 267 ContextLifecycleObserver::trace(visitor); |
268 } | 268 } |
269 | 269 |
270 } // namespace blink | 270 } // namespace blink |
OLD | NEW |