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

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

Issue 457933002: Replace Chrome IPC with Mojo IPC for querying BatteryStatus service Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « device/battery/battery_monitor_impl.h ('k') | device/battery/battery_status.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/battery/battery_monitor_impl.h"
6
7 #include "base/bind.h"
8
9 namespace device {
10
11 //static
12 void BatteryMonitorImpl::Create(
13 mojo::InterfaceRequest<BatteryMonitor> request) {
14 BindToRequest(new BatteryMonitorImpl(), &request);
15 }
16
17 BatteryMonitorImpl::BatteryMonitorImpl() {
18 }
19
20 BatteryMonitorImpl::~BatteryMonitorImpl() {
21 }
22
23 void BatteryMonitorImpl::OnConnectionEstablished() {
24 subscription_ = BatteryStatusService::GetInstance()->AddCallback(
25 base::Bind(&BatteryMonitorImpl::DidChange, base::Unretained(this)));
26 }
27
28 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) {
29 BatteryStatusPtr status(BatteryStatus::New());
30 *status = battery_status;
31 client()->DidChange(status.Pass());
32 }
33
34 } // namespace device
OLDNEW
« no previous file with comments | « device/battery/battery_monitor_impl.h ('k') | device/battery/battery_status.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698