[epiphany] web-extension: Implement Do Not Track in WebKit2
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] web-extension: Implement Do Not Track in WebKit2
- Date: Thu, 14 Mar 2013 19:48:58 +0000 (UTC)
commit 06e40d778446420f776f3f2d404198e0f24b2bf7
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Wed Mar 13 17:29:35 2013 +0100
web-extension: Implement Do Not Track in WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=695343
embed/ephy-web-view.c | 8 ++------
embed/web-extension/ephy-web-extension.c | 14 +++++++++++---
2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 7bbd674..98b29d2 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2648,9 +2648,7 @@ form_auth_data_save_requested (EphyEmbedShell *shell,
}
#endif
-#ifdef HAVE_WEBKIT2
-/* TODO: WebKitWebResource::send-request */
-#else
+#ifndef HAVE_WEBKIT2
static void
add_do_not_track_header_cb (WebKitWebView *view, WebKitWebFrame *frame,
WebKitWebResource *resource, WebKitNetworkRequest *request,
@@ -2815,9 +2813,7 @@ ephy_web_view_init (EphyWebView *web_view)
web_view);
#endif
-#ifdef HAVE_WEBKIT2
- /* TODO: WebKitWebResource::send-request */
-#else
+#ifndef HAVE_WEBKIT2
if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK))
priv->do_not_track_handler = g_signal_connect (web_view, "resource-request-starting",
G_CALLBACK (add_do_not_track_header_cb), NULL);
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index d47c7f8..47feeda 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -80,9 +80,17 @@ web_page_send_request (WebKitWebPage *web_page,
const char *request_uri;
const char *page_uri;
- /* FIXME: Instead of checking the setting here, connect to the signal
- * or not depending on the setting.
- */
+ if (g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_DO_NOT_TRACK)) {
+ SoupMessageHeaders *headers;
+
+ headers = webkit_uri_request_get_http_headers (request);
+ if (headers) {
+ /* Do Not Track header. '1' means 'opt-out'. See:
+ * http://tools.ietf.org/id/draft-mayer-do-not-track-00.txt */
+ soup_message_headers_append (headers, "DNT", "1");
+ }
+ }
+
if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_ADBLOCK))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]