Commit 7cca2cdf authored by Adam Langley's avatar Adam Langley Committed by Chromium LUCI CQ

webauthn: update caBLEv2 serverlink UI

This change changes the wording for the caBLE UI when doing caBLEv2
serverlink. The dialog now contains a link (“Didn't get it?”) which
triggers a new dialog state that instructs the user to connect the phone
via USB cable.

BUG=1002262

Change-Id: I292fe39455cbef296ec6088a7d4ff8a309ff066b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2630740
Commit-Queue: Adam Langley <agl@chromium.org>
Auto-Submit: Adam Langley <agl@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarMartin Kreichgauer <martinkr@google.com>
Cr-Commit-Position: refs/heads/master@{#845020}
parent 1ccb1b4b
......@@ -10738,6 +10738,20 @@ Please help our engineers fix this problem. Tell us what happened right before y
<message name="IDS_WEBAUTHN_CABLE_ACTIVATE_DESCRIPTION" desc="Contents of the dialog shown when the user tries to sign-in using a phone as a security key.">
A notification was sent to your phone to confirm it's you.
</message>
<message name="IDS_WEBAUTHN_CABLEV2_SERVERLINK_DESCRIPTION" desc="Contents of the dialog shown when the user tries to sign-in using a phone as a security key. The second placeholder will be replaced by the contents of the translated string IDS_WEBAUTHN_CABLEV2_SERVERLINK_TROUBLE. A placeholder is used for this because that link will be styled as a clickable link. The word 'Yes' will appear on the phone and is TC ID 6139894934866548097.">
<ph name="WEBSITE"><ex>accounts.google.com</ex>$1</ph> sent a notification to your phone. Tap Yes to confirm it's you. <ph name="LINK"><ex>Didn't get it?</ex>$2</ph>
</message>
<message name="IDS_WEBAUTHN_CABLEV2_SERVERLINK_TROUBLE" desc="This message is shown as a link inside of IDS_WEBAUTHN_CABLEV2_SERVERLINK_DESCRIPTION and replaces placeholder two. The 'it' referenced here is the notification mentioned in that message.">
Didn't get it?
</message>
<message name="IDS_WEBAUTHN_CABLEV2_AOA_TITLE" desc="Contents of the dialog shown when the user tries to sign-in using a phone as a security key. The 'cable' is a physical USB cable.">
Connect your phone with a cable
</message>
<message name="IDS_WEBAUTHN_CABLEV2_AOA_DESCRIPTION" desc="Contents of the dialog shown when the user tries to sign-in using a phone as a security key.">
Use a USB cable to connect your phone to your computer. If your phone is already connected, unplug it and plug it back in.
</message>
<message name="IDS_WEBAUTHN_CABLE_ACTIVATE_DESCRIPTION_SHORT" desc="Second line of text in an item letting the user know that they can use their phone as a security key. The user needs to check their phone and respond to a notification that will ask them to press a button on the phone's screen to confirm that they're logging in.">
Unlock your phone and confirm it's you
</message>
......
d4af7d07327e2c240ab3f2c74f145d3719a96ece
\ No newline at end of file
d4af7d07327e2c240ab3f2c74f145d3719a96ece
\ No newline at end of file
9bee4dce3b1c187db275c916687d8a86759fb3f2
\ No newline at end of file
9bee4dce3b1c187db275c916687d8a86759fb3f2
\ No newline at end of file
......@@ -132,6 +132,7 @@ aggregate_vector_icons("chrome_vector_icons") {
"user_menu_right_arrow.icon",
"warning_badge.icon",
"web.icon",
"webauthn/webauthn_aoa.icon",
"webauthn/webauthn_error.icon",
"webauthn/webauthn_error_bluetooth.icon",
"webauthn/webauthn_error_bluetooth_dark.icon",
......
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 448,
NEW_PATH,
PATH_COLOR_ARGB, 0x0A, 0x00, 0x00, 0x00,
MOVE_TO, 0, 0,
R_H_LINE_TO, 448,
R_V_LINE_TO, 119,
H_LINE_TO, 0,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0xe8, 0xe9, 0xeb,
STROKE, 1,
MOVE_TO, 372.49f, 33.44f,
H_LINE_TO, 329,
R_CUBIC_TO, 0.36f, -5.48f, 4.94f, -9.83f, 10.51f, -9.83f,
R_CUBIC_TO, 1.18f, 0, 2.36f, 0.21f, 3.51f, 0.61f,
R_LINE_TO, 0.47f, 0.17f,
R_LINE_TO, 0.31f, -0.39f,
CUBIC_TO, 346.88f, 20.19f, 351.46f, 18, 356.36f, 18,
R_CUBIC_TO, 8.67f, 0, 15.76f, 6.87f, 16.13f, 15.44f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0xe8, 0xe9, 0xeb,
STROKE, 1,
MOVE_TO, 60.49f, 72.44f,
H_LINE_TO, 17,
R_CUBIC_TO, 0.36f, -5.48f, 4.94f, -9.83f, 10.51f, -9.83f,
R_CUBIC_TO, 1.18f, 0, 2.36f, 0.21f, 3.51f, 0.61f,
R_LINE_TO, 0.47f, 0.17f,
R_LINE_TO, 0.31f, -0.39f,
CUBIC_TO, 34.88f, 59.19f, 39.46f, 57, 44.36f, 57,
R_CUBIC_TO, 8.67f, 0, 15.76f, 6.87f, 16.13f, 15.44f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0xbd, 0xc1, 0xc6,
R_MOVE_TO, 213.99f, 127.93f,
R_H_LINE_TO, -83.95f,
R_ARC_TO, 3.85f, 3.85f, 0, 0, 1, -3.85f, -3.85f,
R_V_LINE_TO, -4.01f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 1.49f, 0,
R_V_LINE_TO, 4.01f,
R_ARC_TO, 2.36f, 2.36f, 0, 0, 0, 2.36f, 2.36f,
R_H_LINE_TO, 83.95f,
R_ARC_TO, 2.36f, 2.36f, 0, 0, 0, 2.36f, -2.36f,
V_LINE_TO, 71.55f,
R_ARC_TO, 2.36f, 2.36f, 0, 0, 0, -2.36f, -2.36f,
R_H_LINE_TO, -22.23f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 0, -1.49f,
R_H_LINE_TO, 22.23f,
R_ARC_TO, 3.85f, 3.85f, 0, 0, 1, 3.85f, 3.85f,
R_V_LINE_TO, 52.54f,
R_ARC_TO, 3.85f, 3.85f, 0, 0, 1, -3.85f, 3.85f,
CLOSE,
R_MOVE_TO, -87.06f, -18.26f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, -0.74f, -0.74f,
V_LINE_TO, 71.55f,
R_ARC_TO, 3.85f, 3.85f, 0, 0, 1, 3.85f, -3.85f,
R_H_LINE_TO, 50.59f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 0, 1.49f,
R_H_LINE_TO, -50.59f,
R_ARC_TO, 2.36f, 2.36f, 0, 0, 0, -2.36f, 2.36f,
R_V_LINE_TO, 37.38f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, -0.74f, 0.74f,
CLOSE,
ROUND_RECT, 132.16f, 73.51f, 79.69f, 48.60f, 0,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0xbd, 0xc1, 0xc6,
R_MOVE_TO, 120.21f, 131.12f,
R_V_LINE_TO, 1.46f,
R_ARC_TO, 3.1f, 3.1f, 0, 0, 0, 3.1f, 3.1f,
R_H_LINE_TO, 97.4f,
R_ARC_TO, 3.1f, 3.1f, 0, 0, 0, 3.1f, -3.1f,
R_V_LINE_TO, -1.46f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0x39, 0x82, 0xf8,
R_MOVE_TO, 255.28f, 134.51f,
R_H_LINE_TO, -28.04f,
R_ARC_TO, 0.93f, 0.93f, 0, 1, 1, 0, -1.86f,
R_H_LINE_TO, 28.04f,
R_CUBIC_TO, 11.14f, 0, 19.7f, -1.61f, 26.95f, -5.07f,
R_ARC_TO, 0.93f, 0.93f, 0, 0, 1, 0.8f, 1.68f,
R_CUBIC_TO, -7.51f, 3.58f, -16.33f, 5.25f, -27.75f, 5.25f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0x39, 0x82, 0xf8,
R_MOVE_TO, 320.91f, 125.47f,
R_CUBIC_TO, -2.34f, -5.05f, -7.06f, -8.55f, -12.32f, -9.13f,
R_CUBIC_TO, -7.87f, -0.87f, -12.24f, 2.18f, -17.3f, 5.71f,
R_CUBIC_TO, -0.96f, 0.67f, -1.96f, 1.37f, -3.02f, 2.07f,
R_ARC_TO, 0.93f, 0.93f, 0, 1, 0, 1.02f, 1.55f,
R_CUBIC_TO, 1.08f, -0.71f, 2.09f, -1.41f, 3.06f, -2.09f,
R_CUBIC_TO, 4.95f, -3.46f, 8.85f, -6.19f, 16.03f, -5.39f,
R_CUBIC_TO, 4.62f, 0.51f, 8.77f, 3.6f, 10.84f, 8.07f,
R_CUBIC_TO, 1.87f, 4.05f, 1.64f, 8.47f, -0.62f, 11.84f,
R_CUBIC_TO, -3.67f, 5.46f, -9.22f, 7.54f, -15.22f, 5.71f,
R_CUBIC_TO, -10.29f, -3.14f, -20.71f, -17.38f, -20.71f, -38.51f,
V_LINE_TO, 92.83f,
R_H_LINE_TO, 1.72f,
V_LINE_TO, 85.14f,
H_LINE_TO, 279.11f,
R_V_LINE_TO, 7.69f,
R_H_LINE_TO, 1.72f,
R_V_LINE_TO, 12.45f,
R_CUBIC_TO, 0, 10.2f, 2.35f, 19.55f, 6.8f, 27.05f,
R_CUBIC_TO, 4.02f, 6.77f, 9.43f, 11.47f, 15.22f, 13.24f,
R_ARC_TO, 16.38f, 16.38f, 0, 0, 0, 4.79f, 0.74f,
R_CUBIC_TO, 4.94f, 0, 9.35f, -2.49f, 12.51f, -7.19f,
R_CUBIC_TO, 2.63f, -3.91f, 2.92f, -9.01f, 0.77f, -13.65f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0xbd, 0xc1, 0xc6,
R_MOVE_TO, 295.2f, 85.14f,
R_H_LINE_TO, -26.88f,
R_ARC_TO, 4.42f, 4.42f, 0, 0, 1, -4.42f, -4.42f,
R_V_LINE_TO, -61.04f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, 1.49f, 0,
R_V_LINE_TO, 61.04f,
R_ARC_TO, 2.94f, 2.94f, 0, 0, 0, 2.93f, 2.93f,
R_H_LINE_TO, 26.86f,
R_ARC_TO, 0.75f, 0.75f, 0, 0, 1, 0.75f, 0.74f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, -0.74f, 0.74f,
CLOSE,
R_MOVE_TO, 3.66f, -9.16f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, -0.74f, -0.74f,
V_LINE_TO, 14.22f,
R_ARC_TO, 2.94f, 2.94f, 0, 0, 0, -2.93f, -2.93f,
R_H_LINE_TO, -26.86f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, -0.01f, -1.49f,
R_H_LINE_TO, 26.87f,
R_ARC_TO, 4.42f, 4.42f, 0, 0, 1, 4.42f, 4.42f,
R_V_LINE_TO, 61.03f,
R_ARC_TO, 0.74f, 0.74f, 0, 0, 1, -0.74f, 0.74f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xff, 0xff, 0xff, 0xff,
ROUND_RECT, 132.16f, 73.51f, 79.69f, 48.60f, 0,
ROUND_RECT, 268.43f, 14.95f, 26.95f, 65.44f, 0
......@@ -4182,6 +4182,8 @@ static_library("ui") {
"views/webauthn/authenticator_client_pin_entry_sheet_view.h",
"views/webauthn/authenticator_client_pin_entry_view.cc",
"views/webauthn/authenticator_client_pin_entry_view.h",
"views/webauthn/authenticator_paask_sheet_view.cc",
"views/webauthn/authenticator_paask_sheet_view.h",
"views/webauthn/authenticator_qr_sheet_view.cc",
"views/webauthn/authenticator_qr_sheet_view.h",
"views/webauthn/authenticator_request_dialog_view.cc",
......
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <memory>
#include <utility>
#include "chrome/browser/ui/views/webauthn/authenticator_paask_sheet_view.h"
#include "chrome/browser/ui/webauthn/sheet_models.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/views/controls/styled_label.h"
AuthenticatorPaaskSheetView::AuthenticatorPaaskSheetView(
std::unique_ptr<AuthenticatorPaaskSheetModel> sheet_model)
: AuthenticatorRequestSheetView(std::move(sheet_model)) {}
AuthenticatorPaaskSheetView::~AuthenticatorPaaskSheetView() = default;
std::unique_ptr<views::View>
AuthenticatorPaaskSheetView::BuildStepSpecificContent() {
AuthenticatorRequestDialogModel* const dialog_model =
reinterpret_cast<AuthenticatorPaaskSheetModel*>(model())->dialog_model();
// This context is only shown in serverlink mode.
if (!dialog_model->cable_is_serverlink()) {
return nullptr;
}
// link_message contains the translation of the text of the link.
const base::string16 link_message =
l10n_util::GetStringUTF16(IDS_WEBAUTHN_CABLEV2_SERVERLINK_TROUBLE);
// offsets will contain the index of the start of the substituted strings. The
// second of these will be the position of the link text, which is used to
// decorate it.
std::vector<size_t> offsets;
const base::string16 description = l10n_util::GetStringFUTF16(
IDS_WEBAUTHN_CABLEV2_SERVERLINK_DESCRIPTION,
{AuthenticatorPaaskSheetModel::GetRelyingPartyIdString(dialog_model),
link_message},
&offsets);
DCHECK_EQ(offsets.size(), 2u);
auto label = std::make_unique<views::StyledLabel>();
label->SetText(description);
label->SetTextContext(views::style::CONTEXT_DIALOG_BODY_TEXT);
label->SetDefaultTextStyle(views::style::STYLE_PRIMARY);
auto link_style =
views::StyledLabel::RangeStyleInfo::CreateForLink(base::BindRepeating(
&AuthenticatorPaaskSheetView::OnLinkClicked, base::Unretained(this)));
label->AddStyleRange(gfx::Range(offsets[1], offsets[1] + link_message.size()),
link_style);
return label;
}
void AuthenticatorPaaskSheetView::OnLinkClicked() {
reinterpret_cast<AuthenticatorPaaskSheetModel*>(model())
->dialog_model()
->ShowCableUsbFallback();
}
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_WEBAUTHN_AUTHENTICATOR_PAASK_SHEET_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_WEBAUTHN_AUTHENTICATOR_PAASK_SHEET_VIEW_H_
#include <memory>
#include "base/macros.h"
#include "chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h"
#include "chrome/browser/ui/webauthn/sheet_models.h"
// AuthenticatorPaaskSheetView adds the description text to the dialog. This is
// done as step-specific content because the text includes a clickable link and
// thus needs special handling.
class AuthenticatorPaaskSheetView : public AuthenticatorRequestSheetView {
public:
explicit AuthenticatorPaaskSheetView(
std::unique_ptr<AuthenticatorPaaskSheetModel> model);
~AuthenticatorPaaskSheetView() override;
AuthenticatorPaaskSheetView(const AuthenticatorPaaskSheetView&) = delete;
AuthenticatorPaaskSheetView& operator=(const AuthenticatorPaaskSheetView&) =
delete;
private:
// AuthenticatorRequestSheetView:
std::unique_ptr<views::View> BuildStepSpecificContent() override;
void OnLinkClicked();
};
#endif // CHROME_BROWSER_UI_VIEWS_WEBAUTHN_AUTHENTICATOR_PAASK_SHEET_VIEW_H_
......@@ -10,6 +10,7 @@
#include "chrome/browser/ui/autofill/payments/webauthn_dialog_model.h"
#include "chrome/browser/ui/views/webauthn/authenticator_bio_enrollment_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_paask_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_select_account_sheet_view.h"
......@@ -103,9 +104,14 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
dialog_model));
break;
case Step::kCableActivate:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
sheet_view = std::make_unique<AuthenticatorPaaskSheetView>(
std::make_unique<AuthenticatorPaaskSheetModel>(dialog_model));
break;
case Step::kAndroidAccessory:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorAndroidAccessorySheetModel>(
dialog_model));
break;
case Step::kCableV2Activate:
sheet_view = std::make_unique<AuthenticatorRequestSheetView>(
std::make_unique<AuthenticatorPaaskV2SheetModel>(dialog_model));
......
......@@ -29,18 +29,6 @@
namespace {
base::string16 GetRelyingPartyIdString(
AuthenticatorRequestDialogModel* dialog_model) {
static constexpr char kRpIdUrlPrefix[] = "https://";
// The preferred width of medium snap point modal dialog view is 448 dp, but
// we leave some room for padding between the text and the modal views.
static constexpr int kDialogWidth = 300;
const auto& rp_id = dialog_model->relying_party_id();
DCHECK(!rp_id.empty());
GURL rp_id_url(kRpIdUrlPrefix + rp_id);
return url_formatter::ElideHost(rp_id_url, gfx::FontList(), kDialogWidth);
}
// Possibly returns a resident key warning if the model indicates that it's
// needed.
base::string16 PossibleResidentKeyWarning(
......@@ -69,6 +57,19 @@ AuthenticatorSheetModelBase::~AuthenticatorSheetModelBase() {
}
}
// static
base::string16 AuthenticatorSheetModelBase::GetRelyingPartyIdString(
const AuthenticatorRequestDialogModel* dialog_model) {
static constexpr char kRpIdUrlPrefix[] = "https://";
// The preferred width of medium snap point modal dialog view is 448 dp, but
// we leave some room for padding between the text and the modal views.
static constexpr int kDialogWidth = 300;
const auto& rp_id = dialog_model->relying_party_id();
DCHECK(!rp_id.empty());
GURL rp_id_url(kRpIdUrlPrefix + rp_id);
return url_formatter::ElideHost(rp_id_url, gfx::FontList(), kDialogWidth);
}
bool AuthenticatorSheetModelBase::IsActivityIndicatorVisible() const {
return false;
}
......@@ -574,6 +575,11 @@ base::string16 AuthenticatorPaaskSheetModel::GetStepTitle() const {
}
base::string16 AuthenticatorPaaskSheetModel::GetStepDescription() const {
if (dialog_model()->cable_is_serverlink()) {
// The description will be shown by AuthenticatorPaaskSheetView because it
// needs to include a clickable link.
return base::string16();
}
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_CABLE_ACTIVATE_DESCRIPTION);
}
......@@ -581,6 +587,53 @@ ui::MenuModel* AuthenticatorPaaskSheetModel::GetOtherTransportsMenuModel() {
return other_transports_menu_model_.get();
}
// AuthenticatorAndroidAccessorySheetModel
// -----------------------------------------
AuthenticatorAndroidAccessorySheetModel::
AuthenticatorAndroidAccessorySheetModel(
AuthenticatorRequestDialogModel* dialog_model)
: AuthenticatorSheetModelBase(dialog_model),
other_transports_menu_model_(std::make_unique<OtherTransportsMenuModel>(
dialog_model,
AuthenticatorTransport::kCloudAssistedBluetoothLowEnergy)) {}
AuthenticatorAndroidAccessorySheetModel::
~AuthenticatorAndroidAccessorySheetModel() = default;
bool AuthenticatorAndroidAccessorySheetModel::IsBackButtonVisible() const {
return true;
}
bool AuthenticatorAndroidAccessorySheetModel::IsActivityIndicatorVisible()
const {
return true;
}
const gfx::VectorIcon&
AuthenticatorAndroidAccessorySheetModel::GetStepIllustration(
ImageColorScheme color_scheme) const {
return kWebauthnAoaIcon;
}
base::string16 AuthenticatorAndroidAccessorySheetModel::GetStepTitle() const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_CABLEV2_AOA_TITLE);
}
base::string16 AuthenticatorAndroidAccessorySheetModel::GetStepDescription()
const {
return l10n_util::GetStringUTF16(IDS_WEBAUTHN_CABLEV2_AOA_DESCRIPTION);
}
ui::MenuModel*
AuthenticatorAndroidAccessorySheetModel::GetOtherTransportsMenuModel() {
return other_transports_menu_model_.get();
}
void AuthenticatorAndroidAccessorySheetModel::OnBack() {
dialog_model()->ShowCable();
}
// AuthenticatorPaaskV2SheetModel -----------------------------------------
AuthenticatorPaaskV2SheetModel::AuthenticatorPaaskV2SheetModel(
......
......@@ -38,6 +38,11 @@ class AuthenticatorSheetModelBase
return dialog_model_;
}
// Returns a string containing the RP ID, styled as an origin, truncated to a
// reasonable width.
static base::string16 GetRelyingPartyIdString(
const AuthenticatorRequestDialogModel* dialog_model);
protected:
// AuthenticatorRequestSheetModel:
bool IsActivityIndicatorVisible() const override;
......@@ -267,6 +272,27 @@ class AuthenticatorPaaskSheetModel : public AuthenticatorSheetModelBase {
std::unique_ptr<OtherTransportsMenuModel> other_transports_menu_model_;
};
class AuthenticatorAndroidAccessorySheetModel
: public AuthenticatorSheetModelBase {
public:
explicit AuthenticatorAndroidAccessorySheetModel(
AuthenticatorRequestDialogModel* dialog_model);
~AuthenticatorAndroidAccessorySheetModel() override;
private:
// AuthenticatorSheetModelBase:
bool IsBackButtonVisible() const override;
bool IsActivityIndicatorVisible() const override;
const gfx::VectorIcon& GetStepIllustration(
ImageColorScheme color_scheme) const override;
base::string16 GetStepTitle() const override;
base::string16 GetStepDescription() const override;
ui::MenuModel* GetOtherTransportsMenuModel() override;
void OnBack() override;
std::unique_ptr<OtherTransportsMenuModel> other_transports_menu_model_;
};
class AuthenticatorPaaskV2SheetModel : public AuthenticatorSheetModelBase {
public:
explicit AuthenticatorPaaskV2SheetModel(
......
......@@ -325,6 +325,16 @@ void AuthenticatorRequestDialogModel::
DispatchRequestAsync(&*platform_authenticator_it);
}
void AuthenticatorRequestDialogModel::ShowCableUsbFallback() {
DCHECK_EQ(current_step(), Step::kCableActivate);
SetCurrentStep(Step::kAndroidAccessory);
}
void AuthenticatorRequestDialogModel::ShowCable() {
DCHECK_EQ(current_step(), Step::kAndroidAccessory);
SetCurrentStep(Step::kCableActivate);
}
void AuthenticatorRequestDialogModel::Cancel() {
if (is_request_complete()) {
SetCurrentStep(Step::kClosed);
......@@ -540,6 +550,15 @@ void AuthenticatorRequestDialogModel::SetSelectedAuthenticatorForTesting(
std::move(test_authenticator));
}
bool AuthenticatorRequestDialogModel::cable_is_serverlink() const {
// A caBLEv2 serverlink is detected by the presence of the AOA transport. The
// result of this function is used to decide whether to use a UI prompt for
// plugging the phone in with a USB cable and the AOA transport needs to exist
// for that to function.
return base::Contains(transport_availability_.available_transports,
AuthenticatorTransport::kAndroidAccessory);
}
void AuthenticatorRequestDialogModel::CollectPIN(
device::pin::PINEntryReason reason,
device::pin::PINEntryError error,
......
......@@ -78,6 +78,7 @@ class AuthenticatorRequestDialogModel {
// Phone as a security key.
kCableActivate,
kAndroidAccessory,
kCableV2Activate,
kCableV2QRCode,
......@@ -251,6 +252,12 @@ class AuthenticatorRequestDialogModel {
// Valid action when at all steps.
void HideDialogAndDispatchToPlatformAuthenticator();
// Show guidance about caBLE USB fallback.
void ShowCableUsbFallback();
// Show caBLE activation sheet.
void ShowCable();
// Cancels the flow as a result of the user clicking `Cancel` on the UI.
//
// Valid action at all steps.
......@@ -368,6 +375,10 @@ class AuthenticatorRequestDialogModel {
const std::string& cable_qr_string() const { return *cable_qr_string_; }
// cable_is_serverlink returns true if the caBLE "v1" UI was triggered by a
// caBLEv2 server-linked request.
bool cable_is_serverlink() const;
void CollectPIN(device::pin::PINEntryReason reason,
device::pin::PINEntryError error,
uint32_t min_pin_length,
......
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