OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/events/ozone/evdev/input_device_factory_evdev.h" | 5 #include "ui/events/ozone/evdev/input_device_factory_evdev.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <linux/input.h> | 8 #include <linux/input.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <utility> |
10 | 11 |
11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
12 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
13 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
14 #include "base/time/time.h" | 15 #include "base/time/time.h" |
15 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
16 #include "ui/events/devices/device_data_manager.h" | 17 #include "ui/events/devices/device_data_manager.h" |
17 #include "ui/events/devices/device_util_linux.h" | 18 #include "ui/events/devices/device_util_linux.h" |
18 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 19 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
19 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" | 20 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 return make_scoped_ptr(new EventReaderLibevdevCros( | 97 return make_scoped_ptr(new EventReaderLibevdevCros( |
97 fd, params.path, params.id, devinfo, gesture_interp.Pass())); | 98 fd, params.path, params.id, devinfo, gesture_interp.Pass())); |
98 } | 99 } |
99 #endif | 100 #endif |
100 | 101 |
101 // Touchscreen: use TouchEventConverterEvdev. | 102 // Touchscreen: use TouchEventConverterEvdev. |
102 if (devinfo.HasTouchscreen()) { | 103 if (devinfo.HasTouchscreen()) { |
103 scoped_ptr<TouchEventConverterEvdev> converter(new TouchEventConverterEvdev( | 104 scoped_ptr<TouchEventConverterEvdev> converter(new TouchEventConverterEvdev( |
104 fd, params.path, params.id, devinfo, params.dispatcher)); | 105 fd, params.path, params.id, devinfo, params.dispatcher)); |
105 converter->Initialize(devinfo); | 106 converter->Initialize(devinfo); |
106 return converter.Pass(); | 107 return std::move(converter); |
107 } | 108 } |
108 | 109 |
109 // Graphics tablet | 110 // Graphics tablet |
110 if (devinfo.HasTablet()) | 111 if (devinfo.HasTablet()) |
111 return make_scoped_ptr<EventConverterEvdev>(new TabletEventConverterEvdev( | 112 return make_scoped_ptr<EventConverterEvdev>(new TabletEventConverterEvdev( |
112 fd, params.path, params.id, params.cursor, devinfo, params.dispatcher)); | 113 fd, params.path, params.id, params.cursor, devinfo, params.dispatcher)); |
113 | 114 |
114 // Everything else: use EventConverterEvdevImpl. | 115 // Everything else: use EventConverterEvdevImpl. |
115 return make_scoped_ptr<EventConverterEvdevImpl>(new EventConverterEvdevImpl( | 116 return make_scoped_ptr<EventConverterEvdevImpl>(new EventConverterEvdevImpl( |
116 fd, params.path, params.id, devinfo, params.cursor, params.dispatcher)); | 117 fd, params.path, params.id, devinfo, params.cursor, params.dispatcher)); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } // namespace | 174 } // namespace |
174 | 175 |
175 InputDeviceFactoryEvdev::InputDeviceFactoryEvdev( | 176 InputDeviceFactoryEvdev::InputDeviceFactoryEvdev( |
176 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher, | 177 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher, |
177 CursorDelegateEvdev* cursor) | 178 CursorDelegateEvdev* cursor) |
178 : task_runner_(base::ThreadTaskRunnerHandle::Get()), | 179 : task_runner_(base::ThreadTaskRunnerHandle::Get()), |
179 cursor_(cursor), | 180 cursor_(cursor), |
180 #if defined(USE_EVDEV_GESTURES) | 181 #if defined(USE_EVDEV_GESTURES) |
181 gesture_property_provider_(new GesturePropertyProvider), | 182 gesture_property_provider_(new GesturePropertyProvider), |
182 #endif | 183 #endif |
183 dispatcher_(dispatcher.Pass()), | 184 dispatcher_(std::move(dispatcher)), |
184 weak_ptr_factory_(this) { | 185 weak_ptr_factory_(this) { |
185 } | 186 } |
186 | 187 |
187 InputDeviceFactoryEvdev::~InputDeviceFactoryEvdev() { | 188 InputDeviceFactoryEvdev::~InputDeviceFactoryEvdev() { |
188 STLDeleteValues(&converters_); | 189 STLDeleteValues(&converters_); |
189 } | 190 } |
190 | 191 |
191 void InputDeviceFactoryEvdev::AddInputDevice(int id, | 192 void InputDeviceFactoryEvdev::AddInputDevice(int id, |
192 const base::FilePath& path) { | 193 const base::FilePath& path) { |
193 scoped_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams); | 194 scoped_ptr<OpenInputDeviceParams> params(new OpenInputDeviceParams); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 input_device_settings_ = settings; | 286 input_device_settings_ = settings; |
286 ApplyInputDeviceSettings(); | 287 ApplyInputDeviceSettings(); |
287 } | 288 } |
288 | 289 |
289 void InputDeviceFactoryEvdev::GetTouchDeviceStatus( | 290 void InputDeviceFactoryEvdev::GetTouchDeviceStatus( |
290 const GetTouchDeviceStatusReply& reply) { | 291 const GetTouchDeviceStatusReply& reply) { |
291 scoped_ptr<std::string> status(new std::string); | 292 scoped_ptr<std::string> status(new std::string); |
292 #if defined(USE_EVDEV_GESTURES) | 293 #if defined(USE_EVDEV_GESTURES) |
293 DumpTouchDeviceStatus(gesture_property_provider_.get(), status.get()); | 294 DumpTouchDeviceStatus(gesture_property_provider_.get(), status.get()); |
294 #endif | 295 #endif |
295 reply.Run(status.Pass()); | 296 reply.Run(std::move(status)); |
296 } | 297 } |
297 | 298 |
298 void InputDeviceFactoryEvdev::GetTouchEventLog( | 299 void InputDeviceFactoryEvdev::GetTouchEventLog( |
299 const base::FilePath& out_dir, | 300 const base::FilePath& out_dir, |
300 const GetTouchEventLogReply& reply) { | 301 const GetTouchEventLogReply& reply) { |
301 scoped_ptr<std::vector<base::FilePath>> log_paths( | 302 scoped_ptr<std::vector<base::FilePath>> log_paths( |
302 new std::vector<base::FilePath>); | 303 new std::vector<base::FilePath>); |
303 #if defined(USE_EVDEV_GESTURES) | 304 #if defined(USE_EVDEV_GESTURES) |
304 DumpTouchEventLog(converters_, gesture_property_provider_.get(), out_dir, | 305 DumpTouchEventLog(converters_, gesture_property_provider_.get(), out_dir, |
305 log_paths.Pass(), reply); | 306 log_paths.Pass(), reply); |
306 #else | 307 #else |
307 reply.Run(log_paths.Pass()); | 308 reply.Run(std::move(log_paths)); |
308 #endif | 309 #endif |
309 } | 310 } |
310 | 311 |
311 base::WeakPtr<InputDeviceFactoryEvdev> InputDeviceFactoryEvdev::GetWeakPtr() { | 312 base::WeakPtr<InputDeviceFactoryEvdev> InputDeviceFactoryEvdev::GetWeakPtr() { |
312 return weak_ptr_factory_.GetWeakPtr(); | 313 return weak_ptr_factory_.GetWeakPtr(); |
313 } | 314 } |
314 | 315 |
315 void InputDeviceFactoryEvdev::ApplyInputDeviceSettings() { | 316 void InputDeviceFactoryEvdev::ApplyInputDeviceSettings() { |
316 TRACE_EVENT0("evdev", "ApplyInputDeviceSettings"); | 317 TRACE_EVENT0("evdev", "ApplyInputDeviceSettings"); |
317 | 318 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 std::vector<int> ids; | 482 std::vector<int> ids; |
482 gesture_property_provider_->GetDeviceIdsByType(type, &ids); | 483 gesture_property_provider_->GetDeviceIdsByType(type, &ids); |
483 for (size_t i = 0; i < ids.size(); ++i) { | 484 for (size_t i = 0; i < ids.size(); ++i) { |
484 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, | 485 SetGestureBoolProperty(gesture_property_provider_.get(), ids[i], name, |
485 value); | 486 value); |
486 } | 487 } |
487 #endif | 488 #endif |
488 } | 489 } |
489 | 490 |
490 } // namespace ui | 491 } // namespace ui |
OLD | NEW |