Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Side by Side Diff: services/device/device_service.cc

Issue 2845763002: Remove DeviceLightEvent implementation (Closed)
Patch Set: same as previous patch Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 #endif 80 #endif
81 81
82 DeviceService::~DeviceService() { 82 DeviceService::~DeviceService() {
83 #if !defined(OS_ANDROID) 83 #if !defined(OS_ANDROID)
84 device::BatteryStatusService::GetInstance()->Shutdown(); 84 device::BatteryStatusService::GetInstance()->Shutdown();
85 #endif 85 #endif
86 } 86 }
87 87
88 void DeviceService::OnStart() { 88 void DeviceService::OnStart() {
89 registry_.AddInterface<mojom::Fingerprint>(this); 89 registry_.AddInterface<mojom::Fingerprint>(this);
90 registry_.AddInterface<mojom::LightSensor>(this);
91 registry_.AddInterface<mojom::MotionSensor>(this); 90 registry_.AddInterface<mojom::MotionSensor>(this);
92 registry_.AddInterface<mojom::OrientationSensor>(this); 91 registry_.AddInterface<mojom::OrientationSensor>(this);
93 registry_.AddInterface<mojom::OrientationAbsoluteSensor>(this); 92 registry_.AddInterface<mojom::OrientationAbsoluteSensor>(this);
94 registry_.AddInterface<mojom::PowerMonitor>(this); 93 registry_.AddInterface<mojom::PowerMonitor>(this);
95 registry_.AddInterface<mojom::ScreenOrientationListener>(this); 94 registry_.AddInterface<mojom::ScreenOrientationListener>(this);
96 if (base::FeatureList::IsEnabled(features::kGenericSensor)) { 95 if (base::FeatureList::IsEnabled(features::kGenericSensor)) {
97 registry_.AddInterface<mojom::SensorProvider>(this); 96 registry_.AddInterface<mojom::SensorProvider>(this);
98 } 97 }
99 registry_.AddInterface<mojom::TimeZoneMonitor>(this); 98 registry_.AddInterface<mojom::TimeZoneMonitor>(this);
100 registry_.AddInterface<mojom::WakeLockContextProvider>(this); 99 registry_.AddInterface<mojom::WakeLockContextProvider>(this);
(...skipping 29 matching lines...) Expand all
130 VibrationManagerImpl::Create(std::move(request)); 129 VibrationManagerImpl::Create(std::move(request));
131 } 130 }
132 #endif 131 #endif
133 132
134 void DeviceService::Create(const service_manager::Identity& remote_identity, 133 void DeviceService::Create(const service_manager::Identity& remote_identity,
135 mojom::FingerprintRequest request) { 134 mojom::FingerprintRequest request) {
136 Fingerprint::Create(std::move(request)); 135 Fingerprint::Create(std::move(request));
137 } 136 }
138 137
139 void DeviceService::Create(const service_manager::Identity& remote_identity, 138 void DeviceService::Create(const service_manager::Identity& remote_identity,
140 mojom::LightSensorRequest request) {
141 #if defined(OS_ANDROID)
142 // On Android the device sensors implementations need to run on the UI thread
143 // to communicate to Java.
144 DeviceLightHost::Create(std::move(request));
145 #else
146 // On platforms other than Android the device sensors implementations run on
147 // the IO thread.
148 if (io_task_runner_) {
149 io_task_runner_->PostTask(FROM_HERE, base::Bind(&DeviceLightHost::Create,
150 base::Passed(&request)));
151 }
152 #endif // defined(OS_ANDROID)
153 }
154
155 void DeviceService::Create(const service_manager::Identity& remote_identity,
156 mojom::MotionSensorRequest request) { 139 mojom::MotionSensorRequest request) {
157 #if defined(OS_ANDROID) 140 #if defined(OS_ANDROID)
158 // On Android the device sensors implementations need to run on the UI thread 141 // On Android the device sensors implementations need to run on the UI thread
159 // to communicate to Java. 142 // to communicate to Java.
160 DeviceMotionHost::Create(std::move(request)); 143 DeviceMotionHost::Create(std::move(request));
161 #else 144 #else
162 // On platforms other than Android the device sensors implementations run on 145 // On platforms other than Android the device sensors implementations run on
163 // the IO thread. 146 // the IO thread.
164 if (io_task_runner_) { 147 if (io_task_runner_) {
165 io_task_runner_->PostTask(FROM_HERE, base::Bind(&DeviceMotionHost::Create, 148 io_task_runner_->PostTask(FROM_HERE, base::Bind(&DeviceMotionHost::Create,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 java_interface_provider_.Bind(std::move(provider)); 238 java_interface_provider_.Bind(std::move(provider));
256 239
257 java_interface_provider_initialized_ = true; 240 java_interface_provider_initialized_ = true;
258 } 241 }
259 242
260 return &java_interface_provider_; 243 return &java_interface_provider_;
261 } 244 }
262 #endif 245 #endif
263 246
264 } // namespace device 247 } // namespace device
OLDNEW
« no previous file with comments | « services/device/device_service.h ('k') | third_party/WebKit/LayoutTests/FlagExpectations/enable-blink-features=LayoutNG » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698