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_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ | 5 #ifndef CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ |
6 #define CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ | 6 #define CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ |
7 | 7 |
| 8 #include "base/basictypes.h" |
8 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
9 #include "content/common/geofencing_status.h" | 10 #include "content/common/geofencing_status.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 struct WebCircularGeofencingRegion; | 13 struct WebCircularGeofencingRegion; |
13 }; | 14 }; |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 class GeofencingProvider { | 18 class GeofencingProvider { |
18 public: | 19 public: |
19 // Callback that gets called on completion of registering a new region. The | 20 typedef base::Callback<void(GeofencingStatus)> StatusCallback; |
20 // status indicates success or failure, and in case of success, an id to use | |
21 // to later unregister the region is passed as |registration_id|. If | |
22 // registration failed, providers should set |registration_id| to -1. | |
23 typedef base::Callback<void(GeofencingStatus, int registration_id)> | |
24 RegisterCallback; | |
25 | 21 |
26 virtual ~GeofencingProvider() {} | 22 virtual ~GeofencingProvider() {} |
27 | 23 |
28 // Called by |GeofencingManager| to register a new fence. GeofencingManager is | 24 // Called by |GeofencingService| to register a new fence. GeofencingService is |
29 // responsible for handling things like duplicate regions, so platform | 25 // responsible for handling things like duplicate regions, so platform |
30 // specific implementations shouldn't have to worry about things like that. | 26 // specific implementations shouldn't have to worry about things like that. |
31 // Also GeofencingManager should be making sure the total number of geofences | 27 // Also GeofencingService should be making sure the total number of geofences |
32 // that is registered with the platform specific provider does not exceed the | 28 // that is registered with the platform specific provider does not exceed the |
33 // number of regions supported by the platform, although that isn't | 29 // number of regions supported by the platform, although that isn't |
34 // implemented yet. | 30 // implemented yet. |
35 virtual void RegisterRegion(const blink::WebCircularGeofencingRegion& region, | 31 // Implementations of RegisterRegion must asynchronously call the |callback| |
36 const RegisterCallback& callback) = 0; | 32 // to indicate success or failure. |
| 33 virtual void RegisterRegion(int64 geofencing_registration_id, |
| 34 const blink::WebCircularGeofencingRegion& region, |
| 35 const StatusCallback& callback) = 0; |
37 | 36 |
38 // Called by |GeofencingManager| to unregister an existing registration. Will | 37 // Called by |GeofencingService| to unregister an existing registration. Will |
39 // only be called once for each registration. | 38 // only be called once for each registration. |
40 virtual void UnregisterRegion(int registration_id) = 0; | 39 virtual void UnregisterRegion(int64 geofencing_registration_id) = 0; |
41 }; | 40 }; |
42 | 41 |
43 } // namespace content | 42 } // namespace content |
44 | 43 |
45 #endif // CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ | 44 #endif // CONTENT_BROWSER_GEOFENCING_GEOFENCING_PROVIDER_H_ |
OLD | NEW |