[chromium] Add Battery Status API support.
Source/WebCore:
Add Battery Status API support to chromium.
https://bugs.webkit.org/show_bug.cgi?id=83284
Patch by Sadrul Habib Chowdhury <sadrul@chromium.org> on 2012-04-11
Reviewed by Adam Barth.
This change is covered by tests in batterystatus/.
* Modules/battery/BatteryController.cpp:
(WebCore::BatteryController::updateBatteryStatus):
(WebCore):
* Modules/battery/BatteryController.h:
(BatteryController):
* Modules/battery/BatteryManager.cpp:
(WebCore::BatteryManager::charging):
(WebCore::BatteryManager::chargingTime):
(WebCore::BatteryManager::dischargingTime):
(WebCore::BatteryManager::level):
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
Source/WebKit/chromium:
The battery-client (BatteryClientChromium) will notify the client (WebBatteryStatusClient) when to start or stop
sending battery status updates. The client, in response will send the notifications to WebViewImpl, which sends
this update information to the WebCore::BatteryClient, and it triggers the appropriate javascript-callbacks.
The spec is at http://www.w3.org/TR/2011/WD-battery-status-
20111129/.
https://bugs.webkit.org/show_bug.cgi?id=83284
Patch by Sadrul Habib Chowdhury <sadrul@chromium.org> on 2012-04-11
Reviewed by Adam Barth.
* WebKit.gyp:
* features.gypi:
* public/WebBatteryStatus.h: Added.
(WebKit):
(WebBatteryStatus):
(WebKit::WebBatteryStatus::WebBatteryStatus):
* public/WebBatteryStatusClient.h: Added.
(WebKit):
(WebBatteryStatusClient):
(WebKit::WebBatteryStatusClient::~WebBatteryStatusClient):
* public/WebView.h:
(WebKit):
(WebView):
(WebKit::WebView::updateBatteryStatus):
* public/WebViewClient.h:
(WebKit):
(WebViewClient):
(WebKit::WebViewClient::batteryStatusClient):
* src/BatteryClientImpl.cpp: Added.
(WebKit):
(WebKit::BatteryClientImpl::BatteryClientImpl):
(WebKit::BatteryClientImpl::updateBatteryStatus):
(WebKit::BatteryClientImpl::setController):
(WebKit::BatteryClientImpl::startUpdating):
(WebKit::BatteryClientImpl::stopUpdating):
(WebKit::BatteryClientImpl::batteryControllerDestroyed):
* src/BatteryClientImpl.h: Added.
(WebKit):
(BatteryClientImpl):
(WebKit::BatteryClientImpl::~BatteryClientImpl):
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::WebViewImpl):
(WebKit):
(WebKit::WebViewImpl::updateBatteryStatus):
* src/WebViewImpl.h:
(WebKit):
(WebViewImpl):
LayoutTests:
Add Battery Status API support to chromium.
https://bugs.webkit.org/show_bug.cgi?id=83284
Patch by Sadrul Habib Chowdhury <sadrul@chromium.org> on 2012-04-11
Reviewed by Adam Barth.
* platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt:
* platform/chromium/test_expectations.txt:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113845
268f45cc-cd09-0410-ab3c-
d52691b4dbfc