[epiphany] Port about handlers to WebKit2
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Port about handlers to WebKit2
- Date: Tue, 26 Jun 2012 12:33:50 +0000 (UTC)
commit d434d5dde2cb2cd239d8d38b3a369466677e84a4
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Fri Jun 22 11:23:55 2012 +0200
Port about handlers to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=678616
embed/ephy-embed-single.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/embed/ephy-embed-single.c b/embed/ephy-embed-single.c
index e2280be..926b362 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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]