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

Side by Side Diff: device/battery/battery_monitor_impl.cc

Issue 728043002: Revert of Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « device/battery/battery_monitor_impl.h ('k') | media/mojo/services/mojo_demuxer_stream_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/battery/battery_monitor_impl.h" 5 #include "device/battery/battery_monitor_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 8
9 namespace device { 9 namespace device {
10 10
11 // static 11 // static
12 void BatteryMonitorImpl::Create( 12 void BatteryMonitorImpl::Create(
13 mojo::InterfaceRequest<BatteryMonitor> request) { 13 mojo::InterfaceRequest<BatteryMonitor> request) {
14 new BatteryMonitorImpl(request.Pass()); 14 BindToRequest(new BatteryMonitorImpl(), &request);
15 } 15 }
16 16
17 BatteryMonitorImpl::BatteryMonitorImpl( 17 BatteryMonitorImpl::BatteryMonitorImpl() {
18 mojo::InterfaceRequest<BatteryMonitor> request)
19 : binding_(this, request.Pass()),
20 subscription_(BatteryStatusService::GetInstance()->AddCallback(
21 base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)))) {
22 } 18 }
23 19
24 BatteryMonitorImpl::~BatteryMonitorImpl() { 20 BatteryMonitorImpl::~BatteryMonitorImpl() {
25 } 21 }
26 22
27 void BatteryMonitorImpl::RegisterSubscription() { 23 void BatteryMonitorImpl::OnConnectionEstablished() {
24 subscription_ = BatteryStatusService::GetInstance()->AddCallback(
25 base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)));
28 } 26 }
29 27
30 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) { 28 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) {
31 BatteryStatusPtr status(BatteryStatus::New()); 29 BatteryStatusPtr status(BatteryStatus::New());
32 *status = battery_status; 30 *status = battery_status;
33 binding_.client()->DidChange(status.Pass()); 31 client()->DidChange(status.Pass());
34 } 32 }
35 33
36 } // namespace device 34 } // namespace device
OLDNEW
« no previous file with comments | « device/battery/battery_monitor_impl.h ('k') | media/mojo/services/mojo_demuxer_stream_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698