зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1185163 - Create tri-state tracking protection pref (for Nightly only). r=liuche
--HG-- extra : commitid : CZ8A8aeMz9K extra : rebase_source : e59be369b9f4d99d87063eaf781282a700d58252
This commit is contained in:
Родитель
2e4069939e
Коммит
1322b83ce8
|
@ -225,6 +225,10 @@
|
|||
<!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_tracking_protection_enabled "Enabled">
|
||||
<!ENTITY pref_tracking_protection_enabled_pb "Enabled in Private Browsing">
|
||||
<!ENTITY pref_tracking_protection_disabled "Disabled">
|
||||
|
||||
<!ENTITY tracking_protection_prompt_title "Now with Tracking Protection">
|
||||
<!ENTITY tracking_protection_prompt_text "Actively block tracking elements so you don\'t have to worry.">
|
||||
<!ENTITY tracking_protection_prompt_tip_text "Visit Privacy settings to learn more">
|
||||
|
|
|
@ -128,6 +128,8 @@ OnSharedPreferenceChangeListener
|
|||
private static final String PREFS_DEVTOOLS_REMOTE_WIFI_ENABLED = "devtools.remote.wifi.enabled";
|
||||
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.state";
|
||||
private static final String PREFS_TRACKING_PROTECTION_PB = "privacy.trackingprotection.pbmode.enabled";
|
||||
public static final String PREFS_OPEN_URLS_IN_PRIVATE = NON_PREF_PREFIX + "openExternalURLsPrivately";
|
||||
public static final String PREFS_VOICE_INPUT_ENABLED = NON_PREF_PREFIX + "voice_input_enabled";
|
||||
public static final String PREFS_QRCODE_ENABLED = NON_PREF_PREFIX + "qrcode_enabled";
|
||||
|
@ -772,6 +774,20 @@ OnSharedPreferenceChangeListener
|
|||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_TRACKING_PROTECTION.equals(key)) {
|
||||
// Remove UI for global TP pref in non-Nightly builds.
|
||||
if (!AppConstants.NIGHTLY_BUILD) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_TRACKING_PROTECTION_PB.equals(key)) {
|
||||
// Remove UI for private-browsing-only TP pref in Nightly builds.
|
||||
if (AppConstants.NIGHTLY_BUILD) {
|
||||
preferences.removePreference(pref);
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
} else if (PREFS_TELEMETRY_ENABLED.equals(key)) {
|
||||
if (!AppConstants.MOZ_TELEMETRY_REPORTING) {
|
||||
preferences.removePreference(pref);
|
||||
|
|
|
@ -50,6 +50,16 @@
|
|||
<item>@string/pref_cookies_not_accept_foreign</item>
|
||||
<item>@string/pref_cookies_disabled</item>
|
||||
</string-array>
|
||||
<string-array name="pref_tracking_protection_values">
|
||||
<item>2</item>
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
</string-array>
|
||||
<string-array name="pref_tracking_protection_entries">
|
||||
<item>@string/pref_tracking_protection_enabled</item>
|
||||
<item>@string/pref_tracking_protection_enabled_pb</item>
|
||||
<item>@string/pref_tracking_protection_disabled</item>
|
||||
</string-array>
|
||||
<string-array name="pref_cookies_values">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
android:summary="@string/pref_tracking_protection_summary"
|
||||
android:persistent="false" />
|
||||
|
||||
<ListPreference android:key="privacy.trackingprotection.state"
|
||||
android:title="@string/pref_tracking_protection_title"
|
||||
android:entries="@array/pref_tracking_protection_entries"
|
||||
android:entryValues="@array/pref_tracking_protection_values"
|
||||
android:persistent="false" />
|
||||
|
||||
<org.mozilla.gecko.preferences.AlignRightLinkPreference
|
||||
android:key="android.not_a_preference.trackingprotection.learn_more"
|
||||
android:title="@string/pref_learn_more"
|
||||
|
|
|
@ -216,6 +216,10 @@
|
|||
<string name="pref_donottrack_title">&pref_donottrack_title;</string>
|
||||
<string name="pref_donottrack_summary">&pref_donottrack_summary;</string>
|
||||
|
||||
<string name="pref_tracking_protection_enabled">&pref_tracking_protection_enabled;</string>
|
||||
<string name="pref_tracking_protection_enabled_pb">&pref_tracking_protection_enabled_pb;</string>
|
||||
<string name="pref_tracking_protection_disabled">&pref_tracking_protection_disabled;</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>
|
||||
|
|
|
@ -1414,6 +1414,11 @@ var BrowserApp = {
|
|||
}, this);
|
||||
},
|
||||
|
||||
// These values come from pref_tracking_protection_entries in arrays.xml.
|
||||
PREF_TRACKING_PROTECTION_ENABLED: "2",
|
||||
PREF_TRACKING_PROTECTION_ENABLED_PB: "1",
|
||||
PREF_TRACKING_PROTECTION_DISABLED: "0",
|
||||
|
||||
handlePreferencesRequest: function handlePreferencesRequest(aRequestId,
|
||||
aPrefNames,
|
||||
aListen) {
|
||||
|
@ -1452,6 +1457,18 @@ var BrowserApp = {
|
|||
pref.value = MasterPassword.enabled;
|
||||
prefs.push(pref);
|
||||
continue;
|
||||
case "privacy.trackingprotection.state": {
|
||||
pref.type = "string";
|
||||
if (Services.prefs.getBoolPref("privacy.trackingprotection.enabled")) {
|
||||
pref.value = this.PREF_TRACKING_PROTECTION_ENABLED;
|
||||
} else if (Services.prefs.getBoolPref("privacy.trackingprotection.pbmode.enabled")) {
|
||||
pref.value = this.PREF_TRACKING_PROTECTION_ENABLED_PB;
|
||||
} else {
|
||||
pref.value = this.PREF_TRACKING_PROTECTION_DISABLED;
|
||||
}
|
||||
prefs.push(pref);
|
||||
continue;
|
||||
}
|
||||
// Crash reporter submit pref must be fetched from nsICrashReporter service.
|
||||
case "datareporting.crashreporter.submitEnabled":
|
||||
let crashReporterBuilt = "nsICrashReporter" in Ci && Services.appinfo instanceof Ci.nsICrashReporter;
|
||||
|
@ -1534,6 +1551,29 @@ var BrowserApp = {
|
|||
MasterPassword.setPassword(json.value);
|
||||
return;
|
||||
|
||||
// "privacy.trackingprotection.state" is not a "real" pref name, but it's used in the setting menu.
|
||||
// By default "privacy.trackingprotection.pbmode.enabled" is true,
|
||||
// and "privacy.trackingprotection.enabled" is false.
|
||||
case "privacy.trackingprotection.state": {
|
||||
switch (json.value) {
|
||||
// Tracking protection disabled.
|
||||
case this.PREF_TRACKING_PROTECTION_DISABLED:
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.pbmode.enabled", false);
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", false);
|
||||
break;
|
||||
// Tracking protection only in private browsing,
|
||||
case this.PREF_TRACKING_PROTECTION_ENABLED_PB:
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.pbmode.enabled", true);
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", false);
|
||||
break;
|
||||
// Tracking protection everywhere.
|
||||
case this.PREF_TRACKING_PROTECTION_ENABLED:
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.pbmode.enabled", true);
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
// Enabling or disabling suggestions will prevent future prompts
|
||||
case SearchEngines.PREF_SUGGEST_ENABLED:
|
||||
Services.prefs.setBoolPref(SearchEngines.PREF_SUGGEST_PROMPTED, true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче