Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / child / power_monitor_broadcast_source.h
blob7bed46beb4f8b7cbe833e8fe6b61a5aea9208d15
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_
6 #define CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_
8 #include "base/power_monitor/power_monitor_source.h"
9 #include "content/common/content_export.h"
10 #include "ipc/ipc_channel.h"
12 namespace IPC {
13 class MessageFilter;
16 namespace content {
18 class PowerMessageFilter;
20 // Receives Power Monitor IPC messages sent from the browser process and relays
21 // them to the PowerMonitor of the current process.
22 class CONTENT_EXPORT PowerMonitorBroadcastSource :
23 public base::PowerMonitorSource {
24 public:
25 explicit PowerMonitorBroadcastSource();
26 virtual ~PowerMonitorBroadcastSource();
28 IPC::MessageFilter* GetMessageFilter();
30 private:
31 friend class PowerMessageFilter;
33 virtual bool IsOnBatteryPowerImpl() OVERRIDE;
35 void OnPowerStateChange(bool on_battery_power);
36 void OnSuspend();
37 void OnResume();
39 bool last_reported_battery_power_state_;
40 scoped_refptr<PowerMessageFilter> message_filter_;
42 DISALLOW_COPY_AND_ASSIGN(PowerMonitorBroadcastSource);
45 } // namespace content
47 #endif // CONTENT_CHILD_POWER_MONITOR_MESSAGE_FILTER_H_