[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

xan at webkit.org xan at webkit.org
Wed Dec 22 18:31:50 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit dc077bdcf22f9dff1b2608c0a7c0f6857e9dd68b
Author: xan at webkit.org <xan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 13 19:29:25 2010 +0000

    2010-12-13  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Martin Robinson.
    
            [GTK] Add API to enable/disable plugins at runtime
            https://bugs.webkit.org/show_bug.cgi?id=50891
    
            * tests/testwebplugindatabase.c:
            (test_webkit_web_plugin_database_get_plugins): test that disabling
            a plugin works.
            * webkit/webkitwebplugin.cpp:
            (webkit_web_plugin_get_property): hook 'enabled' property.
            (webkit_web_plugin_set_property): ditto.
            (webkit_web_plugin_class_init): define 'enabled' property.
            (webkit_web_plugin_set_enabled): setter for the property.
            (webkit_web_plugin_get_enabled): getter for the property.
            * webkit/webkitwebplugin.h: add the APIs to the header.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73936 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 9d33b23..7694c29 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-13  Xan Lopez  <xlopez at igalia.com>
+
+        Reviewed by Martin Robinson.
+
+        [GTK] Add API to enable/disable plugins at runtime
+        https://bugs.webkit.org/show_bug.cgi?id=50891
+
+        * tests/testwebplugindatabase.c:
+        (test_webkit_web_plugin_database_get_plugins): test that disabling
+        a plugin works.
+        * webkit/webkitwebplugin.cpp:
+        (webkit_web_plugin_get_property): hook 'enabled' property.
+        (webkit_web_plugin_set_property): ditto.
+        (webkit_web_plugin_class_init): define 'enabled' property.
+        (webkit_web_plugin_set_enabled): setter for the property.
+        (webkit_web_plugin_get_enabled): getter for the property.
+        * webkit/webkitwebplugin.h: add the APIs to the header.
+
 2010-12-13  Carlos Garcia Campos  <cgarcia at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/tests/testwebplugindatabase.c b/WebKit/gtk/tests/testwebplugindatabase.c
index 802f250..1366f84 100644
--- a/WebKit/gtk/tests/testwebplugindatabase.c
+++ b/WebKit/gtk/tests/testwebplugindatabase.c
@@ -34,6 +34,7 @@ static void test_webkit_web_plugin_database_get_plugins()
     WebKitWebPluginDatabase* database;
     GSList* pluginList, *p;
     gboolean found = FALSE;
+    gboolean enabled = FALSE;
 
     webkit_web_settings_add_extra_plugin_directory(view, TEST_PLUGIN_DIR);
     g_object_ref_sink(G_OBJECT(view));
@@ -43,11 +44,27 @@ static void test_webkit_web_plugin_database_get_plugins()
     for (p = pluginList; p; p = p->next) {
         WebKitWebPlugin* plugin = (WebKitWebPlugin*)p->data;
         if (!g_strcmp0(webkit_web_plugin_get_name(plugin), "WebKit Test PlugIn") &&
-            !g_strcmp0(webkit_web_plugin_get_description(plugin), "Simple Netscape plug-in that handles test content for WebKit"))
+            !g_strcmp0(webkit_web_plugin_get_description(plugin), "Simple Netscape plug-in that handles test content for WebKit")) {
             found = TRUE;
+            enabled = webkit_web_plugin_get_enabled(plugin);
+            webkit_web_plugin_set_enabled(plugin, FALSE);
+        }
     }
     webkit_web_plugin_database_plugins_list_free(pluginList);
     g_assert(found);
+    g_assert(enabled);
+
+    webkit_web_plugin_database_refresh(database);
+    pluginList = webkit_web_plugin_database_get_plugins(database);
+
+    for (p = pluginList; p; p = p->next) {
+        WebKitWebPlugin* plugin = (WebKitWebPlugin*)p->data;
+        if (!g_strcmp0(webkit_web_plugin_get_name(plugin), "WebKit Test PlugIn") &&
+            !g_strcmp0(webkit_web_plugin_get_description(plugin), "Simple Netscape plug-in that handles test content for WebKit"))
+            enabled = webkit_web_plugin_get_enabled(plugin);
+    }
+    webkit_web_plugin_database_plugins_list_free(pluginList);
+    g_assert(!enabled);
 
     g_object_unref(view);
 }
diff --git a/WebKit/gtk/webkit/webkitwebplugin.cpp b/WebKit/gtk/webkit/webkitwebplugin.cpp
index 490bb6f..5d08b4d 100644
--- a/WebKit/gtk/webkit/webkitwebplugin.cpp
+++ b/WebKit/gtk/webkit/webkitwebplugin.cpp
@@ -22,9 +22,16 @@
 #include "PluginPackage.h"
 #include "webkitprivate.h"
 #include "webkitwebpluginprivate.h"
