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_SENSOR_IMPL_H_ |
| 6 #define DEVICE_SENSORS_SENSOR_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "device/sensors/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 namespace mojom { |
| 15 |
| 16 // Implementation of Sensor mojo interface. |
| 17 // Instances of this class are created by SensorProviderImpl. |
| 18 class SensorImpl final : public Sensor, public device::PlatformSensor::Client { |
| 19 public: |
| 20 SensorImpl(mojo::InterfaceRequest<Sensor> request, |
| 21 scoped_refptr<device::PlatformSensor> sensor); |
| 22 ~SensorImpl() override; |
| 23 |
| 24 SensorClientRequest GetClient(); |
| 25 |
| 26 private: |
| 27 // Sensor implementation. |
| 28 void AddConfiguration( |
| 29 const device::PlatformSensorConfiguration& configuration, |
| 30 const AddConfigurationCallback& callback) override; |
| 31 void RemoveConfiguration( |
| 32 const device::PlatformSensorConfiguration& configuration, |
| 33 const RemoveConfigurationCallback& callback) override; |
| 34 |
| 35 // device::Sensor::Client implementation. |
| 36 void OnSensorReadingChanged() override; |
| 37 void OnSensorError() override; |
| 38 |
| 39 private: |
| 40 scoped_refptr<device::PlatformSensor> sensor_; |
| 41 mojo::StrongBinding<Sensor> binding_; |
| 42 SensorClientPtr client_; |
| 43 DISALLOW_COPY_AND_ASSIGN(SensorImpl); |
| 44 }; |
| 45 |
| 46 } // namespace mojom |
| 47 } // namespace device |
| 48 |
| 49 #endif // DEVICE_SENSORS_SENSOR_IMPL_H_ |
OLD | NEW |