Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium OS 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 POWER_MANAGER_UDEV_LISTENER_H_ | |
| 6 #define POWER_MANAGER_UDEV_LISTENER_H_ | |
| 7 | |
|
Daniel Erat
2011/04/14 20:48:37
nit: delete extra blank line
marcheu
2011/04/14 20:59:54
Done.
| |
| 8 | |
| 9 #include <glib.h> | |
| 10 #include <libudev.h> | |
| 11 #include <string> | |
| 12 | |
| 13 #include "base/basictypes.h" | |
| 14 | |
| 15 namespace power_manager { | |
| 16 | |
| 17 class UdevDelegate { | |
| 18 public: | |
| 19 virtual ~UdevDelegate() {} | |
| 20 virtual void Run(GIOChannel* source, GIOCondition condition) = 0; | |
| 21 }; | |
| 22 | |
| 23 class UdevController { | |
| 24 public: | |
| 25 UdevController(UdevDelegate* delegate, const std::string& subsystem); | |
| 26 ~UdevController(); | |
| 27 bool Init(); | |
| 28 | |
| 29 private: | |
| 30 static gboolean EventHandler(GIOChannel* source, | |
| 31 GIOCondition condition, | |
| 32 gpointer data); | |
| 33 | |
| 34 // Delegate for udev event; not owned. | |
| 35 UdevDelegate* delegate_; | |
| 36 | |
| 37 struct udev_monitor* monitor_; | |
| 38 struct udev* udev_; | |
| 39 std::string subsystem_; | |
| 40 | |
| 41 DISALLOW_COPY_AND_ASSIGN(UdevController); | |
| 42 }; | |
| 43 | |
| 44 } // namespace power_manager | |
| 45 | |
| 46 #endif // POWER_MANAGER_UDEV_LISTENER_H_ | |
| OLD | NEW |