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