Commit da39f693 authored by Xinghui Lu's avatar Xinghui Lu Committed by Commit Bot

Rename "Security" section to "Safe Browsing" section.

Per Android UI guidance, radio buttons should not be used in settings
list. To follow the guidance, the "Security" section is renamed to
"Safe Browsing" section. The "DNS over HTTPS" preference remains in the
"Privacy and security" section. For more details, see: go/ep-clank.

To avoid mixing refactoring with functional changes, further renaming
will be done in a followup CL.

* Changes on the "Privacy and security" section
before: http://screen/SoETXTjFKe2
after: http://screen/vH6PVX423xN

* Changes on the "Safe Browsing" section(previous "Security" section)
before: http://screen/02ZdA6rFHK9
after: http://screen/gusmNtHYgnH

Bug: 1097310
Change-Id: Id6de4a38fafad64e4daa39e42f4aa44a28e5ac50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2337390Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Reviewed-by: default avatarNatalie Chouinard <chouinard@chromium.org>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795580}
parent 28ed57e3
...@@ -6,6 +6,7 @@ include_rules = [ ...@@ -6,6 +6,7 @@ include_rules = [
"+chrome/browser/notifications", "+chrome/browser/notifications",
"+chrome/browser/password_manager/android", "+chrome/browser/password_manager/android",
"+chrome/browser/preferences/android/java", "+chrome/browser/preferences/android/java",
"+chrome/browser/safe_browsing/android",
"+chrome/browser/safety_check/android", "+chrome/browser/safety_check/android",
"+chrome/browser/settings/android", "+chrome/browser/settings/android",
"+chrome/browser/ui/android/favicon/java", "+chrome/browser/ui/android/favicon/java",
......
...@@ -33,9 +33,9 @@ ...@@ -33,9 +33,9 @@
android:summary="@string/clear_browsing_data_summary" android:summary="@string/clear_browsing_data_summary"
android:fragment="org.chromium.chrome.browser.browsing_data.ClearBrowsingDataTabsFragment" /> android:fragment="org.chromium.chrome.browser.browsing_data.ClearBrowsingDataTabsFragment" />
<Preference <Preference
android:key="security" android:key="safe_browsing"
android:title="@string/prefs_security_title" android:title="@string/prefs_safe_browsing_title"
android:summary="@string/prefs_security_summary" android:summary="@string/prefs_safe_browsing_summary"
android:fragment="org.chromium.chrome.browser.safe_browsing.settings.SecuritySettingsFragment" /> android:fragment="org.chromium.chrome.browser.safe_browsing.settings.SecuritySettingsFragment" />
<org.chromium.components.browser_ui.settings.TextMessagePreference <org.chromium.components.browser_ui.settings.TextMessagePreference
android:key="sync_and_services_link" android:key="sync_and_services_link"
......
...@@ -21,6 +21,7 @@ import org.chromium.chrome.browser.help.HelpAndFeedback; ...@@ -21,6 +21,7 @@ import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
import org.chromium.chrome.browser.privacy.secure_dns.SecureDnsSettings; import org.chromium.chrome.browser.privacy.secure_dns.SecureDnsSettings;
import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.safe_browsing.settings.SecuritySettingsFragment;
import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate; import org.chromium.chrome.browser.settings.ChromeManagedPreferenceDelegate;
import org.chromium.chrome.browser.settings.SettingsLauncher; import org.chromium.chrome.browser.settings.SettingsLauncher;
import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.settings.SettingsLauncherImpl;
...@@ -44,7 +45,7 @@ public class PrivacySettings ...@@ -44,7 +45,7 @@ public class PrivacySettings
private static final String PREF_SECURE_DNS = "secure_dns"; private static final String PREF_SECURE_DNS = "secure_dns";
private static final String PREF_USAGE_STATS = "usage_stats_reporting"; private static final String PREF_USAGE_STATS = "usage_stats_reporting";
private static final String PREF_DO_NOT_TRACK = "do_not_track"; private static final String PREF_DO_NOT_TRACK = "do_not_track";
private static final String PREF_SECURITY = "security"; private static final String PREF_SAFE_BROWSING = "safe_browsing";
private static final String PREF_SYNC_AND_SERVICES_LINK = "sync_and_services_link"; private static final String PREF_SYNC_AND_SERVICES_LINK = "sync_and_services_link";
private ManagedPreferenceDelegate mManagedPreferenceDelegate; private ManagedPreferenceDelegate mManagedPreferenceDelegate;
...@@ -60,9 +61,12 @@ public class PrivacySettings ...@@ -60,9 +61,12 @@ public class PrivacySettings
// See (go/esb-clank-dd) for more context. // See (go/esb-clank-dd) for more context.
if (ChromeFeatureList.isEnabled(ChromeFeatureList.SAFE_BROWSING_SECURITY_SECTION_UI)) { if (ChromeFeatureList.isEnabled(ChromeFeatureList.SAFE_BROWSING_SECURITY_SECTION_UI)) {
getActivity().setTitle(R.string.prefs_privacy_security); getActivity().setTitle(R.string.prefs_privacy_security);
findPreference(PREF_SAFE_BROWSING)
.setSummary(
SecuritySettingsFragment.getSafeBrowsingSummaryString(getContext()));
} else { } else {
getActivity().setTitle(R.string.prefs_privacy); getActivity().setTitle(R.string.prefs_privacy);
getPreferenceScreen().removePreference(findPreference(PREF_SECURITY)); getPreferenceScreen().removePreference(findPreference(PREF_SAFE_BROWSING));
} }
setHasOptionsMenu(true); setHasOptionsMenu(true);
...@@ -138,6 +142,12 @@ public class PrivacySettings ...@@ -138,6 +142,12 @@ public class PrivacySettings
secureDnsPref.setSummary(SecureDnsSettings.getSummary(getContext())); secureDnsPref.setSummary(SecureDnsSettings.getSummary(getContext()));
} }
Preference safeBrowsingPreference = findPreference(PREF_SAFE_BROWSING);
if (safeBrowsingPreference != null && safeBrowsingPreference.isVisible()) {
safeBrowsingPreference.setSummary(
SecuritySettingsFragment.getSafeBrowsingSummaryString(getContext()));
}
Preference usageStatsPref = findPreference(PREF_USAGE_STATS); Preference usageStatsPref = findPreference(PREF_USAGE_STATS);
if (usageStatsPref != null) { if (usageStatsPref != null) {
if (BuildInfo.isAtLeastQ() && prefService.getBoolean(Pref.USAGE_STATS_ENABLED)) { if (BuildInfo.isAtLeastQ() && prefService.getBoolean(Pref.USAGE_STATS_ENABLED)) {
......
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
android:key="safe_browsing_section"
android:title="@string/prefs_section_safe_browsing_title"/>
<org.chromium.components.browser_ui.settings.TextMessagePreference <org.chromium.components.browser_ui.settings.TextMessagePreference
android:key="text_managed" /> android:key="text_managed" />
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
package org.chromium.chrome.browser.safe_browsing.settings; package org.chromium.chrome.browser.safe_browsing.settings;
import android.content.Context;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
...@@ -22,6 +23,7 @@ import org.chromium.components.browser_ui.settings.TextMessagePreference; ...@@ -22,6 +23,7 @@ import org.chromium.components.browser_ui.settings.TextMessagePreference;
/** /**
* Fragment containing security settings. * Fragment containing security settings.
* TODO(crbug.com/1097310): Rename it to SafeBrowsingSettingsFragment.
*/ */
public class SecuritySettingsFragment extends PreferenceFragmentCompat public class SecuritySettingsFragment extends PreferenceFragmentCompat
implements FragmentSettingsLauncher, implements FragmentSettingsLauncher,
...@@ -34,13 +36,33 @@ public class SecuritySettingsFragment extends PreferenceFragmentCompat ...@@ -34,13 +36,33 @@ public class SecuritySettingsFragment extends PreferenceFragmentCompat
// An instance of SettingsLauncher that is used to launch Safe Browsing subsections. // An instance of SettingsLauncher that is used to launch Safe Browsing subsections.
private SettingsLauncher mSettingsLauncher; private SettingsLauncher mSettingsLauncher;
private RadioButtonGroupSafeBrowsingPreference mSafeBrowsingPreference; private RadioButtonGroupSafeBrowsingPreference mSafeBrowsingPreference;
/**
* @return A summary that describes the current Safe Browsing state.
*/
public static String getSafeBrowsingSummaryString(Context context) {
@SafeBrowsingState
int safeBrowsingState = SafeBrowsingBridge.getSafeBrowsingState();
String safeBrowsingStateString = "";
if (safeBrowsingState == SafeBrowsingState.ENHANCED_PROTECTION) {
safeBrowsingStateString =
context.getString(R.string.safe_browsing_enhanced_protection_title);
} else if (safeBrowsingState == SafeBrowsingState.STANDARD_PROTECTION) {
safeBrowsingStateString =
context.getString(R.string.safe_browsing_standard_protection_title);
} else if (safeBrowsingState == SafeBrowsingState.NO_SAFE_BROWSING) {
safeBrowsingStateString = context.getString(R.string.safe_browsing_no_protection_title);
} else {
assert false : "Should not be reached";
}
return context.getString(R.string.prefs_safe_browsing_summary, safeBrowsingStateString);
}
@Override @Override
public void onCreatePreferences(Bundle bundle, String s) { public void onCreatePreferences(Bundle bundle, String s) {
SettingsUtils.addPreferencesFromResource(this, R.xml.security_preferences); SettingsUtils.addPreferencesFromResource(this, R.xml.security_preferences);
getActivity().setTitle(R.string.prefs_security_title); getActivity().setTitle(R.string.prefs_safe_browsing_title);
ManagedPreferenceDelegate managedPreferenceDelegate = createManagedPreferenceDelegate(); ManagedPreferenceDelegate managedPreferenceDelegate = createManagedPreferenceDelegate();
......
...@@ -964,12 +964,12 @@ Your Google account may have other forms of browsing history like searches and a ...@@ -964,12 +964,12 @@ Your Google account may have other forms of browsing history like searches and a
other {Checked # days ago}} other {Checked # days ago}}
</message> </message>
<!-- Security preferences --> <!-- Safe Browsing preferences -->
<message name="IDS_PREFS_SECURITY_TITLE" desc="Title for the Security preferences. [CHAR-LIMIT=32]"> <message name="IDS_PREFS_SAFE_BROWSING_TITLE" desc="Title for the Safe Browsing preferences. [CHAR-LIMIT=32]">
Security Safe Browsing
</message> </message>
<message name="IDS_PREFS_SECURITY_SUMMARY" desc="Summary for the Security preferences."> <message name="IDS_PREFS_SAFE_BROWSING_SUMMARY" desc="Summary for the Safe Browsing preferences.">
Safe Browsing (protection from dangerous sites) and other security settings <ph name="SAFE_BROWSING_MODE">%1$s<ex>Enhanced protection</ex></ph> is on
</message> </message>
<message name="IDS_PREFS_SECTION_SAFE_BROWSING_TITLE" desc="Title for the Safe Browsing section. [CHAR-LIMIT=32]"> <message name="IDS_PREFS_SECTION_SAFE_BROWSING_TITLE" desc="Title for the Safe Browsing section. [CHAR-LIMIT=32]">
Safe Browsing Safe Browsing
......
6478ea9c8efc586395414ec572df15c02a5d594f
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment