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

Side by Side Diff: content/child/background_sync/background_sync_provider.h

Issue 1104283002: [Background Sync] Add renderer code to interface between JS API and back-end service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bgsync-mojo
Patch Set: Make CallbackThreadAdapter own the wrapped callbacks Created 5 years, 7 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
(Empty)
1 // Copyright 2015 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 CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
6 #define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "content/child/worker_task_runner.h"
12 #include "content/common/background_sync_service.mojom.h"
13 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv ider.h"
14
15 namespace content {
16
17 class ServiceRegistry;
18
19 // The BackgroundSyncProvider is called by the SyncManager and SyncRegistration
20 // objects (and their Periodic counterparts) and communicates with the
21 // BackgroundSyncManager object in the browser process. This class is
22 // instantiated on the main thread by BlinkPlatformImpl, and its methods can be
23 // called directly from the main thread.
24 class BackgroundSyncProvider : public blink::WebSyncProvider {
25 public:
26 explicit BackgroundSyncProvider(ServiceRegistry* service_registry);
27
28 ~BackgroundSyncProvider() override;
29
30 // blink::WebSyncProvider implementation
31 void registerBackgroundSync(
32 const blink::WebSyncRegistration* options,
33 blink::WebServiceWorkerRegistration* service_worker_registration,
34 blink::WebSyncRegistrationCallbacks* callbacks);
35 void unregisterBackgroundSync(
36 blink::WebSyncRegistration::Periodicity periodicity,
37 int64_t id, const blink::WebString& tag,
38 blink::WebServiceWorkerRegistration* service_worker_registration,
39 blink::WebSyncUnregistrationCallbacks* callbacks);
40 void getRegistration(
41 blink::WebSyncRegistration::Periodicity,
42 const blink::WebString& tag,
43 blink::WebServiceWorkerRegistration* service_worker_registration,
44 blink::WebSyncRegistrationCallbacks* callbacks);
45 void getRegistrations(
46 blink::WebSyncRegistration::Periodicity periodicity,
47 blink::WebServiceWorkerRegistration* service_worker_registration,
48 blink::WebSyncGetRegistrationsCallbacks* callbacks);
49
50 private:
51 // Callback handlers
52 void RegisterCallback(blink::WebSyncRegistrationCallbacks* callbacks,
53 const SyncRegistrationPtr &options);
54 void UnregisterCallback(blink::WebSyncUnregistrationCallbacks* callbacks,
55 bool success);
56 void GetRegistrationsCallback(
57 blink::WebSyncGetRegistrationsCallbacks* callbacks,
58 const mojo::Array<SyncRegistrationPtr> &registrations);
59
60 // Helper method that returns an initialized BackgroundSyncServicePtr.
61 BackgroundSyncServicePtr& GetBackgroundSyncServicePtr();
62
63 ServiceRegistry* service_registry_;
64 BackgroundSyncServicePtr background_sync_service_;
65
66 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider);
67 };
68
69 } // namespace content
70
71 #endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698