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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "content/child/background_sync/background_sync_provider.h" | 9 #include "content/child/background_sync/background_sync_provider.h" |
10 #include "content/child/background_sync/background_sync_type_converters.h" | 10 #include "content/child/background_sync/background_sync_type_converters.h" |
11 #include "content/renderer/service_worker/service_worker_context_client.h" | 11 #include "content/renderer/service_worker/service_worker_context_client.h" |
12 #include "third_party/WebKit/public/platform/Platform.h" | 12 #include "third_party/WebKit/public/platform/Platform.h" |
13 #include "third_party/WebKit/public/platform/WebThread.h" | 13 #include "third_party/WebKit/public/platform/WebThread.h" |
14 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv
ider.h" | 14 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncProv
ider.h" |
15 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" | 15 #include "third_party/WebKit/public/platform/modules/background_sync/WebSyncRegi
stration.h" |
16 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" | 16 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerCo
ntextProxy.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 // static | 20 // static |
21 void BackgroundSyncClientImpl::Create( | 21 void BackgroundSyncClientImpl::Create( |
22 mojo::InterfaceRequest<mojom::BackgroundSyncServiceClient> request) { | 22 mojo::InterfaceRequest<blink::mojom::BackgroundSyncServiceClient> request) { |
23 new BackgroundSyncClientImpl(std::move(request)); | 23 new BackgroundSyncClientImpl(std::move(request)); |
24 } | 24 } |
25 | 25 |
26 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} | 26 BackgroundSyncClientImpl::~BackgroundSyncClientImpl() {} |
27 | 27 |
28 BackgroundSyncClientImpl::BackgroundSyncClientImpl( | 28 BackgroundSyncClientImpl::BackgroundSyncClientImpl( |
29 mojo::InterfaceRequest<mojom::BackgroundSyncServiceClient> request) | 29 mojo::InterfaceRequest<blink::mojom::BackgroundSyncServiceClient> request) |
30 : binding_(this, std::move(request)) {} | 30 : binding_(this, std::move(request)) {} |
31 | 31 |
32 void BackgroundSyncClientImpl::Sync( | 32 void BackgroundSyncClientImpl::Sync( |
33 const mojo::String& tag, | 33 const mojo::String& tag, |
34 content::mojom::BackgroundSyncEventLastChance last_chance, | 34 blink::mojom::BackgroundSyncEventLastChance last_chance, |
35 const SyncCallback& callback) { | 35 const SyncCallback& callback) { |
36 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread()); | 36 DCHECK(!blink::Platform::current()->mainThread()->isCurrentThread()); |
37 | 37 |
38 ServiceWorkerContextClient* client = | 38 ServiceWorkerContextClient* client = |
39 ServiceWorkerContextClient::ThreadSpecificInstance(); | 39 ServiceWorkerContextClient::ThreadSpecificInstance(); |
40 if (!client) { | 40 if (!client) { |
41 callback.Run(mojom::ServiceWorkerEventStatus::ABORTED); | 41 callback.Run(blink::mojom::ServiceWorkerEventStatus::ABORTED); |
42 return; | 42 return; |
43 } | 43 } |
44 | 44 |
45 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = | 45 blink::WebServiceWorkerContextProxy::LastChanceOption web_last_chance = |
46 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( | 46 mojo::ConvertTo<blink::WebServiceWorkerContextProxy::LastChanceOption>( |
47 last_chance); | 47 last_chance); |
48 | 48 |
49 client->DispatchSyncEvent(tag, web_last_chance, callback); | 49 client->DispatchSyncEvent(tag, web_last_chance, callback); |
50 } | 50 } |
51 | 51 |
52 } // namespace content | 52 } // namespace content |
OLD | NEW |