| Index: device/geolocation/network_location_provider.h
|
| diff --git a/device/geolocation/network_location_provider.h b/device/geolocation/network_location_provider.h
|
| index dc3fb217f7f02ee2cea4df46e978b68cb2b936ac..634da9a966586d9da773fdab28217e6163525bce 100644
|
| --- a/device/geolocation/network_location_provider.h
|
| +++ b/device/geolocation/network_location_provider.h
|
| @@ -15,8 +15,8 @@
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/strings/string16.h"
|
| -#include "base/threading/non_thread_safe.h"
|
| #include "base/threading/thread.h"
|
| +#include "base/threading/thread_checker.h"
|
| #include "device/geolocation/geolocation_export.h"
|
| #include "device/geolocation/geoposition.h"
|
| #include "device/geolocation/location_provider.h"
|
| @@ -26,8 +26,7 @@
|
| namespace device {
|
| class AccessTokenStore;
|
|
|
| -class NetworkLocationProvider : public base::NonThreadSafe,
|
| - public LocationProvider {
|
| +class NetworkLocationProvider : public LocationProvider {
|
| public:
|
| // Cache of recently resolved locations. Public for tests.
|
| class DEVICE_GEOLOCATION_EXPORT PositionCache {
|
| @@ -71,23 +70,20 @@ class NetworkLocationProvider : public base::NonThreadSafe,
|
| ~NetworkLocationProvider() override;
|
|
|
| // LocationProvider implementation
|
| - void SetUpdateCallback(
|
| - const LocationProviderUpdateCallback& callback) override;
|
| + void SetUpdateCallback(const LocationProviderUpdateCallback& cb) override;
|
| bool StartProvider(bool high_accuracy) override;
|
| void StopProvider() override;
|
| const Geoposition& GetPosition() override;
|
| void OnPermissionGranted() override;
|
|
|
| private:
|
| - // Satisfies a position request from cache or network.
|
| + // Tries to update |position_| request from cache or network.
|
| void RequestPosition();
|
|
|
| - // Gets called when new wifi data is available.
|
| + // Gets called when new wifi data is available, either via explicit request to
|
| + // or callback from |wifi_data_provider_manager_|.
|
| void OnWifiDataUpdate();
|
|
|
| - // Internal helper used by OnWifiDataUpdate.
|
| - void OnWifiDataUpdated();
|
| -
|
| bool IsStarted() const;
|
|
|
| void OnLocationResponse(const Geoposition& position,
|
| @@ -97,7 +93,8 @@ class NetworkLocationProvider : public base::NonThreadSafe,
|
|
|
| const scoped_refptr<AccessTokenStore> access_token_store_;
|
|
|
| - // The wifi data provider, acquired via global factories.
|
| + // The wifi data provider, acquired via global factories. Valid between
|
| + // StartProvider() and StopProvider(), and checked via IsStarted().
|
| WifiDataProviderManager* wifi_data_provider_manager_;
|
|
|
| WifiDataProviderManager::WifiDataUpdateCallback wifi_data_update_callback_;
|
| @@ -125,11 +122,13 @@ class NetworkLocationProvider : public base::NonThreadSafe,
|
| bool is_new_data_available_;
|
|
|
| // The network location request object, and the url it uses.
|
| - std::unique_ptr<NetworkLocationRequest> request_;
|
| + const std::unique_ptr<NetworkLocationRequest> request_;
|
|
|
| // The cache of positions.
|
| const std::unique_ptr<PositionCache> position_cache_;
|
|
|
| + base::ThreadChecker thread_checker_;
|
| +
|
| base::WeakPtrFactory<NetworkLocationProvider> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(NetworkLocationProvider);
|
|
|