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 "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 "build/build_config.h" |
11 #include "content/browser/geolocation/network_location_provider.h" | 12 #include "content/browser/geolocation/network_location_provider.h" |
12 #include "content/public/browser/access_token_store.h" | 13 #include "content/public/browser/access_token_store.h" |
13 #include "content/public/browser/content_browser_client.h" | 14 #include "content/public/browser/content_browser_client.h" |
14 #include "content/public/common/content_client.h" | 15 #include "content/public/common/content_client.h" |
15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 namespace { | 19 namespace { |
19 | 20 |
20 const char* kDefaultNetworkProviderUrl = | 21 const char* kDefaultNetworkProviderUrl = |
21 "https://www.googleapis.com/geolocation/v1/geolocate"; | 22 "https://www.googleapis.com/geolocation/v1/geolocate"; |
22 } // namespace | 23 } // namespace |
23 | 24 |
24 // 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 |
25 // 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. |
26 const int64 LocationArbitratorImpl::kFixStaleTimeoutMilliseconds = | 27 const int64_t LocationArbitratorImpl::kFixStaleTimeoutMilliseconds = |
27 11 * base::Time::kMillisecondsPerSecond; | 28 11 * base::Time::kMillisecondsPerSecond; |
28 | 29 |
29 LocationArbitratorImpl::LocationArbitratorImpl( | 30 LocationArbitratorImpl::LocationArbitratorImpl( |
30 const LocationUpdateCallback& callback) | 31 const LocationUpdateCallback& callback) |
31 : arbitrator_update_callback_(callback), | 32 : arbitrator_update_callback_(callback), |
32 provider_update_callback_( | 33 provider_update_callback_( |
33 base::Bind(&LocationArbitratorImpl::OnLocationUpdate, | 34 base::Bind(&LocationArbitratorImpl::OnLocationUpdate, |
34 base::Unretained(this))), | 35 base::Unretained(this))), |
35 position_provider_(NULL), | 36 position_provider_(NULL), |
36 is_permission_granted_(false), | 37 is_permission_granted_(false), |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 206 } |
206 } | 207 } |
207 return false; | 208 return false; |
208 } | 209 } |
209 | 210 |
210 bool LocationArbitratorImpl::HasPermissionBeenGranted() const { | 211 bool LocationArbitratorImpl::HasPermissionBeenGranted() const { |
211 return is_permission_granted_; | 212 return is_permission_granted_; |
212 } | 213 } |
213 | 214 |
214 } // namespace content | 215 } // namespace content |
OLD | NEW |