Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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
| |
| 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_DEVICE_UDEV_H_ | |
| 6 #define UI_EVENTS_OZONE_DEVICE_UDEV_H_ | |
| 7 | |
| 8 #include <map> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "ui/events/events_export.h" | |
| 13 #include "ui/events/ozone/monitor_udev.h" | |
| 14 #include "ui/events/ozone/scoped_udev.h" | |
| 15 | |
| 16 namespace ui { | |
| 17 | |
| 18 // Device enumerator & monitor using udev. | |
| 19 // | |
| 20 // This class enumerates devices attached to the system using udev. | |
| 21 // | |
| 22 // It also creates & monitors a udev netlink socket and issues callbacks for | |
| 23 // any changes to the set of attached devices. | |
| 24 class EVENTS_EXPORT DeviceUdev { | |
|
spang
2014/04/25 19:50:28
Call it "Udev".
| |
| 25 public: | |
| 26 DeviceUdev(); | |
| 27 ~DeviceUdev(); | |
| 28 | |
| 29 // Registers |monitor| for events matching |subsystem|. | |
| 30 bool RegisterDeviceMonitor(MonitorUdev* monitor, | |
| 31 const std::string& subsystem); | |
| 32 | |
| 33 // Unregisters |monitor|. Once this is called no further events will be | |
| 34 // received by |monitor|. | |
| 35 void UnregisterDeviceMonitor(MonitorUdev* monitor); | |
| 36 | |
| 37 // Scan the system for devices matching |subsystem| and calls into |monitor| | |
| 38 // for each device found. | |
| 39 bool ScanDevices(MonitorUdev* monitor, const std::string& subsystem); | |
| 40 | |
| 41 private: | |
| 42 class WatcherUdev; | |
| 43 | |
| 44 // Connection to Udev. This is used by all watchers when registering. | |
| 45 scoped_udev udev_; | |
| 46 | |
| 47 // Mapping of listeners to the MessagePump watchers. | |
| 48 std::map<MonitorUdev*, WatcherUdev*> monitors_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(DeviceUdev); | |
| 51 }; | |
| 52 | |
| 53 } // namespace ui | |
| 54 | |
| 55 #endif // UI_EVENTS_OZONE_DEVICE_UDEV_H_ | |
| OLD | NEW |