OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ | 5 #ifndef DEVICE_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ |
6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ | 6 #define DEVICE_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "content/browser/geolocation/location_arbitrator.h" | 17 #include "device/geolocation/access_token_store.h" |
18 #include "content/common/content_export.h" | 18 #include "device/geolocation/geolocation_export.h" |
19 #include "content/public/browser/access_token_store.h" | 19 #include "device/geolocation/geolocation_provider.h" |
20 #include "content/public/browser/geolocation_provider.h" | 20 #include "device/geolocation/geoposition.h" |
21 #include "content/public/browser/location_provider.h" | 21 #include "device/geolocation/location_arbitrator.h" |
22 #include "content/public/common/geoposition.h" | 22 #include "device/geolocation/location_provider.h" |
23 #include "net/url_request/url_request_context_getter.h" | 23 #include "net/url_request/url_request_context_getter.h" |
24 | 24 |
25 namespace net { | 25 namespace net { |
26 class URLRequestContextGetter; | 26 class URLRequestContextGetter; |
27 } | 27 } |
28 | 28 |
29 namespace content { | 29 namespace device { |
30 class AccessTokenStore; | 30 class AccessTokenStore; |
31 class GeolocationDelegate; | 31 class GeolocationDelegate; |
32 class LocationProvider; | 32 class LocationProvider; |
33 | 33 |
34 // This class is responsible for handling updates from multiple underlying | 34 // This class is responsible for handling updates from multiple underlying |
35 // providers and resolving them to a single 'best' location fix at any given | 35 // providers and resolving them to a single 'best' location fix at any given |
36 // moment. | 36 // moment. |
37 class CONTENT_EXPORT LocationArbitratorImpl : public LocationArbitrator { | 37 class DEVICE_GEOLOCATION_EXPORT LocationArbitratorImpl |
| 38 : public LocationArbitrator { |
38 public: | 39 public: |
39 // Number of milliseconds newer a location provider has to be that it's worth | 40 // Number of milliseconds newer a location provider has to be that it's worth |
40 // switching to this location provider on the basis of it being fresher | 41 // switching to this location provider on the basis of it being fresher |
41 // (regardles of relative accuracy). Public for tests. | 42 // (regardles of relative accuracy). Public for tests. |
42 static const int64_t kFixStaleTimeoutMilliseconds; | 43 static const int64_t kFixStaleTimeoutMilliseconds; |
43 | 44 |
44 typedef base::Callback<void(const Geoposition&)> LocationUpdateCallback; | 45 typedef base::Callback<void(const Geoposition&)> LocationUpdateCallback; |
45 | 46 |
46 LocationArbitratorImpl(const LocationUpdateCallback& callback, | 47 LocationArbitratorImpl(const LocationUpdateCallback& callback, |
47 GeolocationDelegate* delegate); | 48 GeolocationDelegate* delegate); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // Tracks whether providers should be running. | 117 // Tracks whether providers should be running. |
117 bool is_running_; | 118 bool is_running_; |
118 | 119 |
119 DISALLOW_COPY_AND_ASSIGN(LocationArbitratorImpl); | 120 DISALLOW_COPY_AND_ASSIGN(LocationArbitratorImpl); |
120 }; | 121 }; |
121 | 122 |
122 // Factory functions for the various types of location provider to abstract | 123 // Factory functions for the various types of location provider to abstract |
123 // over the platform-dependent implementations. | 124 // over the platform-dependent implementations. |
124 std::unique_ptr<LocationProvider> NewSystemLocationProvider(); | 125 std::unique_ptr<LocationProvider> NewSystemLocationProvider(); |
125 | 126 |
126 } // namespace content | 127 } // namespace device |
127 | 128 |
128 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ | 129 #endif // DEVICE_GEOLOCATION_LOCATION_ARBITRATOR_IMPL_H_ |
OLD | NEW |