Commit 07a965eb authored by Jun Choi's avatar Jun Choi Committed by Commit Bot

Add UI Sheet model for BLE related flow

Add title and description that appears on UI dialog for BLE registration
and sign-in flow.

Bug: 849323
Change-Id: I373af67363bddcdfc613282bef095dee58f8521a
Reviewed-on: https://chromium-review.googlesource.com/1105598
Commit-Queue: Jun Choi <hongjunchoi@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarKim Paulhamus <kpaulhamus@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572386}
parent fbf51c58
...@@ -10017,6 +10017,55 @@ Please help our engineers fix this problem. Tell us what happened right before y ...@@ -10017,6 +10017,55 @@ Please help our engineers fix this problem. Tell us what happened right before y
<message name="IDS_WEBAUTHN_TIMEOUT_DESCRIPTION" desc="Contents of the dialog shown when Web Authentication request times out due to inactivity or error."> <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 The request timed out
</message> </message>
<message name="IDS_WEBAUTHN_BLE_POWER_ON_MANUAL_TITLE" desc="Title of the dialog shown when instructing the user to manually turn on Bluetooth so that security keys can be used over Bluetooth.">
Turn on Bluetooth
</message>
<message name="IDS_WEBAUTHN_BLE_POWER_ON_MANUAL_DESCRIPTION" desc="Contents of the dialog shown instructing the user to turn on bluetooth so that security keys can be used over Bluetooth.">
Your Security Key only works when your device's Bluetooth is on
</message>
<message name="IDS_WEBAUTHN_BLE_POWER_ON_MANUAL_TRY_AGAIN" desc="Contents of the button shown to let the user restart the Bluetooth pairing process with Bluetooth powered on.">
Try again
</message>
<message name="IDS_WEBAUTHN_BLE_PAIRING_BEGIN_TITLE" desc="Title of the dialog shown when preparing the user to pair Bluetooth security key.">
Ready to pair your Security Key?
</message>
<message name="IDS_WEBAUTHN_BLE_PAIRING_BEGIN_DESCRIPTION" desc="Contents of the dialog shown when initiating the user to pair Bluetooth security key.">
Pair your key to this device so you can use it to sign into your account
</message>
<message name="IDS_WEBAUTHN_BLE_PAIRING_BEGIN_START" desc="Contents of the button that lets the user initiate Bluetooth pairing process.">
Begin
</message>
<message name="IDS_WEBAUTHN_BLE_ENTER_PAIRING_MODE_TITLE" desc="Title of the dialog shown when instructing the user to put security key into pairing mode.">
Allow the use of your Security Key
</message>
<message name="IDS_WEBAUTHN_BLE_ENTER_PAIRING_MODE_DESCRIPTION" desc="Contents of the dialog shown when instructing the user to put security key into pairing mode.">
Press and hold the button on your Security Key for at least 5 seconds
</message>
<message name="IDS_WEBAUTHN_BLE_DEVICE_SELECTION_TITLE" desc="Title of the dialog shown when instructing the user to select security key to connect.">
Select your Security Key
</message>
<message name="IDS_WEBAUTHN_BLE_DEVICE_SELECTION_DESCRIPTION" desc="Contents of the dialog shown when instructing the user to select his/her security key from list of near by BLE devices.">
Find the name printed on the back of your key
</message>
<message name="IDS_WEBAUTHN_BLE_PIN_ENTRY_TITLE" desc="Title of the dialog shown when instructing the user to enter the PIN code to pair a Bluetooth security key.">
Pair with <ph name="DEVICE_NAME">$1<ex>VHGSHSSN</ex></ph>
</message>
<message name="IDS_WEBAUTHN_BLE_PIN_ENTRY_DESCRIPTION" desc="Contents of the dialog shown when instructing the user to enter the PIN code to pair a Bluetooth security key.">
Find the 6-digit PIN on the back of your key
</message>
<message name="IDS_WEBAUTHN_BLE_PIN_ENTRY_NEXT" desc="Contents of the button that lets the user continue the pairing process with the entered Bluetooth PIN code.">
Next
</message>
<message name="IDS_WEBAUTHN_BLE_VERIFYING_TITLE" desc="Title of the dialog shown when the user has established BLE connection with the security key.">
Verifying your Security Key
</message>
<message name="IDS_WEBAUTHN_BLE_ACTIVATE_TITLE" desc="Title of the dialog shown when the user tries to sign-in using a security key.">
Use your Security Key with <ph name="APP_NAME">$1<ex>airbnb.com</ex></ph>
</message>
<message name="IDS_WEBAUTHN_BLE_ACTIVATE_DESCRIPTION" desc="Contents of the dialog shown when the user tries to sign-in using a security key.">
To use most keys, simply press the button
</message>
</messages> </messages>
</release> </release>
</grit> </grit>
...@@ -57,15 +57,40 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf( ...@@ -57,15 +57,40 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
sheet_view = std::make_unique<AuthenticatorRequestSheetView>( sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorTimeoutErrorModel>(dialog_model)); std::make_unique<AuthenticatorTimeoutErrorModel>(dialog_model));
break; break;
case Step::kCompleted:
case Step::kBlePowerOnAutomatic:
case Step::kBlePowerOnManual: case Step::kBlePowerOnManual:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBlePowerOnManualSheetModel>(
dialog_model));
break;
case Step::kBlePairingBegin: case Step::kBlePairingBegin:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBlePairingBeginSheetModel>(
dialog_model));
break;
case Step::kBleEnterPairingMode: case Step::kBleEnterPairingMode:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBleEnterPairingModeSheetModel>(
dialog_model));
break;
case Step::kBleDeviceSelection: case Step::kBleDeviceSelection:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBleDeviceSelectionSheetModel>(
dialog_model));
break;
case Step::kBlePinEntry: case Step::kBlePinEntry:
case Step::kBleActivate: sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBlePinEntrySheetModel>(dialog_model));
break;
case Step::kBleVerifying: case Step::kBleVerifying:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBleVerifyingSheetModel>(dialog_model));
break;
case Step::kBleActivate:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorBleActivateSheetModel>(dialog_model));
break;
case Step::kCompleted:
case Step::kBlePowerOnAutomatic:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>( sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<PlaceholderSheetModel>(dialog_model)); std::make_unique<PlaceholderSheetModel>(dialog_model));
break; break;
......
...@@ -43,6 +43,27 @@ class AuthenticatorDialogTest : public DialogBrowserTest { ...@@ -43,6 +43,27 @@ class AuthenticatorDialogTest : public DialogBrowserTest {
} else if (name == "timeout") { } else if (name == "timeout") {
model->SetCurrentStep( model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kErrorTimedOut); AuthenticatorRequestDialogModel::Step::kErrorTimedOut);
} else if (name == "ble_power_on_manual") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBlePowerOnManual);
} else if (name == "ble_pairing_begin") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBlePairingBegin);
} else if (name == "ble_enter_pairing_mode") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBleEnterPairingMode);
} else if (name == "ble_device_selection") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBleDeviceSelection);
} else if (name == "ble_pin_entry") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBlePinEntry);
} else if (name == "ble_verifying") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBleVerifying);
} else if (name == "ble_activate") {
model->SetCurrentStep(
AuthenticatorRequestDialogModel::Step::kBleActivate);
} }
ShowAuthenticatorRequestDialog( ShowAuthenticatorRequestDialog(
...@@ -79,3 +100,32 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_insert_usb_sign) { ...@@ -79,3 +100,32 @@ IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_insert_usb_sign) {
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_timeout) { IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_timeout) {
ShowAndVerifyUi(); ShowAndVerifyUi();
} }
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_power_on_manual) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_pairing_begin) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest,
InvokeUi_ble_enter_pairing_mode) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_device_selection) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_pin_entry) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_verifying) {
ShowAndVerifyUi();
}
IN_PROC_BROWSER_TEST_F(AuthenticatorDialogTest, InvokeUi_ble_activate) {
ShowAndVerifyUi();
}
...@@ -136,3 +136,127 @@ base::string16 AuthenticatorTimeoutErrorModel::GetStepTitle() const { ...@@ -136,3 +136,127 @@ base::string16 AuthenticatorTimeoutErrorModel::GetStepTitle() const {
base::string16 AuthenticatorTimeoutErrorModel::GetStepDescription() const { base::string16 AuthenticatorTimeoutErrorModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_TIMEOUT_DESCRIPTION); return l10n_util::GetStringUTF16(IDS_WEBAUTHN_TIMEOUT_DESCRIPTION);
} }
// AuthenticatorBlePowerOnManualSheetModel ------------------------------------
base::string16 AuthenticatorBlePowerOnManualSheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_POWER_ON_MANUAL_TITLE);
}
base::string16 AuthenticatorBlePowerOnManualSheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(
IDS_WEBAUTHN_BLE_POWER_ON_MANUAL_DESCRIPTION);
}
bool AuthenticatorBlePowerOnManualSheetModel::IsAcceptButtonVisible() const {
return true;
}
bool AuthenticatorBlePowerOnManualSheetModel::IsAcceptButtonEnabled() const {
return true;
}
base::string16 AuthenticatorBlePowerOnManualSheetModel::GetAcceptButtonLabel()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_POWER_ON_MANUAL_TRY_AGAIN);
}
// AuthenticatorBlePairingBeginSheetModel -------------------------------------
base::string16 AuthenticatorBlePairingBeginSheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_PAIRING_BEGIN_TITLE);
}
base::string16 AuthenticatorBlePairingBeginSheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_PAIRING_BEGIN_DESCRIPTION);
}
bool AuthenticatorBlePairingBeginSheetModel::IsAcceptButtonVisible() const {
return true;
}
bool AuthenticatorBlePairingBeginSheetModel::IsAcceptButtonEnabled() const {
return true;
}
base::string16 AuthenticatorBlePairingBeginSheetModel::GetAcceptButtonLabel()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_PAIRING_BEGIN_START);
}
// AuthenticatorBleEnterPairingModeSheetModel ---------------------------------
base::string16 AuthenticatorBleEnterPairingModeSheetModel::GetStepTitle()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_ENTER_PAIRING_MODE_TITLE);
}
base::string16 AuthenticatorBleEnterPairingModeSheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(
IDS_WEBAUTHN_BLE_ENTER_PAIRING_MODE_DESCRIPTION);
}
// AuthenticatorBleDeviceSelectionSheetModel ----------------------------------
base::string16 AuthenticatorBleDeviceSelectionSheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_DEVICE_SELECTION_TITLE);
}
base::string16 AuthenticatorBleDeviceSelectionSheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(
IDS_WEBAUTHN_BLE_DEVICE_SELECTION_DESCRIPTION);
}
// AuthenticatorBlePinEntrySheetModel -----------------------------------------
base::string16 AuthenticatorBlePinEntrySheetModel::GetStepTitle() const {
// TODO(hongjunchoi): Insert actual device name from model to |device_name|.
base::string16 device_name = base::UTF8ToUTF16("VHGSHSSN");
return l10n_util::GetStringFUTF16(IDS_WEBAUTHN_BLE_PIN_ENTRY_TITLE,
device_name);
}
base::string16 AuthenticatorBlePinEntrySheetModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_PIN_ENTRY_DESCRIPTION);
}
bool AuthenticatorBlePinEntrySheetModel::IsAcceptButtonVisible() const {
return true;
}
bool AuthenticatorBlePinEntrySheetModel::IsAcceptButtonEnabled() const {
return true;
}
base::string16 AuthenticatorBlePinEntrySheetModel::GetAcceptButtonLabel()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_PIN_ENTRY_NEXT);
}
// AuthenticatorBleVerifyingSheetModel ----------------------------------------
base::string16 AuthenticatorBleVerifyingSheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_VERIFYING_TITLE);
}
base::string16 AuthenticatorBleVerifyingSheetModel::GetStepDescription() const {
return base::string16();
}
// AuthenticatorBleActivateSheetModel -----------------------------------------
base::string16 AuthenticatorBleActivateSheetModel::GetStepTitle() const {
// TODO(hongjunchoi): Insert actual domain name from model to
// |application_name|.
base::string16 application_name = base::UTF8ToUTF16("example.com");
return l10n_util::GetStringFUTF16(IDS_WEBAUTHN_BLE_ACTIVATE_TITLE,
application_name);
}
base::string16 AuthenticatorBleActivateSheetModel::GetStepDescription() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_BLE_ACTIVATE_DESCRIPTION);
}
...@@ -105,4 +105,87 @@ class AuthenticatorTimeoutErrorModel : public AuthenticatorSheetModelBase { ...@@ -105,4 +105,87 @@ class AuthenticatorTimeoutErrorModel : public AuthenticatorSheetModelBase {
base::string16 GetStepDescription() const override; base::string16 GetStepDescription() const override;
}; };
class AuthenticatorBlePowerOnManualSheetModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
bool IsAcceptButtonVisible() const override;
bool IsAcceptButtonEnabled() const override;
base::string16 GetAcceptButtonLabel() const override;
};
class AuthenticatorBlePairingBeginSheetModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
bool IsAcceptButtonVisible() const override;
bool IsAcceptButtonEnabled() const override;
base::string16 GetAcceptButtonLabel() const override;
};
class AuthenticatorBleEnterPairingModeSheetModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
};
class AuthenticatorBleDeviceSelectionSheetModel
: public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
};
class AuthenticatorBlePinEntrySheetModel : public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
bool IsAcceptButtonVisible() const override;
bool IsAcceptButtonEnabled() const override;
base::string16 GetAcceptButtonLabel() const override;
};
class AuthenticatorBleVerifyingSheetModel : public AuthenticatorSheetModelBase {
public:
using AuthenticatorSheetModelBase::AuthenticatorSheetModelBase;
private:
// AuthenticatorSheetModelBase:
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
};
class AuthenticatorBleActivateSheetModel : 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_ #endif // CHROME_BROWSER_UI_WEBAUTHN_SHEET_MODELS_H_
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