aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-06-22 17:23:55 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-06-26 20:33:22 +0800
commitd434d5dde2cb2cd239d8d38b3a369466677e84a4 (patch)
tree51e20216a36df36d50b2415e0162b8ce7aaae399
parent63ff2e3dc786c97d74c7c2e6ee96a26f826abca8 (diff)
downloadgsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.tar
gsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.tar.gz
gsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.tar.bz2
gsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.tar.lz
gsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.tar.xz
gsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.tar.zst
gsoc2013-epiphany-d434d5dde2cb2cd239d8d38b3a369466677e84a4.zip
Port about handlers to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=678616
-rw-r--r--embed/ephy-embed-single.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index e2280bea4..926b362e5 100644
--- a/embed/ephy-embed-single.c
+++ b/embed/ephy-embed-single.c
@@ -36,6 +36,7 @@
#include "ephy-prefs.h"
#include "ephy-settings.h"
#include "ephy-request-about.h"
+#include "ephy-about-handler.h"
#ifdef HAVE_WEBKIT2
#include <webkit2/webkit2.h>
@@ -337,6 +338,23 @@ cache_size_cb (GSettings *settings,
soup_cache_set_max_size (single->priv->cache, new_cache_size * 1024 * 1024 /* in bytes */);
}
+#ifdef HAVE_WEBKIT2
+static void
+about_request_cb (WebKitURISchemeRequest *request,
+ gpointer user_data)
+{
+ GString *contents;
+ GInputStream *stream;
+ gint stream_length;
+
+ contents = ephy_about_handler_handle (webkit_uri_scheme_request_get_path (request));
+ stream_length = contents->len;
+ stream = g_memory_input_stream_new_from_data (g_string_free (contents, FALSE), stream_length, g_free);
+ webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html");
+ g_object_unref (stream);
+}
+#endif
+
/**
* ephy_embed_single_initialize:
* @single: the #EphyEmbedSingle
@@ -349,6 +367,10 @@ ephy_embed_single_initialize (EphyEmbedSingle *single)
{
#ifdef HAVE_WEBKIT2
/* TODO: Network features */
+ webkit_web_context_register_uri_scheme (webkit_web_context_get_default (),
+ EPHY_ABOUT_SCHEME,
+ about_request_cb,
+ NULL);
#else
SoupSession *session;
SoupCookieJar *jar;