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

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

Issue 863353003: [PATCH 6/11] ozone: evdev: Factor device I/O out of EventFactoryOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates for events_unittests Created 5 years, 11 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
21 namespace ui {
22
23 class CursorDelegateEvdev;
24 class DeviceEventDispatcherEvdev;
25
26 #if !defined(USE_EVDEV)
27 #error Missing dependency on ui/events/ozone:events_ozone_evdev
28 #endif
29
30 #if defined(USE_EVDEV_GESTURES)
31 class GesturePropertyProvider;
32 #endif
33
34 // Manager for event device objects. All device I/O starts here.
35 class EVENTS_OZONE_EVDEV_EXPORT InputDeviceFactoryEvdev {
36 public:
37 InputDeviceFactoryEvdev(
38 DeviceEventDispatcherEvdev* dispatcher,
39 scoped_refptr<base::SingleThreadTaskRunner> dispatch_runner,
40 #if defined(USE_EVDEV_GESTURES)
41 GesturePropertyProvider* gesture_property_provider_,
42 #endif
43 CursorDelegateEvdev* cursor);
44 ~InputDeviceFactoryEvdev();
45
46 // Open & start reading a newly plugged-in input device.
47 void AddInputDevice(int id, const base::FilePath& path);
48
49 // Stop reading & close an unplugged input device.
50 void RemoveInputDevice(const base::FilePath& path);
51
52 // 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.
54 bool GetDeviceIdsByType(const EventDeviceType type,
55 std::vector<int>* device_ids);
56
57 // Disables the internal touchpad.
58 void DisableInternalTouchpad();
59
60 // Enables the internal touchpad.
61 void EnableInternalTouchpad();
62
63 // Disables all keys on the internal keyboard except |excepted_keys|.
64 void DisableInternalKeyboardExceptKeys(
65 scoped_ptr<std::set<DomCode>> excepted_keys);
66
67 // Enables all keys on the internal keyboard.
68 void EnableInternalKeyboard();
69
70 private:
71 // Open device at path & starting processing events (on UI thread).
72 void AttachInputDevice(scoped_ptr<EventConverterEvdev> converter);
73
74 // Close device at path (on UI thread).
75 void DetachInputDevice(const base::FilePath& file_path);
76
77 // Update observers on device changes.
78 void NotifyDeviceChange(const EventConverterEvdev& converter);
79 void NotifyKeyboardsUpdated();
80 void NotifyTouchscreensUpdated();
81
82 // Owned per-device event converters (by path).
83 std::map<base::FilePath, EventConverterEvdev*> converters_;
84
85 // Task runner for event dispatch.
86 scoped_refptr<base::TaskRunner> ui_task_runner_;
87
88 // Cursor movement.
89 CursorDelegateEvdev* cursor_;
90
91 #if defined(USE_EVDEV_GESTURES)
92 // Gesture library property provider (used by touchpads/mice).
93 GesturePropertyProvider* gesture_property_provider_;
94 #endif
95
96 // Dispatcher for events.
97 DeviceEventDispatcherEvdev* dispatcher_;
98
99 // Support weak pointers for attach & detach callbacks.
100 base::WeakPtrFactory<InputDeviceFactoryEvdev> weak_ptr_factory_;
101
102 DISALLOW_COPY_AND_ASSIGN(InputDeviceFactoryEvdev);
103 };
104
105 } // namespace ui
106
107 #endif // UI_EVENTS_OZONE_EVDEV_INPUT_DEVICE_FACTORY_EVDEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698