OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/background_sync/background_sync_client_impl.h" | 5 #include "content/renderer/background_sync/background_sync_client_impl.h" |
6 | 6 |
| 7 #include "content/child/background_sync/background_sync_type_converters.h" |
7 #include "content/renderer/service_worker/service_worker_context_client.h" | 8 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 9 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" |
8 | 10 |
9 namespace content { | 11 namespace content { |
10 | 12 |
11 // static | 13 // static |
12 void BackgroundSyncClientImpl::Create( | 14 void BackgroundSyncClientImpl::Create( |
13 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) { | 15 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) { |
14 new BackgroundSyncClientImpl(request.Pass()); | 16 new BackgroundSyncClientImpl(request.Pass()); |
15 } | 17 } |
16 | 18 |
17 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} | 19 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} |
18 | 20 |
19 BackgroundSyncClientImpl::BackgroundSyncClientImpl( | 21 BackgroundSyncClientImpl::BackgroundSyncClientImpl( |
20 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) | 22 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) |
21 : binding_(this, request.Pass()) {} | 23 : binding_(this, request.Pass()) {} |
22 | 24 |
23 void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration, | 25 void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration, |
24 const SyncCallback& callback) { | 26 const SyncCallback& callback) { |
25 ServiceWorkerContextClient* client = | 27 ServiceWorkerContextClient* client = |
26 ServiceWorkerContextClient::ThreadSpecificInstance(); | 28 ServiceWorkerContextClient::ThreadSpecificInstance(); |
27 if (!client) { | 29 if (!client) { |
28 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); | 30 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); |
29 return; | 31 return; |
30 } | 32 } |
31 client->DispatchSyncEvent(callback); | 33 scoped_ptr<blink::WebSyncRegistration> reg = |
| 34 mojo::ConvertTo<scoped_ptr<blink::WebSyncRegistration>>(registration); |
| 35 client->DispatchSyncEvent(*reg, callback); |
32 } | 36 } |
33 | 37 |
34 } // namespace content | 38 } // namespace content |
OLD | NEW |