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

Unified 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: Add NeedsRebaseline for 4 tests for Mac. 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/battery/BatteryStatus.cpp
diff --git a/Source/modules/battery/BatteryStatus.cpp b/Source/modules/battery/BatteryStatus.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b91ec1096c8915ac52c444e5afc5be65b9af2de7
--- /dev/null
+++ b/Source/modules/battery/BatteryStatus.cpp
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/battery/BatteryStatus.h"
+
+#include <limits>
+
+namespace WebCore {
+
+PassOwnPtr<BatteryStatus> BatteryStatus::create()
+{
+ return adoptPtr(new BatteryStatus);
+}
+
+PassOwnPtr<BatteryStatus> BatteryStatus::create(bool charging, double chargingTime, double dischargingTime, double level)
+{
+ return adoptPtr(new BatteryStatus(charging, chargingTime, dischargingTime, level));
+}
+
+BatteryStatus::BatteryStatus()
+ : m_charging(true)
+ , m_chargingTime(0)
+ , m_dischargingTime(std::numeric_limits<double>::infinity())
+ , m_level(1)
+{
+}
+
+BatteryStatus::BatteryStatus(bool charging, double chargingTime, double dischargingTime, double level)
+ : m_charging(charging)
+ , m_chargingTime(chargingTime)
+ , m_dischargingTime(dischargingTime)
+ , m_level(level)
+{
+}
+
+} // namespace WebCore
+

Powered by Google App Engine
This is Rietveld 408576698