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_INPUT_DEVICE_FACTORY_EVDEV_H_ | 5 #ifndef UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ |
6 #define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ | 6 #define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #if defined(USE_EVDEV_GESTURES) | 30 #if defined(USE_EVDEV_GESTURES) |
31 class GesturePropertyProvider; | 31 class GesturePropertyProvider; |
32 #endif | 32 #endif |
33 | 33 |
34 // Manager for event device objects. All device I/O starts here. | 34 // Manager for event device objects. All device I/O starts here. |
35 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev { | 35 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev { |
36 public: | 36 public: |
37 InputDeviceFactoryEvdev( | 37 InputDeviceFactoryEvdev( |
38 DeviceEventDispatcherEvdev* dispatcher, | 38 DeviceEventDispatcherEvdev* dispatcher, |
39 scoped_refptr<base::SingleThreadTaskRunner> dispatch_runner, | 39 scoped_refptr<base::SingleThreadTaskRunner> dispatch_runner, |
40 #if defined(USE_EVDEV_GESTURES) | |
41 GesturePropertyProvider* gesture_property_provider_, | |
42 #endif | |
43 CursorDelegateEvdev* cursor); | 40 CursorDelegateEvdev* cursor); |
44 ~InputDeviceFactoryEvdev(); | 41 ~InputDeviceFactoryEvdev(); |
45 | 42 |
46 // Open & start reading a newly plugged-in input device. | 43 // Open & start reading a newly plugged-in input device. |
47 void AddInputDevice(int id, const base::FilePath& path); | 44 void AddInputDevice(int id, const base::FilePath& path); |
48 | 45 |
49 // Stop reading & close an unplugged input device. | 46 // Stop reading & close an unplugged input device. |
50 void RemoveInputDevice(const base::FilePath& path); | 47 void RemoveInputDevice(const base::FilePath& path); |
51 | 48 |
52 // Get a list of device ids that matches a device type. Return true if the | 49 // Get a list of device ids that matches a device type. Return true if the |
53 // list is not empty. |device_ids| can be NULL. | 50 // list is not empty. |device_ids| can be NULL. |
54 bool GetDeviceIdsByType(const EventDeviceType type, | 51 bool GetDeviceIdsByType(const EventDeviceType type, |
55 std::vector<int>* device_ids); | 52 std::vector<int>* device_ids); |
56 | 53 |
57 // Disables the internal touchpad. | 54 // Disables the internal touchpad. |
58 void DisableInternalTouchpad(); | 55 void DisableInternalTouchpad(); |
59 | 56 |
60 // Enables the internal touchpad. | 57 // Enables the internal touchpad. |
61 void EnableInternalTouchpad(); | 58 void EnableInternalTouchpad(); |
62 | 59 |
63 // Disables all keys on the internal keyboard except |excepted_keys|. | 60 // Disables all keys on the internal keyboard except |excepted_keys|. |
64 void DisableInternalKeyboardExceptKeys( | 61 void DisableInternalKeyboardExceptKeys( |
65 scoped_ptr<std::set<DomCode>> excepted_keys); | 62 scoped_ptr<std::set<DomCode>> excepted_keys); |
66 | 63 |
67 // Enables all keys on the internal keyboard. | 64 // Enables all keys on the internal keyboard. |
68 void EnableInternalKeyboard(); | 65 void EnableInternalKeyboard(); |
69 | 66 |
| 67 // Bits from InputController that have to be answered on IO. |
| 68 bool HasMouse(); |
| 69 bool HasTouchpad(); |
| 70 void SetTouchpadSensitivity(int value); |
| 71 void SetTapToClick(bool enabled); |
| 72 void SetThreeFingerClick(bool enabled); |
| 73 void SetTapDragging(bool enabled); |
| 74 void SetNaturalScroll(bool enabled); |
| 75 void SetMouseSensitivity(int value); |
| 76 void SetTapToClickPaused(bool state); |
| 77 |
70 private: | 78 private: |
71 // Open device at path & starting processing events (on UI thread). | 79 // Open device at path & starting processing events (on UI thread). |
72 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter); | 80 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter); |
73 | 81 |
74 // Close device at path (on UI thread). | 82 // Close device at path (on UI thread). |
75 void DetachInputDevice(const base::FilePath& file_path); | 83 void DetachInputDevice(const base::FilePath& file_path); |
76 | 84 |
77 // Update observers on device changes. | 85 // Update observers on device changes. |
78 void NotifyDeviceChange(const EventConverterEvdev& converter); | 86 void NotifyDeviceChange(const EventConverterEvdev& converter); |
79 void NotifyKeyboardsUpdated(); | 87 void NotifyKeyboardsUpdated(); |
80 void NotifyTouchscreensUpdated(); | 88 void NotifyTouchscreensUpdated(); |
81 | 89 |
| 90 void SetIntPropertyForOneType(const EventDeviceType type, |
| 91 const std::string& name, |
| 92 int value); |
| 93 void SetBoolPropertyForOneType(const EventDeviceType type, |
| 94 const std::string& name, |
| 95 bool value); |
| 96 |
82 // Owned per-device event converters (by path). | 97 // Owned per-device event converters (by path). |
83 std::map<base::FilePath, EventConverterEvdev*> converters_; | 98 std::map<base::FilePath, EventConverterEvdev*> converters_; |
84 | 99 |
85 // Task runner for event dispatch. | 100 // Task runner for event dispatch. |
86 scoped_refptr<base::TaskRunner> ui_task_runner_; | 101 scoped_refptr<base::TaskRunner> ui_task_runner_; |
87 | 102 |
88 // Cursor movement. | 103 // Cursor movement. |
89 CursorDelegateEvdev* cursor_; | 104 CursorDelegateEvdev* cursor_; |
90 | 105 |
91 #if defined(USE_EVDEV_GESTURES) | 106 #if defined(USE_EVDEV_GESTURES) |
92 // Gesture library property provider (used by touchpads/mice). | 107 // Gesture library property provider (used by touchpads/mice). |
93 GesturePropertyProvider* gesture_property_provider_; | 108 scoped_ptr<GesturePropertyProvider> gesture_property_provider_; |
94 #endif | 109 #endif |
95 | 110 |
96 // Dispatcher for events. | 111 // Dispatcher for events. |
97 DeviceEventDispatcherEvdev* dispatcher_; | 112 DeviceEventDispatcherEvdev* dispatcher_; |
98 | 113 |
99 // Support weak pointers for attach & detach callbacks. | 114 // Support weak pointers for attach & detach callbacks. |
100 base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_; | 115 base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_; |
101 | 116 |
102 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev); | 117 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev); |
103 }; | 118 }; |
104 | 119 |
105 } // namespace ui | 120 } // namespace ui |
106 | 121 |
107 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ | 122 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_ |
OLD | NEW |