namespace WebCore {
-class BatteryController;
class Page;
class BatteryClient {
public:
virtual ~BatteryClient() { }
- virtual void setController(BatteryController*) = 0;
virtual void startUpdating() = 0;
virtual void stopUpdating() = 0;
virtual void batteryControllerDestroyed() = 0;
: m_client(client)
{
ASSERT(m_client);
- m_client->setController(this);
}
BatteryController::~BatteryController()
page/efl/EventHandlerEfl.cpp
platform/Cursor.cpp
platform/RunLoop.cpp
+ platform/efl/BatteryProviderEfl.cpp
platform/efl/ClipboardEfl.cpp
platform/efl/ColorChooserEfl.cpp
platform/efl/ContextMenuEfl.cpp
LIST(REMOVE_ITEM WebCore_SOURCES platform/graphics/efl/FontEfl.cpp)
ENDIF ()
+IF (ENABLE_TIZEN_BATTERY_STATUS)
+ LIST(APPEND WebCore_LIBRARIES
+ ${Pmapi_LIBRARIES}
+ )
+ LIST(APPEND WebCore_INCLUDE_DIRECTORIES
+ ${Pmapi_INCLUDE_DIRS}
+ )
+ENDIF()
+
IF (ENABLE_TIZEN_MM_PLAYER)
LIST(APPEND WebCore_INCLUDE_DIRECTORIES
${ELEMENTARY_INCLUDE_DIRS}
--- /dev/null
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "BatteryProviderEfl.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryProviderEflClient.h"
+#include "EventNames.h"
+#if ENABLE(TIZEN_BATTERY_STATUS)
+#include <vconf.h>
+#include <pmapi.h>
+#else
+#include <E_Ukit.h>
+#endif
+#include <limits>
+
+namespace WebCore {
+
+BatteryProviderEfl::BatteryProviderEfl(BatteryProviderEflClient* client)
+ : m_client(client)
+#if !ENABLE(TIZEN_BATTERY_STATUS)
+ , m_timer(this, &BatteryProviderEfl::timerFired)
+ , m_batteryStatusRefreshInterval(1.0)
+#endif
+{
+}
+
+
+BatteryStatus* BatteryProviderEfl::batteryStatus() const
+{
+ return m_batteryStatus.get();
+}
+
+#if ENABLE(TIZEN_BATTERY_STATUS)
+void batteryChangeCallback(keynode_t *keynode, void* data)
+{
+ char *key = vconf_keynode_get_name(keynode);
+ if (!key || strlen(key) == 0) {
+ LOG_ERROR("vconf_keynode_get_name failed");
+ return;
+ }
+ BatteryProviderEfl* client = static_cast<BatteryProviderEfl*>(data);
+ BatteryStatus* clientBatteryStatus = client->batteryStatus();
+
+ bool chargingBool = false;
+ int chargingInt = 0;
+ int chargingTime = std::numeric_limits<int>::infinity();
+ int dischargingTime = std::numeric_limits<int>::infinity();
+ int level = 1;
+
+ bool chargingChanged = false;
+ bool chargingTimeChanged = false;
+ bool dischargingTimeChanged = false;
+ bool levelChanged = false;
+
+ chargingBool = clientBatteryStatus->charging();
+ chargingTime = clientBatteryStatus->chargingTime();
+ dischargingTime = clientBatteryStatus->dischargingTime();
+ level = clientBatteryStatus->level();
+
+ if (!strncmp(key, VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, strlen(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW))) {
+ vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &chargingInt);
+ chargingInt ? chargingBool = true : chargingBool = false;
+ if (clientBatteryStatus->charging() != chargingBool)
+ chargingChanged = true;
+ }
+ else if (!strncmp(key, VCONFKEY_PM_BATTERY_TIMETOFULL, strlen(VCONFKEY_PM_BATTERY_TIMETOFULL))) {
+ vconf_get_int(VCONFKEY_PM_BATTERY_TIMETOFULL, &chargingTime);
+ if (clientBatteryStatus->chargingTime() != chargingTime)
+ chargingTimeChanged = true;
+ }
+ else if (!strncmp(key, VCONFKEY_PM_BATTERY_TIMETOEMPTY, strlen(VCONFKEY_PM_BATTERY_TIMETOEMPTY))) {
+ vconf_get_int(VCONFKEY_PM_BATTERY_TIMETOEMPTY, &dischargingTime);
+ if (clientBatteryStatus->dischargingTime() != dischargingTime)
+ dischargingTimeChanged = true;
+ }
+ else if (!strncmp(key, VCONFKEY_SYSMAN_BATTERY_CAPACITY, strlen(VCONFKEY_SYSMAN_BATTERY_CAPACITY))) {
+ vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, &level);
+ if (clientBatteryStatus->level() != level)
+ levelChanged = true;
+ }
+
+ WTF::RefPtr<BatteryStatus> batteryStatus = BatteryStatus::create(chargingBool, static_cast<double>(chargingTime), static_cast<double>(dischargingTime), static_cast<double>(level));
+ if (chargingChanged)
+ client->setBatteryStatus(eventNames().chargingchangeEvent, batteryStatus);
+ if (chargingTimeChanged)
+ client->setBatteryStatus(eventNames().chargingtimechangeEvent, batteryStatus);
+ if (dischargingTimeChanged)
+ client->setBatteryStatus(eventNames().dischargingtimechangeEvent, batteryStatus);
+ if (levelChanged)
+ client->setBatteryStatus(eventNames().levelchangeEvent, batteryStatus);
+}
+#endif
+
+void BatteryProviderEfl::startUpdating()
+{
+#if ENABLE(TIZEN_BATTERY_STATUS)
+ bool chargingBool = false;
+ int chargingInt = 0;
+ int chargingTime = std::numeric_limits<int>::infinity();
+ int dischargingTime = std::numeric_limits<int>::infinity();
+ int level = 1;
+
+ vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, &chargingInt);
+ chargingInt ? chargingBool = true : chargingBool = false;
+ vconf_get_int(VCONFKEY_PM_BATTERY_TIMETOFULL, &chargingTime);
+ vconf_get_int(VCONFKEY_PM_BATTERY_TIMETOEMPTY, &dischargingTime);
+ vconf_get_int(VCONFKEY_SYSMAN_BATTERY_CAPACITY, &level);
+
+ WTF::RefPtr<BatteryStatus> batteryStatus = BatteryStatus::create(chargingBool, static_cast<double>(chargingTime), static_cast<double>(dischargingTime), static_cast<double>(level));
+ this->setBatteryStatus(eventNames().chargingchangeEvent, batteryStatus);
+ this->setBatteryStatus(eventNames().chargingtimechangeEvent, batteryStatus);
+ this->setBatteryStatus(eventNames().dischargingtimechangeEvent, batteryStatus);
+ this->setBatteryStatus(eventNames().levelchangeEvent, batteryStatus);
+
+ pm_start_batteryinfo(0x1);
+ pm_start_batteryinfo(0x2);
+ vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, batteryChangeCallback, static_cast<void*>(this));
+ vconf_notify_key_changed(VCONFKEY_PM_BATTERY_TIMETOEMPTY, batteryChangeCallback, static_cast<void*>(this));
+ vconf_notify_key_changed(VCONFKEY_PM_BATTERY_TIMETOFULL, batteryChangeCallback, static_cast<void*>(this));
+ vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CAPACITY, batteryChangeCallback, static_cast<void*>(this));
+#else
+ if (m_timer.isActive())
+ return;
+
+ if (!e_dbus_init())
+ return;
+
+ if (!e_ukit_init()) {
+ e_dbus_shutdown();
+ return;
+ }
+
+ m_timer.startRepeating(m_batteryStatusRefreshInterval);
+#endif
+}
+
+void BatteryProviderEfl::stopUpdating()
+{
+#if ENABLE(TIZEN_BATTERY_STATUS)
+ pm_stop_batteryinfo(0x1);
+ pm_stop_batteryinfo(0x2);
+ vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, batteryChangeCallback);
+ vconf_ignore_key_changed(VCONFKEY_PM_BATTERY_TIMETOEMPTY, batteryChangeCallback);
+ vconf_ignore_key_changed(VCONFKEY_PM_BATTERY_TIMETOFULL, batteryChangeCallback);
+ vconf_ignore_key_changed(VCONFKEY_SYSMAN_BATTERY_CAPACITY, batteryChangeCallback);
+#else
+ m_timer.stop();
+
+ e_ukit_shutdown();
+ e_dbus_shutdown();
+#endif
+}
+
+void BatteryProviderEfl::setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus)
+{
+ m_batteryStatus = batteryStatus;
+ m_client->didChangeBatteryStatus(eventType, m_batteryStatus);
+}
+
+#if !ENABLE(TIZEN_BATTERY_STATUS)
+void BatteryProviderEfl::timerFired(Timer<BatteryProviderEfl>* timer)
+{
+ ASSERT_UNUSED(timer, timer == &m_timer);
+
+ E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+ if (edbusConnection)
+ e_upower_get_all_devices(edbusConnection, getBatteryStatus, static_cast<void*>(this));
+}
+
+void BatteryProviderEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError)
+{
+ E_Ukit_Get_All_Devices_Return* eukitDeviceNames = static_cast<E_Ukit_Get_All_Devices_Return*>(replyData);
+ if (!eukitDeviceNames || !eukitDeviceNames->strings || dbus_error_is_set(dBusError)) {
+ dbus_error_free(dBusError);
+ return;
+ }
+
+ E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM);
+ Eina_List* list;
+ void* deviceName;
+ EINA_LIST_FOREACH(eukitDeviceNames->strings, list, deviceName)
+ e_upower_get_all_properties(edbusConnection, static_cast<char*>(deviceName), setBatteryClient, data);
+}
+
+void BatteryProviderEfl::setBatteryClient(void* data, void* replyData, DBusError* dBusError)
+{
+ E_Ukit_Get_All_Properties_Return* eukitPropertyNames = static_cast<E_Ukit_Get_All_Properties_Return*>(replyData);
+
+ if (!eukitPropertyNames || dbus_error_is_set(dBusError)) {
+ dbus_error_free(dBusError);
+ return;
+ }
+
+ if (!eukitPropertyNames->properties)
+ return;
+
+ E_Ukit_Property* property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Type"));
+ if (!property || property->val.u != E_UPOWER_SOURCE_BATTERY)
+ return;
+
+ BatteryProviderEfl* client = static_cast<BatteryProviderEfl*>(data);
+ BatteryStatus* clientBatteryStatus = client->batteryStatus();
+ bool charging = false;
+ bool chargingChanged = false;
+ static unsigned chargingState = 0;
+
+ property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "State"));
+ if (!property)
+ return;
+ if (!clientBatteryStatus || chargingState != property->val.u) {
+ chargingChanged = true;
+ chargingState = property->val.u;
+ (chargingState == E_UPOWER_STATE_FULL || chargingState == E_UPOWER_STATE_CHARGING) ? charging = true : charging = false;
+ } else
+ charging = clientBatteryStatus->charging();
+
+ bool chargingTimeChanged = false;
+ bool dischargingTimeChanged = false;
+ double chargingTime = std::numeric_limits<double>::infinity();
+ double dischargingTime = std::numeric_limits<double>::infinity();
+
+ if (charging) {
+ if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != std::numeric_limits<double>::infinity())
+ dischargingTimeChanged = true;
+ dischargingTime = std::numeric_limits<double>::infinity();
+ property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToFull"));
+ if (!property)
+ return;
+ if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != property->val.x)
+ chargingTimeChanged = true;
+ chargingTime = property->val.x;
+ } else {
+ if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != std::numeric_limits<double>::infinity())
+ chargingTimeChanged = true;
+ chargingTime = std::numeric_limits<double>::infinity();
+ property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToEmpty"));
+ if (!property)
+ return;
+ if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != property->val.x)
+ dischargingTimeChanged = true;
+ dischargingTime = property->val.x;
+ }
+
+ double level = 0;
+ bool levelChanged = false;
+
+ property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Percentage"));
+ if (!property)
+ return;
+ if (!clientBatteryStatus || clientBatteryStatus->level() != property->val.d)
+ levelChanged = true;
+ level = property->val.d;
+
+ WTF::RefPtr<BatteryStatus> batteryStatus = BatteryStatus::create(charging, chargingTime, dischargingTime, level);
+ if (chargingChanged)
+ client->setBatteryStatus(eventNames().chargingchangeEvent, batteryStatus);
+ if (chargingTimeChanged)
+ client->setBatteryStatus(eventNames().chargingtimechangeEvent, batteryStatus);
+ if (dischargingTimeChanged)
+ client->setBatteryStatus(eventNames().dischargingtimechangeEvent, batteryStatus);
+ if (levelChanged)
+ client->setBatteryStatus(eventNames().levelchangeEvent, batteryStatus);
+}
+#endif
+}
+
+#endif // BATTERY_STATUS
+
--- /dev/null
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef BatteryProviderEfl_h
+#define BatteryProviderEfl_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryClient.h"
+#include "BatteryStatus.h"
+#include "Timer.h"
+#include <wtf/text/AtomicString.h>
+
+#if !ENABLE(TIZEN_BATTERY_STATUS)
+typedef struct DBusError DBusError;
+#endif
+
+namespace WebCore {
+
+class BatteryProviderEflClient;
+
+class BatteryProviderEfl {
+public:
+ BatteryProviderEfl(BatteryProviderEflClient*);
+ ~BatteryProviderEfl() { }
+
+ virtual void startUpdating();
+ virtual void stopUpdating();
+
+ void setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>);
+ BatteryStatus* batteryStatus() const;
+
+private:
+#if !ENABLE(TIZEN_BATTERY_STATUS)
+ void timerFired(Timer<BatteryProviderEfl>*);
+ static void getBatteryStatus(void* data, void* replyData, DBusError*);
+ static void setBatteryClient(void* data, void* replyData, DBusError*);
+#endif
+ BatteryProviderEflClient* m_client;
+#if !ENABLE(TIZEN_BATTERY_STATUS)
+ Timer<BatteryProviderEfl> m_timer;
+#endif
+ RefPtr<BatteryStatus> m_batteryStatus;
+#if !ENABLE(TIZEN_BATTERY_STATUS)
+ const double m_batteryStatusRefreshInterval;
+#endif
+};
+
+}
+
+#endif // ENABLE(BATTERY_STATUS)
+#endif // BatteryProviderEfl_h
+
--- /dev/null
+/*
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef BatteryProviderEflClient_h
+#define BatteryProviderEflClient_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryStatus.h"
+#include <wtf/text/AtomicString.h>
+
+namespace WebCore {
+
+class BatteryProviderEflClient {
+public:
+ virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // BatteryProviderEflClient_h
LIST(APPEND WebKit_SOURCES
efl/WebCoreSupport/AssertMatchingEnums.cpp
+ efl/WebCoreSupport/BatteryClientEfl.cpp
efl/WebCoreSupport/ChromeClientEfl.cpp
efl/WebCoreSupport/DeviceOrientationClientEfl.cpp
efl/WebCoreSupport/DeviceMotionClientEfl.cpp
/*
- * Copyright (C) 2012 Samsung Electronics
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#if ENABLE(BATTERY_STATUS)
#include "BatteryController.h"
-#include "EventNames.h"
-#include <limits>
-
-namespace WebCore {
BatteryClientEfl::BatteryClientEfl()
: m_controller(0)
- , m_timer(this, &BatteryClientEfl::timerFired)
- , m_batteryStatusRefreshInterval(1.0)
+ , m_provider(this)
{
}
-void BatteryClientEfl::setController(BatteryController* controller)
+void BatteryClientEfl::setController(WebCore::BatteryController* controller)
{
m_controller = controller;
}
void BatteryClientEfl::startUpdating()
{
- if (m_timer.isActive())
- return;
-
- if (!e_dbus_init())
- return;
-
- if (!e_ukit_init()) {
- e_dbus_shutdown();
- return;
- }
-
- m_timer.startRepeating(m_batteryStatusRefreshInterval);
+ m_provider.startUpdating();
}
void BatteryClientEfl::stopUpdating()
{
- m_timer.stop();
- e_ukit_shutdown();
- e_dbus_shutdown();
+ m_provider.stopUpdating();
}
void BatteryClientEfl::batteryControllerDestroyed()
delete this;
}
-void BatteryClientEfl::setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> batteryStatus)
-{
- m_batteryStatus = batteryStatus;
- m_controller->didChangeBatteryStatus(eventType, m_batteryStatus);
-}
-
-void BatteryClientEfl::timerFired(Timer<BatteryClientEfl>* timer)
+void BatteryClientEfl::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus> status)
{
- ASSERT_UNUSED(timer, timer == &m_timer);
- E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM);
- if (edbusConnection)
- e_upower_get_all_devices(edbusConnection, getBatteryStatus, static_cast<void*>(this));
+ ASSERT(m_controller);
+ m_controller->didChangeBatteryStatus(eventType, status);
}
-void BatteryClientEfl::getBatteryStatus(void* data, void* replyData, DBusError* dBusError)
-{
- E_Ukit_Get_All_Devices_Return* eukitDeviceNames = static_cast<E_Ukit_Get_All_Devices_Return*>(replyData);
- if (!eukitDeviceNames || !eukitDeviceNames->strings || dbus_error_is_set(dBusError)) {
- dbus_error_free(dBusError);
- return;
- }
-
- E_DBus_Connection* edbusConnection = e_dbus_bus_get(DBUS_BUS_SYSTEM);
- Eina_List* list;
- void* deviceName;
- EINA_LIST_FOREACH(eukitDeviceNames->strings, list, deviceName)
- e_upower_get_all_properties(edbusConnection, static_cast<char*>(deviceName), setBatteryClient, data);
-}
-
-void BatteryClientEfl::setBatteryClient(void* data, void* replyData, DBusError* dBusError)
-{
- E_Ukit_Get_All_Properties_Return* eukitPropertyNames = static_cast<E_Ukit_Get_All_Properties_Return*>(replyData);
-
- if (!eukitPropertyNames || dbus_error_is_set(dBusError)) {
- dbus_error_free(dBusError);
- return;
- }
-
- if (!eukitPropertyNames->properties)
- return;
-
- E_Ukit_Property* property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Type"));
- if (!property || property->val.u != E_UPOWER_SOURCE_BATTERY)
- return;
-
- BatteryClientEfl* client = static_cast<BatteryClientEfl*>(data);
- BatteryStatus* clientBatteryStatus = client->batteryStatus();
- bool charging = false;
- bool chargingChanged = false;
- static unsigned chargingState = 0;
-
- property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "State"));
- if (!property)
- return;
- if (!clientBatteryStatus || chargingState != property->val.u) {
- chargingChanged = true;
- chargingState = property->val.u;
- (chargingState == E_UPOWER_STATE_FULL || chargingState == E_UPOWER_STATE_CHARGING) ? charging = true : charging = false;
- } else
- charging = clientBatteryStatus->charging();
-
- bool chargingTimeChanged = false;
- bool dischargingTimeChanged = false;
- double chargingTime = std::numeric_limits<double>::infinity();
- double dischargingTime = std::numeric_limits<double>::infinity();
-
- if (charging) {
- if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != std::numeric_limits<double>::infinity())
- dischargingTimeChanged = true;
- dischargingTime = std::numeric_limits<double>::infinity();
- property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToFull"));
- if (!property)
- return;
- if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != property->val.x)
- chargingTimeChanged = true;
- chargingTime = property->val.x;
- } else {
- if (!clientBatteryStatus || clientBatteryStatus->chargingTime() != std::numeric_limits<double>::infinity())
- chargingTimeChanged = true;
- chargingTime = std::numeric_limits<double>::infinity();
- property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "TimeToEmpty"));
- if (!property)
- return;
- if (!clientBatteryStatus || clientBatteryStatus->dischargingTime() != property->val.x)
- dischargingTimeChanged = true;
- dischargingTime = property->val.x;
- }
-
- double level = 0;
- bool levelChanged = false;
-
- property = static_cast<E_Ukit_Property*>(eina_hash_find(eukitPropertyNames->properties, "Percentage"));
- if (!property)
- return;
- if (!clientBatteryStatus || clientBatteryStatus->level() != property->val.d)
- levelChanged = true;
- level = property->val.d;
-
- WTF::RefPtr<BatteryStatus> batteryStatus = BatteryStatus::create(charging, chargingTime, dischargingTime, level);
- if (chargingChanged)
- client->setBatteryStatus(eventNames().chargingchangeEvent, batteryStatus);
- if (chargingTimeChanged)
- client->setBatteryStatus(eventNames().chargingtimechangeEvent, batteryStatus);
- if (dischargingTimeChanged)
- client->setBatteryStatus(eventNames().dischargingtimechangeEvent, batteryStatus);
- if (levelChanged)
- client->setBatteryStatus(eventNames().levelchangeEvent, batteryStatus);
-}
-
-}
-
-#endif // BATTERY_STATUS
-
+#endif // ENABLE(BATTERY_STATUS)
/*
- * Copyright (C) 2012 Samsung Electronics
+ * Copyright (C) 2012 Samsung Electronics. All rights reserved.
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#if ENABLE(BATTERY_STATUS)
#include "BatteryClient.h"
+#include "BatteryProviderEfl.h"
+#include "BatteryProviderEflClient.h"
#include "BatteryStatus.h"
-#include "Timer.h"
-#include <E_Ukit.h>
-#include <wtf/text/AtomicString.h>
+#include <wtf/PassRefPtr.h>
namespace WebCore {
-
class BatteryController;
-class BatteryStatus;
+}
-class BatteryClientEfl : public BatteryClient {
+class BatteryClientEfl : public WebCore::BatteryClient, public WebCore::BatteryProviderEflClient {
public:
BatteryClientEfl();
- ~BatteryClientEfl() { };
+ virtual ~BatteryClientEfl() { }
- virtual void setController(BatteryController*);
+ // BatteryClient interface.
+ virtual void setController(WebCore::BatteryController*);
virtual void startUpdating();
virtual void stopUpdating();
virtual void batteryControllerDestroyed();
- void setBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus>);
- BatteryStatus* batteryStatus() { return m_batteryStatus.get(); }
-
private:
- void timerFired(Timer<BatteryClientEfl>*);
- static void getBatteryStatus(void* data, void* replyData, DBusError*);
- static void setBatteryClient(void* data, void* replyData, DBusError*);
+ // BatteryProviderEflClient interface.
+ virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>);
- BatteryController* m_controller;
- Timer<BatteryClientEfl> m_timer;
- RefPtr<BatteryStatus> m_batteryStatus;
- const double m_batteryStatusRefreshInterval;
+ WebCore::BatteryController* m_controller;
+ WebCore::BatteryProviderEfl m_provider;
};
-}
+#endif // ENABLE(BATTERY_STATUS)
-#endif // BATTERY_STATUS
#endif // BatteryClientEfl_h
-
#endif
#if ENABLE(BATTERY_STATUS)
- WebCore::provideBatteryTo(priv->page.get(), new WebCore::BatteryClientEfl);
+ WebCore::provideBatteryTo(priv->page.get(), new BatteryClientEfl);
#endif
priv->pageSettings = priv->page->settings();
"${WEBKIT2_DIR}/WebProcess"
"${WEBKIT2_DIR}/WebProcess/ApplicationCache"
"${WEBKIT2_DIR}/WebProcess/Authentication"
+ "${WEBKIT2_DIR}/WebProcess/Battery"
"${WEBKIT2_DIR}/WebProcess/Cookies"
"${WEBKIT2_DIR}/WebProcess/Cookies/soup"
"${WEBKIT2_DIR}/WebProcess/Downloads"
"${WEBKIT2_DIR}/WebProcess/WebCoreSupport/soup"
"${WEBKIT2_DIR}/WebProcess/WebPage"
"${WEBCORE_DIR}"
+ "${WEBCORE_DIR}/Modules/battery"
"${WEBCORE_DIR}/Modules/intents"
"${WEBCORE_DIR}/accessibility"
"${WEBCORE_DIR}/bindings/js"
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/WKBatteryStatus.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/Cookies/soup/WebCookieManagerSoup.cpp
WebProcess/soup/WebKitSoupRequestInputStream.cpp
WebProcess/soup/WebSoupRequestManager.cpp
+ WebProcess/WebCoreSupport/WebBatteryClient.cpp
WebProcess/WebCoreSupport/WebChromeClient.cpp
WebProcess/WebCoreSupport/WebColorChooser.cpp
WebProcess/WebCoreSupport/WebContextMenuClient.cpp
UIProcess/DrawingAreaProxy.messages.in
UIProcess/LayerTreeHostProxy.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
MessageClassInjectedBundle,
MessageClassLayerTreeHost,
MessageClassWebApplicationCacheManager,
+ MessageClassWebBatteryManagerProxy,
MessageClassWebCookieManager,
MessageClassWebDatabaseManager,
MessageClassWebFullScreenManager,
MessageClassDrawingAreaProxy,
MessageClassLayerTreeHostProxy,
MessageClassWebApplicationCacheManagerProxy,
+ MessageClassWebBatteryManager,
MessageClassWebContext,
MessageClassWebContextLegacy,
MessageClassWebCookieManagerProxy,
UIProcess/API/C/soup/WKContextSoup.cpp
UIProcess/API/C/soup/WKSoupRequestManager.cpp
+ UIProcess/API/efl/BatteryProvider.cpp
UIProcess/API/efl/PageClientImpl.cpp
UIProcess/API/efl/ewk_context.cpp
UIProcess/API/efl/ewk_view.cpp
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
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"
+#include <wtf/text/AtomicString.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
+}
+
+void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProvider* provider)
+{
+#if ENABLE(BATTERY_STATUS)
+ toImpl(batteryManager)->initializeProvider(provider);
+#endif
+}
+
+void WKBatteryManagerProviderDidChangeBatteryStatus(WKBatteryManagerRef batteryManager, WKStringRef eventType, WKBatteryStatusRef status)
+{
+#if ENABLE(BATTERY_STATUS)
+ toImpl(batteryManager)->providerDidChangeBatteryStatus(AtomicString(toImpl(eventType)->string()), toImpl(status));
+#endif
+}
+
+void WKBatteryManagerProviderUpdateBatteryStatus(WKBatteryManagerRef batteryManager, WKBatteryStatusRef status)
+{
+#if ENABLE(BATTERY_STATUS)
+ toImpl(batteryManager)->providerUpdateBatteryStatus(toImpl(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.
+ */
+
+#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();
+
+WK_EXPORT void WKBatteryManagerSetProvider(WKBatteryManagerRef batteryManager, const WKBatteryProvider* provider);
+
+WK_EXPORT void WKBatteryManagerProviderDidChangeBatteryStatus(WKBatteryManagerRef batteryManager, WKStringRef eventType, WKBatteryStatusRef status);
+WK_EXPORT void WKBatteryManagerProviderUpdateBatteryStatus(WKBatteryManagerRef batteryManager, WKBatteryStatusRef status);
+
+#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 "WKBatteryStatus.h"
+
+#include "WKAPICast.h"
+
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryStatus.h"
+#endif
+
+using namespace WebKit;
+
+WKTypeID WKBatteryStatusGetTypeID()
+{
+#if ENABLE(BATTERY_STATUS)
+ return toAPI(WebBatteryStatus::APIType);
+#else
+ return 0;
+#endif
+}
+
+WKBatteryStatusRef WKBatteryStatusCreate(bool isCharging, double chargingTime, double dischargingTime, double level)
+{
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<WebBatteryStatus> status = WebBatteryStatus::create(isCharging, chargingTime, dischargingTime, level);
+ return toAPI(status.release().leakRef());
+#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 WKBatteryStatus_h
+#define WKBatteryStatus_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBatteryStatusGetTypeID();
+
+WK_EXPORT WKBatteryStatusRef WKBatteryStatusCreate(bool isCharging, double chargingTime, double dischargingTime, double level);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // WKBatteryStatus_h
return toAPI(toImpl(contextRef)->applicationCacheManagerProxy());
}
+WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef contextRef)
+{
+#if ENABLE(BATTERY_STATUS)
+ return toAPI(toImpl(contextRef)->batteryManagerProxy());
+#else
+ return 0;
+#endif
+}
+
WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef contextRef)
{
return toAPI(toImpl(contextRef)->databaseManagerProxy());
WK_EXPORT void WKContextSetIndexedDatabaseDirectory(WKContextRef contextRef, WKStringRef indexedDatabaseDirectory);
WK_EXPORT WKApplicationCacheManagerRef WKContextGetApplicationCacheManager(WKContextRef context);
+WK_EXPORT WKBatteryManagerRef WKContextGetBatteryManager(WKContextRef context);
WK_EXPORT WKCookieManagerRef WKContextGetCookieManager(WKContextRef context);
WK_EXPORT WKDatabaseManagerRef WKContextGetDatabaseManager(WKContextRef context);
WK_EXPORT WKGeolocationManagerRef WKContextGetGeolocationManager(WKContextRef context);
--- /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 "BatteryProvider.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "WKAPICast.h"
+#include "WKBatteryManager.h"
+#include "WKBatteryStatus.h"
+
+using namespace WebCore;
+using namespace WebKit;
+
+static inline BatteryProvider* toBatteryProvider(const void* clientInfo)
+{
+ return static_cast<BatteryProvider*>(const_cast<void*>(clientInfo));
+}
+
+static void startUpdatingCallback(WKBatteryManagerRef batteryManager, const void* clientInfo)
+{
+ toBatteryProvider(clientInfo)->startUpdating();
+}
+
+static void stopUpdatingCallback(WKBatteryManagerRef batteryManager, const void* clientInfo)
+{
+ toBatteryProvider(clientInfo)->stopUpdating();
+}
+
+BatteryProvider::~BatteryProvider()
+{
+ m_provider.stopUpdating();
+}
+
+PassRefPtr<BatteryProvider> BatteryProvider::create(WKBatteryManagerRef wkBatteryManager)
+{
+ return adoptRef(new BatteryProvider(wkBatteryManager));
+}
+
+BatteryProvider::BatteryProvider(WKBatteryManagerRef wkBatteryManager)
+ : m_wkBatteryManager(wkBatteryManager)
+ , m_provider(this)
+{
+ ASSERT(wkBatteryManager);
+
+ WKBatteryProvider wkBatteryProvider = {
+ kWKBatteryProviderCurrentVersion,
+ this, // clientInfo
+ startUpdatingCallback,
+ stopUpdatingCallback
+ };
+ WKBatteryManagerSetProvider(m_wkBatteryManager.get(), &wkBatteryProvider);
+}
+
+void BatteryProvider::startUpdating()
+{
+ m_provider.startUpdating();
+}
+
+void BatteryProvider::stopUpdating()
+{
+ m_provider.stopUpdating();
+}
+
+void BatteryProvider::didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<BatteryStatus> status)
+{
+ WKRetainPtr<WKBatteryStatusRef> wkBatteryStatus(AdoptWK, WKBatteryStatusCreate(status->charging(), status->chargingTime(), status->dischargingTime(), status->level()));
+ WKBatteryManagerProviderDidChangeBatteryStatus(m_wkBatteryManager.get(), toAPI(eventType.impl()), wkBatteryStatus.get());
+}
+
+#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 BatteryProvider_h
+#define BatteryProvider_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryProviderEfl.h"
+#include "BatteryProviderEflClient.h"
+#include "BatteryStatus.h"
+#include "WKRetainPtr.h"
+#include <WebKit2/WKBase.h>
+#include <wtf/PassRefPtr.h>
+
+class BatteryProvider : public RefCounted<BatteryProvider>, public WebCore::BatteryProviderEflClient {
+public:
+ virtual ~BatteryProvider();
+ static PassRefPtr<BatteryProvider> create(WKBatteryManagerRef);
+
+ void startUpdating();
+ void stopUpdating();
+
+private:
+ BatteryProvider(WKBatteryManagerRef);
+
+ // BatteryProviderEflClient interface.
+ virtual void didChangeBatteryStatus(const AtomicString& eventType, PassRefPtr<WebCore::BatteryStatus>);
+
+ WKRetainPtr<WKBatteryManagerRef> m_wkBatteryManager;
+ WebCore::BatteryProviderEfl m_provider;
+};
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // BatteryProvider_h
#include "config.h"
#include "ewk_context.h"
+#include "BatteryProvider.h"
#include "WKAPICast.h"
#include "WKApplicationCacheManager.h"
#include "WKArray.h"
struct _Ewk_Context {
WKRetainPtr<WKContextRef> context;
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<BatteryProvider> batteryProvider;
+#endif
const char* proxyAddress;
#if ENABLE(TIZEN_SQL_DATABASE)
uint64_t defaultDatabaseQuota;
_Ewk_Context(WKRetainPtr<WKContextRef> contextRef)
: context(contextRef)
{
+#if ENABLE(BATTERY_STATUS)
+ WKBatteryManagerRef wkBatteryManager = WKContextGetBatteryManager(contextRef.get());
+ batteryProvider = BatteryProvider::create(wkBatteryManager);
+#endif
this->proxyAddress = 0;
#if ENABLE(TIZEN_SQL_DATABASE)
this->defaultDatabaseQuota = 5 * 1024 * 1024;
--- /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
#include "BuiltInPDFView.h"
#endif
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryManagerProxy.h"
+#endif
+
#if USE(SOUP)
#include "WebSoupRequestManagerProxy.h"
#endif
, m_memorySamplerEnabled(false)
, m_memorySamplerInterval(1400.0)
, m_applicationCacheManagerProxy(WebApplicationCacheManagerProxy::create(this))
+#if ENABLE(BATTERY_STATUS)
+ , m_batteryManagerProxy(WebBatteryManagerProxy::create(this))
+#endif
, m_cookieManagerProxy(WebCookieManagerProxy::create(this))
, m_databaseManagerProxy(WebDatabaseManagerProxy::create(this))
, m_geolocationManagerProxy(WebGeolocationManagerProxy::create(this))
m_applicationCacheManagerProxy->invalidate();
m_applicationCacheManagerProxy->clearContext();
+#if ENABLE(BATTERY_STATUS)
+ m_batteryManagerProxy->invalidate();
+ m_batteryManagerProxy->clearContext();
+#endif
+
m_cookieManagerProxy->invalidate();
m_cookieManagerProxy->clearContext();
m_downloads.clear();
m_applicationCacheManagerProxy->invalidate();
+#if ENABLE(BATTERY_STATUS)
+ m_batteryManagerProxy->invalidate();
+#endif
m_cookieManagerProxy->invalidate();
m_databaseManagerProxy->invalidate();
m_geolocationManagerProxy->invalidate();
return;
}
+#if ENABLE(BATTERY_STATUS)
+ if (messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()) {
+ m_batteryManagerProxy->didReceiveMessage(connection, messageID, arguments);
+ return;
+ }
+#endif
+
if (messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()) {
m_cookieManagerProxy->didReceiveMessage(connection, messageID, arguments);
return;
class DownloadProxy;
class WebApplicationCacheManagerProxy;
+#if ENABLE(BATTERY_STATUS)
+class WebBatteryManagerProxy;
+#endif
class WebCookieManagerProxy;
class WebDatabaseManagerProxy;
class WebGeolocationManagerProxy;
static HashSet<String, CaseFoldingHash> pdfAndPostScriptMIMETypes();
WebApplicationCacheManagerProxy* applicationCacheManagerProxy() const { return m_applicationCacheManagerProxy.get(); }
+#if ENABLE(BATTERY_STATUS)
+ WebBatteryManagerProxy* batteryManagerProxy() const { return m_batteryManagerProxy.get(); }
+#endif
WebCookieManagerProxy* cookieManagerProxy() const { return m_cookieManagerProxy.get(); }
WebDatabaseManagerProxy* databaseManagerProxy() const { return m_databaseManagerProxy.get(); }
WebGeolocationManagerProxy* geolocationManagerProxy() const { return m_geolocationManagerProxy.get(); }
double m_memorySamplerInterval;
RefPtr<WebApplicationCacheManagerProxy> m_applicationCacheManagerProxy;
+#if ENABLE(BATTERY_STATUS)
+ RefPtr<WebBatteryManagerProxy> m_batteryManagerProxy;
+#endif
RefPtr<WebCookieManagerProxy> m_cookieManagerProxy;
RefPtr<WebDatabaseManagerProxy> m_databaseManagerProxy;
RefPtr<WebGeolocationManagerProxy> m_geolocationManagerProxy;
|| messageID.is<CoreIPC::MessageClassWebContextLegacy>()
|| messageID.is<CoreIPC::MessageClassDownloadProxy>()
|| messageID.is<CoreIPC::MessageClassWebApplicationCacheManagerProxy>()
+#if ENABLE(BATTERY_STATUS)
+ || messageID.is<CoreIPC::MessageClassWebBatteryManagerProxy>()
+#endif
|| messageID.is<CoreIPC::MessageClassWebCookieManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebDatabaseManagerProxy>()
|| messageID.is<CoreIPC::MessageClassWebGeolocationManagerProxy>()
--- /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)
+{
+ LOG_ERROR("====Jiyeon WebBatteryManager::registerWebPage");
+ 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
#endif
+#if ENABLE(BATTERY_STATUS)
+#include "WebBatteryClient.h"
+#endif
+
#if PLATFORM(MAC)
#include "BuiltInPDFView.h"
#endif
m_page = adoptPtr(new Page(pageClients));
+#if ENABLE(BATTERY_STATUS)
+ WebCore::provideBatteryTo(m_page.get(), new WebBatteryClient(this));
+#endif
+
#if ENABLE(GEOLOCATION)
WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));
#endif
#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; }
#endif
TextCheckerState m_textCheckerState;
WebGeolocationManager m_geolocationManager;
+#if ENABLE(BATTERY_STATUS)
+ WebBatteryManager m_batteryManager;
+#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
WebNotificationManager m_notificationManager;
#endif
--- /dev/null
+# - Try to find Pmapi
+# Once done, this will define
+#
+# Pmapi_FOUND - system has pmapi
+# Pmapi_INCLUDE_DIRS - the pmapi include directories
+# Pmapi_LIBRARIES - link these to use pmapi
+
+include(LibFindMacros)
+
+# Use pkg-config to get hints about paths
+libfind_pkg_check_modules(Pmapi_PKGCONF pmapi)
+
+# Include dir
+find_path(Pmapi_INCLUDE_DIR
+ NAMES pmapi.h
+ PATHS ${Pmapi_PKGCONF_INCLUDE_DIRS}
+ PATH_SUFFIXES pmapi
+)
+
+# Finally the library itself
+find_library(Pmapi_LIBRARY
+ NAMES pmapi
+ PATHS ${Pmapi_PKGCONF_LIBRARY_DIRS}
+)
+
+# Set the include dir variables and the libraries and let libfind_process do the rest.
+# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
+set(Pmapi_PROCESS_INCLUDES Pmapi_INCLUDE_DIR Pmapi_INCLUDE_DIRS)
+set(Pmapi_PROCESS_LIBS Pmapi_LIBRARY Pmapi_LIBRARIES)
+libfind_process(Pmapi)
+
WEBKIT_OPTION_BEGIN()
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_3D_RENDERING ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BATTERY_STATUS ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_BLOB ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_CSS_FILTERS ON)
WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_DATALIST ON)
SET(ENABLE_TOUCH_ICON_LOADING 1)
+ IF (ENABLE_BATTERY_STATUS)
+ ADD_DEFINITIONS(-DENABLE_TIZEN_BATTERY_STATUS=1)
+ SET(ENABLE_TIZEN_BATTERY_STATUS 1)
+ FIND_PACKAGE(Pmapi REQUIRED)
+ ENDIF ()
+
IF (ENABLE_WEBKIT2)
# SET(ENABLE_NOTIFICATIONS 1)
# LIST(APPEND FEATURE_DEFINES ENABLE_NOTIFICATIONS)
BuildRequires: pkgconfig(leveldb)
BuildRequires: pkgconfig(capi-location-manager)
BuildRequires: pkgconfig(ui-gadget-1)
+BuildRequires: pkgconfig(pmapi)
%ifarch %{arm}
BuildRequires: pkgconfig(gles20)