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