summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorRobin Humble <plaguedbypenguins@gmail.com>2014-06-08 07:18:55 +0200
committerLorDClockaN <davor@losinj.com>2014-06-08 07:19:22 +0200
commite4cb677f406fd7bedd5b3ee7ff6e249c2b6eb68f (patch)
tree415683915b8ac310fc77dd25a234b17916c6875e /res
parent7fa622f559cfb6a504b281c4cb56077683d96d63 (diff)
reduce cookie tracking (4/4): onResume deletion of cookiesHEADkitkat
Optionally delete unwanted cookies (and localstorage) at every Browser resume. The default for this feature is off - ie. maintain the current Browser "keep every cookie" behaviour. Optionally localstorage files (site databases) are also removed whenever cookies have been deleted. This helps to reduce evercookie/supercookie persistence. A whitelist of sites that are permitted to keep cookies is stored in the standard Browser shared_prefs. The site's cookie preference is set via a menu checkbox when viewing the page. This allows opt-in whitelisting behaviour on a per-site basis, suitable for saving eg. login cookies. The cookie deletion itself is done by using existing API's to delete all cookies and then selectively restore just those from the whitelisted sites. Cookie counting is the only new API needed by this patch, and is used to eliminate unnecessary cookie and localstorage deletes. Although simplistic, onResume cookie filtering seems to work well and in testing hasn't broken any web browsing. The underlying CookieMonster functions operate on cached copies in ram and are asynchronous to disk so there should be little or no measurable performance impact on browsing from cookies. localstorage deletion is not cached by any layer so, if enabled, might have some minor performance impact. Change-Id: I55c69292a5ddc460e0e50b340dc4330c28becc5e
Diffstat (limited to 'res')
-rw-r--r--res/menu/browser.xml5
-rw-r--r--res/values/arrays_custom.xml28
-rw-r--r--res/values/strings.xml16
-rw-r--r--res/xml/privacy_security_preferences.xml16
4 files changed, 65 insertions, 0 deletions
diff --git a/res/menu/browser.xml b/res/menu/browser.xml
index 27c0c81d..d019546a 100644
--- a/res/menu/browser.xml
+++ b/res/menu/browser.xml
@@ -63,6 +63,11 @@
android:id="@+id/ua_desktop_menu_id"
android:checkable="true"
android:title="@string/ua_switcher_desktop" />
+ <item
+ android:id="@+id/cookies_whitelisted_menu_id"
+ android:checkable="true"
+ android:title="@string/site_cookies_whitelisted"
+ android:visible="false" />
</group>
<group
android:id="@+id/SNAPSHOT_MENU">
diff --git a/res/values/arrays_custom.xml b/res/values/arrays_custom.xml
new file mode 100644
index 00000000..243a1229
--- /dev/null
+++ b/res/values/arrays_custom.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012-2014 The CyanogenMod Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <string-array name="pref_security_site_whitelist_entries" translatable="false">
+ <item>@string/pref_security_site_whitelist_cookies_never</item>
+ <item>@string/pref_security_site_whitelist_cookies_only</item>
+ <item>@string/pref_security_site_whitelist_cookies_and_data</item>
+ </string-array>
+ <string-array name="pref_security_site_whitelist_values" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ </string-array>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index d71ddac7..4614a89b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1015,4 +1015,20 @@
<!-- Content description for navigating up in the bookmark folder hierarchy [CHAR LIMIT=NONE] -->
<string name="accessibility_button_bookmarks_folder_up">Previous folder</string>
+ <!-- Browser security/privacy anti-tracking label -->
+ <string name="pref_security_site_whitelist_cookies">Reduce tracking. Frequently delete cookies</string>
+ <!-- Browser security/privacy anti-tracking options -->
+ <string name="pref_security_site_whitelist_cookies_never">Never delete</string>
+ <string name="pref_security_site_whitelist_cookies_only">Delete from all sites that aren\'t in my whitelist</string>
+ <string name="pref_security_site_whitelist_cookies_and_data">Also delete all localstorage databases</string>
+ <!-- Browser security/privacy anti-tracking verbose checkbox label -->
+ <string name="pref_security_site_whitelist_cookies_verbose">Cookie count</string>
+ <!-- Browser security/privacy anti-tracking verbose checkbox summary -->
+ <string name="pref_security_site_whitelist_cookies_verbose_summary">Show the number of deleted and remaining cookies</string>
+ <!-- Browser popup menu checkbox that allows the user to whitelist cookies from this site [CHAR LIMIT=50] -->
+ <string name="site_cookies_whitelisted">Keep site\'s cookies</string>
+ <!-- Toast to inform the user of the number of cookies deleted and remaining [CHAR LIMIT=50] -->
+ <string name="cookies_deleted_info">cookies deleted</string>
+ <string name="cookies_remain_info">cookies remain</string>
+
</resources>
diff --git a/res/xml/privacy_security_preferences.xml b/res/xml/privacy_security_preferences.xml
index 26336000..26c19ffc 100644
--- a/res/xml/privacy_security_preferences.xml
+++ b/res/xml/privacy_security_preferences.xml
@@ -44,6 +44,22 @@
android:title="@string/pref_security_accept_cookies"
android:summary="@string/pref_security_accept_cookies_summary" />
+ <ListPreference
+ android:key="site_whitelist_cookies"
+ android:dependency="accept_cookies"
+ android:dialogTitle="@string/pref_security_site_whitelist_cookies"
+ android:title="@string/pref_security_site_whitelist_cookies"
+ android:entries="@array/pref_security_site_whitelist_entries"
+ android:entryValues="@array/pref_security_site_whitelist_values"
+ android:defaultValue="0" />
+
+ <CheckBoxPreference
+ android:key="site_whitelist_cookies_verbose"
+ android:defaultValue="false"
+ android:dependency="accept_cookies"
+ android:title="@string/pref_security_site_whitelist_cookies_verbose"
+ android:summary="@string/pref_security_site_whitelist_cookies_verbose_summary" />
+
<com.android.browser.BrowserYesNoPreference
android:key="privacy_clear_cookies"
android:title="@string/pref_privacy_clear_cookies"