| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_ | 5 #ifndef CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_ |
| 6 #define CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_ | 6 #define CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_ |
| 7 | 7 |
| 8 #include "base/power_monitor/power_monitor_source.h" | 8 #include "base/power_monitor/power_monitor_source.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "ipc/ipc_channel.h" | 10 #include "ipc/ipc_channel.h" |
| 11 #include "ipc/ipc_channel_proxy.h" | 11 |
| 12 namespace IPC { |
| 13 class MessageFilter; |
| 14 } |
| 12 | 15 |
| 13 namespace content { | 16 namespace content { |
| 14 | 17 |
| 15 class PowerMessageFilter; | 18 class PowerMessageFilter; |
| 16 | 19 |
| 17 // Receives Power Monitor IPC messages sent from the browser process and relays | 20 // Receives Power Monitor IPC messages sent from the browser process and relays |
| 18 // them to the PowerMonitor of the current process. | 21 // them to the PowerMonitor of the current process. |
| 19 class CONTENT_EXPORT PowerMonitorBroadcastSource : | 22 class CONTENT_EXPORT PowerMonitorBroadcastSource : |
| 20 public base::PowerMonitorSource { | 23 public base::PowerMonitorSource { |
| 21 public: | 24 public: |
| 22 explicit PowerMonitorBroadcastSource(); | 25 explicit PowerMonitorBroadcastSource(); |
| 23 virtual ~PowerMonitorBroadcastSource(); | 26 virtual ~PowerMonitorBroadcastSource(); |
| 24 | 27 |
| 25 IPC::ChannelProxy::MessageFilter* GetMessageFilter(); | 28 IPC::MessageFilter* GetMessageFilter(); |
| 26 | 29 |
| 27 private: | 30 private: |
| 28 friend class PowerMessageFilter; | 31 friend class PowerMessageFilter; |
| 29 | 32 |
| 30 virtual bool IsOnBatteryPowerImpl() OVERRIDE; | 33 virtual bool IsOnBatteryPowerImpl() OVERRIDE; |
| 31 | 34 |
| 32 void OnPowerStateChange(bool on_battery_power); | 35 void OnPowerStateChange(bool on_battery_power); |
| 33 void OnSuspend(); | 36 void OnSuspend(); |
| 34 void OnResume(); | 37 void OnResume(); |
| 35 | 38 |
| 36 bool last_reported_battery_power_state_; | 39 bool last_reported_battery_power_state_; |
| 37 scoped_refptr<PowerMessageFilter> message_filter_; | 40 scoped_refptr<PowerMessageFilter> message_filter_; |
| 38 | 41 |
| 39 DISALLOW_COPY_AND_ASSIGN(PowerMonitorBroadcastSource); | 42 DISALLOW_COPY_AND_ASSIGN(PowerMonitorBroadcastSource); |
| 40 }; | 43 }; |
| 41 | 44 |
| 42 } // namespace content | 45 } // namespace content |
| 43 | 46 |
| 44 #endif // CONTENT_CHILD_POWER_MONITOR_MESSAGE_FILTER_H_ | 47 #endif // CONTENT_CHILD_POWER_MONITOR_MESSAGE_FILTER_H_ |
| OLD | NEW |