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

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

Issue 728133002: Update mojo sdk to rev e01f9a49449381a5eb430c1fd88bf2cae73ec35a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android + ios gyp fixes 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') | ipc/mojo/ipc_channel_mojo.cc » ('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 BindToRequest(new BatteryMonitorImpl(), &request); 14 new BatteryMonitorImpl(request.Pass());
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)))) {
18 } 22 }
19 23
20 BatteryMonitorImpl::~BatteryMonitorImpl() { 24 BatteryMonitorImpl::~BatteryMonitorImpl() {
21 } 25 }
22 26
23 void BatteryMonitorImpl::OnConnectionEstablished() { 27 void BatteryMonitorImpl::RegisterSubscription() {
24 subscription_ = BatteryStatusService::GetInstance()->AddCallback(
25 base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)));
26 } 28 }
27 29
28 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) { 30 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) {
29 BatteryStatusPtr status(BatteryStatus::New()); 31 BatteryStatusPtr status(BatteryStatus::New());
30 *status = battery_status; 32 *status = battery_status;
31 client()->DidChange(status.Pass()); 33 binding_.client()->DidChange(status.Pass());
32 } 34 }
33 35
34 } // namespace device 36 } // namespace device
OLDNEW
« no previous file with comments | « device/battery/battery_monitor_impl.h ('k') | ipc/mojo/ipc_channel_mojo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698