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

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: Updates based on recent changes to mojo definitions. 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
jkarlin 2015/05/01 16:13:51 Add a class comment here.
iclelland 2015/05/05 14:52:02 Done.
19 class BackgroundSyncProvider : public blink::WebSyncProvider,
20 public WorkerTaskRunner::Observer {
jkarlin 2015/05/01 16:13:51 Why is this a WorkerTaskRunner observer? I don't s
iclelland 2015/05/05 14:52:02 This was a holdover from the template I used; Shou
21 public:
22 explicit BackgroundSyncProvider(ServiceRegistry* service_registry);
23
24 ~BackgroundSyncProvider() override;
25
26 // blink::WebSyncProvider implementation
27 void registerBackgroundSync(
28 const blink::WebSyncRegistration* options,
29 blink::WebServiceWorkerRegistration* service_worker_registration,
30 blink::WebSyncRegistrationCallbacks* callbacks);
31 void unregisterBackgroundSync(
32 blink::WebSyncRegistration::Periodicity periodicity,
33 int64_t id, const blink::WebString& tag,
34 blink::WebServiceWorkerRegistration* service_worker_registration,
35 blink::WebSyncUnregistrationCallbacks* callbacks);
36 void getRegistration(
37 blink::WebSyncRegistration::Periodicity,
38 const blink::WebString& tag,
39 blink::WebServiceWorkerRegistration* service_worker_registration,
40 blink::WebSyncRegistrationCallbacks* callbacks);
41 void getRegistrations(
42 blink::WebSyncRegistration::Periodicity periodicity,
43 blink::WebServiceWorkerRegistration* service_worker_registration,
44 blink::WebSyncGetRegistrationsCallbacks* callbacks);
45
46 // WorkerTaskRunner::Observer implementation.
47 void OnWorkerRunLoopStopped() override;
48
49 // Entry points for Background Sync API calls from worker threads
50 void RegisterBackgroundSyncForWorker(
51 const blink::WebSyncRegistration* options,
jkarlin 2015/05/01 16:13:51 This should be a scoped_ptr.
iclelland 2015/05/07 06:03:50 Done.
52 blink::WebServiceWorkerRegistration* service_worker_registration,
53 blink::WebSyncRegistrationCallbacks* callbacks, int worker_thread_id);
54 void UnregisterBackgroundSyncForWorker(
55 blink::WebSyncRegistration::Periodicity periodicity, int64_t id,
56 const blink::WebString& tag,
57 blink::WebServiceWorkerRegistration* service_worker_registration,
58 blink::WebSyncUnregistrationCallbacks* callbacks, int worker_thread_id);
59 void GetRegistrationForWorker(
60 blink::WebSyncRegistration::Periodicity periodicity,
61 const blink::WebString& tag,
62 blink::WebServiceWorkerRegistration* service_worker_registration,
63 blink::WebSyncRegistrationCallbacks* callbacks, int worker_thread_id);
64 void GetRegistrationsForWorker(
65 blink::WebSyncRegistration::Periodicity periodicity,
66 blink::WebServiceWorkerRegistration* service_worker_registration,
67 blink::WebSyncGetRegistrationsCallbacks* callbacks, int worker_thread_id);
68
69 private:
70 // Callback handlers
71 void registerCallback(blink::WebSyncRegistrationCallbacks* callbacks,
jkarlin 2015/05/01 16:13:51 Caps: RegisterCallback
iclelland 2015/05/05 14:52:02 Done.
72 int worker_thread_id,
73 const SyncRegistrationPtr &options);
74 void unregisterCallback(blink::WebSyncUnregistrationCallbacks* callbacks,
jkarlin 2015/05/01 16:13:51 ditto
iclelland 2015/05/05 14:52:02 Done.
75 int worker_thread_id, bool success);
76 void getRegistrationsCallback(
jkarlin 2015/05/01 16:13:51 ditto
iclelland 2015/05/05 14:52:02 Done.
77 blink::WebSyncGetRegistrationsCallbacks* callbacks, int worker_thread_id,
78 const mojo::Array<SyncRegistrationPtr> &registrations);
79
80 // Helper method that returns an initialized BackgroundSyncServicePtr.
81 BackgroundSyncServicePtr& GetBackgroundSyncServicePtr();
82
83 ServiceRegistry* service_registry_;
84 BackgroundSyncServicePtr background_sync_service_;
85
86 DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider);
87 };
88
89 } // namespace content
90
91 #endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698