Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: device/power_monitor/public/cpp/power_monitor_broadcast_source.h

Issue 2460823002: Decouple Power Monitor from //content. (Closed)
Patch Set: Decouple Power Monitor from //content. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 DEVICE_POWER_MONITOR_POWER_MONITOR_BROADCAST_SOURCE_H_
6 #define CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_ 6 #define DEVICE_POWER_MONITOR_POWER_MONITOR_BROADCAST_SOURCE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/power_monitor/power_monitor_source.h" 9 #include "base/power_monitor/power_monitor_source.h"
10 #include "content/common/content_export.h" 10 #include "device/power_monitor/power_monitor_export.h"
11 #include "device/power_monitor/public/interfaces/power_monitor.mojom.h" 11 #include "device/power_monitor/public/interfaces/power_monitor.mojom.h"
12 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 13
14 namespace content { 14 namespace device {
15 15
16 // Receives Power Monitor IPC messages sent from the browser process and relays 16 // Set itself as a client of Power Monitor in browser process, Receives state-
blundell 2016/11/07 12:50:08 nit: Eliminate everything before "Receives". (in d
ke.he 2016/11/08 08:59:56 Done.
17 // them to the PowerMonitor of the current process. 17 // changes from Power Monitor through mojo, and relays them to the PowerMonitor
18 class CONTENT_EXPORT PowerMonitorBroadcastSource 18 // of the current process.
19 class DEVICE_POWER_MONITOR_EXPORT PowerMonitorBroadcastSource
19 : public base::PowerMonitorSource, 20 : public base::PowerMonitorSource,
20 NON_EXPORTED_BASE(public device::mojom::PowerMonitorClient) { 21 NON_EXPORTED_BASE(public device::mojom::PowerMonitorClient) {
21 public: 22 public:
22 explicit PowerMonitorBroadcastSource(); 23 explicit PowerMonitorBroadcastSource(
24 device::mojom::PowerMonitor* power_monitor);
blundell 2016/11/07 12:50:08 I was suggesting to initialize this with an Interf
ke.he 2016/11/08 08:59:56 I guess you mean InterfaceProvider here. Done.
23 ~PowerMonitorBroadcastSource() override; 25 ~PowerMonitorBroadcastSource() override;
24 26
25 void PowerStateChange(bool on_battery_power) override; 27 void PowerStateChange(bool on_battery_power) override;
26 void Suspend() override; 28 void Suspend() override;
27 void Resume() override; 29 void Resume() override;
28 30
29 private: 31 private:
30 bool IsOnBatteryPowerImpl() override; 32 bool IsOnBatteryPowerImpl() override;
31 bool last_reported_battery_power_state_; 33 bool last_reported_battery_power_state_;
32 mojo::Binding<device::mojom::PowerMonitorClient> binding_; 34 mojo::Binding<device::mojom::PowerMonitorClient> binding_;
33 35
34 DISALLOW_COPY_AND_ASSIGN(PowerMonitorBroadcastSource); 36 DISALLOW_COPY_AND_ASSIGN(PowerMonitorBroadcastSource);
35 }; 37 };
36 38
37 } // namespace content 39 } // namespace device
38 40
39 #endif // CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_ 41 #endif // DEVICE_POWER_MONITOR_POWER_MONITOR_BROADCAST_SOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698