| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DEVICE_POWER_MONITOR_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | |
| 6 #define DEVICE_POWER_MONITOR_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/power_monitor/power_observer.h" | |
| 10 #include "device/power_monitor/power_monitor_export.h" | |
| 11 #include "device/power_monitor/public/interfaces/power_monitor.mojom.h" | |
| 12 | |
| 13 namespace device { | |
| 14 | |
| 15 // A class used to monitor the power state change and communicate it to child | |
| 16 // processes via IPC. | |
| 17 class DEVICE_POWER_MONITOR_EXPORT PowerMonitorMessageBroadcaster | |
| 18 : public base::PowerObserver, | |
| 19 NON_EXPORTED_BASE(public device::mojom::PowerMonitor) { | |
| 20 public: | |
| 21 explicit PowerMonitorMessageBroadcaster(); | |
| 22 ~PowerMonitorMessageBroadcaster() override; | |
| 23 | |
| 24 static void Create(device::mojom::PowerMonitorRequest request); | |
| 25 | |
| 26 // device::mojom::PowerMonitor: | |
| 27 void SetClient( | |
| 28 device::mojom::PowerMonitorClientPtr power_monitor_client) override; | |
| 29 | |
| 30 // base::PowerObserver: | |
| 31 void OnPowerStateChange(bool on_battery_power) override; | |
| 32 void OnSuspend() override; | |
| 33 void OnResume() override; | |
| 34 | |
| 35 private: | |
| 36 device::mojom::PowerMonitorClientPtr power_monitor_client_; | |
| 37 | |
| 38 DISALLOW_COPY_AND_ASSIGN(PowerMonitorMessageBroadcaster); | |
| 39 }; | |
| 40 | |
| 41 } // namespace device | |
| 42 | |
| 43 #endif // DEVICE_POWER_MONITOR_POWER_MONITOR_MESSAGE_BROADCASTER_H_ | |
| OLD | NEW |