OLD | NEW |
---|---|
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ | 5 #ifndef BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ |
6 #define BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ | 6 #define BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ |
7 | 7 |
8 #include "content/public/browser/location_provider.h" | 8 #include "content/public/browser/location_provider.h" |
9 #include "content/public/common/geoposition.h" | 9 #include "content/public/common/geoposition.h" |
10 | 10 |
11 namespace blimp { | 11 namespace blimp { |
12 namespace engine { | 12 namespace engine { |
13 | 13 |
14 // Location provider for Blimp using the device's provider over the network. | 14 // Location provider for Blimp using the device's provider over the network. |
15 class BlimpLocationProvider : public content::LocationProvider { | 15 class BlimpLocationProvider : public content::LocationProvider { |
16 public: | 16 public: |
17 // A delegate that handles geolocation related outcoming and incoming events. | |
18 class BlimpLocationProviderDelegate { | |
Kevin M
2016/06/29 17:52:55
nit: Just "Delegate" should suffice
CJ
2016/07/11 23:21:06
Done.
| |
19 public: | |
20 virtual ~BlimpLocationProviderDelegate() {}; | |
21 | |
22 // Notifies the client that the is listening engine is listening for | |
23 // geoposition information with the given accuracy. | |
24 virtual void SendUpdateListenStateMessage(bool enable_high_accuracy) = 0; | |
Kevin M
2016/06/29 17:52:55
Remove "Send" and "Message" from these method name
CJ
2016/07/11 23:21:07
Done.
| |
25 | |
26 // Notifies the client that the engine is no longer listening for | |
27 // updates. | |
28 virtual void SendStopListenStateMessage() = 0; | |
Kevin M
2016/06/29 17:52:55
I thought we were just going to have Update, not S
CJ
2016/07/11 23:21:06
It is expressed that way in the proto, but I thoug
| |
29 | |
30 // Requests an updated geoposition from the client. | |
31 virtual void SendRequestRefreshMessage() = 0; | |
32 }; | |
33 | |
17 BlimpLocationProvider(); | 34 BlimpLocationProvider(); |
18 ~BlimpLocationProvider() override; | 35 ~BlimpLocationProvider() override; |
19 | 36 |
20 // content::LocationProvider implementation. | 37 // content::LocationProvider implementation. |
21 bool StartProvider(bool high_accuracy) override; | 38 bool StartProvider(bool high_accuracy) override; |
22 void StopProvider() override; | 39 void StopProvider() override; |
23 void GetPosition(content::Geoposition* position) override; | 40 void GetPosition(content::Geoposition* position) override; |
24 void RequestRefresh() override; | 41 void RequestRefresh() override; |
25 void OnPermissionGranted() override; | 42 void OnPermissionGranted() override; |
43 void OnLocationResponse(const content::Geoposition& position); | |
44 void SetDelegate(BlimpLocationProviderDelegate* delegate); | |
Kevin M
2016/06/29 17:52:55
These methods should be placed above the "implemen
CJ
2016/07/11 23:21:06
Done.
| |
26 | 45 |
27 private: | 46 private: |
47 BlimpLocationProviderDelegate* delegate_ = nullptr; | |
48 | |
28 void NotifyCallback(const content::Geoposition& position); | 49 void NotifyCallback(const content::Geoposition& position); |
29 void OnLocationResponse(const content::Geoposition& position); | |
30 void SetUpdateCallback( | 50 void SetUpdateCallback( |
31 const LocationProviderUpdateCallback& callback) override; | 51 const LocationProviderUpdateCallback& callback) override; |
32 | 52 |
33 LocationProviderUpdateCallback callback_; | 53 LocationProviderUpdateCallback callback_; |
34 | 54 |
35 content::Geoposition position_; | 55 content::Geoposition position_; |
36 | 56 |
37 DISALLOW_COPY_AND_ASSIGN(BlimpLocationProvider); | 57 DISALLOW_COPY_AND_ASSIGN(BlimpLocationProvider); |
38 }; | 58 }; |
39 | 59 |
40 } // namespace engine | 60 } // namespace engine |
41 } // namespace blimp | 61 } // namespace blimp |
42 | 62 |
43 #endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ | 63 #endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_BLIMP_LOCATION_PROVIDER_H_ |
OLD | NEW |