OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CONTENT_CHILD_GEOFENCING_WEB_GEOFENCING_PROVIDER_IMPL_H_ | 5 #ifndef CONTENT_CHILD_GEOFENCING_WEB_GEOFENCING_PROVIDER_IMPL_H_ |
6 #define CONTENT_CHILD_GEOFENCING_WEB_GEOFENCING_PROVIDER_IMPL_H_ | 6 #define CONTENT_CHILD_GEOFENCING_WEB_GEOFENCING_PROVIDER_IMPL_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" |
10 #include "third_party/WebKit/public/platform/WebGeofencingProvider.h" | 11 #include "third_party/WebKit/public/platform/WebGeofencingProvider.h" |
11 | 12 |
12 namespace content { | 13 namespace content { |
13 class GeofencingDispatcher; | 14 class GeofencingDispatcher; |
14 class ThreadSafeSender; | 15 class ThreadSafeSender; |
15 | 16 |
16 class WebGeofencingProviderImpl | 17 class CONTENT_EXPORT WebGeofencingProviderImpl |
17 : NON_EXPORTED_BASE(public blink::WebGeofencingProvider) { | 18 : NON_EXPORTED_BASE(public blink::WebGeofencingProvider) { |
18 public: | 19 public: |
19 explicit WebGeofencingProviderImpl(ThreadSafeSender* thread_safe_sender); | 20 explicit WebGeofencingProviderImpl(ThreadSafeSender* thread_safe_sender); |
20 virtual ~WebGeofencingProviderImpl(); | 21 virtual ~WebGeofencingProviderImpl(); |
21 | 22 |
| 23 // Enables mock geofencing service. |service_available| indicates if the |
| 24 // mock service should mock geofencing being available or not. |
| 25 void SetMockProvider(bool service_available); |
| 26 // Disables mock geofencing service. |
| 27 void ClearMockProvider(); |
| 28 // Set the mock geofencing position. |
| 29 void SetMockPosition(double latitude, double longitude); |
| 30 |
22 private: | 31 private: |
23 // WebGeofencingProvider implementation. | 32 // WebGeofencingProvider implementation. |
24 virtual void registerRegion( | 33 virtual void registerRegion( |
25 const blink::WebString& regionId, | 34 const blink::WebString& regionId, |
26 const blink::WebCircularGeofencingRegion& region, | 35 const blink::WebCircularGeofencingRegion& region, |
27 blink::WebServiceWorkerRegistration* service_worker_registration, | 36 blink::WebServiceWorkerRegistration* service_worker_registration, |
28 blink::WebGeofencingCallbacks* callbacks); | 37 blink::WebGeofencingCallbacks* callbacks); |
29 virtual void unregisterRegion( | 38 virtual void unregisterRegion( |
30 const blink::WebString& regionId, | 39 const blink::WebString& regionId, |
31 blink::WebServiceWorkerRegistration* service_worker_registration, | 40 blink::WebServiceWorkerRegistration* service_worker_registration, |
32 blink::WebGeofencingCallbacks* callbacks); | 41 blink::WebGeofencingCallbacks* callbacks); |
33 virtual void getRegisteredRegions( | 42 virtual void getRegisteredRegions( |
34 blink::WebServiceWorkerRegistration* service_worker_registration, | 43 blink::WebServiceWorkerRegistration* service_worker_registration, |
35 blink::WebGeofencingRegionsCallbacks* callbacks); | 44 blink::WebGeofencingRegionsCallbacks* callbacks); |
36 | 45 |
37 GeofencingDispatcher* GetDispatcher(); | 46 GeofencingDispatcher* GetDispatcher(); |
38 | 47 |
39 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 48 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
40 | 49 |
41 DISALLOW_COPY_AND_ASSIGN(WebGeofencingProviderImpl); | 50 DISALLOW_COPY_AND_ASSIGN(WebGeofencingProviderImpl); |
42 }; | 51 }; |
43 | 52 |
44 } // namespace content | 53 } // namespace content |
45 | 54 |
46 #endif // CONTENT_CHILD_GEOFENCING_WEB_GEOFENCING_PROVIDER_IMPL_H_ | 55 #endif // CONTENT_CHILD_GEOFENCING_WEB_GEOFENCING_PROVIDER_IMPL_H_ |
OLD | NEW |