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

Unified Diff: services/device/device_service.cc

Issue 2698083007: Port device_generic_sensor to be hosted in Device Service. (Closed)
Patch Set: Port device_generic_sensor to be hosted in Device Service. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: services/device/device_service.cc
diff --git a/services/device/device_service.cc b/services/device/device_service.cc
index a0aae54d745cd30b2806cbdb39077f33085415c2..3be0b425a935f688bee326ec8949b13de55d2c4a 100644
--- a/services/device/device_service.cc
+++ b/services/device/device_service.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "base/bind.h"
+#include "base/feature_list.h"
#include "base/memory/ptr_util.h"
#include "base/memory/weak_ptr.h"
#include "base/single_thread_task_runner.h"
@@ -14,11 +15,13 @@
#include "device/battery/battery_monitor.mojom.h"
#include "device/battery/battery_monitor_impl.h"
#include "device/battery/battery_status_service.h"
+#include "device/generic_sensor/sensor_provider_impl.h"
#include "device/sensors/device_sensor_host.h"
#include "device/wake_lock/wake_lock_context_provider.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "services/device/fingerprint/fingerprint.h"
#include "services/device/power_monitor/power_monitor_message_broadcaster.h"
+#include "services/device/public/cpp/device_features.h"
#include "services/device/time_zone_monitor/time_zone_monitor.h"
#include "services/service_manager/public/cpp/connection.h"
#include "services/service_manager/public/cpp/interface_registry.h"
@@ -94,6 +97,9 @@ bool DeviceService::OnConnect(const service_manager::ServiceInfo& remote_info,
registry->AddInterface<mojom::OrientationAbsoluteSensor>(this);
registry->AddInterface<mojom::PowerMonitor>(this);
registry->AddInterface<mojom::ScreenOrientationListener>(this);
+ if (base::FeatureList::IsEnabled(features::kGenericSensor)) {
+ registry->AddInterface<mojom::SensorProvider>(this);
+ }
registry->AddInterface<mojom::TimeZoneMonitor>(this);
registry->AddInterface<mojom::WakeLockContextProvider>(this);
@@ -215,6 +221,15 @@ void DeviceService::Create(const service_manager::Identity& remote_identity,
}
void DeviceService::Create(const service_manager::Identity& remote_identity,
+ mojom::SensorProviderRequest request) {
+ if (io_task_runner_) {
+ io_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&device::SensorProviderImpl::Create,
+ file_task_runner_, base::Passed(&request)));
+ }
+}
+
+void DeviceService::Create(const service_manager::Identity& remote_identity,
mojom::TimeZoneMonitorRequest request) {
if (!time_zone_monitor_)
time_zone_monitor_ = TimeZoneMonitor::Create(file_task_runner_);

Powered by Google App Engine
This is Rietveld 408576698