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 FetchEvent_h | 5 #ifndef FetchEvent_h |
6 #define FetchEvent_h | 6 #define FetchEvent_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/FetchEventInit.h" | 13 #include "modules/serviceworkers/FetchEventInit.h" |
14 #include "modules/serviceworkers/RespondWithObserver.h" | 14 #include "modules/serviceworkers/RespondWithObserver.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 class RespondWithObserver; | 22 class RespondWithObserver; |
23 | 23 |
24 // A fetch event is dispatched by the client to a service worker's script | 24 // A fetch event is dispatched by the client to a service worker's script |
25 // context. RespondWithObserver can be used to notify the client about the | 25 // context. RespondWithObserver can be used to notify the client about the |
26 // service worker's response. | 26 // service worker's response. |
27 class MODULES_EXPORT FetchEvent final : public ExtendableEvent { | 27 class MODULES_EXPORT FetchEvent final : public ExtendableEvent { |
28 DEFINE_WRAPPERTYPEINFO(); | 28 DEFINE_WRAPPERTYPEINFO(); |
29 public: | 29 public: |
30 static FetchEvent* create(); | |
31 static FetchEvent* create(ScriptState*, const AtomicString& type, const Fetc
hEventInit&); | 30 static FetchEvent* create(ScriptState*, const AtomicString& type, const Fetc
hEventInit&); |
32 static FetchEvent* create(ScriptState*, const AtomicString& type, const Fetc
hEventInit&, RespondWithObserver*, WaitUntilObserver*); | 31 static FetchEvent* create(ScriptState*, const AtomicString& type, const Fetc
hEventInit&, RespondWithObserver*, WaitUntilObserver*); |
33 | 32 |
34 Request* request() const; | 33 Request* request() const; |
35 String clientId() const; | 34 String clientId() const; |
36 bool isReload() const; | 35 bool isReload() const; |
37 | 36 |
38 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); | 37 void respondWith(ScriptState*, ScriptPromise, ExceptionState&); |
39 | 38 |
40 const AtomicString& interfaceName() const override; | 39 const AtomicString& interfaceName() const override; |
41 | 40 |
42 DECLARE_VIRTUAL_TRACE(); | 41 DECLARE_VIRTUAL_TRACE(); |
43 | 42 |
44 protected: | 43 protected: |
45 FetchEvent(); | |
46 FetchEvent(ScriptState*, const AtomicString& type, const FetchEventInit&, Re
spondWithObserver*, WaitUntilObserver*); | 44 FetchEvent(ScriptState*, const AtomicString& type, const FetchEventInit&, Re
spondWithObserver*, WaitUntilObserver*); |
47 | 45 |
48 private: | 46 private: |
49 Member<RespondWithObserver> m_observer; | 47 Member<RespondWithObserver> m_observer; |
50 Member<Request> m_request; | 48 Member<Request> m_request; |
51 String m_clientId; | 49 String m_clientId; |
52 bool m_isReload; | 50 bool m_isReload; |
53 }; | 51 }; |
54 | 52 |
55 } // namespace blink | 53 } // namespace blink |
56 | 54 |
57 #endif // FetchEvent_h | 55 #endif // FetchEvent_h |
OLD | NEW |