Chromium Code Reviews| Index: blimp/engine/feature/geolocation/blimp_location_provider.h |
| diff --git a/blimp/engine/feature/geolocation/blimp_location_provider.h b/blimp/engine/feature/geolocation/blimp_location_provider.h |
| index d3d16f22a9041915f79a05dd2465a446497b9479..a13b74187d4b6a342f94ee1d1663944a3a9a4297 100644 |
| --- a/blimp/engine/feature/geolocation/blimp_location_provider.h |
| +++ b/blimp/engine/feature/geolocation/blimp_location_provider.h |
| @@ -5,6 +5,7 @@ |
| #ifndef BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ |
| #define BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ |
| +#include "base/memory/weak_ptr.h" |
| #include "content/public/browser/location_provider.h" |
| #include "content/public/common/geoposition.h" |
| @@ -14,24 +15,41 @@ namespace engine { |
| // Location provider for Blimp using the device's provider over the network. |
| class BlimpLocationProvider : public content::LocationProvider { |
| public: |
| + // A delegate that handles outgoing geolocation messages. |
| + class Delegate { |
| + public: |
| + virtual ~Delegate() {} |
| + |
| + // Implments subset of LocationProvider's functions. |
|
Wez
2016/07/14 01:19:22
typo: Implements.
CJ
2016/07/14 23:55:09
Done.
|
| + virtual void StartProvider(bool enable_high_accuracy) = 0; |
| + virtual void StopProvider() = 0; |
| + virtual void RequestRefresh() = 0; |
| + |
| + virtual void SetUpdateCallback( |
| + const base::Callback<void(const content::Geoposition&)>& callback) = 0; |
| + }; |
| + |
| BlimpLocationProvider(); |
| ~BlimpLocationProvider() override; |
| + void SetDelegate(base::WeakPtr<Delegate> delegate); |
| + |
| // content::LocationProvider implementation. |
| bool StartProvider(bool high_accuracy) override; |
| void StopProvider() override; |
| void GetPosition(content::Geoposition* position) override; |
| void RequestRefresh() override; |
| void OnPermissionGranted() override; |
| - |
| - private: |
| - void NotifyCallback(const content::Geoposition& position); |
| - void OnLocationResponse(const content::Geoposition& position); |
| void SetUpdateCallback( |
| const LocationProviderUpdateCallback& callback) override; |
| - LocationProviderUpdateCallback callback_; |
| + private: |
| + // This delegate handles a subset of the LocationProvider functionality. |
| + // The lifetime of the delegate relative to the BlimpLocationProvider |
| + // is unknown. |
| + base::WeakPtr<Delegate> delegate_; |
| + // Needed for GetPosition(), which returns a cached position immediately. |
| content::Geoposition position_; |
| DISALLOW_COPY_AND_ASSIGN(BlimpLocationProvider); |