summaryrefslogtreecommitdiffstats
path: root/device/battery
diff options
context:
space:
mode:
authorthakis <thakis@chromium.org>2014-11-14 16:04:25 -0800
committerCommit bot <commit-bot@chromium.org>2014-11-15 00:04:49 +0000
commit671db43a735bd2297225b9d74129402e66fdc549 (patch)
treeeeeb2735f56d964bcdd6a6bf8aa206d41a744b6c /device/battery
parent3ec1799a199d75eda8bfe2040252df4e05e10735 (diff)
downloadchromium_src-671db43a735bd2297225b9d74129402e66fdc549.zip
chromium_src-671db43a735bd2297225b9d74129402e66fdc549.tar.gz
chromium_src-671db43a735bd2297225b9d74129402e66fdc549.tar.bz2
Revert of Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (patchset #3 id:40001 of https://codereview.chromium.org/728553002/)
Reason for revert: Breaks incremental builds, crbug.com/433524 Original issue's description: > Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 > > TBR=jam@chromium.org > > Committed: https://crrev.com/184f354ddeff66784515ddbbee9c46355cadab6a > Cr-Commit-Position: refs/heads/master@{#304114} TBR=jam@chromium.org,jamesr@chromium.org NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/728043002 Cr-Commit-Position: refs/heads/master@{#304305}
Diffstat (limited to 'device/battery')
-rw-r--r--device/battery/battery_monitor_impl.cc14
-rw-r--r--device/battery/battery_monitor_impl.h18
2 files changed, 14 insertions, 18 deletions
diff --git a/device/battery/battery_monitor_impl.cc b/device/battery/battery_monitor_impl.cc
index dc07b62..3cbf57d 100644
--- a/device/battery/battery_monitor_impl.cc
+++ b/device/battery/battery_monitor_impl.cc
@@ -11,26 +11,24 @@ namespace device {
// static
void BatteryMonitorImpl::Create(
mojo::InterfaceRequest<BatteryMonitor> request) {
- new BatteryMonitorImpl(request.Pass());
+ BindToRequest(new BatteryMonitorImpl(), &request);
}
-BatteryMonitorImpl::BatteryMonitorImpl(
- mojo::InterfaceRequest<BatteryMonitor> request)
- : binding_(this, request.Pass()),
- subscription_(BatteryStatusService::GetInstance()->AddCallback(
- base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)))) {
+BatteryMonitorImpl::BatteryMonitorImpl() {
}
BatteryMonitorImpl::~BatteryMonitorImpl() {
}
-void BatteryMonitorImpl::RegisterSubscription() {
+void BatteryMonitorImpl::OnConnectionEstablished() {
+ subscription_ = BatteryStatusService::GetInstance()->AddCallback(
+ base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)));
}
void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) {
BatteryStatusPtr status(BatteryStatus::New());
*status = battery_status;
- binding_.client()->DidChange(status.Pass());
+ client()->DidChange(status.Pass());
}
} // namespace device
diff --git a/device/battery/battery_monitor_impl.h b/device/battery/battery_monitor_impl.h
index 7916b0d..5c64843 100644
--- a/device/battery/battery_monitor_impl.h
+++ b/device/battery/battery_monitor_impl.h
@@ -2,33 +2,31 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
-#define DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
-
#include "base/memory/scoped_ptr.h"
#include "device/battery/battery_export.h"
#include "device/battery/battery_monitor.mojom.h"
#include "device/battery/battery_status_service.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
+
+#ifndef DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
+#define DEVICE_BATTERY_BATTERY_MONITOR_IMPL_H_
namespace device {
-class BatteryMonitorImpl : public BatteryMonitor {
+class BatteryMonitorImpl : public mojo::InterfaceImpl<BatteryMonitor> {
public:
DEVICE_BATTERY_EXPORT static void Create(
mojo::InterfaceRequest<BatteryMonitor> request);
private:
- explicit BatteryMonitorImpl(mojo::InterfaceRequest<BatteryMonitor> request);
+ BatteryMonitorImpl();
~BatteryMonitorImpl() override;
- void RegisterSubscription();
+ // mojo::InterfaceImpl<..> methods:
+ void OnConnectionEstablished() override;
+
void DidChange(const BatteryStatus& battery_status);
- mojo::StrongBinding<BatteryMonitor> binding_;
scoped_ptr<BatteryStatusService::BatteryUpdateSubscription> subscription_;
-
- DISALLOW_COPY_AND_ASSIGN(BatteryMonitorImpl);
};
} // namespace device