Chromium Code Reviews| Index: udev_listener.h |
| diff --git a/udev_listener.h b/udev_listener.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..becd7adbe9b0df0446d487448ceedb7c3624bb3e |
| --- /dev/null |
| +++ b/udev_listener.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef POWER_MANAGER_UDEV_LISTENER_H_ |
| +#define POWER_MANAGER_UDEV_LISTENER_H_ |
| + |
| +#include <string> |
|
tfarina
2011/04/14 20:03:57
this should be included after libudev.h since it's
marcheu
2011/04/14 20:41:24
Done.
|
| + |
| +#include <glib.h> |
| +#include <libudev.h> |
| + |
| +#include "base/basictypes.h" |
| + |
| +namespace power_manager { |
| + |
| +class UdevCallback { |
|
tfarina
2011/04/14 20:03:57
Thinking about this now, I'd rename this to UdevDe
marcheu
2011/04/14 20:41:24
Done.
|
| + public: |
| + virtual ~UdevCallback() {} |
| + virtual void Run(GIOChannel* source, GIOCondition condition) = 0; |
| +}; |
| + |
| +class UdevListener { |
|
tfarina
2011/04/14 20:03:57
And maybe this to UdevController? I know it's list
marcheu
2011/04/14 20:41:24
Done.
|
| + public: |
| + UdevListener(UdevCallback* callback, const std::string& subsystem); |
| + ~UdevListener(); |
| + bool Init(); |
| + |
| + private: |
| + static gboolean EventHandler(GIOChannel* source, |
| + GIOCondition condition, |
| + gpointer data); |
| + |
| + // Callback on udev event; not owned. |
| + UdevCallback* callback_; |
| + |
| + struct udev_monitor* monitor_; |
| + struct udev* udev_; |
| + std::string subsystem_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UdevListener); |
| +}; |
| + |
| +} // namespace power_manager |
| + |
| +#endif // POWER_MANAGER_UDEV_LISTENER_H_ |