OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_UDEV_LINUX_H_ |
| 6 #define CONTENT_BROWSER_UDEV_LINUX_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_pump_libevent.h" |
| 11 |
| 12 extern "C" { |
| 13 struct udev; |
| 14 struct udev_device; |
| 15 struct udev_monitor; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 class UdevLinux : public base::MessagePumpLibevent::Watcher { |
| 21 public: |
| 22 UdevLinux(); |
| 23 virtual ~UdevLinux(); |
| 24 |
| 25 virtual void Notify(udev_device* device) = 0; |
| 26 |
| 27 protected: |
| 28 virtual void StartMonitoring(); |
| 29 udev* udev_handle(); |
| 30 udev_monitor* monitor(); |
| 31 |
| 32 private: |
| 33 // base::MessagePump:Libevent::Watcher: |
| 34 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
| 35 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
| 36 |
| 37 // libudev-related items, the main context, and the monitoring context to be |
| 38 // notified about changes to device states. |
| 39 udev* udev_; |
| 40 udev_monitor* monitor_; |
| 41 int monitor_fd_; |
| 42 base::MessagePumpLibevent::FileDescriptorWatcher monitor_watcher_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(UdevLinux); |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_BROWSER_UDEV_LINUX_H_ |
OLD | NEW |