| Index: content/child/background_sync/background_sync_provider.h
|
| diff --git a/content/child/background_sync/background_sync_provider.h b/content/child/background_sync/background_sync_provider.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bd7cedd9b8a928b9036d6935a6a060c09e5fd959
|
| --- /dev/null
|
| +++ b/content/child/background_sync/background_sync_provider.h
|
| @@ -0,0 +1,71 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
|
| +#define CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "content/child/worker_task_runner.h"
|
| +#include "content/common/background_sync_service.mojom.h"
|
| +#include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProvider.h"
|
| +
|
| +namespace content {
|
| +
|
| +class ServiceRegistry;
|
| +
|
| +// The BackgroundSyncProvider is called by the SyncManager and SyncRegistration
|
| +// objects (and their Periodic counterparts) and communicates with the
|
| +// BackgroundSyncManager object in the browser process. This class is
|
| +// instantiated on the main thread by BlinkPlatformImpl, and its methods can be
|
| +// called directly from the main thread.
|
| +class BackgroundSyncProvider : public blink::WebSyncProvider {
|
| + public:
|
| + explicit BackgroundSyncProvider(ServiceRegistry* service_registry);
|
| +
|
| + ~BackgroundSyncProvider() override;
|
| +
|
| + // blink::WebSyncProvider implementation
|
| + void registerBackgroundSync(
|
| + const blink::WebSyncRegistration* options,
|
| + blink::WebServiceWorkerRegistration* service_worker_registration,
|
| + blink::WebSyncRegistrationCallbacks* callbacks);
|
| + void unregisterBackgroundSync(
|
| + blink::WebSyncRegistration::Periodicity periodicity,
|
| + int64_t id, const blink::WebString& tag,
|
| + blink::WebServiceWorkerRegistration* service_worker_registration,
|
| + blink::WebSyncUnregistrationCallbacks* callbacks);
|
| + void getRegistration(
|
| + blink::WebSyncRegistration::Periodicity,
|
| + const blink::WebString& tag,
|
| + blink::WebServiceWorkerRegistration* service_worker_registration,
|
| + blink::WebSyncRegistrationCallbacks* callbacks);
|
| + void getRegistrations(
|
| + blink::WebSyncRegistration::Periodicity periodicity,
|
| + blink::WebServiceWorkerRegistration* service_worker_registration,
|
| + blink::WebSyncGetRegistrationsCallbacks* callbacks);
|
| +
|
| + private:
|
| + // Callback handlers
|
| + void RegisterCallback(blink::WebSyncRegistrationCallbacks* callbacks,
|
| + const SyncRegistrationPtr &options);
|
| + void UnregisterCallback(blink::WebSyncUnregistrationCallbacks* callbacks,
|
| + bool success);
|
| + void GetRegistrationsCallback(
|
| + blink::WebSyncGetRegistrationsCallbacks* callbacks,
|
| + const mojo::Array<SyncRegistrationPtr> ®istrations);
|
| +
|
| + // Helper method that returns an initialized BackgroundSyncServicePtr.
|
| + BackgroundSyncServicePtr& GetBackgroundSyncServicePtr();
|
| +
|
| + ServiceRegistry* service_registry_;
|
| + BackgroundSyncServicePtr background_sync_service_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(BackgroundSyncProvider);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_CHILD_BACKGROUND_SYNC_BACKGROUND_SYNC_PROVIDER_H_
|
|
|