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 #include "device/geolocation/location_arbitrator_impl.h" | 5 #include "content/browser/geolocation/location_arbitrator_impl.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "device/geolocation/access_token_store.h" | 13 #include "content/browser/geolocation/network_location_provider.h" |
14 #include "device/geolocation/geolocation_delegate.h" | 14 #include "content/public/browser/access_token_store.h" |
15 #include "device/geolocation/network_location_provider.h" | 15 #include "content/public/browser/geolocation_delegate.h" |
| 16 #include "content/public/common/content_client.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 namespace device { | 19 namespace content { |
19 namespace { | 20 namespace { |
20 | 21 |
21 const char* kDefaultNetworkProviderUrl = | 22 const char* kDefaultNetworkProviderUrl = |
22 "https://www.googleapis.com/geolocation/v1/geolocate"; | 23 "https://www.googleapis.com/geolocation/v1/geolocate"; |
23 } // namespace | 24 } // namespace |
24 | 25 |
25 // To avoid oscillations, set this to twice the expected update interval of a | 26 // To avoid oscillations, set this to twice the expected update interval of a |
26 // a GPS-type location provider (in case it misses a beat) plus a little. | 27 // a GPS-type location provider (in case it misses a beat) plus a little. |
27 const int64_t LocationArbitratorImpl::kFixStaleTimeoutMilliseconds = | 28 const int64_t LocationArbitratorImpl::kFixStaleTimeoutMilliseconds = |
28 11 * base::Time::kMillisecondsPerSecond; | 29 11 * base::Time::kMillisecondsPerSecond; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return base::WrapUnique(new NetworkLocationProvider( | 165 return base::WrapUnique(new NetworkLocationProvider( |
165 access_token_store, context, url, access_token)); | 166 access_token_store, context, url, access_token)); |
166 #endif | 167 #endif |
167 } | 168 } |
168 | 169 |
169 std::unique_ptr<LocationProvider> | 170 std::unique_ptr<LocationProvider> |
170 LocationArbitratorImpl::NewSystemLocationProvider() { | 171 LocationArbitratorImpl::NewSystemLocationProvider() { |
171 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 172 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) |
172 return nullptr; | 173 return nullptr; |
173 #else | 174 #else |
174 return device::NewSystemLocationProvider(); | 175 return content::NewSystemLocationProvider(); |
175 #endif | 176 #endif |
176 } | 177 } |
177 | 178 |
178 base::Time LocationArbitratorImpl::GetTimeNow() const { | 179 base::Time LocationArbitratorImpl::GetTimeNow() const { |
179 return base::Time::Now(); | 180 return base::Time::Now(); |
180 } | 181 } |
181 | 182 |
182 bool LocationArbitratorImpl::IsNewPositionBetter( | 183 bool LocationArbitratorImpl::IsNewPositionBetter( |
183 const Geoposition& old_position, const Geoposition& new_position, | 184 const Geoposition& old_position, const Geoposition& new_position, |
184 bool from_same_provider) const { | 185 bool from_same_provider) const { |
(...skipping 17 matching lines...) Expand all Loading... |
202 return true; | 203 return true; |
203 } | 204 } |
204 } | 205 } |
205 return false; | 206 return false; |
206 } | 207 } |
207 | 208 |
208 bool LocationArbitratorImpl::HasPermissionBeenGranted() const { | 209 bool LocationArbitratorImpl::HasPermissionBeenGranted() const { |
209 return is_permission_granted_; | 210 return is_permission_granted_; |
210 } | 211 } |
211 | 212 |
212 } // namespace device | 213 } // namespace content |
OLD | NEW |