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