summaryrefslogtreecommitdiffstats
path: root/ui/events/ozone/evdev/event_factory.h
diff options
context:
space:
mode:
authorspang@chromium.org <spang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-03 20:06:48 +0000
committerspang@chromium.org <spang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-03 20:06:48 +0000
commit1247de8adb3acfbe1b26416a4e4a89aacab87388 (patch)
tree2cb3cbace0c42e86b3463d91a92a10d7b621bf6b /ui/events/ozone/evdev/event_factory.h
parent93b89a40425cb8b0c0e336211ee8b9fd621fc341 (diff)
downloadchromium_src-1247de8adb3acfbe1b26416a4e4a89aacab87388.zip
chromium_src-1247de8adb3acfbe1b26416a4e4a89aacab87388.tar.gz
chromium_src-1247de8adb3acfbe1b26416a4e4a89aacab87388.tar.bz2
evdev: Support device hotplug with udev
This watches for new input devices and opens any that appear for event dispatching. This is only supported when use_udev==1. Review URL: https://codereview.chromium.org/150633005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248560 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/events/ozone/evdev/event_factory.h')
-rw-r--r--ui/events/ozone/evdev/event_factory.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/ui/events/ozone/evdev/event_factory.h b/ui/events/ozone/evdev/event_factory.h
index a0fbbe4..2bcda41 100644
--- a/ui/events/ozone/evdev/event_factory.h
+++ b/ui/events/ozone/evdev/event_factory.h
@@ -5,6 +5,7 @@
#ifndef UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_
#define UI_EVENTS_OZONE_EVENT_FACTORY_DELEGATE_EVDEV_H_
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "ui/events/events_export.h"
@@ -12,12 +13,22 @@
#include "ui/events/ozone/evdev/event_modifiers.h"
#include "ui/events/ozone/event_factory_ozone.h"
-#if defined(USE_UDEV)
-#include "ui/events/ozone/evdev/scoped_udev.h"
-#endif
-
namespace ui {
+typedef base::Callback<void(const base::FilePath& file_path)>
+ EvdevDeviceCallback;
+
+// Interface for scanning & monitoring input devices.
+class DeviceManagerEvdev {
+ public:
+ virtual ~DeviceManagerEvdev();
+
+ // Enumerate devices & start watching for changes.
+ virtual void ScanAndStartMonitoring(
+ const EvdevDeviceCallback& device_added,
+ const EvdevDeviceCallback& device_removed) = 0;
+};
+
// Ozone events implementation for the Linux input subsystem ("evdev").
class EVENTS_EXPORT EventFactoryEvdev : public EventFactoryOzone {
public:
@@ -30,21 +41,14 @@ class EVENTS_EXPORT EventFactoryEvdev : public EventFactoryOzone {
// Open device at path & starting processing events.
void AttachInputDevice(const base::FilePath& file_path);
- // Scan & open devices in /dev/input (without udev).
- void StartProcessingEventsManual();
-
-#if defined(USE_UDEV)
- // Scan & open devices using udev.
- void StartProcessingEventsUdev();
-#endif
+ // Close device at path.
+ void DetachInputDevice(const base::FilePath& file_path);
// Owned per-device event converters (by path).
std::map<base::FilePath, EventConverterEvdev*> converters_;
-#if defined(USE_UDEV)
- // Udev daemon connection.
- scoped_udev udev_;
-#endif
+ // Interface for scanning & monitoring input devices.
+ scoped_ptr<DeviceManagerEvdev> device_manager_;
EventModifiersEvdev modifiers_;