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 BackgroundFetchManager_h | 5 #ifndef BackgroundFetchManager_h |
6 #define BackgroundFetchManager_h | 6 #define BackgroundFetchManager_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "platform/heap/GarbageCollected.h" | 10 #include "platform/heap/GarbageCollected.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
| 15 class BackgroundFetchOptions; |
| 16 class RequestOrUSVString; |
15 class ScriptState; | 17 class ScriptState; |
16 class ServiceWorkerRegistration; | 18 class ServiceWorkerRegistration; |
17 | 19 |
18 // Implementation of the BackgroundFetchManager JavaScript object, accessible | 20 // Implementation of the BackgroundFetchManager JavaScript object, accessible |
19 // by developers through ServiceWorkerRegistration.backgroundFetch. | 21 // by developers through ServiceWorkerRegistration.backgroundFetch. |
20 class BackgroundFetchManager final | 22 class BackgroundFetchManager final |
21 : public GarbageCollected<BackgroundFetchManager>, | 23 : public GarbageCollected<BackgroundFetchManager>, |
22 public ScriptWrappable { | 24 public ScriptWrappable { |
23 DEFINE_WRAPPERTYPEINFO(); | 25 DEFINE_WRAPPERTYPEINFO(); |
24 | 26 |
25 public: | 27 public: |
26 static BackgroundFetchManager* create( | 28 static BackgroundFetchManager* create( |
27 ServiceWorkerRegistration* registration) { | 29 ServiceWorkerRegistration* registration) { |
28 return new BackgroundFetchManager(registration); | 30 return new BackgroundFetchManager(registration); |
29 } | 31 } |
30 | 32 |
| 33 // Web Exposed methods defined in the IDL file. |
| 34 ScriptPromise fetch(ScriptState*, |
| 35 String tag, |
| 36 HeapVector<RequestOrUSVString> requests, |
| 37 const BackgroundFetchOptions&); |
| 38 ScriptPromise get(ScriptState*, String tag); |
31 ScriptPromise getTags(ScriptState*); | 39 ScriptPromise getTags(ScriptState*); |
32 | 40 |
33 DECLARE_TRACE(); | 41 DECLARE_TRACE(); |
34 | 42 |
35 private: | 43 private: |
36 explicit BackgroundFetchManager(ServiceWorkerRegistration*); | 44 explicit BackgroundFetchManager(ServiceWorkerRegistration*); |
37 | 45 |
38 Member<ServiceWorkerRegistration> m_registration; | 46 Member<ServiceWorkerRegistration> m_registration; |
39 }; | 47 }; |
40 | 48 |
41 } // namespace blink | 49 } // namespace blink |
42 | 50 |
43 #endif // BackgroundFetchManager_h | 51 #endif // BackgroundFetchManager_h |
OLD | NEW |