OLD | NEW |
(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 #include "content/renderer/background_sync/background_sync_client_impl.h" |
| 6 |
| 7 #include "content/renderer/service_worker/service_worker_context_client.h" |
| 8 |
| 9 namespace content { |
| 10 |
| 11 // static |
| 12 void BackgroundSyncClientImpl::Create( |
| 13 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) { |
| 14 new BackgroundSyncClientImpl(request.Pass()); |
| 15 } |
| 16 |
| 17 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} |
| 18 |
| 19 BackgroundSyncClientImpl::BackgroundSyncClientImpl( |
| 20 mojo::InterfaceRequest<BackgroundSyncServiceClient> request) |
| 21 : binding_(this, request.Pass()) {} |
| 22 |
| 23 void BackgroundSyncClientImpl::Sync(content::SyncRegistrationPtr registration, |
| 24 const SyncCallback& callback) { |
| 25 ServiceWorkerContextClient* client = |
| 26 ServiceWorkerContextClient::ThreadSpecificInstance(); |
| 27 if (!client) { |
| 28 callback.Run(SERVICE_WORKER_EVENT_STATUS_ABORTED); |
| 29 return; |
| 30 } |
| 31 client->DispatchSyncEvent(callback); |
| 32 } |
| 33 |
| 34 } // namespace content |
OLD | NEW |