Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.cc

Issue 1740843002: Revert of Migrates battery_status from content/renderer/ to WebKit/platform/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.cc
diff --git a/third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.cc b/third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.cc
deleted file mode 100644
index 1d052dddaf732d20cb99c6bec5acca217d3c4538..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/platform/battery/battery_dispatcher_proxy.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "platform/battery/battery_dispatcher_proxy.h"
-
-#include "platform/battery/battery_status.h"
-#include "platform/threading/BindForMojo.h"
-#include "public/platform/Platform.h"
-#include "wtf/Assertions.h"
-
-namespace blink {
-
-BatteryDispatcherProxy::BatteryDispatcherProxy(Listener* listener)
- : listener_(listener) {
- ASSERT(listener_);
-}
-
-BatteryDispatcherProxy::~BatteryDispatcherProxy() {}
-
-void BatteryDispatcherProxy::StartListening() {
- ASSERT(!monitor_.is_bound());
- Platform::current()->connectToRemoteService(mojo::GetProxy(&monitor_));
- // monitor_ can be null during testing.
- if (monitor_)
- QueryNextStatus();
-}
-
-void BatteryDispatcherProxy::StopListening() {
- // monitor_ can be null during testing.
- if (monitor_)
- monitor_.reset();
-}
-
-void BatteryDispatcherProxy::QueryNextStatus() {
- monitor_->QueryNextStatus(
- sameThreadBindForMojo(&BatteryDispatcherProxy::OnDidChange, this));
-}
-
-void BatteryDispatcherProxy::OnDidChange(
- device::BatteryStatusPtr battery_status) {
- // monitor_ can be null during testing.
- if (monitor_)
- QueryNextStatus();
-
- DCHECK(battery_status);
-
- BatteryStatus status(battery_status->charging,
- battery_status->charging_time,
- battery_status->discharging_time,
- battery_status->level);
- listener_->OnUpdateBatteryStatus(status);
-}
-
-} // namespace blink

Powered by Google App Engine