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

Unified Diff: device/geolocation/network_location_provider.cc

Issue 2298013002: Gets rid of LocationProviderBase. (Closed)
Patch Set: Typo. Created 4 years, 3 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 | « device/geolocation/network_location_provider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/geolocation/network_location_provider.cc
diff --git a/device/geolocation/network_location_provider.cc b/device/geolocation/network_location_provider.cc
index 6ccdf93cd17f6e71d504b39b89073d316c2e7fec..52aec681a2022af9066b0d7cc74206b6285c36a3 100644
--- a/device/geolocation/network_location_provider.cc
+++ b/device/geolocation/network_location_provider.cc
@@ -93,7 +93,7 @@ bool NetworkLocationProvider::PositionCache::MakeKey(const WifiData& wifi_data,
}
// NetworkLocationProvider factory function
-LocationProviderBase* NewNetworkLocationProvider(
+LocationProvider* NewNetworkLocationProvider(
const scoped_refptr<AccessTokenStore>& access_token_store,
const scoped_refptr<net::URLRequestContextGetter>& context,
const GURL& url,
@@ -134,6 +134,11 @@ const Geoposition& NetworkLocationProvider::GetPosition() {
return position_;
}
+void NetworkLocationProvider::SetUpdateCallback(
+ const LocationProvider::LocationProviderUpdateCallback& callback) {
+ location_provider_update_callback_ = callback;
+}
+
void NetworkLocationProvider::OnPermissionGranted() {
const bool was_permission_granted = is_permission_granted_;
is_permission_granted_ = true;
@@ -167,7 +172,8 @@ void NetworkLocationProvider::OnLocationResponse(
}
// Let listeners know that we now have a position available.
- NotifyCallback(position_);
+ if (!location_provider_update_callback_.is_null())
+ location_provider_update_callback_.Run(this, position_);
}
bool NetworkLocationProvider::StartProvider(bool high_accuracy) {
@@ -241,7 +247,8 @@ void NetworkLocationProvider::RequestPosition() {
is_new_data_available_ = false;
// Let listeners know that we now have a position available.
- NotifyCallback(position_);
+ if (!location_provider_update_callback_.is_null())
+ location_provider_update_callback_.Run(this, position_);
return;
}
// Don't send network requests until authorized. http://crbug.com/39171
« no previous file with comments | « device/geolocation/network_location_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698