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

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

Issue 150633005: evdev: Support device hotplug with udev (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fewer memory leaks Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_EVENT_FACTORY_DELEGATE_EVDEV_H_ 5 #ifndef UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_
6 #define UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_ 6 #define UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/message_loop/message_pump_libevent.h"
10 #include "ui/events/events_export.h" 11 #include "ui/events/events_export.h"
11 #include "ui/events/ozone/evdev/event_converter.h" 12 #include "ui/events/ozone/evdev/event_converter.h"
12 #include "ui/events/ozone/evdev/event_modifiers.h" 13 #include "ui/events/ozone/evdev/event_modifiers.h"
13 #include "ui/events/ozone/event_factory_ozone.h" 14 #include "ui/events/ozone/event_factory_ozone.h"
14 15
15 #if defined(USE_UDEV) 16 #if defined(USE_UDEV)
16 #include "ui/events/ozone/evdev/scoped_udev.h" 17 #include "ui/events/ozone/evdev/scoped_udev.h"
17 #endif 18 #endif
18 19
19 namespace ui { 20 namespace ui {
20 21
22 #if defined(USE_UDEV)
23 class UdevWatcher;
24 #endif
25
21 // Ozone events implementation for the Linux input subsystem ("evdev"). 26 // Ozone events implementation for the Linux input subsystem ("evdev").
22 class EVENTS_EXPORT EventFactoryEvdev : public EventFactoryOzone { 27 class EVENTS_EXPORT EventFactoryEvdev : public EventFactoryOzone {
23 public: 28 public:
24 EventFactoryEvdev(); 29 EventFactoryEvdev();
25 virtual ~EventFactoryEvdev(); 30 virtual ~EventFactoryEvdev();
26 31
27 virtual void StartProcessingEvents() OVERRIDE; 32 virtual void StartProcessingEvents() OVERRIDE;
28 33
29 private: 34 private:
30 // Open device at path & starting processing events. 35 // Open device at path & starting processing events.
31 void AttachInputDevice(const base::FilePath& file_path); 36 void AttachInputDevice(const base::FilePath& file_path);
32 37
38 // Close device at path.
39 void DetachInputDevice(const base::FilePath& file_path);
40
33 // Scan & open devices in /dev/input (without udev). 41 // Scan & open devices in /dev/input (without udev).
34 void StartProcessingEventsManual(); 42 void StartProcessingEventsManual();
35 43
36 #if defined(USE_UDEV) 44 #if defined(USE_UDEV)
37 // Scan & open devices using udev. 45 // Scan & open devices using udev.
38 void StartProcessingEventsUdev(); 46 void StartProcessingEventsUdev();
47
48 // Set up device monitor for hotplug.
49 bool StartMonitoringDevicesUdev();
39 #endif 50 #endif
40 51
41 // Owned per-device event converters (by path). 52 // Owned per-device event converters (by path).
42 std::map<base::FilePath, EventConverterEvdev*> converters_; 53 std::map<base::FilePath, EventConverterEvdev*> converters_;
43 54
44 #if defined(USE_UDEV) 55 #if defined(USE_UDEV)
45 // Udev daemon connection. 56 // Udev daemon connection.
46 scoped_udev udev_; 57 scoped_udev udev_;
58
59 // Udev device change monitor.
60 scoped_udev_monitor udev_monitor_;
61
62 // Watcher for uevent netlink socket.
63 scoped_ptr<UdevWatcher> watcher_;
sadrul 2014/01/30 22:10:36 Can there a be single scoped_ptr<UdevController> t
rjkroege 2014/01/30 22:18:09 +1
spang 2014/01/31 17:33:00 Done.
47 #endif 64 #endif
48 65
49 EventModifiersEvdev modifiers_; 66 EventModifiersEvdev modifiers_;
50 67
51 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev); 68 DISALLOW_COPY_AND_ASSIGN(EventFactoryEvdev);
52 }; 69 };
53 70
54 } // namespace ui 71 } // namespace ui
55 72
56 #endif // UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_ 73 #endif // UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698