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.
5 #include "content/renderer/background_sync/background_sync_client_impl.h"
7 #include "content/child/background_sync/background_sync_type_converters.h"
8 #include "content/renderer/service_worker/service_worker_context_client.h"
9 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegistration.h"
14 void BackgroundSyncClientImpl::Create(
15 mojo::InterfaceRequest
<BackgroundSyncServiceClient
> request
) {
16 new BackgroundSyncClientImpl(request
.Pass());
19 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {}
21 BackgroundSyncClientImpl::BackgroundSyncClientImpl(
22 mojo::InterfaceRequest
<BackgroundSyncServiceClient
> request
)
23 : binding_(this, request
.Pass()) {}
25 void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration
,
26 const SyncCallback
& callback
) {
27 ServiceWorkerContextClient
* client
=
28 ServiceWorkerContextClient::ThreadSpecificInstance();
30 callback
.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED
);
33 scoped_ptr
<blink::WebSyncRegistration
> reg
=
34 mojo::ConvertTo
<scoped_ptr
<blink::WebSyncRegistration
>>(registration
);
35 client
->DispatchSyncEvent(*reg
, callback
);
38 } // namespace content