Commit 8d2d6ebc authored by Jun Choi's avatar Jun Choi Committed by Commit Bot

Add 'Time out' UI sheet

Add 'Time out' sheet model to show when Web Authentication request
times-out due to inactivity or error.

Bug: 849323
Change-Id: Ifda965c3120d4fbd28f46a4f62e88200f316ca0f
Reviewed-on: https://chromium-review.googlesource.com/1105284
Commit-Queue: Jun Choi <hongjunchoi@chromium.org>
Reviewed-by: default avatarKim Paulhamus <kpaulhamus@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572325}
parent 5c8f1412
......@@ -10011,6 +10011,12 @@ Please help our engineers fix this problem. Tell us what happened right before y
<message name="IDS_WEBAUTHN_USB_INSERT_DESCRIPTION" desc="Contents of the dialog shown instructing the user to plug in their USB security key.">
Plug in your Security Key and activate it
</message>
<message name="IDS_WEBAUTHN_TIMEOUT_TITLE" desc="Title of the dialog shown when the Web Authentication request times out.">
Time out
</message>
<message name="IDS_WEBAUTHN_TIMEOUT_DESCRIPTION" desc="Contents of the dialog shown when Web Authentication request times out due to inactivity or error.">
The request timed out
</message>
</messages>
</release>
</grit>
......@@ -54,6 +54,9 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
dialog_model));
break;
case Step::kErrorTimedOut:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorTimeoutErrorModel>(dialog_model));
break;
case Step::kCompleted:
case Step::kBlePowerOnAutomatic:
case Step::kBlePowerOnManual:
......
......@@ -40,6 +40,9 @@ class AuthenticatorDialogTest : public DialogBrowserTest {
} else if (name == "insert_usb_sign") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kUsbInsertAndActivateOnSign);
} else if (name == "timeout") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorTimedOut);
}
ShowAuthenticatorRequestDialog(
......@@ -68,6 +71,11 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_transports) {
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_insert_usb_register) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_insert_usb_sign) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_timeout) {
ShowAndVerifyUi();
}
......@@ -4,6 +4,8 @@
#include "chrome/browser/ui/webauthn/sheet_models.h"
#include <vector>
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/grit/generated_resources.h"
......@@ -124,3 +126,13 @@ base::string16
AuthenticatorInsertAndActivateUsbOnSignSheetModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_USB_INSERT_DESCRIPTION);
}
// AuthenticatorTimeoutErrorModel ---------------------------------------------
base::string16 AuthenticatorTimeoutErrorModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_TIMEOUT_TITLE);
}
base::string16 AuthenticatorTimeoutErrorModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_TIMEOUT_DESCRIPTION);
}
......@@ -95,4 +95,14 @@ class AuthenticatorInsertAndActivateUsbOnSignSheetModel
base::string16 GetStepDescription() const override;
};
class AuthenticatorTimeoutErrorModel : public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
};
#endif // CHROME_BROWSER_UI_WEBAUTHN_SHEET_MODELS_H_
......@@ -72,3 +72,7 @@ void AuthenticatorRequestDialogModel::RemoveObserver(Observer* observer) {
void AuthenticatorRequestDialogModel::OnRequestComplete() {
SetCurrentStep(Step::kCompleted);
}
void AuthenticatorRequestDialogModel::OnRequestTimeout() {
SetCurrentStep(Step::kErrorTimedOut);
}
......@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_WEBAUTHN_AUTHENTICATOR_REQUEST_DIALOG_MODEL_H_
#define CHROME_BROWSER_WEBAUTHN_AUTHENTICATOR_REQUEST_DIALOG_MODEL_H_
#include <string>
#include "base/observer_list.h"
#include "chrome/browser/webauthn/transport_list_model.h"
......@@ -117,6 +119,9 @@ class AuthenticatorRequestDialogModel {
// To be called when the Web Authentication request is complete.
void OnRequestComplete();
// To be called when Web Authentication request times-out.
void OnRequestTimeout();
private:
// The current step of the request UX flow that is currently shown.
Step current_step_ = Step::kInitial;
......
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