Bug 1107133 - Expose tracking protection in Fennec privacy preferences. r=liuche
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 08 Dec 2014 15:17:32 -0800
changeset 219498 eb32947900a9ee686dcb45274050791fbf2a9f44
parent 219497 26ec6656f074e2af1ad09623276e9dcfc30d8291
child 219499 d639e397f2f0df891b21c6ed782d92e6df45cd69
push idunknown
push userunknown
push dateunknown
reviewersliuche
bugs1107133
milestone37.0a1
Bug 1107133 - Expose tracking protection in Fennec privacy preferences. r=liuche
mobile/android/base/AppConstants.java.in
mobile/android/base/locales/en-US/android_strings.dtd
mobile/android/base/preferences/GeckoPreferences.java
mobile/android/base/resources/xml/preferences_privacy.xml
mobile/android/base/strings.xml.in
mobile/android/base/tests/StringHelper.java
mobile/android/base/tests/testSettingsMenuItems.java
mobile/android/base/toolbar/SiteIdentityPopup.java
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -230,16 +230,23 @@ public class AppConstants {
     // https://wiki.mozilla.org/Platform/Channel-specific_build_defines
     public static final boolean RELEASE_BUILD =
 //#ifdef RELEASE_BUILD
     true;
 //#else
     false;
 //#endif
 
+    public static final boolean NIGHTLY_BUILD =
+//#ifdef NIGHTLY_BUILD
+    true;
+//#else
+    false;
+//#endif
+
     public static final boolean DEBUG_BUILD =
 //#ifdef MOZ_DEBUG
     true;
 //#else
     false;
 //#endif
 
     public static final boolean MOZ_MEDIA_PLAYER =
--- a/mobile/android/base/locales/en-US/android_strings.dtd
+++ b/mobile/android/base/locales/en-US/android_strings.dtd
@@ -167,16 +167,18 @@
 <!ENTITY pref_header_vendor "&vendorShortName;">
 <!ENTITY pref_header_devtools "Developer tools">
 
 <!ENTITY pref_cookies_menu "Cookies">
 <!ENTITY pref_cookies_accept_all "Enabled">
 <!ENTITY pref_cookies_not_accept_foreign "Enabled, excluding 3rd party">
 <!ENTITY pref_cookies_disabled "Disabled">
 
+<!ENTITY pref_tracking_protection_title "Tracking protection">
+<!ENTITY pref_tracking_protection_summary "&brandShortName; will prevent sites from tracking you">
 <!ENTITY pref_donottrack_title "Do not track">
 <!ENTITY pref_donottrack_summary "&brandShortName; will tell sites that you do not want to be tracked">
 
 <!ENTITY pref_char_encoding "Character encoding">
 <!ENTITY pref_char_encoding_on "Show menu">
 <!ENTITY pref_char_encoding_off "Don\'t show menu">
 <!ENTITY pref_clear_private_data2 "Clear now">
 <!ENTITY pref_clear_private_data_category "Clear private data">
--- a/mobile/android/base/preferences/GeckoPreferences.java
+++ b/mobile/android/base/preferences/GeckoPreferences.java
@@ -118,16 +118,18 @@ OnSharedPreferenceChangeListener
     private static final String PREFS_UPDATER_AUTODOWNLOAD = "app.update.autodownload";
     private static final String PREFS_GEO_REPORTING = NON_PREF_PREFIX + "app.geo.reportdata";
     private static final String PREFS_GEO_LEARN_MORE = NON_PREF_PREFIX + "geo.learn_more";
     private static final String PREFS_HEALTHREPORT_LINK = NON_PREF_PREFIX + "healthreport.link";
     private static final String PREFS_DEVTOOLS_REMOTE_ENABLED = "devtools.debugger.remote-enabled";
     private static final String PREFS_DISPLAY_REFLOW_ON_ZOOM = "browser.zoom.reflowOnZoom";
     private static final String PREFS_DISPLAY_TITLEBAR_MODE = "browser.chrome.titlebarMode";
     private static final String PREFS_SYNC = NON_PREF_PREFIX + "sync";
+    private static final String PREFS_TRACKING_PROTECTION = "privacy.trackingprotection.enabled";
+    private static final String PREFS_TRACKING_PROTECTION_LEARN_MORE = NON_PREF_PREFIX + "trackingprotection.learn_more";
 
     private static final String ACTION_STUMBLER_UPLOAD_PREF = AppConstants.ANDROID_PACKAGE_NAME + ".STUMBLER_PREF";
 
     // This isn't a Gecko pref, even if it looks like one.
     private static final String PREFS_BROWSER_LOCALE = "locale";
 
     public static final String PREFS_RESTORE_SESSION = NON_PREF_PREFIX + "restoreSession3";
     public static final String PREFS_SUGGESTED_SITES = NON_PREF_PREFIX + "home_suggested_sites";
@@ -677,16 +679,23 @@ OnSharedPreferenceChangeListener
                     i--;
                     continue;
                 } else if ((AppConstants.RELEASE_BUILD || !HardwareUtils.isTablet()) &&
                            PREFS_NEW_TABLET_UI.equals(key)) {
                     // Remove toggle for new tablet UI on release builds and phones.
                     preferences.removePreference(pref);
                     i--;
                     continue;
+                } else if (!AppConstants.NIGHTLY_BUILD &&
+                           (PREFS_TRACKING_PROTECTION.equals(key) ||
+                            PREFS_TRACKING_PROTECTION_LEARN_MORE.equals(key))) {
+                    // Remove UI for tracking protection preference on non-Nightly builds.
+                    preferences.removePreference(pref);
+                    i--;
+                    continue;
                 } else if (!AppConstants.MOZ_TELEMETRY_REPORTING &&
                            PREFS_TELEMETRY_ENABLED.equals(key)) {
                     preferences.removePreference(pref);
                     i--;
                     continue;
                 } else if (!AppConstants.MOZ_SERVICES_HEALTHREPORT &&
                            (PREFS_HEALTHREPORT_UPLOAD_ENABLED.equals(key) ||
                             PREFS_HEALTHREPORT_LINK.equals(key))) {
--- a/mobile/android/base/resources/xml/preferences_privacy.xml
+++ b/mobile/android/base/resources/xml/preferences_privacy.xml
@@ -3,36 +3,50 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                   xmlns:gecko="http://schemas.android.com/apk/res-auto"
                   android:title="@string/pref_category_privacy_short"
                   android:enabled="false">
 
+    <CheckBoxPreference android:key="privacy.trackingprotection.enabled"
+                        android:title="@string/pref_tracking_protection_title"
+                        android:summary="@string/pref_tracking_protection_summary"
+                        android:persistent="false" />
+
+    <org.mozilla.gecko.preferences.AlignRightLinkPreference
+            android:key="android.not_a_preference.trackingprotection.learn_more"
+            android:title="@string/pref_learn_more"
+            android:persistent="false"
+            url="https://support.mozilla.org/kb/firefox-android-tracking-protection" />
+
     <CheckBoxPreference android:key="privacy.donottrackheader.enabled"
                         android:title="@string/pref_donottrack_title"
                         android:summary="@string/pref_donottrack_summary"
-                        android:defaultValue="false"
                         android:persistent="false" />
 
+    <org.mozilla.gecko.preferences.AlignRightLinkPreference
+            android:key="android.not_a_preference.donottrackheader.learn_more"
+            android:title="@string/pref_learn_more"
+            android:persistent="false"
+            url="https://www.mozilla.org/firefox/dnt/" />
+
     <ListPreference android:key="network.cookie.cookieBehavior"
                     android:title="@string/pref_cookies_menu"
                     android:entries="@array/pref_cookies_entries"
                     android:entryValues="@array/pref_cookies_values"
                     android:persistent="false" />
 
     <CheckBoxPreference android:key="signon.rememberSignons"
                         android:title="@string/pref_remember_signons"
-                        android:defaultValue="true"
                         android:persistent="false" />
 
     <CheckBoxPreference android:key="privacy.masterpassword.enabled"
                         android:title="@string/pref_use_master_password"
-                        android:defaultValue="false"
                         android:persistent="false" />
 
     <!-- keys prefixed with "android.not_a_preference." are not synced with Gecko -->
     <PreferenceCategory android:title="@string/pref_clear_private_data_category">
 
         <org.mozilla.gecko.preferences.PrivateDataPreference
                             android:key="android.not_a_preference.privacy.clear"
                             android:title="@string/pref_clear_private_data"
--- a/mobile/android/base/strings.xml.in
+++ b/mobile/android/base/strings.xml.in
@@ -177,16 +177,18 @@
 
   <string name="pref_remember_signons">&pref_remember_signons;</string>
 
   <string name="pref_cookies_menu">&pref_cookies_menu;</string>
   <string name="pref_cookies_accept_all">&pref_cookies_accept_all;</string>
   <string name="pref_cookies_not_accept_foreign">&pref_cookies_not_accept_foreign;</string>
   <string name="pref_cookies_disabled">&pref_cookies_disabled;</string>
 
+  <string name="pref_tracking_protection_title">&pref_tracking_protection_title;</string>
+  <string name="pref_tracking_protection_summary">&pref_tracking_protection_summary;</string>
   <string name="pref_donottrack_title">&pref_donottrack_title;</string>
   <string name="pref_donottrack_summary">&pref_donottrack_summary;</string>
 
   <string name="pref_char_encoding">&pref_char_encoding;</string>
   <string name="pref_char_encoding_on">&pref_char_encoding_on;</string>
   <string name="pref_char_encoding_off">&pref_char_encoding_off;</string>
   <string name="pref_clear_private_data">&pref_clear_private_data2;</string>
   <string name="pref_clear_private_data_category">&pref_clear_private_data_category;</string>
--- a/mobile/android/base/tests/StringHelper.java
+++ b/mobile/android/base/tests/StringHelper.java
@@ -172,17 +172,18 @@ public class StringHelper {
     public static final String CHARACTER_ENCODING_LABEL = "Character encoding";
     public static final String PLUGINS_LABEL = "Plugins";
 
     // Title bar
     public static final String SHOW_PAGE_TITLE_LABEL = "Show page title";
     public static final String SHOW_PAGE_ADDRESS_LABEL = "Show page address";
 
     // Privacy
-    public static final String TRACKING_LABEL = "Do not track";
+    public static final String TRACKING_PROTECTION_LABEL = "Tracking protection";
+    public static final String DNT_LABEL = "Do not track";
     public static final String COOKIES_LABEL = "Cookies";
     public static final String REMEMBER_PASSWORDS_LABEL = "Remember passwords";
     public static final String MASTER_PASSWORD_LABEL = "Use master password";
     public static final String CLEAR_PRIVATE_DATA_LABEL = "Clear now";
 
     // Mozilla
     public static final String BRAND_NAME = "(Fennec|Nightly|Aurora|Firefox Beta|Firefox)";
     public static final String ABOUT_LABEL = "About " + BRAND_NAME;
--- a/mobile/android/base/tests/testSettingsMenuItems.java
+++ b/mobile/android/base/tests/testSettingsMenuItems.java
@@ -55,17 +55,18 @@ public class testSettingsMenuItems exten
         { "Advanced" },
         { StringHelper.CHARACTER_ENCODING_LABEL, "Don't show menu", "Show menu", "Don't show menu" },
         { StringHelper.PLUGINS_LABEL, "Tap to play", "Enabled", "Tap to play", "Disabled" },
     };
 
     // Privacy menu items.
     String[] PATH_PRIVACY = { StringHelper.PRIVACY_SECTION_LABEL };
     String[][] OPTIONS_PRIVACY = {
-        { StringHelper.TRACKING_LABEL },
+        { StringHelper.TRACKING_PROTECTION_LABEL },
+        { StringHelper.DNT_LABEL },
         { StringHelper.COOKIES_LABEL, "Enabled", "Enabled, excluding 3rd party", "Disabled" },
         { StringHelper.REMEMBER_PASSWORDS_LABEL },
         { StringHelper.MASTER_PASSWORD_LABEL },
         { StringHelper.CLEAR_PRIVATE_DATA_LABEL, "", "Browsing history", "Downloads", "Form & search history", "Cookies & active logins", "Saved passwords", "Cache", "Offline website data", "Site settings", "Clear data" },
     };
 
     // Mozilla/vendor menu items.
     String[] PATH_MOZILLA = { StringHelper.MOZILLA_SECTION_LABEL };
--- a/mobile/android/base/toolbar/SiteIdentityPopup.java
+++ b/mobile/android/base/toolbar/SiteIdentityPopup.java
@@ -34,17 +34,17 @@ import android.widget.TextView;
  */
 public class SiteIdentityPopup extends ArrowPopup {
     private static final String LOGTAG = "GeckoSiteIdentityPopup";
 
     private static final String MIXED_CONTENT_SUPPORT_URL =
         "https://support.mozilla.org/kb/how-does-insecure-content-affect-safety-android";
 
     private static final String TRACKING_CONTENT_SUPPORT_URL =
-        "https://support.mozilla.org/kb/how-does-insecure-content-affect-safety-android";
+        "https://support.mozilla.org/kb/firefox-android-tracking-protection";
 
     private SiteIdentity mSiteIdentity;
 
     private LinearLayout mIdentity;
 
     private LinearLayout mIdentityKnownContainer;
     private LinearLayout mIdentityUnknownContainer;