Upstream version 11.40.271.0
[platform/framework/web/crosswalk.git] / src / content / child / geofencing / web_geofencing_provider_impl.cc
1 // Copyright 2014 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/child/geofencing/web_geofencing_provider_impl.h"
6
7 #include "content/child/geofencing/geofencing_dispatcher.h"
8 #include "content/child/thread_safe_sender.h"
9
10 namespace content {
11
12 WebGeofencingProviderImpl::WebGeofencingProviderImpl(
13     ThreadSafeSender* thread_safe_sender)
14     : thread_safe_sender_(thread_safe_sender) {
15 }
16
17 WebGeofencingProviderImpl::~WebGeofencingProviderImpl() {
18 }
19
20 void WebGeofencingProviderImpl::registerRegion(
21     const blink::WebString& regionId,
22     const blink::WebCircularGeofencingRegion& region,
23     blink::WebServiceWorkerRegistration* service_worker_registration,
24     blink::WebGeofencingCallbacks* callbacks) {
25   GetDispatcher()->RegisterRegion(
26       regionId, region, service_worker_registration, callbacks);
27 }
28
29 void WebGeofencingProviderImpl::unregisterRegion(
30     const blink::WebString& regionId,
31     blink::WebServiceWorkerRegistration* service_worker_registration,
32     blink::WebGeofencingCallbacks* callbacks) {
33   GetDispatcher()->UnregisterRegion(
34       regionId, service_worker_registration, callbacks);
35 }
36
37 void WebGeofencingProviderImpl::getRegisteredRegions(
38     blink::WebServiceWorkerRegistration* service_worker_registration,
39     blink::WebGeofencingRegionsCallbacks* callbacks) {
40   GetDispatcher()->GetRegisteredRegions(service_worker_registration, callbacks);
41 }
42
43 GeofencingDispatcher* WebGeofencingProviderImpl::GetDispatcher() {
44   return GeofencingDispatcher::GetOrCreateThreadSpecificInstance(
45       thread_safe_sender_.get());
46 }
47
48 }  // namespace content