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