Chromium Code Reviews| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/power_monitor/power_observer.h" | 9 #include "base/power_monitor/power_observer.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 | 11 #include "device/power_monitor/public/interfaces/power_monitor.mojom.h" |
| 12 namespace IPC { | |
| 13 class Sender; | |
| 14 } | |
| 15 | 12 |
| 16 namespace content { | 13 namespace content { |
| 17 | 14 |
| 18 // A class used to monitor the power state change and communicate it to child | 15 // A class used to monitor the power state change and communicate it to child |
| 19 // processes via IPC. | 16 // processes via IPC. |
| 20 class CONTENT_EXPORT PowerMonitorMessageBroadcaster | 17 class CONTENT_EXPORT PowerMonitorMessageBroadcaster |
| 21 : public base::PowerObserver { | 18 : public base::PowerObserver, |
| 19 NON_EXPORTED_BASE(public device::mojom::PowerMonitor) { | |
| 22 public: | 20 public: |
| 23 explicit PowerMonitorMessageBroadcaster(IPC::Sender* sender); | 21 explicit PowerMonitorMessageBroadcaster(); |
| 24 ~PowerMonitorMessageBroadcaster() override; | 22 ~PowerMonitorMessageBroadcaster() override; |
| 25 | 23 |
| 24 static void Create(device::mojom::PowerMonitorRequest request); | |
| 25 | |
| 26 // Implement device::mojom::PowerMonitor. | |
|
blundell
2016/10/25 16:53:44
nit:
device::mojom::PowerMonitor:
ke.he
2016/10/26 10:01:51
Done.
| |
| 27 void AddClient( | |
| 28 device::mojom::PowerMonitorClientPtr power_monitor_client) override; | |
| 29 | |
| 26 // Implement PowerObserver. | 30 // Implement PowerObserver. |
| 27 void OnPowerStateChange(bool on_battery_power) override; | 31 void OnPowerStateChange(bool on_battery_power) override; |
| 28 void OnSuspend() override; | 32 void OnSuspend() override; |
| 29 void OnResume() override; | 33 void OnResume() override; |
| 30 | 34 |
| 31 void Init(); | |
| 32 | |
| 33 private: | 35 private: |
| 34 IPC::Sender* sender_; | 36 device::mojom::PowerMonitorClientPtr power_monitor_client_; |
| 35 | 37 |
| 36 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcaster); | 38 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcaster); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 } // namespace content | 41 } // namespace content |
| 40 | 42 |
| 41 #endif // CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | 43 #endif // CONTENT_BROWSER_POWER_MONITOR_MESSAGE_BROADCASTER_H_ |
| OLD | NEW |