Chromium Code Reviews| Index: udev_controller.h |
| diff --git a/udev_controller.h b/udev_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..18b7525d0e4e9b90e203464c79cd31f8007a26b1 |
| --- /dev/null |
| +++ b/udev_controller.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_ |
| + |
|
Daniel Erat
2011/04/14 20:48:37
nit: delete extra blank line
marcheu
2011/04/14 20:59:54
Done.
|
| + |
| +#include <glib.h> |
| +#include <libudev.h> |
| +#include <string> |
| + |
| +#include "base/basictypes.h" |
| + |
| +namespace power_manager { |
| + |
| +class UdevDelegate { |
| + public: |
| + virtual ~UdevDelegate() {} |
| + virtual void Run(GIOChannel* source, GIOCondition condition) = 0; |
| +}; |
| + |
| +class UdevController { |
| + public: |
| + UdevController(UdevDelegate* delegate, const std::string& subsystem); |
| + ~UdevController(); |
| + bool Init(); |
| + |
| + private: |
| + static gboolean EventHandler(GIOChannel* source, |
| + GIOCondition condition, |
| + gpointer data); |
| + |
| + // Delegate for udev event; not owned. |
| + UdevDelegate* delegate_; |
| + |
| + struct udev_monitor* monitor_; |
| + struct udev* udev_; |
| + std::string subsystem_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UdevController); |
| +}; |
| + |
| +} // namespace power_manager |
| + |
| +#endif // POWER_MANAGER_UDEV_LISTENER_H_ |