| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/event_factory_evdev.h" | 5 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
| 14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
| 15 #include "ui/events/devices/device_data_manager.h" | 15 #include "ui/events/devices/device_data_manager.h" |
| 16 #include "ui/events/ozone/device/device_event.h" | 16 #include "ui/events/ozone/device/device_event.h" |
| 17 #include "ui/events/ozone/device/device_manager.h" | 17 #include "ui/events/ozone/device/device_manager.h" |
| 18 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 18 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 19 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" | 19 #include "ui/events/ozone/evdev/event_converter_evdev_impl.h" |
| 20 #include "ui/events/ozone/evdev/event_device_info.h" | 20 #include "ui/events/ozone/evdev/event_device_info.h" |
| 21 #include "ui/events/ozone/evdev/input_injector_evdev.h" |
| 21 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h" | 22 #include "ui/events/ozone/evdev/tablet_event_converter_evdev.h" |
| 22 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" | 23 #include "ui/events/ozone/evdev/touch_event_converter_evdev.h" |
| 23 | 24 |
| 24 #if defined(USE_EVDEV_GESTURES) | 25 #if defined(USE_EVDEV_GESTURES) |
| 25 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" | 26 #include "ui/events/ozone/evdev/libgestures_glue/event_reader_libevdev_cros.h" |
| 26 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" | 27 #include "ui/events/ozone/evdev/libgestures_glue/gesture_interpreter_libevdev_cr
os.h" |
| 27 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" | 28 #include "ui/events/ozone/evdev/libgestures_glue/gesture_property_provider.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 #ifndef EVIOCSCLOCKID | 31 #ifndef EVIOCSCLOCKID |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 cursor_(cursor), | 178 cursor_(cursor), |
| 178 #if defined(USE_EVDEV_GESTURES) | 179 #if defined(USE_EVDEV_GESTURES) |
| 179 gesture_property_provider_(new GesturePropertyProvider), | 180 gesture_property_provider_(new GesturePropertyProvider), |
| 180 #endif | 181 #endif |
| 181 weak_ptr_factory_(this) { | 182 weak_ptr_factory_(this) { |
| 182 DCHECK(device_manager_); | 183 DCHECK(device_manager_); |
| 183 } | 184 } |
| 184 | 185 |
| 185 EventFactoryEvdev::~EventFactoryEvdev() { STLDeleteValues(&converters_); } | 186 EventFactoryEvdev::~EventFactoryEvdev() { STLDeleteValues(&converters_); } |
| 186 | 187 |
| 188 scoped_ptr<SystemInputInjector> EventFactoryEvdev::CreateSystemInputInjector() { |
| 189 return make_scoped_ptr(new InputInjectorEvdev( |
| 190 &modifiers_, cursor_, &keyboard_, dispatch_callback_)); |
| 191 } |
| 192 |
| 187 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { | 193 void EventFactoryEvdev::PostUiEvent(scoped_ptr<Event> event) { |
| 188 base::ThreadTaskRunnerHandle::Get()->PostTask( | 194 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 189 FROM_HERE, | 195 FROM_HERE, |
| 190 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, | 196 base::Bind(&EventFactoryEvdev::DispatchUiEventTask, |
| 191 weak_ptr_factory_.GetWeakPtr(), | 197 weak_ptr_factory_.GetWeakPtr(), |
| 192 base::Passed(&event))); | 198 base::Passed(&event))); |
| 193 } | 199 } |
| 194 | 200 |
| 195 void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) { | 201 void EventFactoryEvdev::DispatchUiEventTask(scoped_ptr<Event> event) { |
| 196 DispatchEvent(event.get()); | 202 DispatchEvent(event.get()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 } | 330 } |
| 325 | 331 |
| 326 observer->OnTouchscreenDevicesUpdated(touchscreens); | 332 observer->OnTouchscreenDevicesUpdated(touchscreens); |
| 327 } | 333 } |
| 328 | 334 |
| 329 int EventFactoryEvdev::NextDeviceId() { | 335 int EventFactoryEvdev::NextDeviceId() { |
| 330 return ++last_device_id_; | 336 return ++last_device_id_; |
| 331 } | 337 } |
| 332 | 338 |
| 333 } // namespace ui | 339 } // namespace ui |
| OLD | NEW |