| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ForeignFetchEvent_h | 5 #ifndef ForeignFetchEvent_h |
| 6 #define ForeignFetchEvent_h | 6 #define ForeignFetchEvent_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "modules/EventModules.h" | 9 #include "modules/EventModules.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "modules/fetch/Request.h" | 11 #include "modules/fetch/Request.h" |
| 12 #include "modules/serviceworkers/ExtendableEvent.h" | 12 #include "modules/serviceworkers/ExtendableEvent.h" |
| 13 #include "modules/serviceworkers/ForeignFetchEventInit.h" | 13 #include "modules/serviceworkers/ForeignFetchEventInit.h" |
| 14 #include "modules/serviceworkers/ForeignFetchRespondWithObserver.h" | 14 #include "modules/serviceworkers/ForeignFetchRespondWithObserver.h" |
| 15 #include "modules/serviceworkers/WaitUntilObserver.h" | 15 #include "modules/serviceworkers/WaitUntilObserver.h" |
| 16 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 class ExceptionState; | 20 class ExceptionState; |
| 21 class Request; | 21 class Request; |
| 22 | 22 |
| 23 // A foreignfetch event is dispatched by the client to a service worker's script | 23 // A foreignfetch event is dispatched by the client to a service worker's script |
| 24 // context. ForeignFetchRespondWithObserver can be used to notify the client | 24 // context. ForeignFetchRespondWithObserver can be used to notify the client |
| 25 // about the service worker's response. | 25 // about the service worker's response. |
| 26 class MODULES_EXPORT ForeignFetchEvent final : public ExtendableEvent { | 26 class MODULES_EXPORT ForeignFetchEvent final : public ExtendableEvent { |
| 27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
| 28 public: | 28 public: |
| 29 static ForeignFetchEvent* create(); | |
| 30 static ForeignFetchEvent* create(ScriptState*, const AtomicString& type, con
st ForeignFetchEventInit&); | 29 static ForeignFetchEvent* create(ScriptState*, const AtomicString& type, con
st ForeignFetchEventInit&); |
| 31 static ForeignFetchEvent* create(ScriptState*, const AtomicString& type, con
st ForeignFetchEventInit&, ForeignFetchRespondWithObserver*, WaitUntilObserver*)
; | 30 static ForeignFetchEvent* create(ScriptState*, const AtomicString& type, con
st ForeignFetchEventInit&, ForeignFetchRespondWithObserver*, WaitUntilObserver*)
; |
| 32 | 31 |
| 33 Request* request() const; | 32 Request* request() const; |
| 34 String origin() const; | 33 String origin() const; |
| 35 | 34 |
| 36 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); | 35 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); |
| 37 | 36 |
| 38 const AtomicString& interfaceName() const override; | 37 const AtomicString& interfaceName() const override; |
| 39 | 38 |
| 40 DECLARE_VIRTUAL_TRACE(); | 39 DECLARE_VIRTUAL_TRACE(); |
| 41 | 40 |
| 42 protected: | 41 protected: |
| 43 ForeignFetchEvent(); | |
| 44 ForeignFetchEvent(ScriptState*, const AtomicString& type, const ForeignFetch
EventInit&, ForeignFetchRespondWithObserver*, WaitUntilObserver*); | 42 ForeignFetchEvent(ScriptState*, const AtomicString& type, const ForeignFetch
EventInit&, ForeignFetchRespondWithObserver*, WaitUntilObserver*); |
| 45 | 43 |
| 46 private: | 44 private: |
| 47 Member<ForeignFetchRespondWithObserver> m_observer; | 45 Member<ForeignFetchRespondWithObserver> m_observer; |
| 48 Member<Request> m_request; | 46 Member<Request> m_request; |
| 49 String m_origin; | 47 String m_origin; |
| 50 }; | 48 }; |
| 51 | 49 |
| 52 } // namespace blink | 50 } // namespace blink |
| 53 | 51 |
| 54 #endif // ForeignFetchEvent_h | 52 #endif // ForeignFetchEvent_h |
| OLD | NEW |