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