Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: third_party/WebKit/Source/modules/background_fetch/BackgroundFetchManager.h

Issue 2745243002: Implement a Mojo service for Background Fetch (Closed)
Patch Set: rebase + comments v2 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "public/platform/modules/background_fetch/background_fetch.mojom-blink. h"
12 13
13 namespace blink { 14 namespace blink {
14 15
16 class BackgroundFetchBridge;
15 class BackgroundFetchOptions; 17 class BackgroundFetchOptions;
18 class BackgroundFetchRegistration;
16 class RequestOrUSVStringOrRequestOrUSVStringSequence; 19 class RequestOrUSVStringOrRequestOrUSVStringSequence;
20 class ScriptPromiseResolver;
17 class ScriptState; 21 class ScriptState;
18 class ServiceWorkerRegistration; 22 class ServiceWorkerRegistration;
19 23
20 // Implementation of the BackgroundFetchManager JavaScript object, accessible 24 // Implementation of the BackgroundFetchManager JavaScript object, accessible
21 // by developers through ServiceWorkerRegistration.backgroundFetch. 25 // by developers through ServiceWorkerRegistration.backgroundFetch.
22 class BackgroundFetchManager final 26 class BackgroundFetchManager final
23 : public GarbageCollected<BackgroundFetchManager>, 27 : public GarbageCollected<BackgroundFetchManager>,
24 public ScriptWrappable { 28 public ScriptWrappable {
25 DEFINE_WRAPPERTYPEINFO(); 29 DEFINE_WRAPPERTYPEINFO();
26 30
27 public: 31 public:
28 static BackgroundFetchManager* create( 32 static BackgroundFetchManager* create(
29 ServiceWorkerRegistration* registration) { 33 ServiceWorkerRegistration* registration) {
30 return new BackgroundFetchManager(registration); 34 return new BackgroundFetchManager(registration);
31 } 35 }
32 36
33 // Web Exposed methods defined in the IDL file. 37 // Web Exposed methods defined in the IDL file.
34 ScriptPromise fetch( 38 ScriptPromise fetch(
35 ScriptState*, 39 ScriptState*,
36 String tag, 40 const String& tag,
37 const RequestOrUSVStringOrRequestOrUSVStringSequence& requests, 41 const RequestOrUSVStringOrRequestOrUSVStringSequence& requests,
38 const BackgroundFetchOptions&); 42 const BackgroundFetchOptions&);
39 ScriptPromise get(ScriptState*, String tag); 43 ScriptPromise get(ScriptState*, const String& tag);
40 ScriptPromise getTags(ScriptState*); 44 ScriptPromise getTags(ScriptState*);
41 45
42 DECLARE_TRACE(); 46 DECLARE_TRACE();
43 47
44 private: 48 private:
45 explicit BackgroundFetchManager(ServiceWorkerRegistration*); 49 explicit BackgroundFetchManager(ServiceWorkerRegistration*);
46 50
51 void didGetRegistration(ScriptPromiseResolver*,
52 mojom::blink::BackgroundFetchError,
53 BackgroundFetchRegistration*);
54 void didGetTags(ScriptPromiseResolver*,
55 mojom::blink::BackgroundFetchError,
56 const Vector<String>& tags);
57
47 Member<ServiceWorkerRegistration> m_registration; 58 Member<ServiceWorkerRegistration> m_registration;
59 Member<BackgroundFetchBridge> m_bridge;
48 }; 60 };
49 61
50 } // namespace blink 62 } // namespace blink
51 63
52 #endif // BackgroundFetchManager_h 64 #endif // BackgroundFetchManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698