Index: device/battery/battery_monitor_impl.cc |
diff --git a/device/battery/battery_monitor_impl.cc b/device/battery/battery_monitor_impl.cc |
index dc07b62df1a8a2485016c3a059ee0be294c76c51..3cbf57d39394caa1e227fb677c4679a32bb24912 100644 |
--- a/device/battery/battery_monitor_impl.cc |
+++ b/device/battery/battery_monitor_impl.cc |
@@ -11,26 +11,24 @@ |
// 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 |