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

Unified Diff: Source/modules/battery/BatteryManager.cpp

Issue 16298005: Remove Battery Status API support code from Blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/battery/BatteryManager.h ('k') | Source/modules/battery/BatteryManager.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/battery/BatteryManager.cpp
diff --git a/Source/modules/battery/BatteryManager.cpp b/Source/modules/battery/BatteryManager.cpp
deleted file mode 100644
index 29436dc0a733f659362e38411971a85299644673..0000000000000000000000000000000000000000
--- a/Source/modules/battery/BatteryManager.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2012 Samsung Electronics
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "modules/battery/BatteryManager.h"
-
-#if ENABLE(BATTERY_STATUS)
-
-#include "core/dom/Document.h"
-#include "core/dom/Event.h"
-#include "core/page/Frame.h"
-#include "core/page/Navigator.h"
-#include "modules/battery/BatteryController.h"
-#include "modules/battery/BatteryStatus.h"
-#include <limits>
-
-namespace WebCore {
-
-PassRefPtr<BatteryManager> BatteryManager::create(Navigator* navigator)
-{
- RefPtr<BatteryManager> batteryManager(adoptRef(new BatteryManager(navigator)));
- batteryManager->suspendIfNeeded();
- return batteryManager.release();
-}
-
-BatteryManager::~BatteryManager()
-{
-}
-
-BatteryManager::BatteryManager(Navigator* navigator)
- : ActiveDOMObject(navigator->frame()->document())
- , m_batteryController(BatteryController::from(navigator->frame()->page()))
- , m_batteryStatus(0)
-{
- m_batteryController->addListener(this);
-}
-
-bool BatteryManager::charging()
-{
- return m_batteryStatus ? m_batteryStatus->charging() : true;
-}
-
-double BatteryManager::chargingTime()
-{
- if (!m_batteryStatus || !m_batteryStatus->charging())
- return std::numeric_limits<double>::infinity();
-
- return m_batteryStatus->chargingTime();
-}
-
-double BatteryManager::dischargingTime()
-{
- if (!m_batteryStatus || m_batteryStatus->charging())
- return std::numeric_limits<double>::infinity();
-
- return m_batteryStatus->dischargingTime();
-}
-
-double BatteryManager::level()
-{
- return m_batteryStatus ? m_batteryStatus->level() : 1;
-}
-
-void BatteryManager::didChangeBatteryStatus(PassRefPtr<Event> event, PassRefPtr<BatteryStatus> batteryStatus)
-{
- m_batteryStatus = batteryStatus;
- dispatchEvent(event);
-}
-
-void BatteryManager::suspend(ReasonForSuspension)
-{
- if (m_batteryController)
- m_batteryController->removeListener(this);
-}
-
-void BatteryManager::resume()
-{
- if (m_batteryController)
- m_batteryController->addListener(this);
-}
-
-void BatteryManager::stop()
-{
- if (m_batteryController)
- m_batteryController->removeListener(this);
-}
-
-} // namespace WebCore
-
-#endif // BATTERY_STATUS
-
« no previous file with comments | « Source/modules/battery/BatteryManager.h ('k') | Source/modules/battery/BatteryManager.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698