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(SensorConfigurationPtr configuration, |
| 29 const AddConfigurationCallback& callback) override; |
| 30 void RemoveConfiguration( |
| 31 SensorConfigurationPtr configuration, |
| 32 const RemoveConfigurationCallback& callback) override; |
| 33 |
| 34 // device::Sensor::Client implementation. |
| 35 void OnSensorReadingChanged() override; |
| 36 void OnSensorError() override; |
| 37 |
| 38 private: |
| 39 scoped_refptr<device::PlatformSensor> sensor_; |
| 40 mojo::StrongBinding<Sensor> binding_; |
| 41 SensorClientPtr client_; |
| 42 DISALLOW_COPY_AND_ASSIGN(SensorImpl); |
| 43 }; |
| 44 |
| 45 } // namespace mojom |
| 46 } // namespace device |
| 47 |
| 48 #endif // DEVICE_SENSORS_SENSOR_IMPL_H_ |
OLD | NEW |