Chromium Code Reviews| Index: udev_listener.h |
| diff --git a/udev_listener.h b/udev_listener.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a6e6cdd25a0d33c6d8b09cee3e1c5ff57430cfa7 |
| --- /dev/null |
| +++ b/udev_listener.h |
| @@ -0,0 +1,40 @@ |
| +// 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 <glib.h> |
| +#include <libudev.h> |
| +#include <string> |
|
Daniel Erat
2011/04/13 23:33:26
nit: this should come first, followed by a blank l
marcheu
2011/04/14 02:23:55
Done.
|
| + |
| +namespace power_manager { |
| + |
| +class UdevCallBack { |
| + public: |
|
Daniel Erat
2011/04/13 23:33:26
classes with virtual methods should have virtual d
marcheu
2011/04/14 02:23:55
Done.
|
| + virtual void CallBack(GIOChannel* source, GIOCondition condition) = 0; |
|
Daniel Erat
2011/04/13 23:33:26
nit: rename to something like Run()
marcheu
2011/04/14 02:23:55
Done.
|
| +}; |
| + |
| +class UdevListener { |
| + public: |
| + UdevListener(UdevCallBack* callback, std::string subsystem); |
| + ~UdevListener() {} |
| + bool Init(); |
| + |
| + private: |
| + static gboolean EventHandler(GIOChannel* source, |
| + GIOCondition condition, |
| + gpointer data); |
|
Daniel Erat
2011/04/13 23:33:26
nit: add blank line after this
marcheu
2011/04/14 02:23:55
Done.
|
| + // Callback on udev event; not owned. |
| + UdevCallBack* callback_; |
| + |
|
Daniel Erat
2011/04/13 23:33:26
nit: delete extra blank line
marcheu
2011/04/14 02:23:55
Done.
|
| + |
| + struct udev_monitor* monitor_; |
| + std::string subsystem_; |
| +}; |
| + |
| +} // namespace power_manager |
| + |
| +#endif // POWER_MANAGER_UDEV_LISTENER_H_ |
| + |