aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-embed-prefs.c
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2012-06-08 16:50:30 +0800
committerCarlos Garcia Campos <carlosgc@gnome.org>2012-07-04 19:15:37 +0800
commitdcb11d1f5517bd4df39fc0d0228fd02214ad903d (patch)
tree48cace962d9e6edafed409ec5720769d22702545 /embed/ephy-embed-prefs.c
parent74ff5812f0cc1c2f94c64cc00bc99e8bc887793f (diff)
downloadgsoc2013-epiphany-dcb11d1f5517bd4df39fc0d0228fd02214ad903d.tar.gz
gsoc2013-epiphany-dcb11d1f5517bd4df39fc0d0228fd02214ad903d.tar.zst
gsoc2013-epiphany-dcb11d1f5517bd4df39fc0d0228fd02214ad903d.zip
Port cookies to WebKit2
https://bugzilla.gnome.org/show_bug.cgi?id=678626
Diffstat (limited to 'embed/ephy-embed-prefs.c')
-rw-r--r--embed/ephy-embed-prefs.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/embed/ephy-embed-prefs.c b/embed/ephy-embed-prefs.c
index b9daf227d..164abbab3 100644
--- a/embed/ephy-embed-prefs.c
+++ b/embed/ephy-embed-prefs.c
@@ -372,6 +372,28 @@ webkit_pref_callback_accept_languages (GSettings *settings,
#endif
}
+
+#ifdef HAVE_WEBKIT2
+void
+ephy_embed_prefs_set_cookie_accept_policy (WebKitCookieManager *cookie_manager,
+ const char *settings_policy)
+{
+ WebKitCookieAcceptPolicy policy;
+
+ if (g_str_equal (settings_policy, "never"))
+ policy = WEBKIT_COOKIE_POLICY_ACCEPT_NEVER;
+ else if (g_str_equal (settings_policy, "always"))
+ policy = WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS;
+ else if (g_str_equal (settings_policy, "no-third-party"))
+ policy = WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY;
+ else {
+ g_warn_if_reached ();
+ return;
+ }
+
+ webkit_cookie_manager_set_accept_policy (cookie_manager, policy);
+}
+#else
void
ephy_embed_prefs_set_cookie_jar_policy (SoupCookieJar *jar,
const char *settings_policy)
@@ -394,6 +416,7 @@ ephy_embed_prefs_set_cookie_jar_policy (SoupCookieJar *jar,
g_object_set (G_OBJECT (jar), SOUP_COOKIE_JAR_ACCEPT_POLICY, policy, NULL);
}
+#endif
static void
webkit_pref_callback_cookie_accept_policy (GSettings *settings,
@@ -401,7 +424,16 @@ webkit_pref_callback_cookie_accept_policy (GSettings *settings,
gpointer data)
{
#ifdef HAVE_WEBKIT2
- /* TODO: Cookies */
+ WebKitCookieManager *cookie_manager;
+ char *value;
+
+ value = g_settings_get_string (settings, key);
+ if (!value)
+ return;
+
+ cookie_manager = webkit_web_context_get_cookie_manager (webkit_web_context_get_default ());
+ ephy_embed_prefs_set_cookie_accept_policy (cookie_manager, value);
+ g_free (value);
#else
SoupSession *session;
char *value = NULL;