[chromium] Add Battery Status API support.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 10:00:21 +0000 (10:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Apr 2012 10:00:21 +0000 (10:00 +0000)
commitc7abc73a1cf86ccd71c5a14d429a681173906c18
tree400f42f0a8f6b14ffb82eecf287d6c3e7421cbcd
parent48a4f2f64482b5da3c8ca9efa615ce36da1d84a3
[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
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