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

Unified Diff: device/power_monitor/power_monitor_broadcast_source.cc

Issue 2460823002: Decouple Power Monitor from //content. (Closed)
Patch Set: Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: device/power_monitor/power_monitor_broadcast_source.cc
diff --git a/content/child/power_monitor_broadcast_source.cc b/device/power_monitor/power_monitor_broadcast_source.cc
similarity index 60%
rename from content/child/power_monitor_broadcast_source.cc
rename to device/power_monitor/power_monitor_broadcast_source.cc
index 94d11a87f5b6dc4ac96469271a6cb5c3d1ee1cd2..ae33f6b527f8565bd9b0a68e4ba823c4cecc252b 100644
--- a/content/child/power_monitor_broadcast_source.cc
+++ b/device/power_monitor/power_monitor_broadcast_source.cc
@@ -2,28 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/child/power_monitor_broadcast_source.h"
+#include "device/power_monitor/power_monitor_broadcast_source.h"
#include "base/location.h"
#include "base/macros.h"
-#include "content/child/child_thread_impl.h"
#include "mojo/public/cpp/bindings/binding.h"
-#include "services/service_manager/public/cpp/interface_provider.h"
-namespace content {
+namespace device {
PowerMonitorBroadcastSource::PowerMonitorBroadcastSource()
- : last_reported_battery_power_state_(false), binding_(this) {
- // May be null during test execution.
- if (ChildThreadImpl::current()) {
- device::mojom::PowerMonitorPtr power_monitor;
- ChildThreadImpl::current()->GetRemoteInterfaces()->GetInterface(
- mojo::GetProxy(&power_monitor));
- power_monitor->SetClient(binding_.CreateInterfacePtrAndBind());
- }
-}
+ : last_reported_battery_power_state_(false), binding_(this) {}
+
+PowerMonitorBroadcastSource::~PowerMonitorBroadcastSource() {}
-PowerMonitorBroadcastSource::~PowerMonitorBroadcastSource() {
+void PowerMonitorBroadcastSource::SetClient(
+ device::mojom::PowerMonitor* power_monitor) {
+ power_monitor->SetClient(binding_.CreateInterfacePtrAndBind());
}
bool PowerMonitorBroadcastSource::IsOnBatteryPowerImpl() {
@@ -43,4 +37,4 @@ void PowerMonitorBroadcastSource::Resume() {
ProcessPowerEvent(PowerMonitorSource::RESUME_EVENT);
}
-} // namespace content
+} // namespace device

Powered by Google App Engine
This is Rietveld 408576698