Chromium Code Reviews| Index: ui/events/ozone/device_udev.h |
| diff --git a/ui/events/ozone/device_udev.h b/ui/events/ozone/device_udev.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..717a4f6b88a382370cc40c8c231b6d3cce6099f8 |
| --- /dev/null |
| +++ b/ui/events/ozone/device_udev.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
spang
2014/04/25 19:50:28
Can you move ui/events/ozone/*udev* to ui/events/o
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef UI_EVENTS_OZONE_DEVICE_UDEV_H_ |
| +#define UI_EVENTS_OZONE_DEVICE_UDEV_H_ |
| + |
| +#include <map> |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "ui/events/events_export.h" |
| +#include "ui/events/ozone/monitor_udev.h" |
| +#include "ui/events/ozone/scoped_udev.h" |
| + |
| +namespace ui { |
| + |
| +// Device enumerator & monitor using udev. |
| +// |
| +// This class enumerates devices attached to the system using udev. |
| +// |
| +// It also creates & monitors a udev netlink socket and issues callbacks for |
| +// any changes to the set of attached devices. |
| +class EVENTS_EXPORT DeviceUdev { |
|
spang
2014/04/25 19:50:28
Call it "Udev".
|
| + public: |
| + DeviceUdev(); |
| + ~DeviceUdev(); |
| + |
| + // Registers |monitor| for events matching |subsystem|. |
| + bool RegisterDeviceMonitor(MonitorUdev* monitor, |
| + const std::string& subsystem); |
| + |
| + // Unregisters |monitor|. Once this is called no further events will be |
| + // received by |monitor|. |
| + void UnregisterDeviceMonitor(MonitorUdev* monitor); |
| + |
| + // Scan the system for devices matching |subsystem| and calls into |monitor| |
| + // for each device found. |
| + bool ScanDevices(MonitorUdev* monitor, const std::string& subsystem); |
| + |
| + private: |
| + class WatcherUdev; |
| + |
| + // Connection to Udev. This is used by all watchers when registering. |
| + scoped_udev udev_; |
| + |
| + // Mapping of listeners to the MessagePump watchers. |
| + std::map<MonitorUdev*, WatcherUdev*> monitors_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeviceUdev); |
| +}; |
| + |
| +} // namespace ui |
| + |
| +#endif // UI_EVENTS_OZONE_DEVICE_UDEV_H_ |