"${WEBKIT2_DIR}/WebProcess"
"${WEBKIT2_DIR}/WebProcess/ApplicationCache"
"${WEBKIT2_DIR}/WebProcess/Authentication"
+ "${WEBKIT2_DIR}/WebProcess/Battery"
"${WEBKIT2_DIR}/WebProcess/Cookies"
"${WEBKIT2_DIR}/WebProcess/Downloads"
"${WEBKIT2_DIR}/WebProcess/FullScreen"
Shared/UpdateInfo.cpp
Shared/VisitedLinkTable.cpp
Shared/WebBackForwardListItem.cpp
+ Shared/WebBatteryStatus.cpp
Shared/WebConnection.cpp
Shared/WebConnectionClient.cpp
Shared/WebContextMenuItem.cpp
UIProcess/VisitedLinkProvider.cpp
UIProcess/WebApplicationCacheManagerProxy.cpp
UIProcess/WebBackForwardList.cpp
+ UIProcess/WebBatteryManagerProxy.cpp
+ UIProcess/WebBatteryProvider.cpp
UIProcess/WebConnectionToWebProcess.cpp
UIProcess/WebContext.cpp
UIProcess/WebContextConnectionClient.cpp
UIProcess/API/C/WKAuthenticationDecisionListener.cpp
UIProcess/API/C/WKBackForwardList.cpp
UIProcess/API/C/WKBackForwardListItem.cpp
+ UIProcess/API/C/WKBatteryManager.cpp
UIProcess/API/C/WKContext.cpp
UIProcess/API/C/WKCookieManager.cpp
UIProcess/API/C/WKCredential.cpp
WebProcess/Authentication/AuthenticationManager.cpp
+ WebProcess/Battery/WebBatteryManager.cpp
+
WebProcess/Cookies/WebCookieManager.cpp
WebProcess/Downloads/Download.cpp
WebProcess/ResourceCache/WebResourceCacheManager.cpp
+ WebProcess/WebCoreSupport/WebBatteryClient.cpp
WebProcess/WebCoreSupport/WebChromeClient.cpp
WebProcess/WebCoreSupport/WebColorChooser.cpp
WebProcess/WebCoreSupport/WebContextMenuClient.cpp
UIProcess/DrawingAreaProxy.messages.in
UIProcess/LayerTreeCoordinatorProxy.messages.in
UIProcess/WebApplicationCacheManagerProxy.messages.in
+ UIProcess/WebBatteryManagerProxy.messages.in
UIProcess/WebContext.messages.in
UIProcess/WebCookieManagerProxy.messages.in
UIProcess/WebDatabaseManagerProxy.messages.in
WebProcess/Authentication/AuthenticationManager.messages.in
+ WebProcess/Battery/WebBatteryManager.messages.in
+
WebProcess/Cookies/WebCookieManager.messages.in
WebProcess/FullScreen/WebFullScreenManager.messages.in
+2012-07-03 Christophe Dumez <christophe.dumez@intel.com>
+
+ [WK2] Add support for Battery Status API
+ https://bugs.webkit.org/show_bug.cgi?id=89558
+
+ Reviewed by Anders Carlsson.
+
+ Add support for Battery Status API to WebKit2.
+
+ * CMakeLists.txt:
+ * DerivedSources.pri:
+ * GNUmakefile.am:
+ * GNUmakefile.list.am:
+ * Platform/CoreIPC/MessageID.h:
+ * Shared/API/c/WKBase.h:
+ * Shared/APIObject.h:
+ * Shared/WebBatteryStatus.cpp: Added.
+ (WebKit):
+ (WebKit::WebBatteryStatus::WebBatteryStatus):
+ (WebKit::WebBatteryStatus::~WebBatteryStatus):
+ (WebKit::WebBatteryStatus::Data::encode):
+ (WebKit::WebBatteryStatus::Data::decode):
+ * Shared/WebBatteryStatus.h: Added.
+ (WebKit):
+ (WebBatteryStatus):
+ (Data):
+ (WebKit::WebBatteryStatus::create):
+ (WebKit::WebBatteryStatus::isCharging):
+ (WebKit::WebBatteryStatus::chargingTime):
+ (WebKit::WebBatteryStatus::dischargingTime):
+ (WebKit::WebBatteryStatus::level):
+ (WebKit::WebBatteryStatus::data):
+ (WebKit::WebBatteryStatus::type):
+ * Target.pri:
+ * UIProcess/API/C/WKAPICast.h:
+ (WebKit):
+ * UIProcess/API/C/WKBatteryManager.cpp: Added.
+ (WKBatteryManagerGetTypeID):
+ * UIProcess/API/C/WKBatteryManager.h: Added.
+ * UIProcess/WebBatteryManagerProxy.cpp: Added.
+ (WebKit):
+ (WebKit::WebBatteryManagerProxy::create):
+ (WebKit::WebBatteryManagerProxy::WebBatteryManagerProxy):
+ (WebKit::WebBatteryManagerProxy::~WebBatteryManagerProxy):
+ (WebKit::WebBatteryManagerProxy::invalidate):
+ (WebKit::WebBatteryManagerProxy::initializeProvider):
+ (WebKit::WebBatteryManagerProxy::didReceiveMessage):
+ (WebKit::WebBatteryManagerProxy::startUpdating):
+ (WebKit::WebBatteryManagerProxy::stopUpdating):
+ (WebKit::WebBatteryManagerProxy::providerDidChangeBatteryStatus):
+ (WebKit::WebBatteryManagerProxy::providerUpdateBatteryStatus):
+ * UIProcess/WebBatteryManagerProxy.h: Added.
+ (CoreIPC):
+ (WebKit):
+ (WebBatteryManagerProxy):
+ (WebKit::WebBatteryManagerProxy::clearContext):
+ (WebKit::WebBatteryManagerProxy::type):
+ * UIProcess/WebBatteryManagerProxy.messages.in: Added.
+ * UIProcess/WebBatteryProvider.cpp: Added.
+ (WebKit):
+ (WebKit::WebBatteryProvider::startUpdating):
+ (WebKit::WebBatteryProvider::stopUpdating):
+ * UIProcess/WebBatteryProvider.h: Added.
+ (WebKit):
+ (WebBatteryProvider):
+ * WebKit2.pri:
+ * WebProcess/Battery/WebBatteryManager.cpp: Added.
+ (WebKit):
+ (WebKit::WebBatteryManager::WebBatteryManager):
+ (WebKit::WebBatteryManager::~WebBatteryManager):
+ (WebKit::WebBatteryManager::didReceiveMessage):
+ (WebKit::WebBatteryManager::registerWebPage):
+ (WebKit::WebBatteryManager::unregisterWebPage):
+ (WebKit::WebBatteryManager::didChangeBatteryStatus):
+ (WebKit::WebBatteryManager::updateBatteryStatus):
+ * WebProcess/Battery/WebBatteryManager.h: Added.
+ (CoreIPC):
+ (WebKit):
+ (WebBatteryManager):
+ * WebProcess/Battery/WebBatteryManager.messages.in: Added.
+ * WebProcess/WebCoreSupport/WebBatteryClient.cpp: Added.
+ (WebKit):
+ (WebKit::WebBatteryClient::startUpdating):
+ (WebKit::WebBatteryClient::stopUpdating):
+ (WebKit::WebBatteryClient::batteryControllerDestroyed):
+ * WebProcess/WebCoreSupport/WebBatteryClient.h: Added.
+ (WebKit):
+ (WebBatteryClient):
+ (WebKit::WebBatteryClient::WebBatteryClient):
+ (WebKit::WebBatteryClient::~WebBatteryClient):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::WebProcess):
+ (WebKit::WebProcess::didReceiveMessage):
+ * WebProcess/WebProcess.h:
+ (WebProcess):
+ (WebKit::WebProcess::batteryManager):
+
2012-07-03 Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
[Qt] Make use of .qmake.cache for caching features
PluginProcess \
WebProcess/ApplicationCache \
WebProcess/Authentication \
+ WebProcess/Battery \
WebProcess/Cookies \
WebProcess/FullScreen \
WebProcess/Geolocation \
PluginProxy.messages.in \
WebApplicationCacheManager.messages.in \
WebApplicationCacheManagerProxy.messages.in \
+ WebBatteryManager.messages.in \
+ WebBatteryManagerProxy.messages.in \
WebContext.messages.in \
WebCookieManager.messages.in \
WebCookieManagerProxy.messages.in \
-I$(srcdir)/Source/WebKit2/WebProcess \
-I$(srcdir)/Source/WebKit2/WebProcess/ApplicationCache \
-I$(srcdir)/Source/WebKit2/WebProcess/Authentication \
+ -I$(srcdir)/Source/WebKit2/WebProcess/Battery \
-I$(srcdir)/Source/WebKit2/WebProcess/Cookies \
-I$(srcdir)/Source/WebKit2/WebProcess/Downloads \
-I$(srcdir)/Source/WebKit2/WebProcess/FullScreen \
$(WebKit2)/WebProcess \
$(WebKit2)/WebProcess/ApplicationCache \
$(WebKit2)/WebProcess/Authentication \
+ $(WebKit2)/WebProcess/Battery \
$(WebKit2)/WebProcess/Cookies \
$(WebKit2)/WebProcess/FullScreen \
$(WebKit2)/WebProcess/Geolocation \
$(shell ls $(WebKit2)/WebProcess/*.in) \
$(shell ls $(WebKit2)/WebProcess/ApplicationCache/*.in) \
$(shell ls $(WebKit2)/WebProcess/Authentication/*.in) \
+ $(shell ls $(WebKit2)/WebProcess/Battery/*.in) \
$(shell ls $(WebKit2)/WebProcess/Cookies/*.in) \
$(shell ls $(WebKit2)/WebProcess/FullScreen/*.in) \
$(shell ls $(WebKit2)/WebProcess/Geolocation/*.in) \
$(WebKit2)/UIProcess/API/C/WKAuthenticationDecisionListener.h \
$(WebKit2)/UIProcess/API/C/WKBackForwardList.h \
$(WebKit2)/UIProcess/API/C/WKBackForwardListItem.h \
+ $(WebKit2)/UIProcess/API/C/WKBatteryManager.h \
$(WebKit2)/UIProcess/API/C/WKContext.h \
$(WebKit2)/UIProcess/API/C/WKContextPrivate.h \
$(WebKit2)/UIProcess/API/C/WKCookieManager.h \
DerivedSources/WebKit2/WebApplicationCacheManagerMessages.h \
DerivedSources/WebKit2/WebApplicationCacheManagerProxyMessageReceiver.cpp \
DerivedSources/WebKit2/WebApplicationCacheManagerProxyMessages.h \
+ DerivedSources/WebKit2/WebBatteryManagerMessageReceiver.cpp \
+ DerivedSources/WebKit2/WebBatteryManagerMessages.h \
+ DerivedSources/WebKit2/WebBatteryManagerProxyMessageReceiver.cpp \
+ DerivedSources/WebKit2/WebBatteryManagerProxyMessages.h \
DerivedSources/WebKit2/WebContextMessageReceiver.cpp \
DerivedSources/WebKit2/WebContextMessages.h \
DerivedSources/WebKit2/WebCookieManagerMessageReceiver.cpp \
Source/WebKit2/Shared/VisitedLinkTable.h \
Source/WebKit2/Shared/WebBackForwardListItem.cpp \
Source/WebKit2/Shared/WebBackForwardListItem.h \
+ Source/WebKit2/Shared/WebBatteryStatus.cpp \
+ Source/WebKit2/Shared/WebBatteryStatus.h \
Source/WebKit2/Shared/WebCertificateInfo.h \
Source/WebKit2/Shared/WebConnection.cpp \
Source/WebKit2/Shared/WebConnection.h \
Source/WebKit2/UIProcess/API/C/WKBackForwardList.h \
Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.cpp \
Source/WebKit2/UIProcess/API/C/WKBackForwardListItem.h \
+ Source/WebKit2/UIProcess/API/C/WKBatteryManager.cpp \
+ Source/WebKit2/UIProcess/API/C/WKBatteryManager.h \
Source/WebKit2/UIProcess/API/C/WKContext.cpp \
Source/WebKit2/UIProcess/API/C/WKContext.h \
Source/WebKit2/UIProcess/API/C/WKContextPrivate.h \
Source/WebKit2/UIProcess/WebApplicationCacheManagerProxy.cpp \
Source/WebKit2/UIProcess/WebBackForwardList.cpp \
Source/WebKit2/UIProcess/WebBackForwardList.h \
+ Source/WebKit2/UIProcess/WebBatteryManagerProxy.cpp \
+ Source/WebKit2/UIProcess/WebBatteryManagerProxy.h \
+ Source/WebKit2/UIProcess/WebBatteryProvider.cpp \
+ Source/WebKit2/UIProcess/WebBatteryProvider.h \
Source/WebKit2/UIProcess/WebColorChooserProxy.h \
Source/WebKit2/UIProcess/WebConnectionToWebProcess.cpp \
Source/WebKit2/UIProcess/WebConnectionToWebProcess.h \
Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp \
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.cpp \
Source/WebKit2/WebProcess/Authentication/AuthenticationManager.h \
+ Source/WebKit2/WebProcess/Battery/WebBatteryManager.cpp \
+ Source/WebKit2/WebProcess/Battery/WebBatteryManager.h \
Source/WebKit2/WebProcess/Cookies/WebCookieManager.h \
Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp \
Source/WebKit2/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.h \
Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h \
+ Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.cpp \
+ Source/WebKit2/WebProcess/WebCoreSupport/WebBatteryClient.h \
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp \
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h \
Source/WebKit2/WebProcess/WebCoreSupport/WebColorChooser.cpp \
MessageClassInjectedBundle,
MessageClassLayerTreeCoordinator,
MessageClassWebApplicationCacheManager,
+ MessageClassWebBatteryManagerProxy,
MessageClassWebCookieManager,
MessageClassWebDatabaseManager,
MessageClassWebFullScreenManager,
MessageClassDrawingAreaProxy,
MessageClassLayerTreeCoordinatorProxy,
MessageClassWebApplicationCacheManagerProxy,
+ MessageClassWebBatteryManager,
MessageClassWebContext,
MessageClassWebContextLegacy,
MessageClassWebCookieManagerProxy,
typedef const struct OpaqueWKAuthenticationDecisionListener* WKAuthenticationDecisionListenerRef;
typedef const struct OpaqueWKBackForwardList* WKBackForwardListRef;
typedef const struct OpaqueWKBackForwardListItem* WKBackForwardListItemRef;
+typedef const struct OpaqueWKBatteryManager* WKBatteryManagerRef;
+typedef const struct OpaqueWKBatteryStatus* WKBatteryStatusRef;
typedef const struct OpaqueWKResourceCacheManager* WKResourceCacheManagerRef;
typedef const struct OpaqueWKContext* WKContextRef;
typedef const struct OpaqueWKCookieManager* WKCookieManagerRef;
TypeApplicationCacheManager,
TypeBackForwardList,
TypeBackForwardListItem,
+ TypeBatteryManager,
+ TypeBatteryStatus,
TypeCacheManager,
TypeContext,
TypeCookieManager,
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebBatteryStatus.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "ArgumentCoders.h"
+#include "Arguments.h"
+
+namespace WebKit {
+
+WebBatteryStatus::WebBatteryStatus(bool isCharging, double chargingTime, double dischargingTime, double level)
+{
+ m_data.isCharging = isCharging;
+ m_data.chargingTime = chargingTime;
+ m_data.dischargingTime = dischargingTime;
+ m_data.level = level;
+}
+
+WebBatteryStatus::~WebBatteryStatus()
+{
+}
+
+void WebBatteryStatus::Data::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ encoder->encode(CoreIPC::In(isCharging, chargingTime, dischargingTime, level));
+}
+
+bool WebBatteryStatus::Data::decode(CoreIPC::ArgumentDecoder* decoder, Data& data)
+{
+ return decoder->decode(CoreIPC::Out(data.isCharging, data.chargingTime, data.dischargingTime, data.level));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebBatteryStatus_h
+#define WebBatteryStatus_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "APIObject.h"
+#include "ArgumentDecoder.h"
+#include "ArgumentEncoder.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class WebBatteryStatus : public APIObject {
+public:
+ static const Type APIType = TypeBatteryStatus;
+
+ struct Data {
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, Data&);
+
+ bool isCharging;
+ double chargingTime;
+ double dischargingTime;
+ double level;
+ };
+
+ static PassRefPtr<WebBatteryStatus> create(bool isCharging, double chargingTime, double dischargingTime, double level)
+ {
+ return adoptRef(new WebBatteryStatus(isCharging, chargingTime, dischargingTime, level));
+ }
+
+ virtual ~WebBatteryStatus();
+ double isCharging() const { return m_data.isCharging; }
+ double chargingTime() const { return m_data.chargingTime; }
+ double dischargingTime() const { return m_data.dischargingTime; }
+ double level() const { return m_data.level; }
+
+ const Data& data() const { return m_data; }
+
+private:
+ WebBatteryStatus(bool isCharging, double chargingTime, double dischargingTime, double level);
+
+ virtual Type type() const { return APIType; }
+
+ Data m_data;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryStatus_h
Shared/VisitedLinkTable.h \
Shared/WebCoreArgumentCoders.h \
Shared/WebBackForwardListItem.h \
+ Shared/WebBatteryStatus.h \
Shared/WebCertificateInfo.h \
Shared/WebConnection.h \
Shared/WebConnectionClient.h \
UIProcess/API/C/WKAuthenticationDecisionListener.h \
UIProcess/API/C/WKBackForwardList.h \
UIProcess/API/C/WKBackForwardListItem.h \
+ UIProcess/API/C/WKBatteryManager.h \
UIProcess/API/C/WKContext.h \
UIProcess/API/C/WKContextPrivate.h \
UIProcess/API/C/WKCredential.h \
UIProcess/VisitedLinkProvider.h \
UIProcess/WebApplicationCacheManagerProxy.h \
UIProcess/WebBackForwardList.h \
+ UIProcess/WebBatteryManagerProxy.h \
+ UIProcess/WebBatteryProvider.h \
UIProcess/WebColorChooserProxy.h \
UIProcess/WebConnectionToWebProcess.h \
UIProcess/WebContext.h \
UIProcess/texmap/LayerBackingStore.h \
WebProcess/ApplicationCache/WebApplicationCacheManager.h \
WebProcess/Authentication/AuthenticationManager.h \
+ WebProcess/Battery/WebBatteryManager.h \
WebProcess/Cookies/WebCookieManager.h \
WebProcess/Downloads/Download.h \
WebProcess/Downloads/DownloadManager.h \
WebProcess/Plugins/PluginProxy.h \
WebProcess/Plugins/PluginProcessConnection.h \
WebProcess/Plugins/PluginProcessConnectionManager.h \
+ WebProcess/WebCoreSupport/WebBatteryClient.h \
WebProcess/WebCoreSupport/WebChromeClient.h \
WebProcess/WebCoreSupport/WebColorChooser.h \
WebProcess/WebCoreSupport/WebContextMenuClient.h \
Shared/UpdateInfo.cpp \
Shared/VisitedLinkTable.cpp \
Shared/WebBackForwardListItem.cpp \
+ Shared/WebBatteryStatus.cpp \
Shared/WebConnection.cpp \
Shared/WebConnectionClient.cpp \
Shared/WebContextMenuItem.cpp \
UIProcess/API/C/WKAuthenticationDecisionListener.cpp \
UIProcess/API/C/WKBackForwardList.cpp \
UIProcess/API/C/WKBackForwardListItem.cpp \
+ UIProcess/API/C/WKBatteryManager.cpp \
UIProcess/API/C/WKContext.cpp \
UIProcess/API/C/WKCredential.cpp \
UIProcess/API/C/WKDatabaseManager.cpp \
UIProcess/VisitedLinkProvider.cpp \
UIProcess/WebApplicationCacheManagerProxy.cpp \
UIProcess/WebBackForwardList.cpp \
+ UIProcess/WebBatteryManagerProxy.cpp \
+ UIProcess/WebBatteryProvider.cpp \
UIProcess/WebConnectionToWebProcess.cpp \
UIProcess/WebContext.cpp \
UIProcess/WebContextConnectionClient.cpp \
UIProcess/texmap/LayerBackingStore.cpp \
WebProcess/ApplicationCache/WebApplicationCacheManager.cpp \
WebProcess/Authentication/AuthenticationManager.cpp \
+ WebProcess/Battery/WebBatteryManager.cpp \
WebProcess/Cookies/WebCookieManager.cpp \
WebProcess/Cookies/qt/WebCookieManagerQt.cpp \
WebProcess/Downloads/Download.cpp \
WebProcess/Plugins/PluginProxy.cpp \
WebProcess/Plugins/PluginProcessConnection.cpp \
WebProcess/Plugins/PluginProcessConnectionManager.cpp \
+ WebProcess/WebCoreSupport/WebBatteryClient.cpp \
WebProcess/WebCoreSupport/WebChromeClient.cpp \
WebProcess/WebCoreSupport/WebColorChooser.cpp \
WebProcess/WebCoreSupport/WebContextMenuClient.cpp \
class WebApplicationCacheManagerProxy;
class WebBackForwardList;
class WebBackForwardListItem;
+class WebBatteryManagerProxy;
+class WebBatteryStatus;
class WebResourceCacheManagerProxy;
class WebContext;
class WebCookieManagerProxy;
WK_ADD_API_MAPPING(WKAuthenticationDecisionListenerRef, AuthenticationDecisionListener)
WK_ADD_API_MAPPING(WKBackForwardListItemRef, WebBackForwardListItem)
WK_ADD_API_MAPPING(WKBackForwardListRef, WebBackForwardList)
+WK_ADD_API_MAPPING(WKBatteryManagerRef, WebBatteryManagerProxy)
+WK_ADD_API_MAPPING(WKBatteryStatusRef, WebBatteryStatus)
WK_ADD_API_MAPPING(WKResourceCacheManagerRef, WebResourceCacheManagerProxy)
WK_ADD_API_MAPPING(WKContextRef, WebContext)
WK_ADD_API_MAPPING(WKCookieManagerRef, WebCookieManagerProxy)
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKBatteryManager.h"
+
+#include "WKAPICast.h"
+
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryManagerProxy.h"
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKBatteryManagerGetTypeID()
+{
+#if ENABLE(BATTERY_STATUS)
+ return toAPI(WebBatteryManagerProxy::APIType);
+#else
+ return 0;
+#endif
+}
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKBatteryManager_h
+#define WKBatteryManager_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Provider.
+typedef void (*WKBatteryProviderStartUpdatingCallback)(WKBatteryManagerRef batteryManager, const void* clientInfo);
+typedef void (*WKBatteryProviderStopUpdatingCallback)(WKBatteryManagerRef batteryManager, const void* clientInfo);
+
+struct WKBatteryProvider {
+ int version;
+ const void * clientInfo;
+ WKBatteryProviderStartUpdatingCallback startUpdating;
+ WKBatteryProviderStopUpdatingCallback stopUpdating;
+};
+typedef struct WKBatteryProvider WKBatteryProvider;
+
+enum { kWKBatteryProviderCurrentVersion = 0 };
+
+WK_EXPORT WKTypeID WKBatteryManagerGetTypeID();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBatteryManager_h */
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebBatteryManagerProxy.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WebBatteryManagerMessages.h"
+#include "WebContext.h"
+
+namespace WebKit {
+
+PassRefPtr<WebBatteryManagerProxy> WebBatteryManagerProxy::create(WebContext* context)
+{
+ return adoptRef(new WebBatteryManagerProxy(context));
+}
+
+WebBatteryManagerProxy::WebBatteryManagerProxy(WebContext* context)
+ : m_isUpdating(false)
+ , m_context(context)
+{
+}
+
+WebBatteryManagerProxy::~WebBatteryManagerProxy()
+{
+}
+
+void WebBatteryManagerProxy::invalidate()
+{
+ stopUpdating();
+}
+
+void WebBatteryManagerProxy::initializeProvider(const WKBatteryProvider* provider)
+{
+ m_provider.initialize(provider);
+}
+
+void WebBatteryManagerProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebBatteryManagerProxyMessage(connection, messageID, arguments);
+}
+
+void WebBatteryManagerProxy::startUpdating()
+{
+ if (m_isUpdating)
+ return;
+
+ m_provider.startUpdating(this);
+ m_isUpdating = true;
+}
+
+void WebBatteryManagerProxy::stopUpdating()
+{
+ if (!m_isUpdating)
+ return;
+
+ m_provider.stopUpdating(this);
+ m_isUpdating = false;
+}
+
+void WebBatteryManagerProxy::providerDidChangeBatteryStatus(const WTF::AtomicString& eventType, WebBatteryStatus* status)
+{
+ if (!m_context)
+ return;
+
+ m_context->sendToAllProcesses(Messages::WebBatteryManager::DidChangeBatteryStatus(eventType, status->data()));
+}
+
+void WebBatteryManagerProxy::providerUpdateBatteryStatus(WebBatteryStatus* status)
+{
+ if (!m_context)
+ return;
+
+ m_context->sendToAllProcesses(Messages::WebBatteryManager::UpdateBatteryStatus(status->data()));
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebBatteryManagerProxy_h
+#define WebBatteryManagerProxy_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "APIObject.h"
+#include "MessageID.h"
+#include "WebBatteryProvider.h"
+#include <wtf/Forward.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+}
+
+namespace WebKit {
+
+class WebContext;
+class WebBatteryStatus;
+
+class WebBatteryManagerProxy : public APIObject {
+public:
+ static const Type APIType = TypeBatteryManager;
+
+ static PassRefPtr<WebBatteryManagerProxy> create(WebContext*);
+ virtual ~WebBatteryManagerProxy();
+
+ void invalidate();
+ void clearContext() { m_context = 0; }
+
+ void initializeProvider(const WKBatteryProvider*);
+
+ void providerDidChangeBatteryStatus(const WTF::AtomicString&, WebBatteryStatus*);
+ void providerUpdateBatteryStatus(WebBatteryStatus*);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ explicit WebBatteryManagerProxy(WebContext*);
+
+ virtual Type type() const { return APIType; }
+
+ // Implemented in generated WebBatteryManagerProxyMessageReceiver.cpp
+ void didReceiveWebBatteryManagerProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ void startUpdating();
+ void stopUpdating();
+
+ bool m_isUpdating;
+
+ WebContext* m_context;
+ WebBatteryProvider m_provider;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryManagerProxy_h
--- /dev/null
+# Copyright (C) 2012 Intel Corporation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if ENABLE(BATTERY_STATUS)
+
+messages -> WebBatteryManagerProxy {
+ StartUpdating();
+ StopUpdating();
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebBatteryProvider.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WKAPICast.h"
+#include "WebBatteryManagerProxy.h"
+
+namespace WebKit {
+
+void WebBatteryProvider::startUpdating(WebBatteryManagerProxy* batteryManager)
+{
+ if (!m_client.startUpdating)
+ return;
+
+ m_client.startUpdating(toAPI(batteryManager), m_client.clientInfo);
+}
+
+void WebBatteryProvider::stopUpdating(WebBatteryManagerProxy* batteryManager)
+{
+ if (!m_client.stopUpdating)
+ return;
+
+ m_client.stopUpdating(toAPI(batteryManager), m_client.clientInfo);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebBatteryProvider_h
+#define WebBatteryProvider_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "APIClient.h"
+#include "WKBatteryManager.h"
+#include <wtf/Forward.h>
+
+namespace WebKit {
+
+class WebBatteryManagerProxy;
+
+class WebBatteryProvider : public APIClient<WKBatteryProvider, kWKBatteryProviderCurrentVersion> {
+public:
+ void startUpdating(WebBatteryManagerProxy*);
+ void stopUpdating(WebBatteryManagerProxy*);
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryProvider_h
$$SOURCE_DIR/WebProcess \
$$SOURCE_DIR/WebProcess/ApplicationCache \
$$SOURCE_DIR/WebProcess/Authentication \
+ $$SOURCE_DIR/WebProcess/Battery \
$$SOURCE_DIR/WebProcess/Cookies \
$$SOURCE_DIR/WebProcess/Cookies/qt \
$$SOURCE_DIR/WebProcess/Downloads \
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebBatteryManager.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WebBatteryManagerProxyMessages.h"
+#include "WebPage.h"
+#include "WebProcess.h"
+#include <WebCore/BatteryController.h>
+#include <WebCore/BatteryStatus.h>
+#include <WebCore/Page.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebBatteryManager::WebBatteryManager(WebProcess* process)
+ : m_process(process)
+{
+}
+
+WebBatteryManager::~WebBatteryManager()
+{
+}
+
+void WebBatteryManager::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
+{
+ didReceiveWebBatteryManagerMessage(connection, messageID, arguments);
+}
+
+void WebBatteryManager::registerWebPage(WebPage* page)
+{
+ bool wasEmpty = m_pageSet.isEmpty();
+
+ m_pageSet.add(page);
+
+ if (wasEmpty)
+ m_process->connection()->send(Messages::WebBatteryManagerProxy::StartUpdating(), 0);
+}
+
+void WebBatteryManager::unregisterWebPage(WebPage* page)
+{
+ m_pageSet.remove(page);
+
+ if (m_pageSet.isEmpty())
+ m_process->connection()->send(Messages::WebBatteryManagerProxy::StopUpdating(), 0);
+}
+
+void WebBatteryManager::didChangeBatteryStatus(const WTF::AtomicString& eventType, const WebBatteryStatus::Data& data)
+{
+ RefPtr<BatteryStatus> status = BatteryStatus::create(data.isCharging, data.chargingTime, data.dischargingTime, data.level);
+
+ HashSet<WebPage*>::const_iterator it = m_pageSet.begin();
+ HashSet<WebPage*>::const_iterator end = m_pageSet.end();
+ for (; it != end; ++it) {
+ WebPage* page = *it;
+ if (page->corePage())
+ BatteryController::from(page->corePage())->didChangeBatteryStatus(eventType, status.get());
+ }
+}
+
+void WebBatteryManager::updateBatteryStatus(const WebBatteryStatus::Data& data)
+{
+ RefPtr<BatteryStatus> status = BatteryStatus::create(data.isCharging, data.chargingTime, data.dischargingTime, data.level);
+
+ HashSet<WebPage*>::const_iterator it = m_pageSet.begin();
+ HashSet<WebPage*>::const_iterator end = m_pageSet.end();
+ for (; it != end; ++it) {
+ WebPage* page = *it;
+ if (page->corePage())
+ BatteryController::from(page->corePage())->updateBatteryStatus(status.get());
+ }
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebBatteryManager_h
+#define WebBatteryManager_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "MessageID.h"
+#include "WebBatteryStatus.h"
+#include "WebCoreArgumentCoders.h"
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/text/AtomicString.h>
+
+namespace CoreIPC {
+class ArgumentDecoder;
+class Connection;
+}
+
+namespace WebKit {
+
+class WebPage;
+class WebProcess;
+
+class WebBatteryManager {
+ WTF_MAKE_NONCOPYABLE(WebBatteryManager);
+
+public:
+ explicit WebBatteryManager(WebProcess*);
+ ~WebBatteryManager();
+
+ void registerWebPage(WebPage*);
+ void unregisterWebPage(WebPage*);
+
+ void didChangeBatteryStatus(const WTF::AtomicString& eventType, const WebBatteryStatus::Data&);
+ void updateBatteryStatus(const WebBatteryStatus::Data&);
+
+ void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+private:
+ // Implemented in generated WebBatteryManagerMessageReceiver.cpp
+ void didReceiveWebBatteryManagerMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
+
+ WebProcess* m_process;
+ HashSet<WebPage*> m_pageSet;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryManager_h
--- /dev/null
+# Copyright (C) 2012 Intel Corporation. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR
+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#if ENABLE(BATTERY_STATUS)
+
+messages -> WebBatteryManager {
+ DidChangeBatteryStatus(AtomicString eventType, WebKit::WebBatteryStatus::Data status);
+ UpdateBatteryStatus(WebKit::WebBatteryStatus::Data status);
+}
+
+#endif
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebBatteryClient.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WebBatteryManager.h"
+#include "WebPage.h"
+#include "WebProcess.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebBatteryClient::startUpdating()
+{
+ WebProcess::shared().batteryManager().registerWebPage(m_page);
+}
+
+void WebBatteryClient::stopUpdating()
+{
+ WebProcess::shared().batteryManager().unregisterWebPage(m_page);
+}
+
+void WebBatteryClient::batteryControllerDestroyed()
+{
+ WebProcess::shared().batteryManager().unregisterWebPage(m_page);
+ delete this;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
--- /dev/null
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebBatteryClient_h
+#define WebBatteryClient_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include <WebCore/BatteryClient.h>
+
+namespace WebKit {
+
+class WebPage;
+
+class WebBatteryClient : public WebCore::BatteryClient {
+public:
+ WebBatteryClient(WebPage* page)
+ : m_page(page)
+ {
+ }
+
+ virtual ~WebBatteryClient() { }
+
+private:
+ virtual void startUpdating() OVERRIDE;
+ virtual void stopUpdating() OVERRIDE;
+ virtual void batteryControllerDestroyed() OVERRIDE;
+
+ WebPage* m_page;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // WebBatteryClient_h
#endif
, m_textCheckerState()
, m_geolocationManager(this)
+#if ENABLE(BATTERY_STATUS)
+ , m_batteryManager(this)
+#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
, m_notificationManager(this)
#endif
return;
}
+#if ENABLE(BATTERY_STATUS)
+ if (messageID.is<CoreIPC::MessageClassWebBatteryManager>()) {
+ m_batteryManager.didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+#endif
+
if (messageID.is<CoreIPC::MessageClassWebIconDatabaseProxy>()) {
m_iconDatabaseProxy.didReceiveMessage(connection, messageID, arguments);
return;
#include <dispatch/dispatch.h>
#endif
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryManager.h"
+#endif
+
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
#include "WebNotificationManager.h"
#endif
// Geolocation
WebGeolocationManager& geolocationManager() { return m_geolocationManager; }
+
+#if ENABLE(BATTERY_STATUS)
+ WebBatteryManager& batteryManager() { return m_batteryManager; }
+#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
WebNotificationManager& notificationManager() { return m_notificationManager; }
TextCheckerState m_textCheckerState;
WebGeolocationManager m_geolocationManager;
+#if ENABLE(BATTERY_STATUS)
+ WebBatteryManager m_batteryManager;
+#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
WebNotificationManager m_notificationManager;
#endif