+#include <glib/gi18n-lib.h>
 
 using namespace WebCore;
 
+enum {
+    PROP_0,
+
+    PROP_ENABLED
+};
+
 G_DEFINE_TYPE(WebKitWebPlugin, webkit_web_plugin, G_TYPE_OBJECT)
 
 static void freeMIMEType(WebKitWebPluginMIMEType* mimeType)
@@ -57,6 +64,32 @@ static void webkit_web_plugin_finalize(GObject* object)
     G_OBJECT_CLASS(webkit_web_plugin_parent_class)->dispose(object);
 }
 
+static void webkit_web_plugin_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* paramSpec)
+{
+    WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object);
+
+    switch (prop_id) {
+    case PROP_ENABLED:
+        g_value_set_boolean(value, webkit_web_plugin_get_enabled(plugin));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, paramSpec);
+    }
+}
+
+static void webkit_web_plugin_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* paramSpec)
+{
+    WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object);
+
+    switch (prop_id) {
+    case PROP_ENABLED:
+        webkit_web_plugin_set_enabled(plugin, g_value_get_boolean(value));
+        break;
+    default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, paramSpec);
+    }
+}
+
 static void webkit_web_plugin_class_init(WebKitWebPluginClass* klass)
 {
     webkit_init();
@@ -64,6 +97,16 @@ static void webkit_web_plugin_class_init(WebKitWebPluginClass* klass)
     GObjectClass* gobjectClass = reinterpret_cast<GObjectClass*>(klass);
 
     gobjectClass->finalize = webkit_web_plugin_finalize;
+    gobjectClass->get_property = webkit_web_plugin_get_property;
+    gobjectClass->set_property = webkit_web_plugin_set_property;
+
+    g_object_class_install_property(gobjectClass,
+                                    PROP_ENABLED,
+                                    g_param_spec_boolean("enabled",
+                                                         _("Enabled"),
+                                                         _("Whether the plugin is enabled"),
+                                                         FALSE,
+                                                         WEBKIT_PARAM_READWRITE));
 
     g_type_class_add_private(klass, sizeof(WebKitWebPluginPrivate));
 }
@@ -163,3 +206,42 @@ GSList* webkit_web_plugin_get_mimetypes(WebKitWebPlugin* plugin)
 
     return priv->mimeTypes;
 }
+
+/**
+ * webkit_web_plugin_set_enabled:
+ * @plugin: a #WebKitWebPlugin
+ * @enabled: whether to enable the plugin
+ *
+ * Sets the enabled status of the @plugin.
+ *
+ * Since: 1.3.8
+ */
+void webkit_web_plugin_set_enabled(WebKitWebPlugin* plugin, gboolean enabled)
+{
+    g_return_if_fail(WEBKIT_IS_WEB_PLUGIN(plugin));
+    WebKitWebPluginPrivate* priv = plugin->priv;
+
+    ASSERT(priv->corePlugin);
+    if (priv->corePlugin->isEnabled() == enabled)
+        return;
+
+    priv->corePlugin->setEnabled(enabled);
+
+    g_object_notify(G_OBJECT(plugin), "enabled");
+}
+
+/**
+ * webkit_web_plugin_get_enabled:
+ * @plugin: a #WebKitWebPlugin
+ *
+ * Returns: %TRUE if the plugin is enabled, %FALSE otherwise
+ *
+ * Since: 1.3.8
+ */
+gboolean webkit_web_plugin_get_enabled(WebKitWebPlugin* plugin)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_PLUGIN(plugin), FALSE);
+
+    ASSERT(plugin->priv->corePlugin);
+    return plugin->priv->corePlugin->isEnabled();
+}
diff --git a/WebKit/gtk/webkit/webkitwebplugin.h b/WebKit/gtk/webkit/webkitwebplugin.h
index 9c5122b..28b96e1 100644
--- a/WebKit/gtk/webkit/webkitwebplugin.h
+++ b/WebKit/gtk/webkit/webkitwebplugin.h
@@ -79,6 +79,12 @@ webkit_web_plugin_get_description (WebKitWebPlugin*);
 WEBKIT_API GSList*
 webkit_web_plugin_get_mimetypes   (WebKitWebPlugin*);
 
+WEBKIT_API void
+webkit_web_plugin_set_enabled     (WebKitWebPlugin*, gboolean);
+
+WEBKIT_API gboolean
+webkit_web_plugin_get_enabled     (WebKitWebPlugin*);
+
 G_END_DECLS
 
 #endif

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list