Index: device/battery/battery_monitor_impl.cc |
diff --git a/device/battery/battery_monitor_impl.cc b/device/battery/battery_monitor_impl.cc |
index 3cbf57d39394caa1e227fb677c4679a32bb24912..dc07b62df1a8a2485016c3a059ee0be294c76c51 100644 |
--- a/device/battery/battery_monitor_impl.cc |
+++ b/device/battery/battery_monitor_impl.cc |
@@ -11,24 +11,26 @@ namespace device { |
// static |
void BatteryMonitorImpl::Create( |
mojo::InterfaceRequest<BatteryMonitor> request) { |
- BindToRequest(new BatteryMonitorImpl(), &request); |
+ new BatteryMonitorImpl(request.Pass()); |
} |
-BatteryMonitorImpl::BatteryMonitorImpl() { |
+BatteryMonitorImpl::BatteryMonitorImpl( |
+ mojo::InterfaceRequest<BatteryMonitor> request) |
+ : binding_(this, request.Pass()), |
+ subscription_(BatteryStatusService::GetInstance()->AddCallback( |
+ base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)))) { |
} |
BatteryMonitorImpl::~BatteryMonitorImpl() { |
} |
-void BatteryMonitorImpl::OnConnectionEstablished() { |
- subscription_ = BatteryStatusService::GetInstance()->AddCallback( |
- base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this))); |
+void BatteryMonitorImpl::RegisterSubscription() { |
} |
void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) { |
BatteryStatusPtr status(BatteryStatus::New()); |
*status = battery_status; |
- client()->DidChange(status.Pass()); |
+ binding_.client()->DidChange(status.Pass()); |
} |
} // namespace device |