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..65601153c72d1c23eda789b41e9d67196d828711 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,23 +15,44 @@ 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 { |
|
Wez
2016/07/12 21:35:13
This interface looks exactly like the LocationProv
CJ
2016/07/13 21:49:20
Done.
|
| + public: |
| + virtual ~Delegate() {} |
| + |
| + // Notifies the client that the is listening engine is listening for |
| + // geoposition information with the given accuracy. |
| + virtual void UpdateListenState(bool enable_high_accuracy) = 0; |
| + |
| + // Notifies the client that the engine is no longer listening for |
| + // updates. |
| + virtual void StopListenState() = 0; |
|
Wez
2016/07/12 21:35:13
This name is rather confusing; what does it mean t
CJ
2016/07/13 21:49:20
It's now changed to StopListener, as per the previ
Wez
2016/07/14 01:19:21
IIUC you're arguing that this allows you to isolat
CJ
2016/07/14 23:55:08
Done.
|
| + |
| + // Requests an updated geoposition from the client. |
| + virtual void RequestRefresh() = 0; |
| + |
| + virtual void SetUpdateCallback( |
| + const base::Callback<void(const content::Geoposition&)>& callback) = 0; |
| + |
| + virtual void NotifyCallback(const content::Geoposition& position) = 0; |
|
Wez
2016/07/12 21:35:13
Why does the Delegate need a NotifyCallback() API?
CJ
2016/07/13 21:49:20
Done.
|
| + }; |
| + |
| BlimpLocationProvider(); |
| ~BlimpLocationProvider() override; |
| + void SetDelegate(base::WeakPtr<Delegate> delegate); |
|
Wez
2016/07/12 21:35:13
This needs a comment to explain what the |delegate
CJ
2016/07/13 21:49:20
Tried to explain. Please tell me if I'm off.
Wez
2016/07/14 01:19:21
nit: Looks like you can move the |delegate| parame
CJ
2016/07/14 23:55:08
Done.
|
| + |
| // 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: |
| + base::WeakPtr<Delegate> delegate_ = nullptr; |
|
Wez
2016/07/12 21:35:13
I'm surprised that this even compiles, since you'r
CJ
2016/07/13 21:49:20
Didn't know that. Removing nullptr.
|
| content::Geoposition position_; |
|
Wez
2016/07/12 21:35:13
nit: Add a comment to explain why this is required
CJ
2016/07/13 21:49:20
Done.
|