| 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 #include "services/device/device_service.h" | 5 #include "services/device/device_service.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 : file_task_runner_(std::move(file_task_runner)), | 76 : file_task_runner_(std::move(file_task_runner)), |
| 77 io_task_runner_(std::move(io_task_runner)) {} | 77 io_task_runner_(std::move(io_task_runner)) {} |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 DeviceService::~DeviceService() { | 80 DeviceService::~DeviceService() { |
| 81 #if !defined(OS_ANDROID) | 81 #if !defined(OS_ANDROID) |
| 82 device::BatteryStatusService::GetInstance()->Shutdown(); | 82 device::BatteryStatusService::GetInstance()->Shutdown(); |
| 83 #endif | 83 #endif |
| 84 } | 84 } |
| 85 | 85 |
| 86 void DeviceService::OnStart() {} | 86 void DeviceService::OnStart() { |
| 87 | 87 registry_.AddInterface<mojom::Fingerprint>(this); |
| 88 bool DeviceService::OnConnect(const service_manager::ServiceInfo& remote_info, | 88 registry_.AddInterface<mojom::LightSensor>(this); |
| 89 service_manager::InterfaceRegistry* registry) { | 89 registry_.AddInterface<mojom::MotionSensor>(this); |
| 90 registry->AddInterface<mojom::Fingerprint>(this); | 90 registry_.AddInterface<mojom::OrientationSensor>(this); |
| 91 registry->AddInterface<mojom::LightSensor>(this); | 91 registry_.AddInterface<mojom::OrientationAbsoluteSensor>(this); |
| 92 registry->AddInterface<mojom::MotionSensor>(this); | 92 registry_.AddInterface<mojom::PowerMonitor>(this); |
| 93 registry->AddInterface<mojom::OrientationSensor>(this); | 93 registry_.AddInterface<mojom::ScreenOrientationListener>(this); |
| 94 registry->AddInterface<mojom::OrientationAbsoluteSensor>(this); | 94 registry_.AddInterface<mojom::TimeZoneMonitor>(this); |
| 95 registry->AddInterface<mojom::PowerMonitor>(this); | 95 registry_.AddInterface<mojom::WakeLockContextProvider>(this); |
| 96 registry->AddInterface<mojom::ScreenOrientationListener>(this); | |
| 97 registry->AddInterface<mojom::TimeZoneMonitor>(this); | |
| 98 registry->AddInterface<mojom::WakeLockContextProvider>(this); | |
| 99 | 96 |
| 100 #if defined(OS_ANDROID) | 97 #if defined(OS_ANDROID) |
| 101 registry->AddInterface( | 98 registry_.AddInterface( |
| 102 GetJavaInterfaceProvider()->CreateInterfaceFactory<BatteryMonitor>()); | 99 GetJavaInterfaceProvider()->CreateInterfaceFactory<BatteryMonitor>()); |
| 103 registry->AddInterface( | 100 registry_.AddInterface( |
| 104 GetJavaInterfaceProvider() | 101 GetJavaInterfaceProvider() |
| 105 ->CreateInterfaceFactory<mojom::VibrationManager>()); | 102 ->CreateInterfaceFactory<mojom::VibrationManager>()); |
| 106 #else | 103 #else |
| 107 registry->AddInterface<BatteryMonitor>(this); | 104 registry_.AddInterface<BatteryMonitor>(this); |
| 108 registry->AddInterface<mojom::VibrationManager>(this); | 105 registry_.AddInterface<mojom::VibrationManager>(this); |
| 109 #endif | 106 #endif |
| 107 } |
| 110 | 108 |
| 111 return true; | 109 void DeviceService::OnBindInterface( |
| 110 const service_manager::ServiceInfo& source_info, |
| 111 const std::string& interface_name, |
| 112 mojo::ScopedMessagePipeHandle interface_pipe) { |
| 113 registry_.BindInterface(source_info.identity, interface_name, |
| 114 std::move(interface_pipe)); |
| 112 } | 115 } |
| 113 | 116 |
| 114 #if !defined(OS_ANDROID) | 117 #if !defined(OS_ANDROID) |
| 115 void DeviceService::Create(const service_manager::Identity& remote_identity, | 118 void DeviceService::Create(const service_manager::Identity& remote_identity, |
| 116 BatteryMonitorRequest request) { | 119 BatteryMonitorRequest request) { |
| 117 device::BatteryMonitorImpl::Create(std::move(request)); | 120 device::BatteryMonitorImpl::Create(std::move(request)); |
| 118 } | 121 } |
| 119 | 122 |
| 120 void DeviceService::Create(const service_manager::Identity& remote_identity, | 123 void DeviceService::Create(const service_manager::Identity& remote_identity, |
| 121 mojom::VibrationManagerRequest request) { | 124 mojom::VibrationManagerRequest request) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 java_interface_provider_.Bind(std::move(provider)); | 241 java_interface_provider_.Bind(std::move(provider)); |
| 239 | 242 |
| 240 java_interface_provider_initialized_ = true; | 243 java_interface_provider_initialized_ = true; |
| 241 } | 244 } |
| 242 | 245 |
| 243 return &java_interface_provider_; | 246 return &java_interface_provider_; |
| 244 } | 247 } |
| 245 #endif | 248 #endif |
| 246 | 249 |
| 247 } // namespace device | 250 } // namespace device |
| OLD | NEW |