• commit-queue@webkit.org's avatar
    .: Support for Battery Status API. · 0de163f6
    commit-queue@webkit.org authored
    https://bugs.webkit.org/show_bug.cgi?id=62698
    
    Enable BATTERY_STATUS for WebKit-Efl.
    http://www.w3.org/TR/battery-status/
    
    Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
    Reviewed by Adam Barth.
    
    * Source/cmake/OptionsEfl.cmake:
    * Source/cmakeconfig.h.cmake:
    
    Source/WebCore: Support for Battery Status API
    https://bugs.webkit.org/show_bug.cgi?id=62698
    
    Battery Status API is implemented under the Navigator class.
    Battery Status API has four types of events, and all events are operated based on a callback mechanism.
     : onchargingchange, onchargingtimechange, ondischargingtimechange, onlevelchange.
    The battery status can be accessed using BatteryManager(navigator.webkitBattery), and battery status is controlled by BatteryController which manages instances of BatteryManager.
    When battery status event is raised, BatteryController calls all registered BatteryManager's event dispatcher.
    http://www.w3.org/TR/battery-status/
    
    Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
    Reviewed by Adam Barth.
    
    Tests: batterystatus/add-listener-from-callback.html
           batterystatus/basic-all-types-of-events.html
           batterystatus/basic-operation.html
           batterystatus/event-after-navigation.html
           batterystatus/multiple-frames.html
           batterystatus/updates.html
           batterystatus/window-property.html
    
    * CMakeLists.txt:
    * Modules/battery/BatteryClient.h: Added.
    (WebCore):
    (BatteryClient):
    (WebCore::BatteryClient::~BatteryClient):
    * Modules/battery/BatteryController.cpp: Added.
    (WebCore):
    (WebCore::BatteryController::BatteryController):
    (WebCore::BatteryController::~BatteryController):
    (WebCore::BatteryController::create):
    (WebCore::BatteryController::addListener):
    (WebCore::BatteryController::removeListener):
    (WebCore::BatteryController::didChangeBatteryStatus):
    (WebCore::BatteryController::supplementName):
    (WebCore::BatteryController::isActive):
    (WebCore::provideBatteryTo):
    * Modules/battery/BatteryController.h: Added.
    (WebCore):
    (BatteryController):
    (WebCore::BatteryController::client):
    (WebCore::BatteryController::from):
    * Modules/battery/BatteryManager.cpp: Added.
    (WebCore):
    (WebCore::BatteryManager::create):
    (WebCore::BatteryManager::~BatteryManager):
    (WebCore::BatteryManager::BatteryManager):
    (WebCore::BatteryManager::charging):
    (WebCore::BatteryManager::chargingTime):
    (WebCore::BatteryManager::dischargingTime):
    (WebCore::BatteryManager::level):
    (WebCore::BatteryManager::didChangeBatteryStatus):
    (WebCore::BatteryManager::suspend):
    (WebCore::BatteryManager::resume):
    (WebCore::BatteryManager::stop):
    * Modules/battery/BatteryManager.h: Added.
    (WebCore):
    (BatteryManager):
    (WebCore::BatteryManager::interfaceName):
    (WebCore::BatteryManager::scriptExecutionContext):
    (WebCore::BatteryManager::batteryControllerDestroyed):
    (WebCore::BatteryManager::canSuspend):
    (WebCore::BatteryManager::eventTargetData):
    (WebCore::BatteryManager::ensureEventTargetData):
    (WebCore::BatteryManager::refEventTarget):
    (WebCore::BatteryManager::derefEventTarget):
    * Modules/battery/BatteryManager.idl: Added.
    * Modules/battery/BatteryStatus.cpp: Added.
    (WebCore):
    (WebCore::BatteryStatus::create):
    (WebCore::BatteryStatus::BatteryStatus):
    * Modules/battery/BatteryStatus.h: Added.
    (WebCore):
    (BatteryStatus):
    (WebCore::BatteryStatus::charging):
    (WebCore::BatteryStatus::chargingTime):
    (WebCore::BatteryStatus::dischargingTime):
    (WebCore::BatteryStatus::level):
    * Modules/battery/NavigatorBattery.cpp: Added.
    (WebCore):
    (WebCore::NavigatorBattery::NavigatorBattery):
    (WebCore::NavigatorBattery::~NavigatorBattery):
    (WebCore::NavigatorBattery::webkitBattery):
    (WebCore::NavigatorBattery::from):
    (WebCore::NavigatorBattery::batteryManager):
    * Modules/battery/NavigatorBattery.h: Added.
    (WebCore):
    (NavigatorBattery):
    * Modules/battery/NavigatorBattery.idl: Added.
    * dom/EventNames.h:
    (WebCore):
    * dom/EventTargetFactory.in:
    * testing/Internals.cpp:
    (WebCore::Internals::setBatteryStatus):
    (WebCore):
    * testing/Internals.h:
    (Internals):
    * testing/Internals.idl:
    
    Source/WebKit: Support for Battery Status API
    https://bugs.webkit.org/show_bug.cgi?id=62698
    
    Add include directory and file.
    http://www.w3.org/TR/battery-status/
    
    Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
    Reviewed by Adam Barth.
    
    * PlatformEfl.cmake:
    
    Source/WebKit/efl: Support for Battery Status API
    https://bugs.webkit.org/show_bug.cgi?id=62698
    
    Add BatteryClientEfl class implementation for the layout tests now.
    BatteryClientEfl class is not fully implemented in this patch.
    (It will be completed by other patch as necessary in the Efl port.)
    http://www.w3.org/TR/battery-status/
    
    Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
    Reviewed by Adam Barth.
    
    * WebCoreSupport/BatteryClientEfl.cpp: Added.
    (WebCore):
    (WebCore::BatteryClientEfl::BatteryClientEfl):
    (WebCore::BatteryClientEfl::setController):
    (WebCore::BatteryClientEfl::startUpdating):
    (WebCore::BatteryClientEfl::stopUpdating):
    (WebCore::BatteryClientEfl::batteryControllerDestroyed):
    (WebCore::BatteryClientEfl::setBatteryStatus):
    * WebCoreSupport/BatteryClientEfl.h: Added.
    (WebCore):
    (BatteryClientEfl):
    (WebCore::BatteryClientEfl::~BatteryClientEfl):
    * ewk/ewk_view.cpp:
    (_Ewk_View_Private_Data):
    (_ewk_view_priv_new):
    
    Tools: Support for Battery Status API
    https://bugs.webkit.org/show_bug.cgi?id=62698
    
    Add include directory and file.
    http://www.w3.org/TR/battery-status/
    
    Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
    Reviewed by Adam Barth.
    
    * Scripts/build-webkit:
    
    LayoutTests: Support for Battery Status API.
    https://bugs.webkit.org/show_bug.cgi?id=62698
    
    Add new test cases for Battery Status API.
    http://www.w3.org/TR/battery-status/
    
    Patch by Kihong Kwon <kihong.kwon@samsung.com> on 2012-03-16
    Reviewed by Adam Barth.
    
    * batterystatus/add-listener-from-callback-expected.txt: Added.
    * batterystatus/add-listener-from-callback.html: Added.
    * batterystatus/basic-all-types-of-events-expected.txt: Added.
    * batterystatus/basic-all-types-of-events.html: Added.
    * batterystatus/basic-operation-expected.txt: Added.
    * batterystatus/basic-operation.html: Added.
    * batterystatus/event-after-navigation-expected.txt: Added.
    * batterystatus/event-after-navigation.html: Added.
    * batterystatus/multiple-frames-expected.txt: Added.
    * batterystatus/multiple-frames.html: Added.
    * batterystatus/resources/event-after-navigation-new.html: Added.
    * batterystatus/script-tests/add-listener-from-callback.js: Added.
    (checkBatteryStatus):
    (firstListener):
    (secondListener):
    (maybeFinishTest):
    * batterystatus/script-tests/basic-all-types-of-events.js: Added.
    (checkBatteryStatus):
    (battery):
    * batterystatus/script-tests/basic-operation.js: Added.
    * batterystatus/script-tests/event-after-navigation.js: Added.
    * batterystatus/script-tests/multiple-frames.js: Added.
    (checkBatteryStatus):
    (checkChildBatteryStatus):
    (mainFrameListener):
    (childFrameListener):
    (maybeFinishTest):
    * batterystatus/script-tests/updates.js: Added.
    (checkBatteryStatus):
    (setBatteryStatus):
    (firstListener):
    (updateListener):
    * batterystatus/script-tests/window-property.js: Added.
    (hasOnBatteryProperty):
    * batterystatus/updates-expected.txt: Added.
    * batterystatus/updates.html: Added.
    * batterystatus/window-property-expected.txt: Added.
    * batterystatus/window-property.html: Added.
    * platform/chromium/test_expectations.txt:
    * platform/gtk/Skipped:
    * platform/qt/Skipped:
    * platform/win/Skipped:
    * platform/wincairo/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@110991 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    0de163f6