| 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/input_injector_evdev.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 5 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 6 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| 7 #include "ui/events/keycodes/dom/dom_code.h" | 11 #include "ui/events/keycodes/dom/dom_code.h" |
| 8 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 12 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| 9 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 13 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
| 10 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 14 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
| 11 #include "ui/events/ozone/evdev/input_injector_evdev.h" | |
| 12 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 15 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
| 13 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" | 16 #include "ui/events/ozone/evdev/keyboard_util_evdev.h" |
| 14 | 17 |
| 15 namespace ui { | 18 namespace ui { |
| 16 | 19 |
| 17 namespace { | 20 namespace { |
| 18 | 21 |
| 19 const int kDeviceIdForInjection = -1; | 22 const int kDeviceIdForInjection = -1; |
| 20 | 23 |
| 21 } // namespace | 24 } // namespace |
| 22 | 25 |
| 23 InputInjectorEvdev::InputInjectorEvdev( | 26 InputInjectorEvdev::InputInjectorEvdev( |
| 24 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher, | 27 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher, |
| 25 CursorDelegateEvdev* cursor) | 28 CursorDelegateEvdev* cursor) |
| 26 : cursor_(cursor), dispatcher_(dispatcher.Pass()) { | 29 : cursor_(cursor), dispatcher_(std::move(dispatcher)) {} |
| 27 } | |
| 28 | 30 |
| 29 InputInjectorEvdev::~InputInjectorEvdev() { | 31 InputInjectorEvdev::~InputInjectorEvdev() { |
| 30 } | 32 } |
| 31 | 33 |
| 32 void InputInjectorEvdev::InjectMouseButton(EventFlags button, bool down) { | 34 void InputInjectorEvdev::InjectMouseButton(EventFlags button, bool down) { |
| 33 unsigned int code; | 35 unsigned int code; |
| 34 switch (button) { | 36 switch (button) { |
| 35 case EF_LEFT_MOUSE_BUTTON: | 37 case EF_LEFT_MOUSE_BUTTON: |
| 36 code = BTN_LEFT; | 38 code = BTN_LEFT; |
| 37 break; | 39 break; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key); | 79 int native_keycode = KeycodeConverter::DomCodeToNativeKeycode(physical_key); |
| 78 int evdev_code = NativeCodeToEvdevCode(native_keycode); | 80 int evdev_code = NativeCodeToEvdevCode(native_keycode); |
| 79 | 81 |
| 80 dispatcher_->DispatchKeyEvent( | 82 dispatcher_->DispatchKeyEvent( |
| 81 KeyEventParams(kDeviceIdForInjection, evdev_code, down, | 83 KeyEventParams(kDeviceIdForInjection, evdev_code, down, |
| 82 suppress_auto_repeat, EventTimeForNow())); | 84 suppress_auto_repeat, EventTimeForNow())); |
| 83 } | 85 } |
| 84 | 86 |
| 85 } // namespace ui | 87 } // namespace ui |
| 86 | 88 |
| OLD | NEW |