[GTK][WK1] Add an empty BatteryClientGtk
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Dec 2013 16:46:18 +0000 (16:46 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Dec 2013 16:46:18 +0000 (16:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115628

Reviewed by Martin Robinson.

Add an empty BatteryClientGtk, implementing the WebCore's BatteryClient interface.
The implementation is left empty intentionally as the WebKit1 port is now in maintenance
mode and there's no desire to support new features under it. It's still required as the
WebCore implementation of the Battery Status API expects an existing BatteryClient, even
if the latter does not set up a provider that would then serve information about the battery
state.

* GNUmakefile.am: Add the BatteryClientGtk source files to the build.
* WebCoreSupport/BatteryClientGtk.cpp: Added.
(WebKit):
(WebKit::BatteryClientGtk::BatteryClientGtk):
(WebKit::BatteryClientGtk::startUpdating):
(WebKit::BatteryClientGtk::stopUpdating):
(WebKit::BatteryClientGtk::batteryControllerDestroyed):
* WebCoreSupport/BatteryClientGtk.h: Added.
(WebKit):
(BatteryClientGtk):
* webkit/webkitwebview.cpp:
(webkit_web_view_init): Set up the BatteryClientGtk for the new WebCore::Page object.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@160437 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/gtk/ChangeLog
Source/WebKit/gtk/GNUmakefile.am
Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.cpp [new file with mode: 0644]
Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.h [new file with mode: 0644]
Source/WebKit/gtk/webkit/webkitwebview.cpp

index 4ef8b82..d553c65 100644 (file)
@@ -1,3 +1,30 @@
+2013-12-11  José Dapena Paz  <jdapena@igalia.com> and Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK][WK1] Add an empty BatteryClientGtk
+        https://bugs.webkit.org/show_bug.cgi?id=115628
+
+        Reviewed by Martin Robinson.
+
+        Add an empty BatteryClientGtk, implementing the WebCore's BatteryClient interface.
+        The implementation is left empty intentionally as the WebKit1 port is now in maintenance
+        mode and there's no desire to support new features under it. It's still required as the
+        WebCore implementation of the Battery Status API expects an existing BatteryClient, even
+        if the latter does not set up a provider that would then serve information about the battery
+        state.
+
+        * GNUmakefile.am: Add the BatteryClientGtk source files to the build.
+        * WebCoreSupport/BatteryClientGtk.cpp: Added.
+        (WebKit):
+        (WebKit::BatteryClientGtk::BatteryClientGtk):
+        (WebKit::BatteryClientGtk::startUpdating):
+        (WebKit::BatteryClientGtk::stopUpdating):
+        (WebKit::BatteryClientGtk::batteryControllerDestroyed):
+        * WebCoreSupport/BatteryClientGtk.h: Added.
+        (WebKit):
+        (BatteryClientGtk):
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_init): Set up the BatteryClientGtk for the new WebCore::Page object.
+
 2013-12-11  Brendan Long  <b.long@cablelabs.com>
 
         [GTK] Add "enable-mediasource" property to WebKitWebSettings
index 4ff4656..3c81104 100644 (file)
@@ -192,6 +192,8 @@ webkitgtk_sources += \
        Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContext.h \
        Source/WebKit/gtk/WebCoreSupport/AcceleratedCompositingContextGL.cpp \
        Source/WebKit/gtk/WebCoreSupport/AssertMatchingEnums.cpp \
+       Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.cpp \
+       Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.h \
        Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp \
        Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.h \
        Source/WebKit/gtk/WebCoreSupport/ContextMenuClientGtk.cpp \
diff --git a/Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.cpp
new file mode 100644 (file)
index 0000000..4285821
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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 "BatteryClientGtk.h"
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "NotImplemented.h"
+
+namespace WebKit {
+
+BatteryClientGtk::BatteryClientGtk()
+{
+}
+
+void BatteryClientGtk::startUpdating()
+{
+    notImplemented();
+}
+
+void BatteryClientGtk::stopUpdating()
+{
+    notImplemented();
+}
+
+void BatteryClientGtk::batteryControllerDestroyed()
+{
+    notImplemented();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
diff --git a/Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/BatteryClientGtk.h
new file mode 100644 (file)
index 0000000..b7d37ff
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2013 Igalia S.L.
+ *
+ * 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 BatteryClientGtk_h
+#define BatteryClientGtk_h
+
+#if ENABLE(BATTERY_STATUS)
+
+#include "BatteryClient.h"
+
+namespace WebKit {
+
+class BatteryClientGtk : public WebCore::BatteryClient {
+public:
+    BatteryClientGtk();
+
+    // WebCore::BatteryClient
+    virtual void startUpdating();
+    virtual void stopUpdating();
+    virtual void batteryControllerDestroyed();
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(BATTERY_STATUS)
+
+#endif // BatteryClientGtk_h
index f7e361c..24c8c3b 100644 (file)
@@ -35,6 +35,7 @@
 #include "AXObjectCache.h"
 #include "ArchiveResource.h"
 #include "BackForwardList.h"
+#include "BatteryClientGtk.h"
 #include "CairoUtilities.h"
 #include "Chrome.h"
 #include "ChromeClientGtk.h"
@@ -3837,6 +3838,10 @@ static void webkit_web_view_init(WebKitWebView* webView)
     WebCore::provideNavigatorContentUtilsTo(priv->corePage, priv->navigatorContentUtilsClient.get());
 #endif
 
+#if ENABLE(BATTERY_STATUS)
+    WebCore::provideBatteryTo(priv->corePage, new BatteryClientGtk);
+#endif
+
     if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) {
         // Set some testing-specific settings
         priv->corePage->settings().setInteractiveFormValidationEnabled(true);