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 DEVICE_SENSORS_MOJO_SENSOR_IMPL_H_ |
| 6 #define DEVICE_SENSORS_MOJO_SENSOR_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "device/sensors/platform/platform_sensor.h" |
| 10 #include "device/sensors/public/interfaces/sensor.mojom.h" |
| 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 12 |
| 13 namespace device { |
| 14 |
| 15 namespace sensors { |
| 16 |
| 17 // Implementation of Sensor mojo interface. |
| 18 // Instances of this class are created by SensorFactoryImpl. |
| 19 class SensorImpl final : public Sensor, public device::PlatformSensor::Client { |
| 20 public: |
| 21 SensorImpl(mojo::InterfaceRequest<Sensor> request, |
| 22 scoped_refptr<device::PlatformSensor> sensor); |
| 23 ~SensorImpl() override; |
| 24 |
| 25 private: |
| 26 // Sensor implementation. |
| 27 void SetClient(SensorClientPtr client) override; |
| 28 void Start(SensorConfigurationPtr configuration, |
| 29 const StartCallback& callback) override; |
| 30 void Stop(SensorConfigurationPtr configuration, |
| 31 const StopCallback& callback) override; |
| 32 |
| 33 // device::Sensor::Client implementation. |
| 34 void OnSensorReadingChanged() override; |
| 35 void OnSensorError() override; |
| 36 |
| 37 private: |
| 38 scoped_refptr<device::PlatformSensor> sensor_; |
| 39 mojo::StrongBinding<Sensor> binding_; |
| 40 SensorClientPtr client_; |
| 41 DISALLOW_COPY_AND_ASSIGN(SensorImpl); |
| 42 }; |
| 43 |
| 44 } // namespace sensors |
| 45 } // namespace device |
| 46 |
| 47 #endif // DEVICE_SENSORS_MOJO_SENSOR_IMPL_H_ |
OLD | NEW |