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