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

Side by Side Diff: Source/modules/battery/BatteryStatus.cpp

Issue 182613002: Add support to Battery Status API in blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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 /*
2 * Copyright (C) 2012 Samsung Electronics
3 * Copyright (C) 2014 Intel Corporation
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22 #include "modules/battery/BatteryStatus.h"
23
24 #include <limits>
25
26 namespace WebCore {
27
28 PassRefPtr<BatteryStatus> BatteryStatus::create()
29 {
30 return adoptRef(new BatteryStatus);
31 }
32
33 PassRefPtr<BatteryStatus> BatteryStatus::create(bool charging, double chargingTi me, double dischargingTime, double level)
34 {
35 return adoptRef(new BatteryStatus(charging, chargingTime, dischargingTime, l evel));
36 }
37
38 BatteryStatus::BatteryStatus()
39 : m_charging(true)
40 , m_chargingTime(0)
41 , m_dischargingTime(std::numeric_limits<double>::infinity())
42 , m_level(1)
43 {
44 }
45
46 BatteryStatus::BatteryStatus(bool charging, double chargingTime, double discharg ingTime, double level)
47 : m_charging(charging)
48 , m_chargingTime(chargingTime)
49 , m_dischargingTime(dischargingTime)
50 , m_level(level)
51 {
52 }
53
54 } // namespace WebCore
55
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698