Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / ozone / device / udev / device_manager_udev.h
blob8a7537abebe40b73c31fc0f0f79fc67b96192bba
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.
5 #ifndef UI_EVENTS_OZONE_DEVICE_UDEV_DEVICE_MANAGER_UDEV_H_
6 #define UI_EVENTS_OZONE_DEVICE_UDEV_DEVICE_MANAGER_UDEV_H_
8 #include "base/message_loop/message_pump_libevent.h"
9 #include "base/observer_list.h"
10 #include "device/udev_linux/udev.h"
11 #include "ui/events/ozone/device/device_manager.h"
13 namespace ui {
15 class DeviceEvent;
16 class DeviceEventObserver;
18 class DeviceManagerUdev
19 : public DeviceManager, base::MessagePumpLibevent::Watcher {
20 public:
21 DeviceManagerUdev();
22 virtual ~DeviceManagerUdev();
24 private:
25 scoped_ptr<DeviceEvent> ProcessMessage(udev_device* device);
27 // Creates a device-monitor to look for device add/remove/change events.
28 void CreateMonitor();
30 // DeviceManager overrides:
31 virtual void ScanDevices(DeviceEventObserver* observer) OVERRIDE;
32 virtual void AddObserver(DeviceEventObserver* observer) OVERRIDE;
33 virtual void RemoveObserver(DeviceEventObserver* observer) OVERRIDE;
35 // base::MessagePumpLibevent::Watcher overrides:
36 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE;
37 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE;
39 device::ScopedUdevPtr udev_;
40 device::ScopedUdevMonitorPtr monitor_;
42 base::MessagePumpLibevent::FileDescriptorWatcher controller_;
44 ObserverList<DeviceEventObserver> observers_;
46 DISALLOW_COPY_AND_ASSIGN(DeviceManagerUdev);
49 } // namespace ui
51 #endif // UI_EVENTS_OZONE_DEVICE_UDEV_DEVICE_MANAGER_UDEV_H_