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

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: Better scoped_ptr construction (nit) 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
« no previous file with comments | « no previous file | content/child/background_sync/background_sync_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
38 const blink::WebString& tag,
39 blink::WebServiceWorkerRegistration* service_worker_registration,
40 blink::WebSyncUnregistrationCallbacks* callbacks);
41 void getRegistration(
42 blink::WebSyncRegistration::Periodicity,
43 const blink::WebString& tag,
44 blink::WebServiceWorkerRegistration* service_worker_registration,
45 blink::WebSyncRegistrationCallbacks* callbacks);
46 void getRegistrations(
47 blink::WebSyncRegistration::Periodicity periodicity,
48 blink::WebServiceWorkerRegistration* service_worker_registration,
49 blink::WebSyncGetRegistrationsCallbacks* callbacks);
50
51 private:
52 // Callback handlers
53 void RegisterCallback(
54 scoped_ptr<blink::WebSyncRegistrationCallbacks> callbacks,
55 const SyncRegistrationPtr& options);
56 void UnregisterCallback(
57 scoped_ptr<blink::WebSyncUnregistrationCallbacks> callbacks,
58 bool success);
59 void GetRegistrationsCallback(
60 scoped_ptr<blink::WebSyncGetRegistrationsCallbacks> callbacks,
61 const mojo::Array<SyncRegistrationPtr>& registrations);
62
63 // Helper method that returns an initialized BackgroundSyncServicePtr.
64 BackgroundSyncServicePtr& GetBackgroundSyncServicePtr();
65
66 ServiceRegistry* service_registry_;
67 BackgroundSyncServicePtr background_sync_service_;
68
69 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider);
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/background_sync/background_sync_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698