| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_DEVICE_DEVICE_SERVICE_H_ | 5 #ifndef SERVICES_DEVICE_DEVICE_SERVICE_H_ |
| 6 #define SERVICES_DEVICE_DEVICE_SERVICE_H_ | 6 #define SERVICES_DEVICE_DEVICE_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "device/battery/battery_monitor.mojom.h" | 9 #include "device/battery/battery_monitor.mojom.h" |
| 10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom.h" | 10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom.h" |
| 11 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h
" | 11 #include "device/screen_orientation/public/interfaces/screen_orientation.mojom.h
" |
| 12 #include "device/sensors/public/interfaces/light.mojom.h" | |
| 13 #include "device/sensors/public/interfaces/motion.mojom.h" | 12 #include "device/sensors/public/interfaces/motion.mojom.h" |
| 14 #include "device/sensors/public/interfaces/orientation.mojom.h" | 13 #include "device/sensors/public/interfaces/orientation.mojom.h" |
| 15 #include "device/wake_lock/public/interfaces/wake_lock_context_provider.mojom.h" | 14 #include "device/wake_lock/public/interfaces/wake_lock_context_provider.mojom.h" |
| 16 #include "device/wake_lock/wake_lock_service_context.h" | 15 #include "device/wake_lock/wake_lock_service_context.h" |
| 17 #include "mojo/public/cpp/bindings/binding_set.h" | 16 #include "mojo/public/cpp/bindings/binding_set.h" |
| 18 #include "services/device/public/interfaces/fingerprint.mojom.h" | 17 #include "services/device/public/interfaces/fingerprint.mojom.h" |
| 19 #include "services/device/public/interfaces/power_monitor.mojom.h" | 18 #include "services/device/public/interfaces/power_monitor.mojom.h" |
| 20 #include "services/device/public/interfaces/time_zone_monitor.mojom.h" | 19 #include "services/device/public/interfaces/time_zone_monitor.mojom.h" |
| 21 #include "services/device/public/interfaces/vibration_manager.mojom.h" | 20 #include "services/device/public/interfaces/vibration_manager.mojom.h" |
| 22 #include "services/service_manager/public/cpp/binder_registry.h" | 21 #include "services/service_manager/public/cpp/binder_registry.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 const WakeLockContextCallback& wake_lock_context_callback); | 39 const WakeLockContextCallback& wake_lock_context_callback); |
| 41 #else | 40 #else |
| 42 std::unique_ptr<service_manager::Service> CreateDeviceService( | 41 std::unique_ptr<service_manager::Service> CreateDeviceService( |
| 43 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, | 42 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner, |
| 44 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 43 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 45 #endif | 44 #endif |
| 46 | 45 |
| 47 class DeviceService | 46 class DeviceService |
| 48 : public service_manager::Service, | 47 : public service_manager::Service, |
| 49 public service_manager::InterfaceFactory<mojom::Fingerprint>, | 48 public service_manager::InterfaceFactory<mojom::Fingerprint>, |
| 50 public service_manager::InterfaceFactory<mojom::LightSensor>, | |
| 51 public service_manager::InterfaceFactory<mojom::MotionSensor>, | 49 public service_manager::InterfaceFactory<mojom::MotionSensor>, |
| 52 public service_manager::InterfaceFactory<mojom::OrientationSensor>, | 50 public service_manager::InterfaceFactory<mojom::OrientationSensor>, |
| 53 public service_manager::InterfaceFactory< | 51 public service_manager::InterfaceFactory< |
| 54 mojom::OrientationAbsoluteSensor>, | 52 mojom::OrientationAbsoluteSensor>, |
| 55 #if !defined(OS_ANDROID) | 53 #if !defined(OS_ANDROID) |
| 56 // On Android the Device Service provides BatteryMonitor via Java. | 54 // On Android the Device Service provides BatteryMonitor via Java. |
| 57 public service_manager::InterfaceFactory<mojom::BatteryMonitor>, | 55 public service_manager::InterfaceFactory<mojom::BatteryMonitor>, |
| 58 // On Android the Device Service provides VibrationManager via Java. | 56 // On Android the Device Service provides VibrationManager via Java. |
| 59 public service_manager::InterfaceFactory<mojom::VibrationManager>, | 57 public service_manager::InterfaceFactory<mojom::VibrationManager>, |
| 60 #endif | 58 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 79 // service_manager::Service: | 77 // service_manager::Service: |
| 80 void OnStart() override; | 78 void OnStart() override; |
| 81 void OnBindInterface(const service_manager::ServiceInfo& source_info, | 79 void OnBindInterface(const service_manager::ServiceInfo& source_info, |
| 82 const std::string& interface_name, | 80 const std::string& interface_name, |
| 83 mojo::ScopedMessagePipeHandle interface_pipe) override; | 81 mojo::ScopedMessagePipeHandle interface_pipe) override; |
| 84 | 82 |
| 85 // InterfaceFactory<mojom::Fingerprint>: | 83 // InterfaceFactory<mojom::Fingerprint>: |
| 86 void Create(const service_manager::Identity& remote_identity, | 84 void Create(const service_manager::Identity& remote_identity, |
| 87 mojom::FingerprintRequest request) override; | 85 mojom::FingerprintRequest request) override; |
| 88 | 86 |
| 89 // InterfaceFactory<mojom::LightSensor>: | |
| 90 void Create(const service_manager::Identity& remote_identity, | |
| 91 mojom::LightSensorRequest request) override; | |
| 92 | |
| 93 // InterfaceFactory<mojom::MotionSensor>: | 87 // InterfaceFactory<mojom::MotionSensor>: |
| 94 void Create(const service_manager::Identity& remote_identity, | 88 void Create(const service_manager::Identity& remote_identity, |
| 95 mojom::MotionSensorRequest request) override; | 89 mojom::MotionSensorRequest request) override; |
| 96 | 90 |
| 97 // InterfaceFactory<mojom::OrientationSensor>: | 91 // InterfaceFactory<mojom::OrientationSensor>: |
| 98 void Create(const service_manager::Identity& remote_identity, | 92 void Create(const service_manager::Identity& remote_identity, |
| 99 mojom::OrientationSensorRequest request) override; | 93 mojom::OrientationSensorRequest request) override; |
| 100 | 94 |
| 101 // InterfaceFactory<mojom::OrientationAbsolueSensor>: | 95 // InterfaceFactory<mojom::OrientationAbsolueSensor>: |
| 102 void Create(const service_manager::Identity& remote_identity, | 96 void Create(const service_manager::Identity& remote_identity, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 WakeLockContextCallback wake_lock_context_callback_; | 145 WakeLockContextCallback wake_lock_context_callback_; |
| 152 | 146 |
| 153 service_manager::BinderRegistry registry_; | 147 service_manager::BinderRegistry registry_; |
| 154 | 148 |
| 155 DISALLOW_COPY_AND_ASSIGN(DeviceService); | 149 DISALLOW_COPY_AND_ASSIGN(DeviceService); |
| 156 }; | 150 }; |
| 157 | 151 |
| 158 } // namespace device | 152 } // namespace device |
| 159 | 153 |
| 160 #endif // SERVICES_DEVICE_DEVICE_SERVICE_H_ | 154 #endif // SERVICES_DEVICE_DEVICE_SERVICE_H_ |
| OLD | NEW |