Chromium Code Reviews| 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..ca3abc459598abf4f6c00886e3feaa1e28348d93 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) { |
| + callback_ = callback; |
| +} |
| + |
| void NetworkLocationProvider::OnPermissionGranted() { |
| const bool was_permission_granted = is_permission_granted_; |
| is_permission_granted_ = true; |
| @@ -167,7 +172,9 @@ void NetworkLocationProvider::OnLocationResponse( |
| } |
| // Let listeners know that we now have a position available. |
| - NotifyCallback(position_); |
| + if (!callback_.is_null()) { |
|
Michael van Ouwerkerk
2016/08/31 09:44:37
nit: no curly braces
CJ
2016/08/31 17:22:11
Done.
|
| + callback_.Run(this, position_); |
| + } |
| } |
| bool NetworkLocationProvider::StartProvider(bool high_accuracy) { |
| @@ -241,7 +248,9 @@ void NetworkLocationProvider::RequestPosition() { |
| is_new_data_available_ = false; |
| // Let listeners know that we now have a position available. |
| - NotifyCallback(position_); |
| + if (!callback_.is_null()) { |
|
Michael van Ouwerkerk
2016/08/31 09:44:37
nit: no curly braces
CJ
2016/08/31 17:22:11
Done.
|
| + callback_.Run(this, position_); |
| + } |
| return; |
| } |
| // Don't send network requests until authorized. http://crbug.com/39171 |