| 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 #ifndef RespondWithObserver_h | 5 #ifndef RespondWithObserver_h |
| 6 #define RespondWithObserver_h | 6 #define RespondWithObserver_h |
| 7 | 7 |
| 8 #include "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "core/events/EventTarget.h" | 9 #include "core/events/EventTarget.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "public/platform/WebURLRequest.h" | 12 #include "public/platform/WebURLRequest.h" |
| 13 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h" | 13 #include "public/platform/modules/serviceworker/WebServiceWorkerResponseError.h" |
| 14 | 14 |
| 15 namespace blink { | 15 namespace blink { |
| 16 | 16 |
| 17 class ExceptionState; | 17 class ExceptionState; |
| 18 class ExecutionContext; | 18 class ExecutionContext; |
| 19 class ScriptPromise; | 19 class ScriptPromise; |
| 20 class ScriptState; | 20 class ScriptState; |
| 21 class ScriptValue; | 21 class ScriptValue; |
| 22 | 22 |
| 23 // This class observes the service worker's handling of a FetchEvent and | 23 // This class observes the service worker's handling of a FetchEvent and |
| 24 // notifies the client. | 24 // notifies the client. |
| 25 class MODULES_EXPORT RespondWithObserver final : public GarbageCollectedFinalize
d<RespondWithObserver>, public ContextLifecycleObserver { | 25 class MODULES_EXPORT RespondWithObserver final : public GarbageCollectedFinalize
d<RespondWithObserver>, public ContextLifecycleObserver { |
| 26 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RespondWithObserver); | 26 USING_GARBAGE_COLLECTED_MIXIN(RespondWithObserver); |
| 27 public: | 27 public: |
| 28 static RespondWithObserver* create(ExecutionContext*, int eventID, const KUR
L& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURL
Request::RequestContext); | 28 static RespondWithObserver* create(ExecutionContext*, int eventID, const KUR
L& requestURL, WebURLRequest::FetchRequestMode, WebURLRequest::FrameType, WebURL
Request::RequestContext); |
| 29 | 29 |
| 30 void contextDestroyed() override; | 30 void contextDestroyed() override; |
| 31 | 31 |
| 32 void didDispatchEvent(DispatchEventResult dispatchResult); | 32 void didDispatchEvent(DispatchEventResult dispatchResult); |
| 33 | 33 |
| 34 // Observes the promise and delays calling didHandleFetchEvent() until the | 34 // Observes the promise and delays calling didHandleFetchEvent() until the |
| 35 // given promise is resolved or rejected. | 35 // given promise is resolved or rejected. |
| 36 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); | 36 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 51 WebURLRequest::FrameType m_frameType; | 51 WebURLRequest::FrameType m_frameType; |
| 52 WebURLRequest::RequestContext m_requestContext; | 52 WebURLRequest::RequestContext m_requestContext; |
| 53 | 53 |
| 54 enum State { Initial, Pending, Done }; | 54 enum State { Initial, Pending, Done }; |
| 55 State m_state; | 55 State m_state; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| 59 | 59 |
| 60 #endif // RespondWithObserver_h | 60 #endif // RespondWithObserver_h |
| OLD | NEW |