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_FACTORY_IMPL_H_ |
| 6 #define DEVICE_SENSORS_MOJO_SENSOR_FACTORY_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "device/sensors/public/interfaces/sensor_factory.mojom.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 |
| 12 namespace device { |
| 13 |
| 14 class PlatformSensorProvider; |
| 15 |
| 16 namespace sensors { |
| 17 |
| 18 // Implementation of SensorFactory mojo interface. |
| 19 // Uses PlatformSensorProvider singleton to create platform specific instances |
| 20 // of PlatformSensor which are used by SensorImpl. |
| 21 class SensorFactoryImpl final : public SensorFactory { |
| 22 public: |
| 23 static void Create(mojo::InterfaceRequest<SensorFactory> request); |
| 24 |
| 25 ~SensorFactoryImpl() override; |
| 26 |
| 27 private: |
| 28 explicit SensorFactoryImpl(mojo::InterfaceRequest<SensorFactory> request); |
| 29 |
| 30 // SensorFactory implementation. |
| 31 void CreateSensor(SensorType type, |
| 32 SensorRequest sensor_request, |
| 33 const CreateSensorCallback& callback) override; |
| 34 |
| 35 mojo::Closure connection_error_handler_; |
| 36 mojo::StrongBinding<SensorFactory> binding_; |
| 37 static PlatformSensorProvider* s_provider_; |
| 38 DISALLOW_COPY_AND_ASSIGN(SensorFactoryImpl); |
| 39 }; |
| 40 |
| 41 } // namespace sensors |
| 42 } // namespace device |
| 43 |
| 44 #endif // DEVICE_SENSORS_MOJO_SENSOR_FACTORY_IMPL_H_ |
OLD | NEW |