diff options
Diffstat (limited to 'Source/WebCore/Modules/battery')
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryClient.h | 44 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryController.cpp | 116 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryController.h | 65 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryManager.cpp | 112 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryManager.h | 87 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryManager.idl | 45 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryStatus.cpp | 58 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/BatteryStatus.h | 54 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/NavigatorBattery.cpp | 75 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/NavigatorBattery.h | 55 | ||||
-rw-r--r-- | Source/WebCore/Modules/battery/NavigatorBattery.idl | 24 |
11 files changed, 0 insertions, 735 deletions
diff --git a/Source/WebCore/Modules/battery/BatteryClient.h b/Source/WebCore/Modules/battery/BatteryClient.h deleted file mode 100644 index 2c87a44bb..000000000 --- a/Source/WebCore/Modules/battery/BatteryClient.h +++ /dev/null @@ -1,44 +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. - */ - -#ifndef BatteryClient_h -#define BatteryClient_h - -#if ENABLE(BATTERY_STATUS) - -namespace WebCore { - -class Page; - -class BatteryClient { -public: - virtual ~BatteryClient() { } - - virtual void startUpdating() = 0; - virtual void stopUpdating() = 0; - virtual void batteryControllerDestroyed() = 0; -}; - -void provideBatteryTo(Page*, BatteryClient*); - -} - -#endif // BATTERY_STATUS -#endif // BatteryClient_h - diff --git a/Source/WebCore/Modules/battery/BatteryController.cpp b/Source/WebCore/Modules/battery/BatteryController.cpp deleted file mode 100644 index f10883a14..000000000 --- a/Source/WebCore/Modules/battery/BatteryController.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * Copyright (C) 2012 Google Inc. - * - * 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 "BatteryController.h" - -#if ENABLE(BATTERY_STATUS) - -#include "BatteryClient.h" -#include "BatteryStatus.h" -#include "Event.h" - -namespace WebCore { - -BatteryController::BatteryController(BatteryClient* client) - : m_client(client) -{ - ASSERT(m_client); -} - -BatteryController::~BatteryController() -{ - for (ListenerVector::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) - (*it)->batteryControllerDestroyed(); - m_client->batteryControllerDestroyed(); -} - -PassOwnPtr<BatteryController> BatteryController::create(BatteryClient* client) -{ - return adoptPtr(new BatteryController(client)); -} - -void BatteryController::addListener(BatteryManager* batteryManager) -{ - m_listeners.append(batteryManager); - m_client->startUpdating(); - - if (m_batteryStatus) - batteryManager->updateBatteryStatus(m_batteryStatus); -} - -void BatteryController::removeListener(BatteryManager* batteryManager) -{ - size_t pos = m_listeners.find(batteryManager); - if (pos == WTF::notFound) - return; - m_listeners.remove(pos); - if (m_listeners.isEmpty()) - m_client->stopUpdating(); -} - -void BatteryController::updateBatteryStatus(PassRefPtr<BatteryStatus> batteryStatus) -{ - RefPtr<BatteryStatus> status = batteryStatus; - if (m_batteryStatus) { - if (m_batteryStatus->charging() != status->charging()) - didChangeBatteryStatus(WebCore::eventNames().chargingchangeEvent, status); - else if (status->charging() && m_batteryStatus->chargingTime() != status->chargingTime()) - didChangeBatteryStatus(WebCore::eventNames().chargingtimechangeEvent, status); - else if (!status->charging() && m_batteryStatus->dischargingTime() != status->dischargingTime()) - didChangeBatteryStatus(WebCore::eventNames().dischargingtimechangeEvent, status); - - if (m_batteryStatus->level() != status->level()) - didChangeBatteryStatus(WebCore::eventNames().levelchangeEvent, status); - } else { - for (ListenerVector::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) - (*it)->updateBatteryStatus(status); - } - - m_batteryStatus = status.release(); -} - -void BatteryController::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus) -{ - RefPtr<Event> event = Event::create(eventType, false, false); - RefPtr<BatteryStatus> battery = batteryStatus; - for (ListenerVector::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) - (*it)->didChangeBatteryStatus(event, battery); -} - -const char* BatteryController::supplementName() -{ - return "BatteryController"; -} - -bool BatteryController::isActive(Page* page) -{ - return static_cast<bool>(BatteryController::from(page)); -} - -void provideBatteryTo(Page* page, BatteryClient* client) -{ - Supplement<Page>::provideTo(page, BatteryController::supplementName(), BatteryController::create(client)); -} - -} - -#endif // BATTERY_STATUS - diff --git a/Source/WebCore/Modules/battery/BatteryController.h b/Source/WebCore/Modules/battery/BatteryController.h deleted file mode 100644 index e43a092b8..000000000 --- a/Source/WebCore/Modules/battery/BatteryController.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2012 Samsung Electronics - * Copyright (C) 2012 Google Inc. - * - * 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. - */ - -#ifndef BatteryController_h -#define BatteryController_h - -#if ENABLE(BATTERY_STATUS) - -#include "BatteryManager.h" -#include "Page.h" - -namespace WebCore { - -class BatteryClient; - -class BatteryController : public Supplement<Page> { -public: - ~BatteryController(); - - static PassOwnPtr<BatteryController> create(BatteryClient*); - - void addListener(BatteryManager*); - void removeListener(BatteryManager*); - void updateBatteryStatus(PassRefPtr<BatteryStatus>); - void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>); - - BatteryClient* client() const { return m_client; } - - static const char* supplementName(); - static BatteryController* from(Page* page) { return static_cast<BatteryController*>(Supplement<Page>::from(page, supplementName())); } - static bool isActive(Page*); - -private: - typedef Vector<BatteryManager*> ListenerVector; - - explicit BatteryController(BatteryClient*); - - BatteryClient* m_client; - ListenerVector m_listeners; - - RefPtr<BatteryStatus> m_batteryStatus; -}; - -} - -#endif // BATTERY_STATUS -#endif // BatteryController_h - diff --git a/Source/WebCore/Modules/battery/BatteryManager.cpp b/Source/WebCore/Modules/battery/BatteryManager.cpp deleted file mode 100644 index f637b524f..000000000 --- a/Source/WebCore/Modules/battery/BatteryManager.cpp +++ /dev/null @@ -1,112 +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 "BatteryManager.h" - -#if ENABLE(BATTERY_STATUS) - -#include "BatteryController.h" -#include "BatteryStatus.h" -#include "Document.h" -#include "Event.h" -#include "Frame.h" -#include "Navigator.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) -{ - updateBatteryStatus(batteryStatus); - dispatchEvent(event); -} - -void BatteryManager::updateBatteryStatus(PassRefPtr<BatteryStatus> batteryStatus) -{ - m_batteryStatus = batteryStatus; -} - -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 - diff --git a/Source/WebCore/Modules/battery/BatteryManager.h b/Source/WebCore/Modules/battery/BatteryManager.h deleted file mode 100644 index 93047a51d..000000000 --- a/Source/WebCore/Modules/battery/BatteryManager.h +++ /dev/null @@ -1,87 +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. - */ - -#ifndef BatteryManager_h -#define BatteryManager_h - -#if ENABLE(BATTERY_STATUS) - -#include "ActiveDOMObject.h" -#include "BatteryStatus.h" -#include "EventTarget.h" - -namespace WebCore { - -class BatteryController; -class Navigator; -class ScriptExecutionContext; - -class BatteryManager : public ActiveDOMObject, public RefCounted<BatteryManager>, public EventTarget { -public: - virtual ~BatteryManager(); - static PassRefPtr<BatteryManager> create(Navigator*); - - // EventTarget implementation. - virtual EventTargetInterface eventTargetInterface() const { return BatteryManagerEventTargetInterfaceType; } - virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); } - - bool charging(); - double chargingTime(); - double dischargingTime(); - double level(); - - DEFINE_ATTRIBUTE_EVENT_LISTENER(chargingchange); - DEFINE_ATTRIBUTE_EVENT_LISTENER(chargingtimechange); - DEFINE_ATTRIBUTE_EVENT_LISTENER(dischargingtimechange); - DEFINE_ATTRIBUTE_EVENT_LISTENER(levelchange); - - void didChangeBatteryStatus(PassRefPtr<Event>, PassRefPtr<BatteryStatus>); - void updateBatteryStatus(PassRefPtr<BatteryStatus>); - void batteryControllerDestroyed() { m_batteryController = 0; } - - using RefCounted<BatteryManager>::ref; - using RefCounted<BatteryManager>::deref; - - // ActiveDOMObject implementation. - virtual bool canSuspend() const { return true; } - virtual void suspend(ReasonForSuspension); - virtual void resume(); - virtual void stop(); - -protected: - virtual EventTargetData* eventTargetData() { return &m_eventTargetData; } - virtual EventTargetData& ensureEventTargetData() { return m_eventTargetData; } - -private: - explicit BatteryManager(Navigator*); - - // EventTarget implementation. - virtual void refEventTarget() { ref(); } - virtual void derefEventTarget() { deref(); } - - BatteryController* m_batteryController; - EventTargetData m_eventTargetData; - RefPtr<BatteryStatus> m_batteryStatus; -}; - -} - -#endif // BATTERY_STATUS -#endif // BatteryManager_h - diff --git a/Source/WebCore/Modules/battery/BatteryManager.idl b/Source/WebCore/Modules/battery/BatteryManager.idl deleted file mode 100644 index be8b74358..000000000 --- a/Source/WebCore/Modules/battery/BatteryManager.idl +++ /dev/null @@ -1,45 +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. - */ - -// http://dev.w3.org/2009/dap/system-info/battery-status.html -[ - NoInterfaceObject, - Conditional=BATTERY_STATUS, - ActiveDOMObject, - EventTarget, -] interface BatteryManager { - readonly attribute boolean charging; - readonly attribute double chargingTime; - readonly attribute double dischargingTime; - readonly attribute double level; - - attribute EventListener onchargingchange; - attribute EventListener onchargingtimechange; - attribute EventListener ondischargingtimechange; - attribute EventListener onlevelchange; - - // EventTarget interface - void addEventListener(DOMString type, - EventListener listener, - optional boolean useCapture); - void removeEventListener(DOMString type, - EventListener listener, - optional boolean useCapture); - [RaisesException] boolean dispatchEvent(Event event); -}; diff --git a/Source/WebCore/Modules/battery/BatteryStatus.cpp b/Source/WebCore/Modules/battery/BatteryStatus.cpp deleted file mode 100644 index 00f530bf8..000000000 --- a/Source/WebCore/Modules/battery/BatteryStatus.cpp +++ /dev/null @@ -1,58 +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 "BatteryStatus.h" - -#if ENABLE(BATTERY_STATUS) - -#include <limits> - -namespace WebCore { - -PassRefPtr<BatteryStatus> BatteryStatus::create() -{ - return adoptRef(new BatteryStatus); -} - -PassRefPtr<BatteryStatus> BatteryStatus::create(bool charging, double chargingTime, double dischargingTime, double level) -{ - return adoptRef(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 - -#endif // BATTERY_STATUS - diff --git a/Source/WebCore/Modules/battery/BatteryStatus.h b/Source/WebCore/Modules/battery/BatteryStatus.h deleted file mode 100644 index 2c451ab4e..000000000 --- a/Source/WebCore/Modules/battery/BatteryStatus.h +++ /dev/null @@ -1,54 +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. - */ - -#ifndef BatteryStatus_h -#define BatteryStatus_h - -#if ENABLE(BATTERY_STATUS) - -#include <wtf/PassRefPtr.h> -#include <wtf/RefCounted.h> - -namespace WebCore { - -class BatteryStatus : public RefCounted<BatteryStatus> { -public: - static PassRefPtr<BatteryStatus> create(); - static PassRefPtr<BatteryStatus> create(bool charging, double chargingTime, double dischargingTime, double level); - - bool charging() const { return m_charging; } - double chargingTime() const { return m_chargingTime; } - double dischargingTime() const { return m_dischargingTime; } - double level() const { return m_level; } - -private: - BatteryStatus(); - BatteryStatus(bool charging, double chargingTime, double dischargingTime, double level); - - bool m_charging; - double m_chargingTime; - double m_dischargingTime; - double m_level; -}; - -} // namespace WebCore - -#endif // BATTERY_STATUS -#endif // BatteryStatus_h - diff --git a/Source/WebCore/Modules/battery/NavigatorBattery.cpp b/Source/WebCore/Modules/battery/NavigatorBattery.cpp deleted file mode 100644 index 6ae0c9d98..000000000 --- a/Source/WebCore/Modules/battery/NavigatorBattery.cpp +++ /dev/null @@ -1,75 +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 "NavigatorBattery.h" - -#if ENABLE(BATTERY_STATUS) - -#include "BatteryController.h" -#include "BatteryManager.h" -#include "Navigator.h" -#include "ScriptExecutionContext.h" - -namespace WebCore { - -NavigatorBattery::NavigatorBattery() -{ -} - -NavigatorBattery::~NavigatorBattery() -{ -} - -BatteryManager* NavigatorBattery::webkitBattery(Navigator* navigator) -{ - if (!navigator->frame()) - return 0; - - NavigatorBattery* navigatorBattery = NavigatorBattery::from(navigator); - if (!navigatorBattery->m_batteryManager) - navigatorBattery->m_batteryManager = BatteryManager::create(navigator); - return navigatorBattery->m_batteryManager.get(); -} - -const char* NavigatorBattery::supplementName() -{ - return "NavigatorBattery"; -} - -NavigatorBattery* NavigatorBattery::from(Navigator* navigator) -{ - NavigatorBattery* supplement = static_cast<NavigatorBattery*>(Supplement<Navigator>::from(navigator, supplementName())); - if (!supplement) { - supplement = new NavigatorBattery(); - provideTo(navigator, supplementName(), adoptPtr(supplement)); - } - return supplement; -} - -BatteryManager* NavigatorBattery::batteryManager() -{ - return m_batteryManager.get(); -} - -} // namespace WebCore - -#endif // ENABLE(BATTERY_STATUS) - - diff --git a/Source/WebCore/Modules/battery/NavigatorBattery.h b/Source/WebCore/Modules/battery/NavigatorBattery.h deleted file mode 100644 index af7114f42..000000000 --- a/Source/WebCore/Modules/battery/NavigatorBattery.h +++ /dev/null @@ -1,55 +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. - */ - -#ifndef NavigatorBattery_h -#define NavigatorBattery_h - -#if ENABLE(BATTERY_STATUS) - -#include "Supplementable.h" - -namespace WebCore { - -class BatteryManager; -class Navigator; -class ScriptExecutionContext; - -class NavigatorBattery : public Supplement<Navigator> { -public: - virtual ~NavigatorBattery(); - - static NavigatorBattery* from(Navigator*); - - static BatteryManager* webkitBattery(Navigator*); - BatteryManager* batteryManager(); - - private: - NavigatorBattery(); - static const char* supplementName(); - - RefPtr<BatteryManager> m_batteryManager; -}; - -} // namespace WebCore - -#endif // ENABLE(BATTERY_STATUS) - -#endif // NavigatorBattery_h - - diff --git a/Source/WebCore/Modules/battery/NavigatorBattery.idl b/Source/WebCore/Modules/battery/NavigatorBattery.idl deleted file mode 100644 index f69199fd2..000000000 --- a/Source/WebCore/Modules/battery/NavigatorBattery.idl +++ /dev/null @@ -1,24 +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. - */ - -[ - Conditional=BATTERY_STATUS, -] partial interface Navigator { - readonly attribute BatteryManager webkitBattery; -}; |