aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorSergio Villar Senin <svillar@igalia.com>2011-03-30 15:36:08 +0800
committerSergio Villar Senin <svillar@igalia.com>2011-06-01 22:00:59 +0800
commit89cd6749b82686ca78e8d44c5b3fb18fead02363 (patch)
tree0156a79859ec3a08a5e985d5d538c486980f1b47 /embed
parent813993d057e19bf9f7b1c091d165026c6dad8a41 (diff)
downloadgsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.tar
gsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.tar.gz
gsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.tar.bz2
gsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.tar.lz
gsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.tar.xz
gsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.tar.zst
gsoc2013-epiphany-89cd6749b82686ca78e8d44c5b3fb18fead02363.zip
Added about:plugins support.
We are now able to show a page with the list of installed plugins. Bug #575498
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-single.c9
-rw-r--r--embed/ephy-embed-utils.c19
-rw-r--r--embed/ephy-history.c12
-rw-r--r--embed/ephy-web-view.c8
4 files changed, 43 insertions, 5 deletions
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index 2353a122b..a214f82bd 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -36,6 +36,7 @@
#include "ephy-profile-utils.h"
#include "ephy-prefs.h"
#include "ephy-settings.h"
+#include "ephy-request-about.h"
#ifdef ENABLE_CERTIFICATE_MANAGER
#include "ephy-certificate-manager.h"
@@ -45,6 +46,7 @@
#include <glib/gi18n.h>
#include <libsoup/soup-gnome.h>
#include <libsoup/soup-cache.h>
+#include <libsoup/soup-requester.h>
#include <gnome-keyring.h>
#define EPHY_EMBED_SINGLE_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_EMBED_SINGLE, EphyEmbedSinglePrivate))
@@ -484,6 +486,7 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
char *cookie_policy;
char *cache_dir;
EphyEmbedSinglePrivate *priv = single->priv;
+ SoupSessionFeature *requester;
/* Initialise nspluginwrapper's plugins if available */
if (g_file_test (NSPLUGINWRAPPER_SETUP, G_FILE_TEST_EXISTS) != FALSE)
@@ -537,6 +540,12 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
G_CALLBACK (cache_size_cb),
single);
+ /* about: URIs handler */
+ requester = SOUP_SESSION_FEATURE (soup_requester_new());
+ soup_session_add_feature (session, requester);
+ soup_session_feature_add_feature (requester, EPHY_TYPE_REQUEST_ABOUT);
+ g_object_unref (requester);
+
#ifdef SOUP_TYPE_PASSWORD_MANAGER
/* Use GNOME keyring to store passwords. Only add the manager if we
are not using a private session, otherwise we want any new
diff --git a/embed/ephy-embed-utils.c b/embed/ephy-embed-utils.c
index d0e369052..2ca6d7689 100644
--- a/embed/ephy-embed-utils.c
+++ b/embed/ephy-embed-utils.c
@@ -29,6 +29,7 @@
#include "ephy-string.h"
#include "ephy-embed-utils.h"
+#include "ephy-request-about.h"
char*
ephy_embed_utils_link_message_parse (char *message)
@@ -105,15 +106,25 @@ ephy_embed_utils_address_has_web_scheme (const char *address)
char*
ephy_embed_utils_normalize_address (const char *address)
{
- char *effective_address;
+ char *effective_address = NULL;
g_return_val_if_fail (address, NULL);
if (ephy_embed_utils_address_has_web_scheme (address) == FALSE)
effective_address = g_strconcat ("http://", address, NULL);
- else
- effective_address = g_strdup (address);
-
+ else {
+ /* Convert about: schemes to ephy-about: in order to
+ * force WebKit to delegate its handling to our
+ * EphyRequestAbout. In general about: schemes are
+ * handled internally by WebKit and mean "empty
+ * document".
+ */
+ if (!g_ascii_strcasecmp (address, "about:plugins"))
+ effective_address = g_strdup (EPHY_ABOUT_SCHEME":plugins");
+ else
+ effective_address = g_strdup (address);
+ }
+
return effective_address;
}
diff --git a/embed/ephy-history.c b/embed/ephy-history.c
index 86a4aaaf0..b6fe5dc4b 100644
--- a/embed/ephy-history.c
+++ b/embed/ephy-history.c
@@ -27,6 +27,7 @@
#include "ephy-node-db.h"
#include "ephy-node-common.h"
#include "ephy-prefs.h"
+#include "ephy-request-about.h"
#include "ephy-settings.h"
#include "ephy-string.h"
@@ -823,22 +824,30 @@ ephy_history_add_page (EphyHistory *eh,
static gboolean
impl_add_page (EphyHistory *eb,
- const char *url,
+ const char *orig_url,
gboolean redirect,
gboolean toplevel)
{
EphyNode *bm, *node, *host;
gulong flags = 0;
+ char *url;
if (eb->priv->enabled == FALSE)
{
return FALSE;
}
+ /* Do not show internal ephy-about: protocol to users */
+ if (g_str_has_prefix (orig_url, EPHY_ABOUT_SCHEME))
+ url = g_strdup_printf ("about:%s", orig_url + EPHY_ABOUT_SCHEME_LEN + 1);
+ else
+ url = g_strdup (orig_url);
+
node = ephy_history_get_page (eb, url);
if (node)
{
ephy_history_visited (eb, node);
+ g_free (url);
return TRUE;
}
@@ -846,6 +855,7 @@ impl_add_page (EphyHistory *eb,
ephy_node_set_property_string (bm, EPHY_NODE_PAGE_PROP_LOCATION, url);
ephy_node_set_property_string (bm, EPHY_NODE_PAGE_PROP_TITLE, url);
+ g_free (url);
if (redirect) flags |= REDIRECT_FLAG;
if (toplevel) flags |= TOPLEVEL_FLAG;
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 64ddc69a9..8cd73a769 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -44,6 +44,7 @@
#include "ephy-profile-utils.h"
#include "ephy-favicon-cache.h"
#include "ephy-history.h"
+#include "ephy-request-about.h"
#include "ephy-settings.h"
#include "ephy-string.h"
#include "ephy-web-view.h"
@@ -2455,6 +2456,8 @@ get_title_from_address (const char *address)
{
if (g_str_has_prefix (address, "file://"))
return g_strdup (address + 7);
+ else if (!strcmp (address, EPHY_ABOUT_SCHEME":plugins"))
+ return g_strdup (_("Plugins"));
else
return ephy_string_get_host_name (address);
}
@@ -2744,6 +2747,11 @@ ephy_web_view_location_changed (EphyWebView *view,
strcmp (location, "about:blank") == 0) {
ephy_web_view_set_address (view, NULL);
ephy_web_view_set_title (view, EMPTY_PAGE);
+ } else if (g_str_has_prefix (location, EPHY_ABOUT_SCHEME)) {
+ char *new_address = g_strdup_printf ("about:%s", location + EPHY_ABOUT_SCHEME_LEN + 1);
+ ephy_web_view_set_address (view, new_address);
+ g_free (new_address);
+ ephy_web_view_set_title (view, EMPTY_PAGE);
} else {
char *view_address;