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

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

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
7
8 #include <map>
9 #include <set>
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "base/files/file_path.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/task_runner.h"
17 #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/events_ozone_evdev_export.h"
20 #include "ui/events/ozone/evdev/input_device_settings_evdev.h"
21
22 namespace ui {
23
24 class CursorDelegateEvdev;
25 class DeviceEventDispatcherEvdev;
26 class InputDeviceFactoryEvdevProxy;
27
28 #if !defined(USE_EVDEV)
29 #error Missing dependency on ui/events/ozone:events_ozone_evdev
30 #endif
31
32 #if defined(USE_EVDEV_GESTURES)
33 class GesturePropertyProvider;
34 #endif
35
36 typedef base::Callback<void(scoped_ptr<std::string>)> GetTouchDeviceStatusReply;
37 typedef base::Callback<void(scoped_ptr<std::vector<base::FilePath>>)>
38 GetTouchEventLogReply;
39
40 // Manager for event device objects. All device I/O starts here.
41 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
42 public:
43 InputDeviceFactoryEvdev(scoped_ptr<DeviceEventDispatcherEvdev> dispatcher,
44 CursorDelegateEvdev* cursor);
45 ~InputDeviceFactoryEvdev();
46
47 // Open & start reading a newly plugged-in input device.
48 void AddInputDevice(int id, const base::FilePath& path);
49
50 // Stop reading & close an unplugged input device.
51 void RemoveInputDevice(const base::FilePath& path);
52
53 // Device thread handler for initial scan completion.
54 void OnStartupScanComplete();
55
56 // LED state.
57 void SetCapsLockLed(bool enabled);
58
59 // Bits from InputController that have to be answered on IO.
60 void UpdateInputDeviceSettings(const InputDeviceSettingsEvdev& settings);
61 void GetTouchDeviceStatus(const GetTouchDeviceStatusReply& reply);
62 void GetTouchEventLog(const base::FilePath& out_dir,
63 const GetTouchEventLogReply& reply);
64
65 base::WeakPtr<InputDeviceFactoryEvdev> GetWeakPtr();
66
67 private:
68 // Open device at path & starting processing events (on UI thread).
69 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter);
70
71 // Close device at path (on UI thread).
72 void DetachInputDevice(const base::FilePath& file_path);
73
74 // Sync input_device_settings_ to attached devices.
75 void ApplyInputDeviceSettings();
76 void ApplyCapsLockLed();
77
78 // Policy for device enablement.
79 bool IsDeviceEnabled(const EventConverterEvdev* converter);
80
81 // Update observers on device changes.
82 void UpdateDirtyFlags(const EventConverterEvdev* converter);
83 void NotifyDevicesUpdated();
84 void NotifyKeyboardsUpdated();
85 void NotifyTouchscreensUpdated();
86 void NotifyMouseDevicesUpdated();
87 void NotifyTouchpadDevicesUpdated();
88
89 void SetIntPropertyForOneType(const EventDeviceType type,
90 const std::string& name,
91 int value);
92 void SetBoolPropertyForOneType(const EventDeviceType type,
93 const std::string& name,
94 bool value);
95
96 // Owned per-device event converters (by path).
97 std::map<base::FilePath, EventConverterEvdev*> converters_;
98
99 // Task runner for our thread.
100 scoped_refptr<base::TaskRunner> task_runner_;
101
102 // Cursor movement.
103 CursorDelegateEvdev* cursor_;
104
105 #if defined(USE_EVDEV_GESTURES)
106 // Gesture library property provider (used by touchpads/mice).
107 scoped_ptr<GesturePropertyProvider> gesture_property_provider_;
108 #endif
109
110 // Dispatcher for events.
111 scoped_ptr<DeviceEventDispatcherEvdev> dispatcher_;
112
113 // Number of pending device additions & device classes.
114 int pending_device_changes_ = 0;
115 bool touchscreen_list_dirty_ = true;
116 bool keyboard_list_dirty_ = true;
117 bool mouse_list_dirty_ = true;
118 bool touchpad_list_dirty_ = true;
119
120 // Whether we have a list of devices that were present at startup.
121 bool startup_devices_enumerated_ = false;
122
123 // Whether devices that were present at startup are open.
124 bool startup_devices_opened_ = false;
125
126 // LEDs.
127 bool caps_lock_led_enabled_ = false;
128
129 // Device settings. These primarily affect libgestures behavior.
130 InputDeviceSettingsEvdev input_device_settings_;
131
132 // Support weak pointers for attach & detach callbacks.
133 base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_;
134
135 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev);
136 };
137
138 } // namespace ui
139
140 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/evdev/input_controller_evdev.cc ('k') | ui/events/ozone/evdev/input_device_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698