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

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

Issue 2850743004: Replace ServiceInfo with BindSourceInfo. (Closed)
Patch Set: . 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
« no previous file with comments | « services/device/device_service.h ('k') | services/device/device_service_test_base.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "device/battery/battery_monitor.mojom.h" 15 #include "device/battery/battery_monitor.mojom.h"
16 #include "device/battery/battery_monitor_impl.h" 16 #include "device/battery/battery_monitor_impl.h"
17 #include "device/battery/battery_status_service.h" 17 #include "device/battery/battery_status_service.h"
18 #include "device/generic_sensor/sensor_provider_impl.h" 18 #include "device/generic_sensor/sensor_provider_impl.h"
19 #include "device/sensors/device_sensor_host.h" 19 #include "device/sensors/device_sensor_host.h"
20 #include "device/wake_lock/wake_lock_context_provider.h" 20 #include "device/wake_lock/wake_lock_context_provider.h"
21 #include "mojo/public/cpp/system/message_pipe.h" 21 #include "mojo/public/cpp/system/message_pipe.h"
22 #include "services/device/fingerprint/fingerprint.h" 22 #include "services/device/fingerprint/fingerprint.h"
23 #include "services/device/power_monitor/power_monitor_message_broadcaster.h" 23 #include "services/device/power_monitor/power_monitor_message_broadcaster.h"
24 #include "services/device/public/cpp/device_features.h" 24 #include "services/device/public/cpp/device_features.h"
25 #include "services/device/time_zone_monitor/time_zone_monitor.h" 25 #include "services/device/time_zone_monitor/time_zone_monitor.h"
26 #include "services/service_manager/public/cpp/service_info.h" 26 #include "services/service_manager/public/cpp/bind_source_info.h"
27 #include "ui/gfx/native_widget_types.h" 27 #include "ui/gfx/native_widget_types.h"
28 28
29 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
30 #include "base/android/context_utils.h" 30 #include "base/android/context_utils.h"
31 #include "base/android/jni_android.h" 31 #include "base/android/jni_android.h"
32 #include "jni/InterfaceRegistrar_jni.h" 32 #include "jni/InterfaceRegistrar_jni.h"
33 #include "services/device/android/register_jni.h" 33 #include "services/device/android/register_jni.h"
34 #include "services/device/screen_orientation/screen_orientation_listener_android .h" 34 #include "services/device/screen_orientation/screen_orientation_listener_android .h"
35 #else 35 #else
36 #include "services/device/vibration/vibration_manager_impl.h" 36 #include "services/device/vibration/vibration_manager_impl.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 registry_.AddInterface( 103 registry_.AddInterface(
104 GetJavaInterfaceProvider() 104 GetJavaInterfaceProvider()
105 ->CreateInterfaceFactory<mojom::VibrationManager>()); 105 ->CreateInterfaceFactory<mojom::VibrationManager>());
106 #else 106 #else
107 registry_.AddInterface<mojom::BatteryMonitor>(this); 107 registry_.AddInterface<mojom::BatteryMonitor>(this);
108 registry_.AddInterface<mojom::VibrationManager>(this); 108 registry_.AddInterface<mojom::VibrationManager>(this);
109 #endif 109 #endif
110 } 110 }
111 111
112 void DeviceService::OnBindInterface( 112 void DeviceService::OnBindInterface(
113 const service_manager::ServiceInfo& source_info, 113 const service_manager::BindSourceInfo& source_info,
114 const std::string& interface_name, 114 const std::string& interface_name,
115 mojo::ScopedMessagePipeHandle interface_pipe) { 115 mojo::ScopedMessagePipeHandle interface_pipe) {
116 registry_.BindInterface(source_info.identity, interface_name, 116 registry_.BindInterface(source_info.identity, interface_name,
117 std::move(interface_pipe)); 117 std::move(interface_pipe));
118 } 118 }
119 119
120 #if !defined(OS_ANDROID) 120 #if !defined(OS_ANDROID)
121 void DeviceService::Create(const service_manager::Identity& remote_identity, 121 void DeviceService::Create(const service_manager::Identity& remote_identity,
122 mojom::BatteryMonitorRequest request) { 122 mojom::BatteryMonitorRequest request) {
123 BatteryMonitorImpl::Create(std::move(request)); 123 BatteryMonitorImpl::Create(std::move(request));
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 java_interface_provider_.Bind(std::move(provider)); 237 java_interface_provider_.Bind(std::move(provider));
238 238
239 java_interface_provider_initialized_ = true; 239 java_interface_provider_initialized_ = true;
240 } 240 }
241 241
242 return &java_interface_provider_; 242 return &java_interface_provider_;
243 } 243 }
244 #endif 244 #endif
245 245
246 } // namespace device 246 } // namespace device
OLDNEW
« no previous file with comments | « services/device/device_service.h ('k') | services/device/device_service_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698