Changeset 73936 in webkit
- Timestamp:
- Dec 13, 2010 11:29:25 AM (13 years ago)
- Location:
- trunk/WebKit/gtk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/gtk/ChangeLog
r73906 r73936 1 2010-12-13 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Martin Robinson. 4 5 [GTK] Add API to enable/disable plugins at runtime 6 https://bugs.webkit.org/show_bug.cgi?id=50891 7 8 * tests/testwebplugindatabase.c: 9 (test_webkit_web_plugin_database_get_plugins): test that disabling 10 a plugin works. 11 * webkit/webkitwebplugin.cpp: 12 (webkit_web_plugin_get_property): hook 'enabled' property. 13 (webkit_web_plugin_set_property): ditto. 14 (webkit_web_plugin_class_init): define 'enabled' property. 15 (webkit_web_plugin_set_enabled): setter for the property. 16 (webkit_web_plugin_get_enabled): getter for the property. 17 * webkit/webkitwebplugin.h: add the APIs to the header. 18 1 19 2010-12-13 Carlos Garcia Campos <cgarcia@igalia.com> 2 20 -
trunk/WebKit/gtk/tests/testwebplugindatabase.c
r73858 r73936 35 35 GSList* pluginList, *p; 36 36 gboolean found = FALSE; 37 gboolean enabled = FALSE; 37 38 38 39 webkit_web_settings_add_extra_plugin_directory(view, TEST_PLUGIN_DIR); … … 44 45 WebKitWebPlugin* plugin = (WebKitWebPlugin*)p->data; 45 46 if (!g_strcmp0(webkit_web_plugin_get_name(plugin), "WebKit Test PlugIn") && 46 !g_strcmp0(webkit_web_plugin_get_description(plugin), "Simple Netscape plug-in that handles test content for WebKit")) 47 !g_strcmp0(webkit_web_plugin_get_description(plugin), "Simple Netscape plug-in that handles test content for WebKit")) { 47 48 found = TRUE; 49 enabled = webkit_web_plugin_get_enabled(plugin); 50 webkit_web_plugin_set_enabled(plugin, FALSE); 51 } 48 52 } 49 53 webkit_web_plugin_database_plugins_list_free(pluginList); 50 54 g_assert(found); 55 g_assert(enabled); 56 57 webkit_web_plugin_database_refresh(database); 58 pluginList = webkit_web_plugin_database_get_plugins(database); 59 60 for (p = pluginList; p; p = p->next) { 61 WebKitWebPlugin* plugin = (WebKitWebPlugin*)p->data; 62 if (!g_strcmp0(webkit_web_plugin_get_name(plugin), "WebKit Test PlugIn") && 63 !g_strcmp0(webkit_web_plugin_get_description(plugin), "Simple Netscape plug-in that handles test content for WebKit")) 64 enabled = webkit_web_plugin_get_enabled(plugin); 65 } 66 webkit_web_plugin_database_plugins_list_free(pluginList); 67 g_assert(!enabled); 51 68 52 69 g_object_unref(view); -
trunk/WebKit/gtk/webkit/webkitwebplugin.cpp
r73906 r73936 23 23 #include "webkitprivate.h" 24 24 #include "webkitwebpluginprivate.h" 25 #include <glib/gi18n-lib.h> 25 26 26 27 using namespace WebCore; 28 29 enum { 30 PROP_0, 31 32 PROP_ENABLED 33 }; 27 34 28 35 G_DEFINE_TYPE(WebKitWebPlugin, webkit_web_plugin, G_TYPE_OBJECT) … … 58 65 } 59 66 67 static void webkit_web_plugin_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* paramSpec) 68 { 69 WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object); 70 71 switch (prop_id) { 72 case PROP_ENABLED: 73 g_value_set_boolean(value, webkit_web_plugin_get_enabled(plugin)); 74 break; 75 default: 76 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, paramSpec); 77 } 78 } 79 80 static void webkit_web_plugin_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* paramSpec) 81 { 82 WebKitWebPlugin* plugin = WEBKIT_WEB_PLUGIN(object); 83 84 switch (prop_id) { 85 case PROP_ENABLED: 86 webkit_web_plugin_set_enabled(plugin, g_value_get_boolean(value)); 87 break; 88 default: 89 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, paramSpec); 90 } 91 } 92 60 93 static void webkit_web_plugin_class_init(WebKitWebPluginClass* klass) 61 94 { … … 65 98 66 99 gobjectClass->finalize = webkit_web_plugin_finalize; 100 gobjectClass->get_property = webkit_web_plugin_get_property; 101 gobjectClass->set_property = webkit_web_plugin_set_property; 102 103 g_object_class_install_property(gobjectClass, 104 PROP_ENABLED, 105 g_param_spec_boolean("enabled", 106 _("Enabled"), 107 _("Whether the plugin is enabled"), 108 FALSE, 109 WEBKIT_PARAM_READWRITE)); 67 110 68 111 g_type_class_add_private(klass, sizeof(WebKitWebPluginPrivate)); … … 164 207 return priv->mimeTypes; 165 208 } 209 210 /** 211 * webkit_web_plugin_set_enabled: 212 * @plugin: a #WebKitWebPlugin 213 * @enabled: whether to enable the plugin 214 * 215 * Sets the enabled status of the @plugin. 216 * 217 * Since: 1.3.8 218 */ 219 void webkit_web_plugin_set_enabled(WebKitWebPlugin* plugin, gboolean enabled) 220 { 221 g_return_if_fail(WEBKIT_IS_WEB_PLUGIN(plugin)); 222 WebKitWebPluginPrivate* priv = plugin->priv; 223 224 ASSERT(priv->corePlugin); 225 if (priv->corePlugin->isEnabled() == enabled) 226 return; 227 228 priv->corePlugin->setEnabled(enabled); 229 230 g_object_notify(G_OBJECT(plugin), "enabled"); 231 } 232 233 /** 234 * webkit_web_plugin_get_enabled: 235 * @plugin: a #WebKitWebPlugin 236 * 237 * Returns: %TRUE if the plugin is enabled, %FALSE otherwise 238 * 239 * Since: 1.3.8 240 */ 241 gboolean webkit_web_plugin_get_enabled(WebKitWebPlugin* plugin) 242 { 243 g_return_val_if_fail(WEBKIT_IS_WEB_PLUGIN(plugin), FALSE); 244 245 ASSERT(plugin->priv->corePlugin); 246 return plugin->priv->corePlugin->isEnabled(); 247 } -
trunk/WebKit/gtk/webkit/webkitwebplugin.h
r73875 r73936 80 80 webkit_web_plugin_get_mimetypes (WebKitWebPlugin*); 81 81 82 WEBKIT_API void 83 webkit_web_plugin_set_enabled (WebKitWebPlugin*, gboolean); 84 85 WEBKIT_API gboolean 86 webkit_web_plugin_get_enabled (WebKitWebPlugin*); 87 82 88 G_END_DECLS 83 89
Note: See TracChangeset
for help on using the changeset viewer.