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 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/task_runner.h" | 12 #include "base/task_runner.h" |
13 #include "ui/events/ozone/device/device_event_observer.h" | 13 #include "ui/events/ozone/device/device_event_observer.h" |
14 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" | 14 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h" |
15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" | 15 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" |
| 16 #include "ui/events/ozone/evdev/event_thread_evdev.h" |
16 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" | 17 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" |
17 #include "ui/events/ozone/evdev/input_controller_evdev.h" | 18 #include "ui/events/ozone/evdev/input_controller_evdev.h" |
18 #include "ui/events/ozone/evdev/keyboard_evdev.h" | 19 #include "ui/events/ozone/evdev/keyboard_evdev.h" |
19 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" | 20 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" |
20 #include "ui/events/platform/platform_event_source.h" | 21 #include "ui/events/platform/platform_event_source.h" |
21 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
22 #include "ui/ozone/public/system_input_injector.h" | 23 #include "ui/ozone/public/system_input_injector.h" |
23 | 24 |
24 namespace gfx { | 25 namespace gfx { |
25 class PointF; | 26 class PointF; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 91 |
91 private: | 92 private: |
92 // Post a task to dispatch an event. | 93 // Post a task to dispatch an event. |
93 virtual void PostUiEvent(scoped_ptr<Event> event); | 94 virtual void PostUiEvent(scoped_ptr<Event> event); |
94 | 95 |
95 // Dispatch event via PlatformEventSource. | 96 // Dispatch event via PlatformEventSource. |
96 void DispatchUiEventTask(scoped_ptr<Event> event); | 97 void DispatchUiEventTask(scoped_ptr<Event> event); |
97 | 98 |
98 int NextDeviceId(); | 99 int NextDeviceId(); |
99 | 100 |
| 101 // Device thread initialization. |
| 102 void StartThread(); |
| 103 void OnThreadStarted( |
| 104 scoped_ptr<InputDeviceFactoryProxyEvdev> input_device_factory); |
| 105 |
100 // Used to uniquely identify input devices. | 106 // Used to uniquely identify input devices. |
101 int last_device_id_; | 107 int last_device_id_; |
102 | 108 |
103 // Interface for scanning & monitoring input devices. | 109 // Interface for scanning & monitoring input devices. |
104 DeviceManager* device_manager_; // Not owned. | 110 DeviceManager* device_manager_; // Not owned. |
105 | 111 |
106 // Factory for per-device objects. | 112 // Factory for per-device objects. |
107 scoped_ptr<InputDeviceFactoryEvdev> input_device_factory_; | |
108 scoped_ptr<InputDeviceFactoryProxyEvdev> input_device_factory_proxy_; | 113 scoped_ptr<InputDeviceFactoryProxyEvdev> input_device_factory_proxy_; |
109 | 114 |
110 // Dispatch callback for events. | 115 // Dispatch callback for events. |
111 EventDispatchCallback dispatch_callback_; | 116 EventDispatchCallback dispatch_callback_; |
112 | 117 |
113 // Modifier key state (shift, ctrl, etc). | 118 // Modifier key state (shift, ctrl, etc). |
114 EventModifiersEvdev modifiers_; | 119 EventModifiersEvdev modifiers_; |
115 | 120 |
116 // Mouse button map. | 121 // Mouse button map. |
117 MouseButtonMapEvdev button_map_; | 122 MouseButtonMapEvdev button_map_; |
118 | 123 |
119 // Keyboard state. | 124 // Keyboard state. |
120 KeyboardEvdev keyboard_; | 125 KeyboardEvdev keyboard_; |
121 | 126 |
122 // Cursor movement. | 127 // Cursor movement. |
123 CursorDelegateEvdev* cursor_; | 128 CursorDelegateEvdev* cursor_; |
124 | 129 |
125 // Object for controlling input devices. | 130 // Object for controlling input devices. |
126 InputControllerEvdev input_controller_; | 131 InputControllerEvdev input_controller_; |
127 | 132 |
128 // Whether we've set up the device factory & done initial scan. | 133 // Whether we've set up the device factory. |
129 bool initialized_; | 134 bool initialized_; |
130 | 135 |
| 136 // Thread for device I/O. |
| 137 EventThreadEvdev thread_; |
| 138 |
131 // Support weak pointers for attach & detach callbacks. | 139 // Support weak pointers for attach & detach callbacks. |
132 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; | 140 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; |
133 | 141 |
134 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); | 142 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); |
135 }; | 143 }; |
136 | 144 |
137 } // namespace ui | 145 } // namespace ui |
138 | 146 |
139 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ | 147 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ |
OLD | NEW |