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 | |
| 8 #include <string> | |
| 9 | |
| 10 #include <glib.h> | |
| 11 #include <libudev.h> | |
| 12 | |
| 13 namespace power_manager { | |
| 14 | |
| 15 class UdevCallback { | |
| 16 public: | |
| 17 virtual ~UdevCallback() {} | |
| 18 virtual void Run(GIOChannel* source, GIOCondition condition) = 0; | |
| 19 }; | |
| 20 | |
| 21 class UdevListener { | |
| 22 public: | |
| 23 UdevListener(UdevCallback* callback, std::string subsystem); | |
|
Daniel Erat
2011/04/14 19:18:46
nit: const std::string&
marcheu
2011/04/14 19:54:57
Done.
| |
| 24 ~UdevListener(); | |
| 25 bool Init(); | |
| 26 | |
| 27 private: | |
| 28 static gboolean EventHandler(GIOChannel* source, | |
| 29 GIOCondition condition, | |
| 30 gpointer data); | |
| 31 | |
| 32 // Callback on udev event; not owned. | |
| 33 UdevCallback* callback_; | |
| 34 | |
| 35 struct udev_monitor* monitor_; | |
| 36 struct udev* udev_; | |
| 37 std::string subsystem_; | |
| 38 }; | |
|
Daniel Erat
2011/04/14 19:18:46
include "base/basictypes.h" and add DISALLOW_COPY_
marcheu
2011/04/14 19:54:57
Done.
| |
| 39 | |
| 40 } // namespace power_manager | |
| 41 | |
| 42 #endif // POWER_MANAGER_UDEV_LISTENER_H_ | |
| OLD | NEW |