Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: chromeos/timezone/timezone_resolver.cc

Issue 1837893003: ChromeOS: Refactor TimeZoneResolver, add TimeZoneResolverManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/timezone/timezone_resolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/timezone/timezone_resolver.cc
diff --git a/chromeos/timezone/timezone_resolver.cc b/chromeos/timezone/timezone_resolver.cc
index 9e4c7b9a26b627b101db4526f2f7a607f5749bd8..c4b3e79371b3571ab4e7b505e7a5988393cb218d 100644
--- a/chromeos/timezone/timezone_resolver.cc
+++ b/chromeos/timezone/timezone_resolver.cc
@@ -118,6 +118,8 @@ class TimeZoneResolver::TimeZoneResolverImpl : public base::PowerObserver {
base::WeakPtr<TimeZoneResolver::TimeZoneResolverImpl> AsWeakPtr();
+ bool ShouldSendWiFiGeolocationData();
+
private:
const TimeZoneResolver* resolver_;
@@ -183,7 +185,7 @@ void TZRequest::StartRequestOnNetworkAvailable() {
resolver_->RecordAttempt();
resolver_->geolocation_provider()->RequestGeolocation(
base::TimeDelta::FromSeconds(kRefreshTimeZoneTimeoutSeconds),
- false /* send_wifi_geolocation_data */,
+ resolver_->ShouldSendWiFiGeolocationData(),
base::Bind(&TZRequest::OnLocationResolved, AsWeakPtr()));
}
@@ -366,27 +368,39 @@ void TimeZoneResolver::TimeZoneResolverImpl::ApplyTimeZone(
resolver_->apply_timezone().Run(timezone);
}
+bool TimeZoneResolver::TimeZoneResolverImpl::ShouldSendWiFiGeolocationData() {
+ return resolver_->ShouldSendWiFiGeolocationData();
+}
+
base::WeakPtr<TimeZoneResolver::TimeZoneResolverImpl>
TimeZoneResolver::TimeZoneResolverImpl::AsWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
// ------------------------------------------------------------------------
+// TimeZoneResolver::Delegate implementation
+TimeZoneResolver::Delegate::Delegate() {}
+TimeZoneResolver::Delegate::~Delegate() {}
+
+// ------------------------------------------------------------------------
// TimeZoneResolver implementation
TimeZoneResolver::TimeZoneResolver(
+ Delegate* delegate,
scoped_refptr<net::URLRequestContextGetter> context,
const GURL& url,
const ApplyTimeZoneCallback& apply_timezone,
const DelayNetworkCallClosure& delay_network_call,
PrefService* local_state)
- : context_(context),
+ : delegate_(delegate),
+ context_(context),
url_(url),
apply_timezone_(apply_timezone),
delay_network_call_(delay_network_call),
local_state_(local_state),
send_wifi_data_to_geolocation_api_(false) {
DCHECK(!apply_timezone.is_null());
+ DCHECK(delegate_);
}
TimeZoneResolver::~TimeZoneResolver() {
@@ -422,4 +436,8 @@ void TimeZoneResolver::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterInt64Pref(kLastTimeZoneRefreshTime, 0);
}
+bool TimeZoneResolver::ShouldSendWiFiGeolocationData() const {
+ return delegate_->ShouldSendWiFiGeolocationData();
+}
+
} // namespace chromeos
« no previous file with comments | « chromeos/timezone/timezone_resolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698