Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(604)

Side by Side Diff: ui/events/ozone/evdev/event_factory_evdev.h

Issue 869613003: [PATCH 5/11] ozone: evdev: Replace dispatch callbacks with an interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: namespace ui Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/task_runner.h" 15 #include "base/task_runner.h"
16 #include "ui/events/ozone/device/device_event_observer.h" 16 #include "ui/events/ozone/device/device_event_observer.h"
17 #include "ui/events/ozone/evdev/device_event_dispatcher_evdev.h"
17 #include "ui/events/ozone/evdev/event_converter_evdev.h" 18 #include "ui/events/ozone/evdev/event_converter_evdev.h"
18 #include "ui/events/ozone/evdev/event_device_info.h" 19 #include "ui/events/ozone/evdev/event_device_info.h"
19 #include "ui/events/ozone/evdev/event_modifiers_evdev.h" 20 #include "ui/events/ozone/evdev/event_modifiers_evdev.h"
20 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h" 21 #include "ui/events/ozone/evdev/events_ozone_evdev_export.h"
21 #include "ui/events/ozone/evdev/input_controller_evdev.h" 22 #include "ui/events/ozone/evdev/input_controller_evdev.h"
22 #include "ui/events/ozone/evdev/keyboard_evdev.h" 23 #include "ui/events/ozone/evdev/keyboard_evdev.h"
23 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h" 24 #include "ui/events/ozone/evdev/mouse_button_map_evdev.h"
24 #include "ui/events/platform/platform_event_source.h" 25 #include "ui/events/platform/platform_event_source.h"
25 #include "ui/gfx/native_widget_types.h" 26 #include "ui/gfx/native_widget_types.h"
26 #include "ui/ozone/public/system_input_injector.h" 27 #include "ui/ozone/public/system_input_injector.h"
(...skipping 11 matching lines...) Expand all
38 39
39 #if !defined(USE_EVDEV) 40 #if !defined(USE_EVDEV)
40 #error Missing dependency on ui/events/ozone:events_ozone_evdev 41 #error Missing dependency on ui/events/ozone:events_ozone_evdev
41 #endif 42 #endif
42 43
43 #if defined(USE_EVDEV_GESTURES) 44 #if defined(USE_EVDEV_GESTURES)
44 class GesturePropertyProvider; 45 class GesturePropertyProvider;
45 #endif 46 #endif
46 47
47 // Ozone events implementation for the Linux input subsystem ("evdev"). 48 // Ozone events implementation for the Linux input subsystem ("evdev").
48 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev : public DeviceEventObserver, 49 class EVENTS_OZONE_EVDEV_EXPORT EventFactoryEvdev
49 public PlatformEventSource { 50 : public DeviceEventObserver,
51 public PlatformEventSource,
52 public DeviceEventDispatcherEvdev {
50 public: 53 public:
51 EventFactoryEvdev(CursorDelegateEvdev* cursor, 54 EventFactoryEvdev(CursorDelegateEvdev* cursor,
52 DeviceManager* device_manager, 55 DeviceManager* device_manager,
53 KeyboardLayoutEngine* keyboard_layout_engine); 56 KeyboardLayoutEngine* keyboard_layout_engine);
54 ~EventFactoryEvdev() override; 57 ~EventFactoryEvdev() override;
55 58
59 // Initialize. Must be called with a valid message loop.
60 void Init();
61
56 // Get a list of device ids that matches a device type. Return true if the 62 // Get a list of device ids that matches a device type. Return true if the
57 // list is not empty. |device_ids| can be NULL. 63 // list is not empty. |device_ids| can be NULL.
58 bool GetDeviceIdsByType(const EventDeviceType type, 64 bool GetDeviceIdsByType(const EventDeviceType type,
59 std::vector<int>* device_ids); 65 std::vector<int>* device_ids);
60 66
61 void WarpCursorTo(gfx::AcceleratedWidget widget, 67 void WarpCursorTo(gfx::AcceleratedWidget widget,
62 const gfx::PointF& location); 68 const gfx::PointF& location);
63 69
64 // Disables the internal touchpad. 70 // Disables the internal touchpad.
65 void DisableInternalTouchpad(); 71 void DisableInternalTouchpad();
66 72
67 // Enables the internal touchpad. 73 // Enables the internal touchpad.
68 void EnableInternalTouchpad(); 74 void EnableInternalTouchpad();
69 75
70 // Disables all keys on the internal keyboard except |excepted_keys|. 76 // Disables all keys on the internal keyboard except |excepted_keys|.
71 void DisableInternalKeyboardExceptKeys( 77 void DisableInternalKeyboardExceptKeys(
72 scoped_ptr<std::set<DomCode>> excepted_keys); 78 scoped_ptr<std::set<DomCode>> excepted_keys);
73 79
74 // Enables all keys on the internal keyboard. 80 // Enables all keys on the internal keyboard.
75 void EnableInternalKeyboard(); 81 void EnableInternalKeyboard();
76 82
77 scoped_ptr<SystemInputInjector> CreateSystemInputInjector(); 83 scoped_ptr<SystemInputInjector> CreateSystemInputInjector();
78 84
79 InputController* input_controller() { return &input_controller_; } 85 InputController* input_controller() { return &input_controller_; }
80 86
81 // Post events to UI. 87 // DeviceEventDispatchEvdev:
82 void PostKeyEvent(const KeyEventParams& params); 88 void DispatchKeyEvent(const KeyEventParams& params) override;
83 void PostMouseMoveEvent(const MouseMoveEventParams& params); 89 void DispatchMouseMoveEvent(const MouseMoveEventParams& params) override;
84 void PostMouseButtonEvent(const MouseButtonEventParams& params); 90 void DispatchMouseButtonEvent(const MouseButtonEventParams& params) override;
85 void PostMouseWheelEvent(const MouseWheelEventParams& parms); 91 void DispatchMouseWheelEvent(const MouseWheelEventParams& params) override;
86 void PostScrollEvent(const ScrollEventParams& params); 92 void DispatchScrollEvent(const ScrollEventParams& params) override;
87 void PostTouchEvent(const TouchEventParams& params); 93 void DispatchTouchEvent(const TouchEventParams& params) override;
88 94
89 protected: 95 protected:
90 // DeviceEventObserver overrides: 96 // DeviceEventObserver overrides:
91 // 97 //
92 // Callback for device add (on UI thread). 98 // Callback for device add (on UI thread).
93 void OnDeviceEvent(const DeviceEvent& event) override; 99 void OnDeviceEvent(const DeviceEvent& event) override;
94 100
95 // PlatformEventSource: 101 // PlatformEventSource:
96 void OnDispatcherListChanged() override; 102 void OnDispatcherListChanged() override;
97 103
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 CursorDelegateEvdev* cursor_; 149 CursorDelegateEvdev* cursor_;
144 150
145 #if defined(USE_EVDEV_GESTURES) 151 #if defined(USE_EVDEV_GESTURES)
146 // Gesture library property provider (used by touchpads/mice). 152 // Gesture library property provider (used by touchpads/mice).
147 scoped_ptr<GesturePropertyProvider> gesture_property_provider_; 153 scoped_ptr<GesturePropertyProvider> gesture_property_provider_;
148 #endif 154 #endif
149 155
150 // Object for controlling input devices. 156 // Object for controlling input devices.
151 InputControllerEvdev input_controller_; 157 InputControllerEvdev input_controller_;
152 158
159 // Whether we've set up the device factory & done initial scan.
160 bool initialized_;
161
153 // Support weak pointers for attach & detach callbacks. 162 // Support weak pointers for attach & detach callbacks.
154 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_; 163 base::WeakPtrFactory<EventFactoryEvdev> weak_ptr_factory_;
155 164
156 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); 165 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev);
157 }; 166 };
158 167
159 } // namespace ui 168 } // namespace ui
160 169
161 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_ 170 #endif // UI_EVENTS_OZONE_EVDEV_EVENT_FACTORY_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/event_dispatch_callback.cc ('k') | ui/events/ozone/evdev/event_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698