Commit 8389357b authored by Nina Satragno's avatar Nina Satragno Committed by Chromium LUCI CQ

[webauthn] Add "Try again" button on error sheet

We show a generic error sheet when the authenticator is missing a
capability or is locked. For any of these cases, the user might have
tapped the wrong authenticator, or they may unplug and replug their
authenticator. We should show a "try again" button like we do for other
errors.

Fixed: 1144183
Change-Id: I0bcd658becf18b50cc04737179764f7db77b38aa
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2579826Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Commit-Queue: Nina Satragno <nsatragno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835816}
parent 95eff7cd
......@@ -970,6 +970,19 @@ base::string16 AuthenticatorGenericErrorSheetModel::GetCancelButtonLabel()
return l10n_util::GetStringUTF16(IDS_CLOSE);
}
bool AuthenticatorGenericErrorSheetModel::IsAcceptButtonVisible() const {
return dialog_model()->offer_try_again_in_ui();
}
bool AuthenticatorGenericErrorSheetModel::IsAcceptButtonEnabled() const {
return true;
}
base::string16 AuthenticatorGenericErrorSheetModel::GetAcceptButtonLabel()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_RETRY);
}
const gfx::VectorIcon& AuthenticatorGenericErrorSheetModel::GetStepIllustration(
ImageColorScheme color_scheme) const {
return color_scheme == ImageColorScheme::kDark ? kWebauthnErrorDarkIcon
......@@ -984,6 +997,10 @@ base::string16 AuthenticatorGenericErrorSheetModel::GetStepDescription() const {
return description_;
}
void AuthenticatorGenericErrorSheetModel::OnAccept() {
dialog_model()->StartOver();
}
// AuthenticatorResidentCredentialConfirmationSheetView -----------------------
AuthenticatorResidentCredentialConfirmationSheetView::
......
......@@ -388,8 +388,7 @@ class AuthenticatorRetryUvSheetModel : public AuthenticatorSheetModelBase {
base::string16 GetError() const override;
};
// Generic error dialog that can only be dismissed. Backwards navigation is
// not visible.
// Generic error dialog that allows starting the request over.
class AuthenticatorGenericErrorSheetModel : public AuthenticatorSheetModelBase {
public:
static std::unique_ptr<AuthenticatorGenericErrorSheetModel>
......@@ -411,12 +410,16 @@ class AuthenticatorGenericErrorSheetModel : public AuthenticatorSheetModelBase {
base::string16 description);
// AuthenticatorSheetModelBase:
bool IsAcceptButtonVisible() const override;
bool IsAcceptButtonEnabled() const override;
base::string16 GetAcceptButtonLabel() const override;
bool IsBackButtonVisible() const override;
base::string16 GetCancelButtonLabel() const override;
const gfx::VectorIcon& GetStepIllustration(
ImageColorScheme color_scheme) const override;
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
void OnAccept() override;
base::string16 title_;
base::string16 description_;
......
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