| 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 #include "chromeos/timezone/timezone_resolver.h" | 5 #include "chromeos/timezone/timezone_resolver.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 DISALLOW_COPY_AND_ASSIGN(TZRequest); | 176 DISALLOW_COPY_AND_ASSIGN(TZRequest); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 TZRequest::~TZRequest() { | 179 TZRequest::~TZRequest() { |
| 180 } | 180 } |
| 181 | 181 |
| 182 void TZRequest::StartRequestOnNetworkAvailable() { | 182 void TZRequest::StartRequestOnNetworkAvailable() { |
| 183 resolver_->RecordAttempt(); | 183 resolver_->RecordAttempt(); |
| 184 resolver_->geolocation_provider()->RequestGeolocation( | 184 resolver_->geolocation_provider()->RequestGeolocation( |
| 185 base::TimeDelta::FromSeconds(kRefreshTimeZoneTimeoutSeconds), | 185 base::TimeDelta::FromSeconds(kRefreshTimeZoneTimeoutSeconds), |
| 186 false /* send_wifi_geolocation_data */, |
| 186 base::Bind(&TZRequest::OnLocationResolved, AsWeakPtr())); | 187 base::Bind(&TZRequest::OnLocationResolved, AsWeakPtr())); |
| 187 } | 188 } |
| 188 | 189 |
| 189 void TZRequest::Start() { | 190 void TZRequest::Start() { |
| 190 // call to chromeos::DelayNetworkCall | 191 // call to chromeos::DelayNetworkCall |
| 191 resolver_->delay_network_call().Run( | 192 resolver_->delay_network_call().Run( |
| 192 base::Bind(&TZRequest::StartRequestOnNetworkAvailable, AsWeakPtr())); | 193 base::Bind(&TZRequest::StartRequestOnNetworkAvailable, AsWeakPtr())); |
| 193 } | 194 } |
| 194 | 195 |
| 195 void TZRequest::OnLocationResolved(const Geoposition& position, | 196 void TZRequest::OnLocationResolved(const Geoposition& position, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 int TimeZoneResolver::IntervalForNextRequestForTesting(const int requests) { | 415 int TimeZoneResolver::IntervalForNextRequestForTesting(const int requests) { |
| 415 return IntervalForNextRequest(requests); | 416 return IntervalForNextRequest(requests); |
| 416 } | 417 } |
| 417 | 418 |
| 418 // static | 419 // static |
| 419 void TimeZoneResolver::RegisterPrefs(PrefRegistrySimple* registry) { | 420 void TimeZoneResolver::RegisterPrefs(PrefRegistrySimple* registry) { |
| 420 registry->RegisterInt64Pref(kLastTimeZoneRefreshTime, 0); | 421 registry->RegisterInt64Pref(kLastTimeZoneRefreshTime, 0); |
| 421 } | 422 } |
| 422 | 423 |
| 423 } // namespace chromeos | 424 } // namespace chromeos |
| OLD | NEW |