Commit 707e8c28 authored by Adam Langley's avatar Adam Langley Committed by Commit Bot

Add flag-protected security key UI under Passwords.

This change adds a hidden-by-default entry in the passwords settings
UI on Android that triggers the Phone as a Security Key prototype code.

The most important thing to verify about this change is that it doesn't
have any effect unless the user manually sets the flag: the UI is
intended for experimentation and for UX-team to consider at this point.

BUG: 1002262
Change-Id: I17d1077002b53198bc1d2422e28d13c6611dfc5b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079614
Commit-Queue: Adam Langley <agl@chromium.org>
Auto-Submit: Adam Langley <agl@chromium.org>
Reviewed-by: default avatarFriedrich [CET] <fhorschig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748453}
parent b1a4b614
...@@ -27,6 +27,7 @@ import androidx.annotation.VisibleForTesting; ...@@ -27,6 +27,7 @@ import androidx.annotation.VisibleForTesting;
import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.StrictModeContext; import org.chromium.base.StrictModeContext;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.help.HelpAndFeedback; import org.chromium.chrome.browser.help.HelpAndFeedback;
import org.chromium.chrome.browser.password_manager.PasswordManagerLauncher; import org.chromium.chrome.browser.password_manager.PasswordManagerLauncher;
import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.Pref;
...@@ -38,6 +39,7 @@ import org.chromium.chrome.browser.settings.ChromeSwitchPreference; ...@@ -38,6 +39,7 @@ import org.chromium.chrome.browser.settings.ChromeSwitchPreference;
import org.chromium.chrome.browser.settings.SearchUtils; import org.chromium.chrome.browser.settings.SearchUtils;
import org.chromium.chrome.browser.settings.SettingsLauncher; import org.chromium.chrome.browser.settings.SettingsLauncher;
import org.chromium.chrome.browser.settings.TextMessagePreference; import org.chromium.chrome.browser.settings.TextMessagePreference;
import org.chromium.chrome.browser.webauth.authenticator.CableAuthenticatorUIFactory;
import org.chromium.ui.text.SpanApplier; import org.chromium.ui.text.SpanApplier;
import java.util.Locale; import java.util.Locale;
...@@ -63,8 +65,10 @@ public class PasswordSettings ...@@ -63,8 +65,10 @@ public class PasswordSettings
public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_switch"; public static final String PREF_SAVE_PASSWORDS_SWITCH = "save_passwords_switch";
public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch"; public static final String PREF_AUTOSIGNIN_SWITCH = "autosignin_switch";
public static final String PREF_KEY_MANAGE_ACCOUNT_LINK = "manage_account_link"; public static final String PREF_KEY_MANAGE_ACCOUNT_LINK = "manage_account_link";
public static final String PREF_KEY_SECURITY_KEY_LINK = "security_key_link";
// A PasswordEntryViewer receives a boolean value with this key. If set true, the the entry was // A PasswordEntryViewer receives a boolean value with this key. If set true, the the entry was
// part of a search result. // part of a search result.
public static final String EXTRA_FOUND_VIA_SEARCH = "found_via_search_args"; public static final String EXTRA_FOUND_VIA_SEARCH = "found_via_search_args";
...@@ -75,9 +79,10 @@ public class PasswordSettings ...@@ -75,9 +79,10 @@ public class PasswordSettings
private static final int ORDER_SWITCH = 0; private static final int ORDER_SWITCH = 0;
private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1; private static final int ORDER_AUTO_SIGNIN_CHECKBOX = 1;
private static final int ORDER_MANAGE_ACCOUNT_LINK = 2; private static final int ORDER_MANAGE_ACCOUNT_LINK = 2;
private static final int ORDER_SAVED_PASSWORDS = 3; private static final int ORDER_SECURITY_KEY = 3;
private static final int ORDER_EXCEPTIONS = 4; private static final int ORDER_SAVED_PASSWORDS = 4;
private static final int ORDER_SAVED_PASSWORDS_NO_TEXT = 5; private static final int ORDER_EXCEPTIONS = 5;
private static final int ORDER_SAVED_PASSWORDS_NO_TEXT = 6;
private boolean mNoPasswords; private boolean mNoPasswords;
private boolean mNoPasswordExceptions; private boolean mNoPasswordExceptions;
...@@ -87,6 +92,7 @@ public class PasswordSettings ...@@ -87,6 +92,7 @@ public class PasswordSettings
private String mSearchQuery; private String mSearchQuery;
private Preference mLinkPref; private Preference mLinkPref;
private Preference mSecurityKey;
private ChromeSwitchPreference mSavePasswordsSwitch; private ChromeSwitchPreference mSavePasswordsSwitch;
private ChromeBaseCheckBoxPreference mAutoSignInSwitch; private ChromeBaseCheckBoxPreference mAutoSignInSwitch;
private TextMessagePreference mEmptyView; private TextMessagePreference mEmptyView;
...@@ -259,6 +265,11 @@ public class PasswordSettings ...@@ -259,6 +265,11 @@ public class PasswordSettings
resetList(PREF_KEY_CATEGORY_SAVED_PASSWORDS); resetList(PREF_KEY_CATEGORY_SAVED_PASSWORDS);
resetNoEntriesTextMessage(); resetNoEntriesTextMessage();
if (CableAuthenticatorUIFactory.isAvailable()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.WEB_AUTH_PHONE_SUPPORT)) {
displaySecurityKeyLink();
}
mNoPasswords = count == 0; mNoPasswords = count == 0;
if (mNoPasswords) { if (mNoPasswords) {
if (mNoPasswordExceptions) displayEmptyScreenMessage(); if (mNoPasswordExceptions) displayEmptyScreenMessage();
...@@ -480,6 +491,21 @@ public class PasswordSettings ...@@ -480,6 +491,21 @@ public class PasswordSettings
getPreferenceScreen().addPreference(mLinkPref); getPreferenceScreen().addPreference(mLinkPref);
} }
private void displaySecurityKeyLink() {
if (mSecurityKey == null) {
mSecurityKey = new ChromeBasePreference(getStyledContext());
mSecurityKey.setKey(PREF_KEY_SECURITY_KEY_LINK);
mSecurityKey.setTitle(R.string.phone_as_security_key_text);
mSecurityKey.setOnPreferenceClickListener(preference -> {
SettingsLauncher.getInstance().launchSettingsPage(
getActivity(), CableAuthenticatorUIFactory.getFragmentClass(), null);
return true;
});
mSecurityKey.setOrder(ORDER_SECURITY_KEY);
}
getPreferenceScreen().addPreference(mSecurityKey);
}
private Context getStyledContext() { private Context getStyledContext() {
return getPreferenceManager().getContext(); return getPreferenceManager().getContext();
} }
......
...@@ -3328,12 +3328,10 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -3328,12 +3328,10 @@ const FeatureEntry kFeatureEntries[] = {
kMarkHttpAsFeatureVariations, kMarkHttpAsFeatureVariations,
"HTTPReallyBadFinal")}, "HTTPReallyBadFinal")},
#if !defined(OS_ANDROID)
{"enable-web-authentication-cable-v2-support", {"enable-web-authentication-cable-v2-support",
flag_descriptions::kEnableWebAuthenticationCableV2SupportName, flag_descriptions::kEnableWebAuthenticationCableV2SupportName,
flag_descriptions::kEnableWebAuthenticationCableV2SupportDescription, flag_descriptions::kEnableWebAuthenticationCableV2SupportDescription,
kOsDesktop, FEATURE_VALUE_TYPE(device::kWebAuthPhoneSupport)}, kOsDesktop | kOsAndroid, FEATURE_VALUE_TYPE(device::kWebAuthPhoneSupport)},
#endif // !defined(OS_ANDROID)
{"use-preferred-interval-for-video", {"use-preferred-interval-for-video",
flag_descriptions::kUsePreferredIntervalForVideoName, flag_descriptions::kUsePreferredIntervalForVideoName,
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "components/subresource_filter/core/browser/subresource_filter_features.h" #include "components/subresource_filter/core/browser/subresource_filter_features.h"
#include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_driver_switches.h"
#include "content/public/common/content_features.h" #include "content/public/common/content_features.h"
#include "device/fido/features.h"
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#include "net/base/features.h" #include "net/base/features.h"
#include "services/device/public/cpp/device_features.h" #include "services/device/public/cpp/device_features.h"
...@@ -72,6 +73,7 @@ const base::Feature* kFeaturesExposedToJava[] = { ...@@ -72,6 +73,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&autofill::features::kAutofillTouchToFill, &autofill::features::kAutofillTouchToFill,
&content_settings::kImprovedCookieControls, &content_settings::kImprovedCookieControls,
&content_settings::kImprovedCookieControlsForThirdPartyCookieBlocking, &content_settings::kImprovedCookieControlsForThirdPartyCookieBlocking,
&device::kWebAuthPhoneSupport,
&download::features::kDownloadAutoResumptionNative, &download::features::kDownloadAutoResumptionNative,
&download::features::kUseDownloadOfflineContentProvider, &download::features::kUseDownloadOfflineContentProvider,
&features::kAppNotificationStatusMessaging, &features::kAppNotificationStatusMessaging,
......
...@@ -417,6 +417,7 @@ public abstract class ChromeFeatureList { ...@@ -417,6 +417,7 @@ public abstract class ChromeFeatureList {
public static final String VR_BROWSING_FEEDBACK = "VrBrowsingFeedback"; public static final String VR_BROWSING_FEEDBACK = "VrBrowsingFeedback";
public static final String WEBAPK_ADAPTIVE_ICON = "WebApkAdaptiveIcon"; public static final String WEBAPK_ADAPTIVE_ICON = "WebApkAdaptiveIcon";
public static final String WEB_AUTH = "WebAuthentication"; public static final String WEB_AUTH = "WebAuthentication";
public static final String WEB_AUTH_PHONE_SUPPORT = "WebAuthenticationPhoneSupport";
public static final String WEB_PAYMENTS = "WebPayments"; public static final String WEB_PAYMENTS = "WebPayments";
public static final String WEB_PAYMENTS_ALWAYS_ALLOW_JUST_IN_TIME_PAYMENT_APP = public static final String WEB_PAYMENTS_ALWAYS_ALLOW_JUST_IN_TIME_PAYMENT_APP =
"AlwaysAllowJustInTimePaymentApp"; "AlwaysAllowJustInTimePaymentApp";
......
...@@ -497,6 +497,9 @@ CHAR-LIMIT guidelines: ...@@ -497,6 +497,9 @@ CHAR-LIMIT guidelines:
<message name="IDS_MANAGE_PASSWORDS_TEXT" desc="Text for link to manage passwords on Account Central."> <message name="IDS_MANAGE_PASSWORDS_TEXT" desc="Text for link to manage passwords on Account Central.">
View and manage saved passwords in your <ph name="BEGIN_LINK">&lt;link&gt;</ph>Google Account<ph name="END_LINK">&lt;/link&gt;</ph> View and manage saved passwords in your <ph name="BEGIN_LINK">&lt;link&gt;</ph>Google Account<ph name="END_LINK">&lt;/link&gt;</ph>
</message> </message>
<message name="IDS_PHONE_AS_SECURITY_KEY_TEXT" desc="Text for link to use phone as a security key. A 'security key' is physical device used for authentication, usually as part of two-factor security. This option allows a phone to be used in place of a dedicated security key.">
Use phone as a security key
</message>
<message name="IDS_SAVED_PASSWORDS_NONE_TEXT" desc="Text when there are no saved passwords/exceptions."> <message name="IDS_SAVED_PASSWORDS_NONE_TEXT" desc="Text when there are no saved passwords/exceptions.">
Saved passwords will appear here. Saved passwords will appear here.
</message> </message>
......
823af2573acce3901d7e137ca5885d3ebb333d27
\ 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