Chromium Code Reviews| Index: content/common/power_monitor_broadcast_source.h |
| diff --git a/content/common/power_monitor_broadcast_source.h b/content/common/power_monitor_broadcast_source.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..60132eaf419aca4e6c81ac0533dd0ca8562bbcae |
| --- /dev/null |
| +++ b/content/common/power_monitor_broadcast_source.h |
| @@ -0,0 +1,57 @@ |
| +// Copyright (c) 2013 The Chromium 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 CONTENT_COMMON_POWER_MONITOR_BROADCAST_SOURCE_H_ |
| +#define CONTENT_COMMON_POWER_MONITOR_BROADCAST_SOURCE_H_ |
| + |
| +#include "base/power_monitor/power_monitor_source.h" |
| + |
| +#include "ipc/ipc_channel.h" |
| +#include "ipc/ipc_channel_proxy.h" |
| + |
| +namespace content { |
| + |
| +class PowerMonitorBroadcastSource : public base::PowerMonitorSource { |
| + public: |
| + PowerMonitorBroadcastSource(); |
| + virtual ~PowerMonitorBroadcastSource(); |
| + |
| + IPC::ChannelProxy::MessageFilter* MessageFilter(); |
| + |
| + private: |
| + friend class PowerMonitorMessageFilter; |
| + |
| + class PowerMessageFilter : public IPC::ChannelProxy::MessageFilter { |
| + public: |
| + PowerMessageFilter(PowerMonitorBroadcastSource* source); |
|
apatrick_chromium
2013/07/01 23:59:58
This constructor should be explicit.
|
| + |
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| + |
| + private: |
| + friend class base::RefCounted<PowerMessageFilter>; |
| + |
| + virtual ~PowerMessageFilter(); |
| + |
| + void OnPowerStateChange(bool on_battery_power); |
| + void OnSuspend(); |
| + void OnResume(); |
| + |
| + PowerMonitorBroadcastSource* source_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(PowerMessageFilter); |
| + }; |
| + |
| + virtual bool IsBatteryPower() OVERRIDE; |
| + |
| + void OnPowerStateChange(bool on_battery_power); |
| + void OnSuspend(); |
| + void OnResume(); |
| + |
| + bool on_battery_power_; |
| + scoped_refptr<PowerMessageFilter> message_filter_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_COMMON_POWER_MONITOR_MESSAGE_FILTER_H_ |
|
Ken Russell (switch to Gerrit)
2013/07/02 09:05:15
Wrong name in #include guard.
|