[epiphany] Revert "Remove support for browser plugins"
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Revert "Remove support for browser plugins"
- Date: Fri, 28 Oct 2016 01:09:52 +0000 (UTC)
commit 51930150253889e18f667730137242aa73d45a37
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Thu Oct 27 20:05:30 2016 -0500
Revert "Remove support for browser plugins"
This reverts commit 9e1457f64b44d6847ea6b75a096aec105691c996.
You win again, gravity....
data/org.gnome.epiphany.gschema.xml | 4 ++
embed/ephy-about-handler.c | 85 ++++++++++++++++++++++++++++++++++-
embed/ephy-embed-prefs.c | 5 ++-
lib/ephy-prefs.h | 1 +
src/prefs-dialog.c | 7 +++
src/resources/prefs-dialog.ui | 7 +++
6 files changed, 107 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.epiphany.gschema.xml b/data/org.gnome.epiphany.gschema.xml
index c84318d..a994250 100644
--- a/data/org.gnome.epiphany.gschema.xml
+++ b/data/org.gnome.epiphany.gschema.xml
@@ -156,6 +156,10 @@
<summary>Allow popups</summary>
<description>Allow sites to open new windows using JavaScript (if JavaScript is
enabled).</description>
</key>
+ <key type="b" name="enable-plugins">
+ <default>true</default>
+ <summary>Enable Plugins</summary>
+ </key>
<key type="b" name="enable-webgl">
<default>true</default>
<summary>Enable WebGL</summary>
diff --git a/embed/ephy-about-handler.c b/embed/ephy-about-handler.c
index c81a2e8..f7be7c9 100644
--- a/embed/ephy-about-handler.c
+++ b/embed/ephy-about-handler.c
@@ -119,6 +119,87 @@ ephy_about_request_free (EphyAboutRequest *about_request)
}
static void
+get_plugins_cb (WebKitWebContext *web_context,
+ GAsyncResult *result,
+ EphyAboutRequest *about_request)
+{
+ GString *data_str;
+ gsize data_length;
+ GList *plugin_list, *p;
+ gboolean enabled;
+
+ enabled = g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_PLUGINS);
+
+ data_str = g_string_new ("<html>");
+ g_string_append_printf (data_str, "<head><title>%s</title>"
+ "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"
+ "<link href=\""EPHY_PAGE_TEMPLATE_ABOUT_CSS "\" rel=\"stylesheet\"
type=\"text/css\">"
+ "</head><body>",
+ _("Installed plugins"));
+ g_string_append_printf (data_str, "<h1>%s</h1>", _("Plugins"));
+
+ if (!enabled)
+ g_string_append_printf (data_str, "<p><b>%s</b></p>", _("Plugins are disabled in the preferences"));
+
+ plugin_list = webkit_web_context_get_plugins_finish (web_context, result, NULL);
+ for (p = plugin_list; p; p = p->next) {
+ WebKitPlugin *plugin = WEBKIT_PLUGIN (p->data);
+ GList *m, *mime_types;
+
+ /* TODO: Enable/disable plugins in WebKit2 */
+ g_string_append_printf (data_str, "<h2>%s</h2>%s<br>%s: <b>%s</b>" \
+ "<table id=\"plugin-table\">" \
+ " <thead><tr><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>",
+ webkit_plugin_get_name (plugin),
+ webkit_plugin_get_description (plugin),
+ _("Enabled"), /*webkit_plugin_get_enabled (plugin) && */ enabled ? _("Yes") :
_("No"),
+ _("MIME type"), _("Description"), _("Suffixes"));
+
+ mime_types = webkit_plugin_get_mime_info_list (plugin);
+
+ for (m = mime_types; m; m = m->next) {
+ WebKitMimeInfo *mime_info = (WebKitMimeInfo *)m->data;
+ const gchar * const *extensions;
+ guint i;
+
+ g_string_append_printf (data_str, "<tr><td>%s</td><td>%s</td><td>",
+ webkit_mime_info_get_mime_type (mime_info),
+ webkit_mime_info_get_description (mime_info));
+
+ extensions = webkit_mime_info_get_extensions (mime_info);
+ for (i = 0; extensions && extensions[i] != NULL; i++)
+ g_string_append_printf (data_str, "%s%c", extensions[i],
+ extensions[i + 1] ? ',' : ' ');
+
+ g_string_append (data_str, "</td></tr>");
+ }
+
+ g_string_append (data_str, "</tbody></table>");
+ }
+ g_string_append (data_str, "</body></html>");
+
+ g_list_free_full (plugin_list, g_object_unref);
+
+ data_length = data_str->len;
+ ephy_about_handler_finish_request (about_request->request, g_string_free (data_str, FALSE), data_length);
+ ephy_about_request_free (about_request);
+}
+
+static gboolean
+ephy_about_handler_handle_plugins (EphyAboutHandler *handler,
+ WebKitURISchemeRequest *request)
+{
+ EphyEmbedShell *shell = ephy_embed_shell_get_default ();
+
+ webkit_web_context_get_plugins (ephy_embed_shell_get_web_context (shell),
+ NULL,
+ (GAsyncReadyCallback)get_plugins_cb,
+ ephy_about_request_new (handler, request));
+
+ return TRUE;
+}
+
+static void
handle_memory_finished_cb (EphyAboutHandler *handler,
GAsyncResult *result,
WebKitURISchemeRequest *request)
@@ -551,7 +632,9 @@ ephy_about_handler_handle_request (EphyAboutHandler *handler,
path = webkit_uri_scheme_request_get_path (request);
- if (!g_strcmp0 (path, "memory"))
+ if (!g_strcmp0 (path, "plugins"))
+ handled = ephy_about_handler_handle_plugins (handler, request);
+ else if (!g_strcmp0 (path, "memory"))
handled = ephy_about_handler_handle_memory (handler, request);
else if (!g_strcmp0 (path, "epiphany"))
handled = ephy_about_handler_handle_epiphany (handler, request);
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index 7c6f217..c5701e9 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -555,7 +555,6 @@ ephy_embed_prefs_init (gpointer user_data)
webkit_settings = webkit_settings_new_with_settings ("enable-developer-extras", TRUE,
"enable-fullscreen", TRUE,
"enable-javascript", TRUE,
- "enable-plugins", FALSE,
"enable-site-specific-quirks", TRUE,
"enable-dns-prefetching", TRUE,
"javascript-can-open-windows-automatically", TRUE,
@@ -593,6 +592,10 @@ ephy_embed_prefs_init (gpointer user_data)
webkit_settings, "enable-caret-browsing",
G_SETTINGS_BIND_GET);
g_settings_bind (EPHY_SETTINGS_WEB,
+ EPHY_PREFS_WEB_ENABLE_PLUGINS,
+ webkit_settings, "enable-plugins",
+ G_SETTINGS_BIND_GET);
+ g_settings_bind (EPHY_SETTINGS_WEB,
EPHY_PREFS_WEB_FONT_MIN_SIZE,
webkit_settings, "minimum-font-size",
G_SETTINGS_BIND_GET);
diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h
index 2283e28..ef93c27 100644
--- a/lib/ephy-prefs.h
+++ b/lib/ephy-prefs.h
@@ -76,6 +76,7 @@ typedef enum
#define EPHY_PREFS_WEB_MONOSPACE_FONT "monospace-font"
#define EPHY_PREFS_WEB_ENABLE_USER_CSS "enable-user-css"
#define EPHY_PREFS_WEB_ENABLE_POPUPS "enable-popups"
+#define EPHY_PREFS_WEB_ENABLE_PLUGINS "enable-plugins"
#define EPHY_PREFS_WEB_ENABLE_SPELL_CHECKING "enable-spell-checking"
#define EPHY_PREFS_WEB_ENABLE_WEBGL "enable-webgl"
#define EPHY_PREFS_WEB_ENABLE_WEBAUDIO "enable-webaudio"
diff --git a/src/prefs-dialog.c b/src/prefs-dialog.c
index 0f08016..2d7e809 100644
--- a/src/prefs-dialog.c
+++ b/src/prefs-dialog.c
@@ -69,6 +69,7 @@ struct _PrefsDialog {
GtkWidget *restore_session_checkbutton;
GtkWidget *popups_allow_checkbutton;
GtkWidget *adblock_allow_checkbutton;
+ GtkWidget *enable_plugins_checkbutton;
/* fonts */
GtkWidget *use_gnome_fonts_checkbutton;
@@ -521,6 +522,7 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, restore_session_checkbutton);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, popups_allow_checkbutton);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, adblock_allow_checkbutton);
+ gtk_widget_class_bind_template_child (widget_class, PrefsDialog, enable_plugins_checkbutton);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_button_hbox);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, download_button_label);
@@ -1421,6 +1423,11 @@ setup_general_page (PrefsDialog *dialog)
dialog->adblock_allow_checkbutton,
"active",
G_SETTINGS_BIND_INVERT_BOOLEAN);
+ g_settings_bind (web_settings,
+ EPHY_PREFS_WEB_ENABLE_PLUGINS,
+ dialog->enable_plugins_checkbutton,
+ "active",
+ G_SETTINGS_BIND_DEFAULT);
create_download_path_button (dialog);
create_search_engine_combo (GTK_COMBO_BOX (dialog->search_engine_combo));
diff --git a/src/resources/prefs-dialog.ui b/src/resources/prefs-dialog.ui
index 838eee6..4a63db3 100644
--- a/src/resources/prefs-dialog.ui
+++ b/src/resources/prefs-dialog.ui
@@ -211,6 +211,13 @@
<property name="use-underline">True</property>
</object>
</child>
+ <child>
+ <object class="GtkCheckButton" id="enable_plugins_checkbutton">
+ <property name="label" translatable="yes">Enable _plugins</property>
+ <property name="visible">True</property>
+ <property name="use-underline">True</property>
+ </object>
+ </child>
</object>
</child>
</object>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]