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

Side by Side Diff: content/renderer/battery_status/fake_battery_status_dispatcher.cc

Issue 298263002: Battery Status API: add testing support for LayoutTests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 6 years, 6 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
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 "fake_battery_status_dispatcher.h"
6
7 #include "base/bind.h"
8 #include "base/location.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "third_party/WebKit/public/platform/WebBatteryStatusListener.h"
11
12 namespace content {
13
14 FakeBatteryStatusDispatcher::FakeBatteryStatusDispatcher() : listener_(0) {
15 }
16
17 void FakeBatteryStatusDispatcher::SetListener(
18 blink::WebBatteryStatusListener* listener) {
19 listener_ = listener;
20 }
21
22 void FakeBatteryStatusDispatcher::PostBatteryStatusChange(
23 const blink::WebBatteryStatus& status) {
24 if (!listener_)
25 return;
26
27 base::MessageLoopProxy::current()->PostTask(
28 FROM_HERE,
29 base::Bind(&blink::WebBatteryStatusListener::updateBatteryStatus,
30 base::Unretained(listener_),
31 status));
32 }
33
34 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698