Commit 277ce06a authored by Ben Schwartz's avatar Ben Schwartz Committed by Commit Bot

Secure DNS UI improvements

This hides all the server choice fields when "Choose another provider"
is not selected.  It also adjusts the label and removes the bottom
horizontal line, as requested.

Bug: 1106095
Change-Id: Ib362f5f2507235dd63c76d1fd857943425bb7f00
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2320131Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Commit-Queue: Ben Schwartz <bemasc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792143}
parent 339c424d
......@@ -4,7 +4,8 @@
found in the LICENSE file. -->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="secure_dns_switch"
......@@ -13,6 +14,7 @@
android:summary="@string/settings_secure_dns_description" />
<org.chromium.chrome.browser.privacy.secure_dns.SecureDnsProviderPreference
android:key="secure_dns_provider" />
android:key="secure_dns_provider"
app:allowDividerBelow="false" />
</PreferenceScreen>
......@@ -215,35 +215,42 @@ class SecureDnsProviderPreference extends Preference implements RadioGroup.OnChe
mServerMenu.setSelection(position);
}
// Position 0 is the custom server. Other positions are actual server entries.
if (position > 0) {
// Selected server mode.
Entry entry = (Entry) mServerMenu.getSelectedItem();
String html = mPrivacyTemplate.replace("$1", entry.privacy);
mPrivacyPolicy.setText(Html.fromHtml(html));
mPrivacyPolicy.setVisibility(View.VISIBLE);
mCustomServerLayout.setVisibility(View.GONE);
} else {
// Custom server mode.
if (!mCustomServer.getText().toString().equals(mState.template)) {
mCustomServer.setText(mState.template);
mCustomServer.removeCallbacks(mProbeRunner);
if (mState.secure) {
mCustomServer.requestFocus();
// If the custom server field is idle for one second, run a probe.
// Any changes to the field will cancel this probe and start another.
mCustomServer.postDelayed(mProbeRunner, 1000);
if (mState.secure) {
mServerMenu.setVisibility(View.VISIBLE);
// Position 0 is the custom server. Other positions are actual server entries.
if (position > 0) {
// Selected server mode.
Entry entry = (Entry) mServerMenu.getSelectedItem();
String html = mPrivacyTemplate.replace("$1", entry.privacy);
mPrivacyPolicy.setText(Html.fromHtml(html));
mPrivacyPolicy.setVisibility(View.VISIBLE);
mCustomServerLayout.setVisibility(View.GONE);
} else {
// Custom server mode.
if (!mCustomServer.getText().toString().equals(mState.template)) {
mCustomServer.setText(mState.template);
mCustomServer.removeCallbacks(mProbeRunner);
if (mState.secure) {
mCustomServer.requestFocus();
// If the custom server field is idle for one second, run a probe.
// Any changes to the field will cancel this probe and start another.
mCustomServer.postDelayed(mProbeRunner, 1000);
}
}
}
// Show a warning if the input is invalid and is not the start of a valid URL.
boolean showWarning = !mState.valid && !"https://".startsWith(mState.template);
mCustomServerLayout.setError(showWarning ? mInvalidWarning : null);
// Show a warning if the input is invalid and is not the start of a valid URL.
boolean showWarning = !mState.valid && !"https://".startsWith(mState.template);
mCustomServerLayout.setError(showWarning ? mInvalidWarning : null);
mCustomServerLayout.setVisibility(mState.secure ? View.VISIBLE : View.INVISIBLE);
mCustomServerLayout.setVisibility(View.VISIBLE);
mPrivacyPolicy.setVisibility(View.GONE);
}
} else {
mServerMenu.setVisibility(View.GONE);
mPrivacyPolicy.setVisibility(View.GONE);
mCustomServerLayout.setVisibility(View.GONE);
}
SecureDnsBridge.updateValidationHistogram(mState.valid);
......
......@@ -753,7 +753,7 @@ For example, some websites may respond to this request by showing you ads that a
Automatic
</message>
<message name="IDS_SETTINGS_SECURE_DROPDOWN_MODE_DESCRIPTION" desc="Text of the radio button that allows a secure resolver to be selected from a dropdown menu">
Choose another provider:
Choose another provider
</message>
<message name="IDS_SETTINGS_SECURE_DROPDOWN_MODE_PRIVACY_POLICY" desc="Text that displays a link to the privacy policy of the resolver selected from a dropdown menu">
See this provider's <ph name="BEGIN_LINK">&lt;a target="_blank" href="$1<ex>https://google.com/</ex>"&gt;</ph>privacy policy<ph name="END_LINK">&lt;/a&gt;</ph>
......
6e5e2c36f636ad3c56ffc05b07f0c72cb2815d1d
\ No newline at end of file
88c64ac08eb03996b557f7a047fdd4c46aa501bf
\ 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