OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 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_ENGINE_GEOLOCATION_FEATURE_H_ | 5 #ifndef BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_ |
6 #define BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_ | 6 #define BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "blimp/engine/feature/geolocation/blimp_location_provider.h" | 11 #include "blimp/engine/feature/geolocation/blimp_location_provider.h" |
12 #include "blimp/net/blimp_message_processor.h" | 12 #include "blimp/net/blimp_message_processor.h" |
13 #include "content/public/browser/geolocation_delegate.h" | 13 |
14 #include "content/public/browser/location_provider.h" | 14 namespace device { |
15 #include "content/public/common/geoposition.h" | 15 class GeolocationDelegate; |
| 16 struct Geoposition; |
| 17 } |
16 | 18 |
17 namespace blimp { | 19 namespace blimp { |
18 namespace engine { | 20 namespace engine { |
19 | 21 |
20 // Handles all incoming and outgoing protobuf messages types tied to | 22 // Handles all incoming and outgoing protobuf messages types tied to |
21 // geolocation. | 23 // geolocation. |
22 class EngineGeolocationFeature : public BlimpMessageProcessor, | 24 class EngineGeolocationFeature : public BlimpMessageProcessor, |
23 public BlimpLocationProvider::Delegate { | 25 public BlimpLocationProvider::Delegate { |
24 public: | 26 public: |
25 EngineGeolocationFeature(); | 27 EngineGeolocationFeature(); |
26 ~EngineGeolocationFeature() override; | 28 ~EngineGeolocationFeature() override; |
27 | 29 |
28 void set_outgoing_message_processor( | 30 void set_outgoing_message_processor( |
29 std::unique_ptr<BlimpMessageProcessor> message_processor); | 31 std::unique_ptr<BlimpMessageProcessor> message_processor); |
30 | 32 |
31 content::GeolocationDelegate* CreateGeolocationDelegate(); | 33 device::GeolocationDelegate* CreateGeolocationDelegate(); |
32 | 34 |
33 // BlimpMessageProcessor implementation. | 35 // BlimpMessageProcessor implementation. |
34 void ProcessMessage(std::unique_ptr<BlimpMessage> message, | 36 void ProcessMessage(std::unique_ptr<BlimpMessage> message, |
35 const net::CompletionCallback& callback) override; | 37 const net::CompletionCallback& callback) override; |
36 | 38 |
37 private: | 39 private: |
38 void NotifyCallback(const content::Geoposition& position); | 40 void NotifyCallback(const device::Geoposition& position); |
39 | 41 |
40 // BlimpLocationProvider::Delegate implementation. | 42 // BlimpLocationProvider::Delegate implementation. |
41 void RequestAccuracy( | 43 void RequestAccuracy( |
42 GeolocationSetInterestLevelMessage::Level level) override; | 44 GeolocationSetInterestLevelMessage::Level level) override; |
43 void RequestRefresh() override; | 45 void RequestRefresh() override; |
44 void SetUpdateCallback(const GeopositionReceivedCallback& callback) override; | 46 void SetUpdateCallback(const GeopositionReceivedCallback& callback) override; |
45 | 47 |
46 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; | 48 std::unique_ptr<BlimpMessageProcessor> outgoing_message_processor_; |
47 GeopositionReceivedCallback geoposition_received_callback_; | 49 GeopositionReceivedCallback geoposition_received_callback_; |
48 base::WeakPtrFactory<EngineGeolocationFeature> weak_factory_; | 50 base::WeakPtrFactory<EngineGeolocationFeature> weak_factory_; |
49 | 51 |
50 DISALLOW_COPY_AND_ASSIGN(EngineGeolocationFeature); | 52 DISALLOW_COPY_AND_ASSIGN(EngineGeolocationFeature); |
51 }; | 53 }; |
52 | 54 |
53 } // namespace engine | 55 } // namespace engine |
54 } // namespace blimp | 56 } // namespace blimp |
55 | 57 |
56 #endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_ | 58 #endif // BLIMP_ENGINE_FEATURE_GEOLOCATION_ENGINE_GEOLOCATION_FEATURE_H_ |
OLD | NEW |