[chromium] Add Battery Status API support.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 17:28:25 +0000 (17:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Apr 2012 17:28:25 +0000 (17:28 +0000)
commit0b7b179fc8bd9b47ca5b383e6c1aa630c21dd4d2
treee620f6c53cfce3bf369f2ff957aa9c2bc5d86cdb
parent20a6c5cfeb0308726060b2d2f8021f9a43b3e6a0
[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-10
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-10
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-10
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@113734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/chromium/fast/dom/navigator-detached-no-crash-expected.txt
LayoutTests/platform/chromium/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/battery/BatteryController.cpp
Source/WebCore/Modules/battery/BatteryController.h
Source/WebCore/Modules/battery/BatteryManager.cpp
Source/WebCore/WebCore.gyp/WebCore.gyp
Source/WebCore/WebCore.gypi
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/WebKit.gyp
Source/WebKit/chromium/features.gypi
Source/WebKit/chromium/public/WebBatteryStatus.h [new file with mode: 0644]
Source/WebKit/chromium/public/WebBatteryStatusClient.h [new file with mode: 0644]
Source/WebKit/chromium/public/WebView.h
Source/WebKit/chromium/public/WebViewClient.h
Source/WebKit/chromium/src/BatteryClientImpl.cpp [new file with mode: 0644]
Source/WebKit/chromium/src/BatteryClientImpl.h [new file with mode: 0644]
Source/WebKit/chromium/src/WebViewImpl.cpp
Source/WebKit/chromium/src/WebViewImpl.h