OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | 5 #ifndef CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ |
6 #define CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | 6 #define CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | |
10 #include "base/power_monitor/power_observer.h" | 9 #include "base/power_monitor/power_observer.h" |
11 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
12 #include "content/public/browser/browser_thread.h" | |
13 | 11 |
14 namespace IPC { | 12 namespace IPC { |
15 class Sender; | 13 class Sender; |
16 } | 14 } |
17 | 15 |
18 namespace content { | 16 namespace content { |
19 | 17 |
20 // A class used to monitor the power state change and communicate it to child | 18 // A class used to monitor the power state change and communicate it to child |
21 // processes via IPC. | 19 // processes via IPC. |
22 class CONTENT_EXPORT PowerMonitorMessageBroadcaster | 20 class CONTENT_EXPORT PowerMonitorMessageBroadcaster |
23 : public base::PowerObserver { | 21 : public base::PowerObserver { |
24 public: | 22 public: |
25 explicit PowerMonitorMessageBroadcaster(IPC::Sender* sender); | 23 explicit PowerMonitorMessageBroadcaster(IPC::Sender* sender); |
26 virtual ~PowerMonitorMessageBroadcaster(); | 24 virtual ~PowerMonitorMessageBroadcaster(); |
27 | 25 |
28 // Implement PowerObserver. | 26 // Implement PowerObserver. |
29 virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE; | 27 virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE; |
30 virtual void OnSuspend() OVERRIDE; | 28 virtual void OnSuspend() OVERRIDE; |
31 virtual void OnResume() OVERRIDE; | 29 virtual void OnResume() OVERRIDE; |
32 | 30 |
33 private: | 31 private: |
34 IPC::Sender* sender_; | 32 IPC::Sender* sender_; |
35 | 33 |
36 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcaster); | 34 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcaster); |
37 }; | 35 }; |
38 | 36 |
39 } // namespace base | 37 } // namespace content |
40 | 38 |
41 #endif // CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | 39 #endif // CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ |
OLD | NEW |