...
 
Commits (2)
......@@ -169,9 +169,9 @@
<description>Preferred languages. Array of locale codes or “system” to use current locale.</description>
</key>
<key name="cookies-policy" enum="org.gnome.Epiphany.EphyPrefsWebCookiesPolicy">
<default>'no-third-party'</default>
<default>'intelligent-tracking-prevention'</default>
<summary>Cookie accept</summary>
<description>Where to accept cookies from. Possible values are “always”, “no-third-party” and “never”.</description>
<description>Where to accept cookies from. Possible values are “always”, “no-third-party”, “intelligent-tracking-prevention”, and “never”.</description>
</key>
<key type="b" name="enable-popups">
<default>true</default>
......
......@@ -275,20 +275,28 @@ void
ephy_embed_prefs_set_cookie_accept_policy (WebKitCookieManager *cookie_manager,
const char *settings_policy)
{
EphyEmbedShell *shell;
WebKitWebContext *context;
WebKitWebsiteDataManager *manager;
WebKitCookieAcceptPolicy policy;
if (!strcmp (settings_policy, "never"))
policy = WEBKIT_COOKIE_POLICY_ACCEPT_NEVER;
else if (!strcmp (settings_policy, "always"))
policy = WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS;
else if (!strcmp (settings_policy, "no-third-party"))
else if (!strcmp (settings_policy, "no-third-party") || !strcmp (settings_policy, "intelligent-tracking-prevention"))
policy = WEBKIT_COOKIE_POLICY_ACCEPT_NO_THIRD_PARTY;
else {
g_warn_if_reached ();
return;
}
webkit_cookie_manager_set_accept_policy (cookie_manager, policy);
shell = ephy_embed_shell_get_default ();
context = ephy_embed_shell_get_web_context (shell);
manager = webkit_web_context_get_website_data_manager (context);
webkit_website_data_manager_set_resource_load_statistics_enabled (manager,
!strcmp (settings_policy, "intelligent-tracking-prevention"));
}
static void
......
......@@ -49,7 +49,8 @@ typedef enum
{
EPHY_PREFS_WEB_COOKIES_POLICY_ALWAYS,
EPHY_PREFS_WEB_COOKIES_POLICY_NO_THIRD_PARTY,
EPHY_PREFS_WEB_COOKIES_POLICY_NEVER
EPHY_PREFS_WEB_COOKIES_POLICY_NEVER,
EPHY_PREFS_WEB_COOKIES_POLICY_INTELLIGENT_TRACKING_PREVENTION
} EphyPrefsWebCookiesPolicy;
typedef enum
......
......@@ -68,7 +68,8 @@ G_DEFINE_TYPE (ClearDataDialog, clear_data_dialog, GTK_TYPE_DIALOG)
WEBKIT_WEBSITE_DATA_LOCAL_STORAGE | \
WEBKIT_WEBSITE_DATA_WEBSQL_DATABASES | \
WEBKIT_WEBSITE_DATA_INDEXEDDB_DATABASES | \
WEBKIT_WEBSITE_DATA_PLUGIN_DATA
WEBKIT_WEBSITE_DATA_PLUGIN_DATA | \
WEBKIT_WEBSITE_DATA_RESOURCE_LOAD_STATISTICS
typedef struct {
WebKitWebsiteDataTypes type;
......@@ -82,7 +83,8 @@ static const DataEntry data_entries[] = {
{ WEBKIT_WEBSITE_DATA_OFFLINE_APPLICATION_CACHE, TRUE, N_("Offline web application cache") },
{ WEBKIT_WEBSITE_DATA_INDEXEDDB_DATABASES, FALSE, N_("IndexedDB databases") },
{ WEBKIT_WEBSITE_DATA_WEBSQL_DATABASES, FALSE, N_("WebSQL databases") },
{ WEBKIT_WEBSITE_DATA_PLUGIN_DATA, FALSE, N_("Plugins data") }
{ WEBKIT_WEBSITE_DATA_PLUGIN_DATA, FALSE, N_("Plugins data") },
{ WEBKIT_WEBSITE_DATA_RESOURCE_LOAD_STATISTICS, FALSE, N_("Resource load statistics") }
};
static WebKitWebsiteDataManager *
......
......@@ -97,6 +97,7 @@ struct _PrefsDialog {
/* stored data */
GtkWidget *always;
GtkWidget *no_third_party;
GtkWidget *intelligent_tracking_prevention;
GtkWidget *never;
GtkWidget *remember_passwords_checkbutton;
GtkWidget *do_not_track_checkbutton;
......@@ -753,6 +754,7 @@ prefs_dialog_class_init (PrefsDialogClass *klass)
/* stored data */
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, always);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, no_third_party);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, intelligent_tracking_prevention);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, never);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, remember_passwords_checkbutton);
gtk_widget_class_bind_template_child (widget_class, PrefsDialog, do_not_track_checkbutton);
......@@ -1486,6 +1488,8 @@ cookies_get_mapping (GValue *value,
if (g_strcmp0 (name, "no_third_party") == 0)
name = "no-third-party";
else if (g_strcmp0 (name, "intelligent_tracking_prevention") == 0)
name = "intelligent-tracking-prevention";
/* If the button name matches the setting, it should be active. */
if (g_strcmp0 (name, setting) == 0)
......@@ -1509,6 +1513,8 @@ cookies_set_mapping (const GValue *value,
name = gtk_buildable_get_name (GTK_BUILDABLE (user_data));
if (g_strcmp0 (name, "no_third_party") == 0)
variant = g_variant_new_string ("no-third-party");
else if (g_strcmp0 (name, "intelligent_tracking_prevention") == 0)
variant = g_variant_new_string ("intelligent-tracking-prevention");
else
variant = g_variant_new_string (name);
......@@ -1841,6 +1847,15 @@ setup_stored_data_page (PrefsDialog *dialog)
cookies_set_mapping,
dialog->no_third_party,
NULL);
g_settings_bind_with_mapping (web_settings,
EPHY_PREFS_WEB_COOKIES_POLICY,
dialog->intelligent_tracking_prevention,
"active",
G_SETTINGS_BIND_DEFAULT,
cookies_get_mapping,
cookies_set_mapping,
dialog->intelligent_tracking_prevention,
NULL);
g_settings_bind_with_mapping (web_settings,
EPHY_PREFS_WEB_COOKIES_POLICY,
dialog->never,
......
......@@ -526,15 +526,11 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkRadioButton" id="intelligent_tracking_prevention">
<property name="label" translatable="yes">Use _intelligent tracking prevention</property>
<property name="visible">True</property>
<property name="halign">start</property>
<property name="label" translatable="yes" comments="Refers to &quot;Only from sites you visit&quot; option under Cookies.">For example, not from advertisers on these sites</property>
<property name="use-markup">True</property>
<property name="margin-start">22</property>
<attributes>
<attribute name="scale" value="0.8"/>
</attributes>
<property name="use-underline">True</property>
<property name="group">always</property>
</object>
</child>
<child>
......