OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 BackgroundFetchedEvent_h | 5 #ifndef BackgroundFetchedEvent_h |
6 #define BackgroundFetchedEvent_h | 6 #define BackgroundFetchedEvent_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "modules/ModulesExport.h" |
9 #include "modules/background_fetch/BackgroundFetchEvent.h" | 10 #include "modules/background_fetch/BackgroundFetchEvent.h" |
10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
11 #include "public/platform/modules/background_fetch/background_fetch.mojom-blink.
h" | 12 #include "public/platform/modules/background_fetch/background_fetch.mojom-blink.
h" |
12 #include "wtf/text/AtomicString.h" | 13 #include "wtf/text/AtomicString.h" |
13 | 14 |
14 namespace blink { | 15 namespace blink { |
15 | 16 |
16 class BackgroundFetchSettledFetch; | 17 class BackgroundFetchSettledFetch; |
17 class BackgroundFetchedEventInit; | 18 class BackgroundFetchedEventInit; |
| 19 class ScriptState; |
18 class ServiceWorkerRegistration; | 20 class ServiceWorkerRegistration; |
| 21 struct WebBackgroundFetchSettledFetch; |
19 | 22 |
20 class BackgroundFetchedEvent final : public BackgroundFetchEvent { | 23 class MODULES_EXPORT BackgroundFetchedEvent final |
| 24 : public BackgroundFetchEvent { |
21 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
22 | 26 |
23 public: | 27 public: |
24 static BackgroundFetchedEvent* create( | 28 static BackgroundFetchedEvent* create( |
25 const AtomicString& type, | 29 const AtomicString& type, |
26 const BackgroundFetchedEventInit& initializer) { | 30 const BackgroundFetchedEventInit& initializer) { |
27 return new BackgroundFetchedEvent(type, initializer, | 31 return new BackgroundFetchedEvent(type, initializer); |
28 nullptr /* registration */); | |
29 } | 32 } |
30 | 33 |
31 static BackgroundFetchedEvent* create( | 34 static BackgroundFetchedEvent* create( |
32 const AtomicString& type, | 35 const AtomicString& type, |
33 const BackgroundFetchedEventInit& initializer, | 36 const BackgroundFetchedEventInit& initializer, |
| 37 const WebVector<WebBackgroundFetchSettledFetch>& fetches, |
| 38 ScriptState* scriptState, |
| 39 WaitUntilObserver* observer, |
34 ServiceWorkerRegistration* registration) { | 40 ServiceWorkerRegistration* registration) { |
35 return new BackgroundFetchedEvent(type, initializer, registration); | 41 return new BackgroundFetchedEvent(type, initializer, fetches, scriptState, |
| 42 observer, registration); |
36 } | 43 } |
37 | 44 |
38 ~BackgroundFetchedEvent() override; | 45 ~BackgroundFetchedEvent() override; |
39 | 46 |
40 // Web Exposed attribute defined in the IDL file. | 47 // Web Exposed attribute defined in the IDL file. |
41 HeapVector<Member<BackgroundFetchSettledFetch>> fetches() const; | 48 HeapVector<Member<BackgroundFetchSettledFetch>> fetches() const; |
42 | 49 |
43 // Web Exposed method defined in the IDL file. | 50 // Web Exposed method defined in the IDL file. |
44 ScriptPromise updateUI(ScriptState*, const String& title); | 51 ScriptPromise updateUI(ScriptState*, const String& title); |
45 | 52 |
46 // ExtendableEvent interface. | 53 // ExtendableEvent interface. |
47 const AtomicString& interfaceName() const override; | 54 const AtomicString& interfaceName() const override; |
48 | 55 |
49 DECLARE_VIRTUAL_TRACE(); | 56 DECLARE_VIRTUAL_TRACE(); |
50 | 57 |
51 private: | 58 private: |
52 BackgroundFetchedEvent(const AtomicString& type, | 59 BackgroundFetchedEvent(const AtomicString& type, |
53 const BackgroundFetchedEventInit&, | 60 const BackgroundFetchedEventInit&); |
54 ServiceWorkerRegistration*); | 61 BackgroundFetchedEvent( |
| 62 const AtomicString& type, |
| 63 const BackgroundFetchedEventInit&, |
| 64 const WebVector<WebBackgroundFetchSettledFetch>& fetches, |
| 65 ScriptState*, |
| 66 WaitUntilObserver*, |
| 67 ServiceWorkerRegistration*); |
55 | 68 |
56 void didUpdateUI(ScriptPromiseResolver*, mojom::blink::BackgroundFetchError); | 69 void didUpdateUI(ScriptPromiseResolver*, mojom::blink::BackgroundFetchError); |
57 | 70 |
58 HeapVector<Member<BackgroundFetchSettledFetch>> m_fetches; | 71 HeapVector<Member<BackgroundFetchSettledFetch>> m_fetches; |
59 Member<ServiceWorkerRegistration> m_registration; | 72 Member<ServiceWorkerRegistration> m_registration; |
60 }; | 73 }; |
61 | 74 |
62 } // namespace blink | 75 } // namespace blink |
63 | 76 |
64 #endif // BackgroundFetchedEvent_h | 77 #endif // BackgroundFetchedEvent_h |
OLD | NEW |