Commit 0ad78f76 authored by siyua's avatar siyua Committed by Commit Bot

[Autofill Auth UI] Rename webauthn dialog flow

Reason for this CL: We did implementation review with Chrome UX and
one feedback was the verify pending dialog was too short for a modal
dialog. Therefore UX decision is for this dialog, we also reuse the
template of the webauthn dialog (adding an illustration on top). So
it makes sense to merge the separate MVCs of webauthn_offer_dialog
and verify_pending_dialog into one, and show different content for
different states (in other words, adding kVerifyPending as a new state
in WebauthnDialogModel).

This is a renaming CL which is the precursor of the major merging CL.

Includes two changes:
1. Rename all WebauthnOffer- to Webauthn- to avoid confusion;
2. In AutofillClient, move all webauthn related functions under build
flags to ensure these functions are all on desktop.

No other change on flow logic.

TBR=michaelbai@chromium.org,mahmadi@chromium.org,martinkr@google.com

Change-Id: I80ae00d219cdaf868056a04938c6968ed186ad3d
Bug: 949269
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1925761
Commit-Queue: Siyu An <siyua@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarJared Saul <jsaul@google.com>
Cr-Commit-Position: refs/heads/master@{#718394}
parent 82f8c066
...@@ -141,11 +141,6 @@ void AwAutofillClient::ShowLocalCardMigrationResults( ...@@ -141,11 +141,6 @@ void AwAutofillClient::ShowLocalCardMigrationResults(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void AwAutofillClient::ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback callback) {
NOTIMPLEMENTED();
}
void AwAutofillClient::ConfirmSaveAutofillProfile( void AwAutofillClient::ConfirmSaveAutofillProfile(
const autofill::AutofillProfile& profile, const autofill::AutofillProfile& profile,
base::OnceClosure callback) { base::OnceClosure callback) {
......
...@@ -94,7 +94,6 @@ class AwAutofillClient : public autofill::AutofillClient, ...@@ -94,7 +94,6 @@ class AwAutofillClient : public autofill::AutofillClient,
const std::vector<autofill::MigratableCreditCard>& const std::vector<autofill::MigratableCreditCard>&
migratable_credit_cards, migratable_credit_cards,
MigrationDeleteCardCallback delete_local_card_callback) override; MigrationDeleteCardCallback delete_local_card_callback) override;
void ShowWebauthnOfferDialog(WebauthnOfferDialogCallback callback) override;
void ConfirmSaveAutofillProfile(const autofill::AutofillProfile& profile, void ConfirmSaveAutofillProfile(const autofill::AutofillProfile& profile,
base::OnceClosure callback) override; base::OnceClosure callback) override;
void ConfirmSaveCreditCardLocally( void ConfirmSaveCreditCardLocally(
......
...@@ -16,8 +16,8 @@ aggregate_vector_icons("chrome_vector_icons") { ...@@ -16,8 +16,8 @@ aggregate_vector_icons("chrome_vector_icons") {
"add.icon", "add.icon",
"ads.icon", "ads.icon",
"apps.icon", "apps.icon",
"autofill/webauthn_offer_dialog_header.icon", "autofill/webauthn_dialog_header.icon",
"autofill/webauthn_offer_dialog_header_dark.icon", "autofill/webauthn_dialog_header_dark.icon",
"blocked_badge.icon", "blocked_badge.icon",
"blocked_redirect.icon", "blocked_redirect.icon",
"bluetooth.icon", "bluetooth.icon",
......
...@@ -2031,21 +2031,21 @@ jumbo_static_library("ui") { ...@@ -2031,21 +2031,21 @@ jumbo_static_library("ui") {
"autofill/payments/verify_pending_dialog_controller_impl.cc", "autofill/payments/verify_pending_dialog_controller_impl.cc",
"autofill/payments/verify_pending_dialog_controller_impl.h", "autofill/payments/verify_pending_dialog_controller_impl.h",
"autofill/payments/verify_pending_dialog_view.h", "autofill/payments/verify_pending_dialog_view.h",
"autofill/payments/webauthn_offer_dialog_controller.h", "autofill/payments/webauthn_dialog_controller.h",
"autofill/payments/webauthn_offer_dialog_controller_impl.cc", "autofill/payments/webauthn_dialog_controller_impl.cc",
"autofill/payments/webauthn_offer_dialog_controller_impl.h", "autofill/payments/webauthn_dialog_controller_impl.h",
"autofill/payments/webauthn_offer_dialog_model.cc", "autofill/payments/webauthn_dialog_model.cc",
"autofill/payments/webauthn_offer_dialog_model.h", "autofill/payments/webauthn_dialog_model.h",
"autofill/payments/webauthn_offer_dialog_model_observer.h", "autofill/payments/webauthn_dialog_model_observer.h",
"autofill/payments/webauthn_offer_dialog_view.h", "autofill/payments/webauthn_dialog_view.h",
"frame/window_frame_util.cc", "frame/window_frame_util.cc",
"frame/window_frame_util.h", "frame/window_frame_util.h",
"tab_contents/chrome_web_contents_view_handle_drop.cc", "tab_contents/chrome_web_contents_view_handle_drop.cc",
"tab_contents/chrome_web_contents_view_handle_drop.h", "tab_contents/chrome_web_contents_view_handle_drop.h",
"views/autofill/payments/verify_pending_dialog_view_impl.cc", "views/autofill/payments/verify_pending_dialog_view_impl.cc",
"views/autofill/payments/verify_pending_dialog_view_impl.h", "views/autofill/payments/verify_pending_dialog_view_impl.h",
"views/autofill/payments/webauthn_offer_dialog_view_impl.cc", "views/autofill/payments/webauthn_dialog_view_impl.cc",
"views/autofill/payments/webauthn_offer_dialog_view_impl.h", "views/autofill/payments/webauthn_dialog_view_impl.h",
"views/close_bubble_on_tab_activation_helper.cc", "views/close_bubble_on_tab_activation_helper.cc",
"views/close_bubble_on_tab_activation_helper.h", "views/close_bubble_on_tab_activation_helper.h",
"views/hats/hats_bubble_view.cc", "views/hats/hats_bubble_view.cc",
......
...@@ -84,8 +84,8 @@ ...@@ -84,8 +84,8 @@
#include "chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.h" #include "chrome/browser/ui/autofill/payments/save_card_bubble_controller_impl.h"
#include "chrome/browser/ui/autofill/payments/verify_pending_dialog_controller_impl.h" #include "chrome/browser/ui/autofill/payments/verify_pending_dialog_controller_impl.h"
#include "chrome/browser/ui/autofill/payments/verify_pending_dialog_view.h" #include "chrome/browser/ui/autofill/payments/verify_pending_dialog_view.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_controller_impl.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_controller_impl.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_view.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_view.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_finder.h"
...@@ -273,7 +273,30 @@ void ChromeAutofillClient::ShowLocalCardMigrationResults( ...@@ -273,7 +273,30 @@ void ChromeAutofillClient::ShowLocalCardMigrationResults(
} }
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
void ChromeAutofillClient::ShowVerifyPendingDialog( void ChromeAutofillClient::ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback offer_dialog_callback) {
autofill::WebauthnDialogControllerImpl::CreateForWebContents(web_contents());
autofill::WebauthnDialogControllerImpl::FromWebContents(web_contents())
->ShowOfferDialog(std::move(offer_dialog_callback));
}
void ChromeAutofillClient::UpdateWebauthnOfferDialogWithError() {
WebauthnDialogControllerImpl* controller =
autofill::WebauthnDialogControllerImpl::FromWebContents(web_contents());
if (controller)
controller->UpdateDialogWithError();
}
bool ChromeAutofillClient::CloseWebauthnOfferDialog() {
WebauthnDialogControllerImpl* controller =
autofill::WebauthnDialogControllerImpl::FromWebContents(web_contents());
if (controller)
return controller->CloseDialog();
return false;
}
void ChromeAutofillClient::ShowWebauthnVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) { base::OnceClosure cancel_card_verification_callback) {
autofill::VerifyPendingDialogControllerImpl::CreateForWebContents( autofill::VerifyPendingDialogControllerImpl::CreateForWebContents(
web_contents()); web_contents());
...@@ -281,7 +304,7 @@ void ChromeAutofillClient::ShowVerifyPendingDialog( ...@@ -281,7 +304,7 @@ void ChromeAutofillClient::ShowVerifyPendingDialog(
->ShowDialog(std::move(cancel_card_verification_callback)); ->ShowDialog(std::move(cancel_card_verification_callback));
} }
void ChromeAutofillClient::CloseVerifyPendingDialog() { void ChromeAutofillClient::CloseWebauthnVerifyPendingDialog() {
VerifyPendingDialogControllerImpl* controller = VerifyPendingDialogControllerImpl* controller =
autofill::VerifyPendingDialogControllerImpl::FromWebContents( autofill::VerifyPendingDialogControllerImpl::FromWebContents(
web_contents()); web_contents());
...@@ -292,37 +315,6 @@ void ChromeAutofillClient::CloseVerifyPendingDialog() { ...@@ -292,37 +315,6 @@ void ChromeAutofillClient::CloseVerifyPendingDialog() {
} }
#endif #endif
void ChromeAutofillClient::ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback callback) {
#if !defined(OS_ANDROID)
autofill::WebauthnOfferDialogControllerImpl::CreateForWebContents(
web_contents());
autofill::WebauthnOfferDialogControllerImpl::FromWebContents(web_contents())
->ShowOfferDialog(std::move(callback));
#endif
}
bool ChromeAutofillClient::CloseWebauthnOfferDialog() {
#if !defined(OS_ANDROID)
WebauthnOfferDialogControllerImpl* controller =
autofill::WebauthnOfferDialogControllerImpl::FromWebContents(
web_contents());
if (controller)
return controller->CloseDialog();
#endif
return false;
}
void ChromeAutofillClient::UpdateWebauthnOfferDialogWithError() {
#if !defined(OS_ANDROID)
WebauthnOfferDialogControllerImpl* controller =
autofill::WebauthnOfferDialogControllerImpl::FromWebContents(
web_contents());
if (controller)
controller->UpdateDialogWithError();
#endif
}
void ChromeAutofillClient::ConfirmSaveAutofillProfile( void ChromeAutofillClient::ConfirmSaveAutofillProfile(
const AutofillProfile& profile, const AutofillProfile& profile,
base::OnceClosure callback) { base::OnceClosure callback) {
......
...@@ -87,13 +87,14 @@ class ChromeAutofillClient ...@@ -87,13 +87,14 @@ class ChromeAutofillClient
const std::vector<MigratableCreditCard>& migratable_credit_cards, const std::vector<MigratableCreditCard>& migratable_credit_cards,
MigrationDeleteCardCallback delete_local_card_callback) override; MigrationDeleteCardCallback delete_local_card_callback) override;
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
void ShowVerifyPendingDialog( void ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback offer_dialog_callback) override;
void UpdateWebauthnOfferDialogWithError() override;
bool CloseWebauthnOfferDialog() override;
void ShowWebauthnVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) override; base::OnceClosure cancel_card_verification_callback) override;
void CloseVerifyPendingDialog() override; void CloseWebauthnVerifyPendingDialog() override;
#endif // !defined(OS_ANDROID) #endif // !defined(OS_ANDROID)
void ShowWebauthnOfferDialog(WebauthnOfferDialogCallback callback) override;
bool CloseWebauthnOfferDialog() override;
void UpdateWebauthnOfferDialogWithError() override;
void ConfirmSaveAutofillProfile(const AutofillProfile& profile, void ConfirmSaveAutofillProfile(const AutofillProfile& profile,
base::OnceClosure callback) override; base::OnceClosure callback) override;
void ConfirmSaveCreditCardLocally( void ConfirmSaveCreditCardLocally(
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_CONTROLLER_H_ #ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_CONTROLLER_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_CONTROLLER_H_ #define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_CONTROLLER_H_
#include "base/macros.h" #include "base/macros.h"
...@@ -14,11 +14,10 @@ class WebContents; ...@@ -14,11 +14,10 @@ class WebContents;
namespace autofill { namespace autofill {
// An interface that exposes necessary controller functionality to // An interface that exposes necessary controller functionality to
// WebauthnOfferDialogView. // WebauthnDialogView.
class WebauthnOfferDialogController { class WebauthnDialogController {
public: public:
WebauthnOfferDialogController() = default; virtual ~WebauthnDialogController() = default;
virtual ~WebauthnOfferDialogController() = default;
virtual void OnOkButtonClicked() = 0; virtual void OnOkButtonClicked() = 0;
...@@ -27,11 +26,8 @@ class WebauthnOfferDialogController { ...@@ -27,11 +26,8 @@ class WebauthnOfferDialogController {
virtual void OnDialogClosed() = 0; virtual void OnDialogClosed() = 0;
virtual content::WebContents* GetWebContents() = 0; virtual content::WebContents* GetWebContents() = 0;
private:
DISALLOW_COPY_AND_ASSIGN(WebauthnOfferDialogController);
}; };
} // namespace autofill } // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_CONTROLLER_H_ #endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_CONTROLLER_H_
...@@ -2,74 +2,70 @@ ...@@ -2,74 +2,70 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_controller_impl.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_controller_impl.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_model.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_model.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_view.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_view.h"
namespace autofill { namespace autofill {
WebauthnOfferDialogControllerImpl::WebauthnOfferDialogControllerImpl( WebauthnDialogControllerImpl::WebauthnDialogControllerImpl(
content::WebContents* web_contents) content::WebContents* web_contents)
: content::WebContentsObserver(web_contents) {} : content::WebContentsObserver(web_contents) {}
WebauthnOfferDialogControllerImpl::~WebauthnOfferDialogControllerImpl() { WebauthnDialogControllerImpl::~WebauthnDialogControllerImpl() {
// This part of code is executed only if browser window is closed when the // This part of code is executed only if browser window is closed when the
// dialog is visible. In this case the controller is destroyed before // dialog is visible. In this case the controller is destroyed before
// WebauthnOfferDialogViewImpl::dtor() being called, but the reference to // WebauthnDialogViewImpl::dtor() being called, but the reference to
// controller is not reset. Need to reset via // controller is not reset. Need to reset via WebauthnDialogViewImpl::Hide()
// WebauthnOfferDialogViewImpl::Hide() to avoid crash. // to avoid crash.
if (dialog_model_) { if (dialog_model_)
dialog_model_->SetDialogState( dialog_model_->SetDialogState(WebauthnDialogModel::DialogState::kInactive);
WebauthnOfferDialogModel::DialogState::kInactive);
}
} }
void WebauthnOfferDialogControllerImpl::ShowOfferDialog( void WebauthnDialogControllerImpl::ShowOfferDialog(
AutofillClient::WebauthnOfferDialogCallback callback) { AutofillClient::WebauthnOfferDialogCallback offer_dialog_callback) {
DCHECK(!dialog_model_); DCHECK(!dialog_model_);
offer_dialog_callback_ = std::move(callback); offer_dialog_callback_ = std::move(offer_dialog_callback);
dialog_view_ = WebauthnOfferDialogView::CreateAndShow(this); dialog_view_ = WebauthnDialogView::CreateAndShow(this);
dialog_model_ = dialog_view_->GetDialogModel(); dialog_model_ = dialog_view_->GetDialogModel();
} }
bool WebauthnOfferDialogControllerImpl::CloseDialog() { bool WebauthnDialogControllerImpl::CloseDialog() {
if (!dialog_model_) if (!dialog_model_)
return false; return false;
dialog_model_->SetDialogState( dialog_model_->SetDialogState(WebauthnDialogModel::DialogState::kInactive);
WebauthnOfferDialogModel::DialogState::kInactive);
return true; return true;
} }
void WebauthnOfferDialogControllerImpl::UpdateDialogWithError() { void WebauthnDialogControllerImpl::UpdateDialogWithError() {
dialog_model_->SetDialogState(WebauthnOfferDialogModel::DialogState::kError); dialog_model_->SetDialogState(WebauthnDialogModel::DialogState::kError);
offer_dialog_callback_.Reset(); offer_dialog_callback_.Reset();
} }
void WebauthnOfferDialogControllerImpl::OnDialogClosed() { void WebauthnDialogControllerImpl::OnDialogClosed() {
dialog_model_ = nullptr; dialog_model_ = nullptr;
dialog_view_ = nullptr; dialog_view_ = nullptr;
offer_dialog_callback_.Reset(); offer_dialog_callback_.Reset();
} }
content::WebContents* WebauthnOfferDialogControllerImpl::GetWebContents() { content::WebContents* WebauthnDialogControllerImpl::GetWebContents() {
return web_contents(); return web_contents();
} }
void WebauthnOfferDialogControllerImpl::OnOkButtonClicked() { void WebauthnDialogControllerImpl::OnOkButtonClicked() {
DCHECK(offer_dialog_callback_); DCHECK(offer_dialog_callback_);
offer_dialog_callback_.Run(/*did_accept=*/true); offer_dialog_callback_.Run(/*did_accept=*/true);
dialog_model_->SetDialogState( dialog_model_->SetDialogState(WebauthnDialogModel::DialogState::kPending);
WebauthnOfferDialogModel::DialogState::kPending);
} }
void WebauthnOfferDialogControllerImpl::OnCancelButtonClicked() { void WebauthnDialogControllerImpl::OnCancelButtonClicked() {
DCHECK(offer_dialog_callback_); DCHECK(offer_dialog_callback_);
offer_dialog_callback_.Run(/*did_accept=*/false); offer_dialog_callback_.Run(/*did_accept=*/false);
} }
WEB_CONTENTS_USER_DATA_KEY_IMPL(WebauthnOfferDialogControllerImpl) WEB_CONTENTS_USER_DATA_KEY_IMPL(WebauthnDialogControllerImpl)
} // namespace autofill } // namespace autofill
...@@ -2,61 +2,61 @@ ...@@ -2,61 +2,61 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_CONTROLLER_IMPL_H_ #ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_CONTROLLER_IMPL_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_CONTROLLER_IMPL_H_ #define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_CONTROLLER_IMPL_H_
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_controller.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_controller.h"
#include "components/autofill/core/browser/autofill_client.h" #include "components/autofill/core/browser/autofill_client.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
namespace autofill { namespace autofill {
class WebauthnOfferDialogModel; class WebauthnDialogModel;
class WebauthnOfferDialogView; class WebauthnDialogView;
// Implementation of the per-tab controller to control the // Implementation of the per-tab controller to control the
// WebauthnOfferDialogView. Lazily initialized when used. // WebauthnDialogView. Lazily initialized when used.
class WebauthnOfferDialogControllerImpl class WebauthnDialogControllerImpl
: public WebauthnOfferDialogController, : public WebauthnDialogController,
public content::WebContentsObserver, public content::WebContentsObserver,
public content::WebContentsUserData<WebauthnOfferDialogControllerImpl> { public content::WebContentsUserData<WebauthnDialogControllerImpl> {
public: public:
~WebauthnOfferDialogControllerImpl() override; ~WebauthnDialogControllerImpl() override;
void ShowOfferDialog(AutofillClient::WebauthnOfferDialogCallback callback); void ShowOfferDialog(
AutofillClient::WebauthnOfferDialogCallback offer_dialog_callback);
bool CloseDialog(); bool CloseDialog();
void UpdateDialogWithError(); void UpdateDialogWithError();
// WebauthnOfferDialogController: // WebauthnDialogController:
void OnOkButtonClicked() override; void OnOkButtonClicked() override;
void OnCancelButtonClicked() override; void OnCancelButtonClicked() override;
void OnDialogClosed() override; void OnDialogClosed() override;
content::WebContents* GetWebContents() override; content::WebContents* GetWebContents() override;
WebauthnOfferDialogView* dialog_view() { return dialog_view_; } WebauthnDialogView* dialog_view() { return dialog_view_; }
protected: protected:
explicit WebauthnOfferDialogControllerImpl( explicit WebauthnDialogControllerImpl(content::WebContents* web_contents);
content::WebContents* web_contents);
private: private:
friend class content::WebContentsUserData<WebauthnOfferDialogControllerImpl>; friend class content::WebContentsUserData<WebauthnDialogControllerImpl>;
// Callback invoked when any button in the dialog is clicked. Note this // Callback invoked when any button in the offer dialog is clicked. Note this
// repeating callback can be run twice, since after the accept button is // repeating callback can be run twice, since after the accept button is
// clicked, the dialog stays and the cancel button is still clickable. // clicked, the offer dialog stays and the cancel button is still clickable.
AutofillClient::WebauthnOfferDialogCallback offer_dialog_callback_; AutofillClient::WebauthnOfferDialogCallback offer_dialog_callback_;
WebauthnOfferDialogModel* dialog_model_ = nullptr; WebauthnDialogModel* dialog_model_ = nullptr;
WebauthnOfferDialogView* dialog_view_ = nullptr; WebauthnDialogView* dialog_view_ = nullptr;
WEB_CONTENTS_USER_DATA_KEY_DECL(); WEB_CONTENTS_USER_DATA_KEY_DECL();
DISALLOW_COPY_AND_ASSIGN(WebauthnOfferDialogControllerImpl); DISALLOW_COPY_AND_ASSIGN(WebauthnDialogControllerImpl);
}; };
} // namespace autofill } // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_CONTROLLER_IMPL_H_ #endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_CONTROLLER_IMPL_H_
...@@ -2,51 +2,50 @@ ...@@ -2,51 +2,50 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_model.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_model.h"
#include "chrome/app/vector_icons/vector_icons.h" #include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_model_observer.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_model_observer.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
namespace autofill { namespace autofill {
WebauthnOfferDialogModel::WebauthnOfferDialogModel() { WebauthnDialogModel::WebauthnDialogModel() {
state_ = kOffer; state_ = kOffer;
} }
WebauthnOfferDialogModel::~WebauthnOfferDialogModel() = default; WebauthnDialogModel::~WebauthnDialogModel() = default;
void WebauthnOfferDialogModel::SetDialogState(DialogState state) { void WebauthnDialogModel::SetDialogState(DialogState state) {
state_ = state; state_ = state;
for (WebauthnOfferDialogModelObserver& observer : observers_) for (WebauthnDialogModelObserver& observer : observers_)
observer.OnDialogStateChanged(); observer.OnDialogStateChanged();
} }
void WebauthnOfferDialogModel::AddObserver( void WebauthnDialogModel::AddObserver(WebauthnDialogModelObserver* observer) {
WebauthnOfferDialogModelObserver* observer) {
observers_.AddObserver(observer); observers_.AddObserver(observer);
} }
void WebauthnOfferDialogModel::RemoveObserver( void WebauthnDialogModel::RemoveObserver(
WebauthnOfferDialogModelObserver* observer) { WebauthnDialogModelObserver* observer) {
observers_.RemoveObserver(observer); observers_.RemoveObserver(observer);
} }
bool WebauthnOfferDialogModel::IsActivityIndicatorVisible() const { bool WebauthnDialogModel::IsActivityIndicatorVisible() const {
return state_ == DialogState::kPending; return state_ == DialogState::kPending;
} }
bool WebauthnOfferDialogModel::IsBackButtonVisible() const { bool WebauthnDialogModel::IsBackButtonVisible() const {
return false; return false;
} }
bool WebauthnOfferDialogModel::IsCancelButtonVisible() const { bool WebauthnDialogModel::IsCancelButtonVisible() const {
return true; return true;
} }
base::string16 WebauthnOfferDialogModel::GetCancelButtonLabel() const { base::string16 WebauthnDialogModel::GetCancelButtonLabel() const {
switch (state_) { switch (state_) {
case DialogState::kOffer: case DialogState::kOffer:
case DialogState::kPending: case DialogState::kPending:
...@@ -62,27 +61,27 @@ base::string16 WebauthnOfferDialogModel::GetCancelButtonLabel() const { ...@@ -62,27 +61,27 @@ base::string16 WebauthnOfferDialogModel::GetCancelButtonLabel() const {
return base::string16(); return base::string16();
} }
bool WebauthnOfferDialogModel::IsAcceptButtonVisible() const { bool WebauthnDialogModel::IsAcceptButtonVisible() const {
return state_ == DialogState::kOffer || state_ == DialogState::kPending; return state_ == DialogState::kOffer || state_ == DialogState::kPending;
} }
bool WebauthnOfferDialogModel::IsAcceptButtonEnabled() const { bool WebauthnDialogModel::IsAcceptButtonEnabled() const {
return state_ != DialogState::kPending; return state_ != DialogState::kPending;
} }
base::string16 WebauthnOfferDialogModel::GetAcceptButtonLabel() const { base::string16 WebauthnDialogModel::GetAcceptButtonLabel() const {
return l10n_util::GetStringUTF16( return l10n_util::GetStringUTF16(
IDS_AUTOFILL_WEBAUTHN_OPT_IN_DIALOG_OK_BUTTON_LABEL); IDS_AUTOFILL_WEBAUTHN_OPT_IN_DIALOG_OK_BUTTON_LABEL);
} }
const gfx::VectorIcon& WebauthnOfferDialogModel::GetStepIllustration( const gfx::VectorIcon& WebauthnDialogModel::GetStepIllustration(
ImageColorScheme color_scheme) const { ImageColorScheme color_scheme) const {
switch (state_) { switch (state_) {
case DialogState::kOffer: case DialogState::kOffer:
case DialogState::kPending: case DialogState::kPending:
return color_scheme == ImageColorScheme::kDark return color_scheme == ImageColorScheme::kDark
? kWebauthnOfferDialogHeaderDarkIcon ? kWebauthnDialogHeaderDarkIcon
: kWebauthnOfferDialogHeaderIcon; : kWebauthnDialogHeaderIcon;
case DialogState::kError: case DialogState::kError:
return color_scheme == ImageColorScheme::kDark ? kWebauthnErrorDarkIcon return color_scheme == ImageColorScheme::kDark ? kWebauthnErrorDarkIcon
: kWebauthnErrorIcon; : kWebauthnErrorIcon;
...@@ -94,7 +93,7 @@ const gfx::VectorIcon& WebauthnOfferDialogModel::GetStepIllustration( ...@@ -94,7 +93,7 @@ const gfx::VectorIcon& WebauthnOfferDialogModel::GetStepIllustration(
return gfx::kNoneIcon; return gfx::kNoneIcon;
} }
base::string16 WebauthnOfferDialogModel::GetStepTitle() const { base::string16 WebauthnDialogModel::GetStepTitle() const {
switch (state_) { switch (state_) {
case DialogState::kOffer: case DialogState::kOffer:
case DialogState::kPending: case DialogState::kPending:
...@@ -111,7 +110,7 @@ base::string16 WebauthnOfferDialogModel::GetStepTitle() const { ...@@ -111,7 +110,7 @@ base::string16 WebauthnOfferDialogModel::GetStepTitle() const {
return base::string16(); return base::string16();
} }
base::string16 WebauthnOfferDialogModel::GetStepDescription() const { base::string16 WebauthnDialogModel::GetStepDescription() const {
switch (state_) { switch (state_) {
case DialogState::kOffer: case DialogState::kOffer:
case DialogState::kPending: case DialogState::kPending:
...@@ -128,12 +127,12 @@ base::string16 WebauthnOfferDialogModel::GetStepDescription() const { ...@@ -128,12 +127,12 @@ base::string16 WebauthnOfferDialogModel::GetStepDescription() const {
return base::string16(); return base::string16();
} }
base::Optional<base::string16> base::Optional<base::string16> WebauthnDialogModel::GetAdditionalDescription()
WebauthnOfferDialogModel::GetAdditionalDescription() const { const {
return base::nullopt; return base::nullopt;
} }
ui::MenuModel* WebauthnOfferDialogModel::GetOtherTransportsMenuModel() { ui::MenuModel* WebauthnDialogModel::GetOtherTransportsMenuModel() {
return nullptr; return nullptr;
} }
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_MODEL_H_ #ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_MODEL_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_MODEL_H_ #define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_MODEL_H_
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list.h" #include "base/observer_list.h"
...@@ -12,11 +12,11 @@ ...@@ -12,11 +12,11 @@
namespace autofill { namespace autofill {
class WebauthnOfferDialogModelObserver; class WebauthnDialogModelObserver;
// The model for WebauthnOfferDialogView determining what content is shown. // The model for WebauthnDialogView determining what content is shown.
// Owned by the AuthenticatorRequestSheetView. // Owned by the AuthenticatorRequestSheetView.
class WebauthnOfferDialogModel : public AuthenticatorRequestSheetModel { class WebauthnDialogModel : public AuthenticatorRequestSheetModel {
public: public:
enum DialogState { enum DialogState {
kUnknown, kUnknown,
...@@ -31,14 +31,14 @@ class WebauthnOfferDialogModel : public AuthenticatorRequestSheetModel { ...@@ -31,14 +31,14 @@ class WebauthnOfferDialogModel : public AuthenticatorRequestSheetModel {
kError, kError,
}; };
WebauthnOfferDialogModel(); WebauthnDialogModel();
~WebauthnOfferDialogModel() override; ~WebauthnDialogModel() override;
void SetDialogState(DialogState state); void SetDialogState(DialogState state);
DialogState dialog_state() { return state_; } DialogState dialog_state() { return state_; }
void AddObserver(WebauthnOfferDialogModelObserver* observer); void AddObserver(WebauthnDialogModelObserver* observer);
void RemoveObserver(WebauthnOfferDialogModelObserver* observer); void RemoveObserver(WebauthnDialogModelObserver* observer);
// AuthenticatorRequestSheetModel: // AuthenticatorRequestSheetModel:
bool IsActivityIndicatorVisible() const override; bool IsActivityIndicatorVisible() const override;
...@@ -62,11 +62,11 @@ class WebauthnOfferDialogModel : public AuthenticatorRequestSheetModel { ...@@ -62,11 +62,11 @@ class WebauthnOfferDialogModel : public AuthenticatorRequestSheetModel {
private: private:
DialogState state_ = DialogState::kUnknown; DialogState state_ = DialogState::kUnknown;
base::ObserverList<WebauthnOfferDialogModelObserver> observers_; base::ObserverList<WebauthnDialogModelObserver> observers_;
DISALLOW_COPY_AND_ASSIGN(WebauthnOfferDialogModel); DISALLOW_COPY_AND_ASSIGN(WebauthnDialogModel);
}; };
} // namespace autofill } // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_MODEL_H_ #endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_MODEL_H_
...@@ -2,19 +2,19 @@ ...@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_MODEL_OBSERVER_H_ #ifndef CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_MODEL_OBSERVER_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_MODEL_OBSERVER_H_ #define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_MODEL_OBSERVER_H_
#include "base/observer_list_types.h" #include "base/observer_list_types.h"
namespace autofill { namespace autofill {
// The observer for WebauthnOfferDialogModel. // The observer for WebauthnDialogModel.
class WebauthnOfferDialogModelObserver : public base::CheckedObserver { class WebauthnDialogModelObserver : public base::CheckedObserver {
public: public:
virtual void OnDialogStateChanged() = 0; virtual void OnDialogStateChanged() = 0;
}; };
} // namespace autofill } // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_MODEL_OBSERVER_H_ #endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_MODEL_OBSERVER_H_
// Copyright 2019 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_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_VIEW_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_VIEW_H_
namespace autofill {
class WebauthnDialogController;
class WebauthnDialogModel;
// The view of the dialog that offers the option to use device's platform
// authenticator. It is shown automatically after card unmasked details are
// obtained and filled into the form.
class WebauthnDialogView {
public:
static WebauthnDialogView* CreateAndShow(
WebauthnDialogController* controller);
virtual WebauthnDialogModel* GetDialogModel() const = 0;
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_VIEW_H_
// Copyright 2019 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_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_VIEW_H_
#define CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_VIEW_H_
namespace autofill {
class WebauthnOfferDialogController;
class WebauthnOfferDialogModel;
// The dialog to offer the option of using device's platform authenticator
// instead of CVC to verify the card in the future. Returns the reference to the
// model of the dialog.
class WebauthnOfferDialogView {
public:
static WebauthnOfferDialogView* CreateAndShow(
WebauthnOfferDialogController* controller);
virtual WebauthnOfferDialogModel* GetDialogModel() const = 0;
};
} // namespace autofill
#endif // CHROME_BROWSER_UI_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_VIEW_H_
...@@ -3,61 +3,61 @@ ...@@ -3,61 +3,61 @@
// found in the LICENSE file. // found in the LICENSE file.
#include "base/run_loop.h" #include "base/run_loop.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_controller_impl.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_controller_impl.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_view.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_view.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/test/test_browser_dialog.h" #include "chrome/browser/ui/test/test_browser_dialog.h"
#include "chrome/browser/ui/views/autofill/payments/webauthn_offer_dialog_view_impl.h" #include "chrome/browser/ui/views/autofill/payments/webauthn_dialog_view_impl.h"
namespace autofill { namespace autofill {
class WebauthnOfferDialogBrowserTest : public DialogBrowserTest { class WebauthnDialogBrowserTest : public DialogBrowserTest {
public: public:
WebauthnOfferDialogBrowserTest() = default; WebauthnDialogBrowserTest() = default;
// DialogBrowserTest: // DialogBrowserTest:
void ShowUi(const std::string& name) override { void ShowUi(const std::string& name) override {
content::WebContents* web_contents = content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
// Do lazy initialization of WebauthnOfferDialogControllerImpl. // Do lazy initialization of WebauthnDialogControllerImpl.
WebauthnOfferDialogControllerImpl::CreateForWebContents(web_contents); WebauthnDialogControllerImpl::CreateForWebContents(web_contents);
DCHECK(controller()); DCHECK(controller());
controller()->ShowOfferDialog(base::DoNothing()); controller()->ShowOfferDialog(base::DoNothing());
} }
WebauthnOfferDialogViewImpl* GetWebauthnOfferDialog() { WebauthnDialogViewImpl* GetWebauthnDialog() {
if (!controller()) if (!controller())
return nullptr; return nullptr;
WebauthnOfferDialogView* dialog_view = controller()->dialog_view(); WebauthnDialogView* dialog_view = controller()->dialog_view();
if (!dialog_view) if (!dialog_view)
return nullptr; return nullptr;
return static_cast<WebauthnOfferDialogViewImpl*>(dialog_view); return static_cast<WebauthnDialogViewImpl*>(dialog_view);
} }
WebauthnOfferDialogControllerImpl* controller() { WebauthnDialogControllerImpl* controller() {
if (!browser() || !browser()->tab_strip_model() || if (!browser() || !browser()->tab_strip_model() ||
!browser()->tab_strip_model()->GetActiveWebContents()) !browser()->tab_strip_model()->GetActiveWebContents())
return nullptr; return nullptr;
return WebauthnOfferDialogControllerImpl::FromWebContents( return WebauthnDialogControllerImpl::FromWebContents(
browser()->tab_strip_model()->GetActiveWebContents()); browser()->tab_strip_model()->GetActiveWebContents());
} }
private: private:
DISALLOW_COPY_AND_ASSIGN(WebauthnOfferDialogBrowserTest); DISALLOW_COPY_AND_ASSIGN(WebauthnDialogBrowserTest);
}; };
IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest, InvokeUi_default) { IN_PROC_BROWSER_TEST_F(WebauthnDialogBrowserTest, InvokeUi_default) {
ShowAndVerifyUi(); ShowAndVerifyUi();
} }
// Ensures closing tab while dialog being visible is correctly handled. // Ensures closing tab while dialog being visible is correctly handled.
// RunUntilIdle() makes sure that nothing crashes after browser tab is closed. // RunUntilIdle() makes sure that nothing crashes after browser tab is closed.
IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest, IN_PROC_BROWSER_TEST_F(WebauthnDialogBrowserTest,
CanCloseTabWhileDialogShowing) { CanCloseTabWhileDialogShowing) {
ShowUi(std::string()); ShowUi(std::string());
VerifyUi(); VerifyUi();
...@@ -66,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest, ...@@ -66,7 +66,7 @@ IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest,
} }
// Ensures closing browser while dialog being visible is correctly handled. // Ensures closing browser while dialog being visible is correctly handled.
IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest, IN_PROC_BROWSER_TEST_F(WebauthnDialogBrowserTest,
CanCloseBrowserWhileDialogShowing) { CanCloseBrowserWhileDialogShowing) {
ShowUi(std::string()); ShowUi(std::string());
VerifyUi(); VerifyUi();
...@@ -75,10 +75,10 @@ IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest, ...@@ -75,10 +75,10 @@ IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest,
} }
// Ensures dialog is closed when cancel button is clicked. // Ensures dialog is closed when cancel button is clicked.
IN_PROC_BROWSER_TEST_F(WebauthnOfferDialogBrowserTest, ClickCancelButton) { IN_PROC_BROWSER_TEST_F(WebauthnDialogBrowserTest, ClickCancelButton) {
ShowUi(std::string()); ShowUi(std::string());
VerifyUi(); VerifyUi();
GetWebauthnOfferDialog()->CancelDialog(); GetWebauthnDialog()->CancelDialog();
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
} }
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/ui/views/autofill/payments/webauthn_offer_dialog_view_impl.h" #include "chrome/browser/ui/views/autofill/payments/webauthn_dialog_view_impl.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_controller.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_controller.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_model.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_model.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h" #include "chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/sheet_view_factory.h" #include "chrome/browser/ui/views/webauthn/sheet_view_factory.h"
...@@ -18,12 +18,12 @@ ...@@ -18,12 +18,12 @@
namespace autofill { namespace autofill {
WebauthnOfferDialogViewImpl::WebauthnOfferDialogViewImpl( WebauthnDialogViewImpl::WebauthnDialogViewImpl(
WebauthnOfferDialogController* controller) WebauthnDialogController* controller)
: controller_(controller) { : controller_(controller) {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
std::unique_ptr<WebauthnOfferDialogModel> model = std::unique_ptr<WebauthnDialogModel> model =
std::make_unique<WebauthnOfferDialogModel>(); std::make_unique<WebauthnDialogModel>();
model_ = model.get(); model_ = model.get();
model_->AddObserver(this); model_->AddObserver(this);
sheet_view_ = sheet_view_ =
...@@ -36,7 +36,7 @@ WebauthnOfferDialogViewImpl::WebauthnOfferDialogViewImpl( ...@@ -36,7 +36,7 @@ WebauthnOfferDialogViewImpl::WebauthnOfferDialogViewImpl(
model_->GetCancelButtonLabel()); model_->GetCancelButtonLabel());
} }
WebauthnOfferDialogViewImpl::~WebauthnOfferDialogViewImpl() { WebauthnDialogViewImpl::~WebauthnDialogViewImpl() {
model_->RemoveObserver(this); model_->RemoveObserver(this);
if (controller_) { if (controller_) {
controller_->OnDialogClosed(); controller_->OnDialogClosed();
...@@ -45,62 +45,59 @@ WebauthnOfferDialogViewImpl::~WebauthnOfferDialogViewImpl() { ...@@ -45,62 +45,59 @@ WebauthnOfferDialogViewImpl::~WebauthnOfferDialogViewImpl() {
} }
// static // static
WebauthnOfferDialogView* WebauthnOfferDialogView::CreateAndShow( WebauthnDialogView* WebauthnDialogView::CreateAndShow(
WebauthnOfferDialogController* controller) { WebauthnDialogController* controller) {
WebauthnOfferDialogViewImpl* dialog = WebauthnDialogViewImpl* dialog = new WebauthnDialogViewImpl(controller);
new WebauthnOfferDialogViewImpl(controller);
constrained_window::ShowWebModalDialogViews(dialog, constrained_window::ShowWebModalDialogViews(dialog,
controller->GetWebContents()); controller->GetWebContents());
return dialog; return dialog;
} }
WebauthnOfferDialogModel* WebauthnOfferDialogViewImpl::GetDialogModel() const { WebauthnDialogModel* WebauthnDialogViewImpl::GetDialogModel() const {
return model_; return model_;
} }
void WebauthnOfferDialogViewImpl::OnDialogStateChanged() { void WebauthnDialogViewImpl::OnDialogStateChanged() {
switch (model_->dialog_state()) { switch (model_->dialog_state()) {
case WebauthnOfferDialogModel::DialogState::kInactive: case WebauthnDialogModel::DialogState::kInactive:
Hide(); Hide();
break; break;
case WebauthnOfferDialogModel::DialogState::kPending: case WebauthnDialogModel::DialogState::kPending:
case WebauthnOfferDialogModel::DialogState::kError: case WebauthnDialogModel::DialogState::kError:
RefreshContent(); RefreshContent();
break; break;
case WebauthnOfferDialogModel::DialogState::kUnknown: case WebauthnDialogModel::DialogState::kUnknown:
case WebauthnOfferDialogModel::DialogState::kOffer: case WebauthnDialogModel::DialogState::kOffer:
NOTREACHED(); NOTREACHED();
} }
} }
gfx::Size WebauthnOfferDialogViewImpl::CalculatePreferredSize() const { gfx::Size WebauthnDialogViewImpl::CalculatePreferredSize() const {
const int width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH); DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH);
return gfx::Size(width, GetHeightForWidth(width)); return gfx::Size(width, GetHeightForWidth(width));
} }
bool WebauthnOfferDialogViewImpl::Accept() { bool WebauthnDialogViewImpl::Accept() {
DCHECK_EQ(model_->dialog_state(), DCHECK_EQ(model_->dialog_state(), WebauthnDialogModel::DialogState::kOffer);
WebauthnOfferDialogModel::DialogState::kOffer);
controller_->OnOkButtonClicked(); controller_->OnOkButtonClicked();
return false; return false;
} }
bool WebauthnOfferDialogViewImpl::Cancel() { bool WebauthnDialogViewImpl::Cancel() {
if (model_->dialog_state() == WebauthnOfferDialogModel::DialogState::kOffer || if (model_->dialog_state() == WebauthnDialogModel::DialogState::kOffer ||
model_->dialog_state() == model_->dialog_state() == WebauthnDialogModel::DialogState::kPending) {
WebauthnOfferDialogModel::DialogState::kPending) {
controller_->OnCancelButtonClicked(); controller_->OnCancelButtonClicked();
} }
return true; return true;
} }
bool WebauthnOfferDialogViewImpl::Close() { bool WebauthnDialogViewImpl::Close() {
return true; return true;
} }
int WebauthnOfferDialogViewImpl::GetDialogButtons() const { int WebauthnDialogViewImpl::GetDialogButtons() const {
// Cancel button is always visible but OK button depends on dialog state. // Cancel button is always visible but OK button depends on dialog state.
DCHECK(model_->IsCancelButtonVisible()); DCHECK(model_->IsCancelButtonVisible());
return model_->IsAcceptButtonVisible() return model_->IsAcceptButtonVisible()
...@@ -108,29 +105,29 @@ int WebauthnOfferDialogViewImpl::GetDialogButtons() const { ...@@ -108,29 +105,29 @@ int WebauthnOfferDialogViewImpl::GetDialogButtons() const {
: ui::DIALOG_BUTTON_CANCEL; : ui::DIALOG_BUTTON_CANCEL;
} }
bool WebauthnOfferDialogViewImpl::IsDialogButtonEnabled( bool WebauthnDialogViewImpl::IsDialogButtonEnabled(
ui::DialogButton button) const { ui::DialogButton button) const {
return button == ui::DIALOG_BUTTON_OK ? model_->IsAcceptButtonEnabled() return button == ui::DIALOG_BUTTON_OK ? model_->IsAcceptButtonEnabled()
: true; : true;
} }
ui::ModalType WebauthnOfferDialogViewImpl::GetModalType() const { ui::ModalType WebauthnDialogViewImpl::GetModalType() const {
return ui::MODAL_TYPE_CHILD; return ui::MODAL_TYPE_CHILD;
} }
base::string16 WebauthnOfferDialogViewImpl::GetWindowTitle() const { base::string16 WebauthnDialogViewImpl::GetWindowTitle() const {
return model_->GetStepTitle(); return model_->GetStepTitle();
} }
bool WebauthnOfferDialogViewImpl::ShouldShowWindowTitle() const { bool WebauthnDialogViewImpl::ShouldShowWindowTitle() const {
return false; return false;
} }
bool WebauthnOfferDialogViewImpl::ShouldShowCloseButton() const { bool WebauthnDialogViewImpl::ShouldShowCloseButton() const {
return false; return false;
} }
void WebauthnOfferDialogViewImpl::Hide() { void WebauthnDialogViewImpl::Hide() {
// Reset controller reference if the controller has been destroyed before the // Reset controller reference if the controller has been destroyed before the
// view being destroyed. This happens if browser window is closed when the // view being destroyed. This happens if browser window is closed when the
// dialog is visible. // dialog is visible.
...@@ -141,7 +138,7 @@ void WebauthnOfferDialogViewImpl::Hide() { ...@@ -141,7 +138,7 @@ void WebauthnOfferDialogViewImpl::Hide() {
GetWidget()->Close(); GetWidget()->Close();
} }
void WebauthnOfferDialogViewImpl::RefreshContent() { void WebauthnDialogViewImpl::RefreshContent() {
sheet_view_->ReInitChildViews(); sheet_view_->ReInitChildViews();
sheet_view_->InvalidateLayout(); sheet_view_->InvalidateLayout();
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_OK, DialogDelegate::set_button_label(ui::DIALOG_BUTTON_OK,
......
...@@ -2,36 +2,32 @@ ...@@ -2,36 +2,32 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_VIEW_IMPL_H_ #ifndef CHROME_BROWSER_UI_VIEWS_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_VIEW_IMPL_H_
#define CHROME_BROWSER_UI_VIEWS_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_VIEW_IMPL_H_ #define CHROME_BROWSER_UI_VIEWS_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_VIEW_IMPL_H_
#include "base/macros.h" #include "base/macros.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_model_observer.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_model_observer.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_view.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_view.h"
#include "ui/views/window/dialog_delegate.h" #include "ui/views/window/dialog_delegate.h"
class AuthenticatorRequestSheetView; class AuthenticatorRequestSheetView;
namespace autofill { namespace autofill {
class WebauthnOfferDialogController; class WebauthnDialogController;
class WebauthnOfferDialogModel; class WebauthnDialogModel;
// The view of the dialog that offers the option to use device's platform class WebauthnDialogViewImpl : public WebauthnDialogView,
// authenticator. It is shown automatically after card unmasked details are public WebauthnDialogModelObserver,
// obtained and filled into the form. public views::DialogDelegateView {
class WebauthnOfferDialogViewImpl : public WebauthnOfferDialogView,
public WebauthnOfferDialogModelObserver,
public views::DialogDelegateView {
public: public:
explicit WebauthnOfferDialogViewImpl( explicit WebauthnDialogViewImpl(WebauthnDialogController* controller);
WebauthnOfferDialogController* controller); ~WebauthnDialogViewImpl() override;
~WebauthnOfferDialogViewImpl() override;
// WebauthnOfferDialogView: // WebauthnDialogView:
WebauthnOfferDialogModel* GetDialogModel() const override; WebauthnDialogModel* GetDialogModel() const override;
// WebauthnOfferDialogModelObserver: // WebauthnDialogModelObserver:
void OnDialogStateChanged() override; void OnDialogStateChanged() override;
// views::DialogDelegateView: // views::DialogDelegateView:
...@@ -46,7 +42,6 @@ class WebauthnOfferDialogViewImpl : public WebauthnOfferDialogView, ...@@ -46,7 +42,6 @@ class WebauthnOfferDialogViewImpl : public WebauthnOfferDialogView,
bool ShouldShowWindowTitle() const override; bool ShouldShowWindowTitle() const override;
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
private: private:
// Closes the dialog. // Closes the dialog.
void Hide(); void Hide();
...@@ -54,17 +49,17 @@ class WebauthnOfferDialogViewImpl : public WebauthnOfferDialogView, ...@@ -54,17 +49,17 @@ class WebauthnOfferDialogViewImpl : public WebauthnOfferDialogView,
// Re-inits dialog content and resizes. // Re-inits dialog content and resizes.
void RefreshContent(); void RefreshContent();
WebauthnOfferDialogController* controller_ = nullptr; WebauthnDialogController* controller_ = nullptr;
AuthenticatorRequestSheetView* sheet_view_ = nullptr; AuthenticatorRequestSheetView* sheet_view_ = nullptr;
// Dialog model owned by |sheet_view_|. Since this dialog owns the // Dialog model owned by |sheet_view_|. Since this dialog owns the
// |sheet_view_|, the model_ will always be valid. // |sheet_view_|, the model_ will always be valid.
WebauthnOfferDialogModel* model_ = nullptr; WebauthnDialogModel* model_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(WebauthnOfferDialogViewImpl); DISALLOW_COPY_AND_ASSIGN(WebauthnDialogViewImpl);
}; };
} // namespace autofill } // namespace autofill
#endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_PAYMENTS_WEBAUTHN_OFFER_DIALOG_VIEW_IMPL_H_ #endif // CHROME_BROWSER_UI_VIEWS_AUTOFILL_PAYMENTS_WEBAUTHN_DIALOG_VIEW_IMPL_H_
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#include "chrome/browser/ui/views/webauthn/sheet_view_factory.h" #include "chrome/browser/ui/views/webauthn/sheet_view_factory.h"
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/ui/autofill/payments/webauthn_offer_dialog_model.h" #include "chrome/browser/ui/autofill/payments/webauthn_dialog_model.h"
#include "chrome/browser/ui/views/webauthn/authenticator_ble_pin_entry_sheet_view.h" #include "chrome/browser/ui/views/webauthn/authenticator_ble_pin_entry_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_sheet_view.h" #include "chrome/browser/ui/views/webauthn/authenticator_client_pin_entry_sheet_view.h"
#include "chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h" #include "chrome/browser/ui/views/webauthn/authenticator_qr_sheet_view.h"
...@@ -196,6 +196,6 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf( ...@@ -196,6 +196,6 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
std::unique_ptr<AuthenticatorRequestSheetView> std::unique_ptr<AuthenticatorRequestSheetView>
CreateSheetViewForAutofillWebAuthn( CreateSheetViewForAutofillWebAuthn(
std::unique_ptr<autofill::WebauthnOfferDialogModel> model) { std::unique_ptr<autofill::WebauthnDialogModel> model) {
return std::make_unique<AuthenticatorRequestSheetView>(std::move(model)); return std::make_unique<AuthenticatorRequestSheetView>(std::move(model));
} }
...@@ -11,7 +11,7 @@ class AuthenticatorRequestSheetView; ...@@ -11,7 +11,7 @@ class AuthenticatorRequestSheetView;
class AuthenticatorRequestDialogModel; class AuthenticatorRequestDialogModel;
namespace autofill { namespace autofill {
class WebauthnOfferDialogModel; class WebauthnDialogModel;
} }
// Creates the appropriate AuthenticatorRequestSheetView subclass instance, // Creates the appropriate AuthenticatorRequestSheetView subclass instance,
...@@ -21,9 +21,9 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf( ...@@ -21,9 +21,9 @@ std::unique_ptr<AuthenticatorRequestSheetView> CreateSheetViewForCurrentStepOf(
AuthenticatorRequestDialogModel* dialog_model); AuthenticatorRequestDialogModel* dialog_model);
// Creates the AuthenticatorRequestSheetView instance used by // Creates the AuthenticatorRequestSheetView instance used by
// WebauthnOfferDialogView. // WebauthnDialogView.
std::unique_ptr<AuthenticatorRequestSheetView> std::unique_ptr<AuthenticatorRequestSheetView>
CreateSheetViewForAutofillWebAuthn( CreateSheetViewForAutofillWebAuthn(
std::unique_ptr<autofill::WebauthnOfferDialogModel> model); std::unique_ptr<autofill::WebauthnDialogModel> model);
#endif // CHROME_BROWSER_UI_VIEWS_WEBAUTHN_SHEET_VIEW_FACTORY_H_ #endif // CHROME_BROWSER_UI_VIEWS_WEBAUTHN_SHEET_VIEW_FACTORY_H_
...@@ -1890,7 +1890,7 @@ if (!is_android) { ...@@ -1890,7 +1890,7 @@ if (!is_android) {
"../browser/ui/views/autofill/payments/card_unmask_prompt_view_tester_views.h", "../browser/ui/views/autofill/payments/card_unmask_prompt_view_tester_views.h",
"../browser/ui/views/autofill/payments/local_card_migration_browsertest.cc", "../browser/ui/views/autofill/payments/local_card_migration_browsertest.cc",
"../browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc", "../browser/ui/views/autofill/payments/save_card_bubble_views_browsertest.cc",
"../browser/ui/views/autofill/payments/webauthn_offer_dialog_browsertest.cc", "../browser/ui/views/autofill/payments/webauthn_dialog_browsertest.cc",
"../browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc", "../browser/ui/views/bookmarks/bookmark_bubble_view_browsertest.cc",
"../browser/ui/views/bookmarks/bookmark_editor_view_browsertest.cc", "../browser/ui/views/bookmarks/bookmark_editor_view_browsertest.cc",
"../browser/ui/views/certificate_selector_dialog_browsertest.cc", "../browser/ui/views/certificate_selector_dialog_browsertest.cc",
......
...@@ -23,8 +23,4 @@ LogManager* AutofillClient::GetLogManager() const { ...@@ -23,8 +23,4 @@ LogManager* AutofillClient::GetLogManager() const {
return nullptr; return nullptr;
} }
bool AutofillClient::CloseWebauthnOfferDialog() {
return false;
}
} // namespace autofill } // namespace autofill
...@@ -307,31 +307,33 @@ class AutofillClient : public RiskDataLoader { ...@@ -307,31 +307,33 @@ class AutofillClient : public RiskDataLoader {
MigrationDeleteCardCallback delete_local_card_callback) = 0; MigrationDeleteCardCallback delete_local_card_callback) = 0;
#if !defined(OS_ANDROID) && !defined(OS_IOS) #if !defined(OS_ANDROID) && !defined(OS_IOS)
// Will show a dialog indicating the card verification is in progress. It is
// shown after verification starts only if the WebAuthn is enabled.
// Implemented only on desktop.
virtual void ShowVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) = 0;
// Close the verify pending dialog once the card verificiation is completed or
// verification falls back to CVC.
virtual void CloseVerifyPendingDialog() = 0;
#endif
// Will show a dialog offering the option to use device's platform // Will show a dialog offering the option to use device's platform
// authenticator in the future instead of CVC to verify the card being // authenticator in the future instead of CVC to verify the card being
// unmasked. Runs |callback| if the OK button or the cancel button in the // unmasked. Runs |offer_dialog_callback| if the OK button or the cancel
// dialog is clicked. This is only implemented on desktop. // button in the dialog is clicked. This is only implemented on desktop.
virtual void ShowWebauthnOfferDialog( virtual void ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback callback) = 0; WebauthnOfferDialogCallback offer_dialog_callback) = 0;
// Will update the WebAuthn offer dialog content to the error state.
// Implemented only on desktop.
virtual void UpdateWebauthnOfferDialogWithError() = 0;
// TODO(crbug.com/949269): Merge CloseWebauthnOfferDialog() and
// CloseWebauthnVerifyPendingDialog() into one function.
// Will close the WebAuthn offer dialog. Returns true if dialog was visible // Will close the WebAuthn offer dialog. Returns true if dialog was visible
// and has been closed. Implemented only on desktop. // and has been closed. Implemented only on desktop.
virtual bool CloseWebauthnOfferDialog(); virtual bool CloseWebauthnOfferDialog() = 0;
// Will update the WebAuthn offer dialog content to the error state. // Will show a dialog indicating the card verification is in progress. It is
// shown after verification starts only if the WebAuthn is enabled.
// Implemented only on desktop. // Implemented only on desktop.
virtual void UpdateWebauthnOfferDialogWithError() {} virtual void ShowWebauthnVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) = 0;
// Close the verify pending dialog once the card verificiation is completed or
// verification falls back to CVC.
virtual void CloseWebauthnVerifyPendingDialog() = 0;
#endif
// Runs |callback| if the |profile| should be imported as personal data. // Runs |callback| if the |profile| should be imported as personal data.
virtual void ConfirmSaveAutofillProfile(const AutofillProfile& profile, virtual void ConfirmSaveAutofillProfile(const AutofillProfile& profile,
......
...@@ -410,7 +410,7 @@ void CreditCardAccessManager::Authenticate(bool get_unmask_details_returned) { ...@@ -410,7 +410,7 @@ void CreditCardAccessManager::Authenticate(bool get_unmask_details_returned) {
#if !defined(OS_ANDROID) && !defined(OS_IOS) #if !defined(OS_ANDROID) && !defined(OS_IOS)
// Close the verify pending dialog if it enters CVC authentication flow // Close the verify pending dialog if it enters CVC authentication flow
// since the card unmask prompt will pop up. // since the card unmask prompt will pop up.
client_->CloseVerifyPendingDialog(); client_->CloseWebauthnVerifyPendingDialog();
#endif #endif
GetOrCreateCVCAuthenticator()->Authenticate( GetOrCreateCVCAuthenticator()->Authenticate(
card_, weak_ptr_factory_.GetWeakPtr(), personal_data_manager_, card_, weak_ptr_factory_.GetWeakPtr(), personal_data_manager_,
...@@ -495,7 +495,7 @@ void CreditCardAccessManager::OnFIDOAuthenticationComplete( ...@@ -495,7 +495,7 @@ void CreditCardAccessManager::OnFIDOAuthenticationComplete(
// Close the verify pending dialog. If FIDO authentication succeeded, card is // Close the verify pending dialog. If FIDO authentication succeeded, card is
// filled to the form, otherwise fall back to CVC authentication which does // filled to the form, otherwise fall back to CVC authentication which does
// not need the verify pending dialog either. // not need the verify pending dialog either.
client_->CloseVerifyPendingDialog(); client_->CloseWebauthnVerifyPendingDialog();
#endif #endif
if (did_succeed) { if (did_succeed) {
...@@ -527,7 +527,7 @@ bool CreditCardAccessManager::AuthenticationRequiresUnmaskDetails() { ...@@ -527,7 +527,7 @@ bool CreditCardAccessManager::AuthenticationRequiresUnmaskDetails() {
#if !defined(OS_ANDROID) && !defined(OS_IOS) #if !defined(OS_ANDROID) && !defined(OS_IOS)
void CreditCardAccessManager::ShowVerifyPendingDialog() { void CreditCardAccessManager::ShowVerifyPendingDialog() {
client_->ShowVerifyPendingDialog( client_->ShowWebauthnVerifyPendingDialog(
base::BindOnce(&CreditCardAccessManager::OnDidCancelCardVerification, base::BindOnce(&CreditCardAccessManager::OnDidCancelCardVerification,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
......
...@@ -63,12 +63,14 @@ CreditCardFIDOAuthenticator::~CreditCardFIDOAuthenticator() {} ...@@ -63,12 +63,14 @@ CreditCardFIDOAuthenticator::~CreditCardFIDOAuthenticator() {}
void CreditCardFIDOAuthenticator::ShowWebauthnOfferDialog( void CreditCardFIDOAuthenticator::ShowWebauthnOfferDialog(
std::string card_authorization_token) { std::string card_authorization_token) {
#if !defined(OS_ANDROID)
card_authorization_token_ = card_authorization_token; card_authorization_token_ = card_authorization_token;
autofill_client_->ShowWebauthnOfferDialog(base::BindRepeating( autofill_client_->ShowWebauthnOfferDialog(base::BindRepeating(
&CreditCardFIDOAuthenticator::OnWebauthnOfferDialogUserResponse, &CreditCardFIDOAuthenticator::OnWebauthnOfferDialogUserResponse,
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
AutofillMetrics::LogWebauthnOptInPromoShown( AutofillMetrics::LogWebauthnOptInPromoShown(
/*is_checkout_flow=*/!card_authorization_token_.empty()); /*is_checkout_flow=*/!card_authorization_token_.empty());
#endif
} }
void CreditCardFIDOAuthenticator::Authenticate( void CreditCardFIDOAuthenticator::Authenticate(
...@@ -387,8 +389,10 @@ void CreditCardFIDOAuthenticator::OnDidGetOptChangeResult( ...@@ -387,8 +389,10 @@ void CreditCardFIDOAuthenticator::OnDidGetOptChangeResult(
// End the flow if the server responded with an error. // End the flow if the server responded with an error.
if (result != AutofillClient::PaymentsRpcResult::SUCCESS) { if (result != AutofillClient::PaymentsRpcResult::SUCCESS) {
#if !defined(OS_ANDROID)
if (current_flow_ == OPT_IN_FETCH_CHALLENGE_FLOW) if (current_flow_ == OPT_IN_FETCH_CHALLENGE_FLOW)
autofill_client_->UpdateWebauthnOfferDialogWithError(); autofill_client_->UpdateWebauthnOfferDialogWithError();
#endif
current_flow_ = NONE_FLOW; current_flow_ = NONE_FLOW;
return; return;
} }
......
...@@ -108,19 +108,21 @@ void TestAutofillClient::ShowLocalCardMigrationResults( ...@@ -108,19 +108,21 @@ void TestAutofillClient::ShowLocalCardMigrationResults(
MigrationDeleteCardCallback delete_local_card_callback) {} MigrationDeleteCardCallback delete_local_card_callback) {}
#if !defined(OS_ANDROID) && !defined(OS_IOS) #if !defined(OS_ANDROID) && !defined(OS_IOS)
void TestAutofillClient::ShowVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) {}
void TestAutofillClient::CloseVerifyPendingDialog() {}
#endif
void TestAutofillClient::ShowWebauthnOfferDialog( void TestAutofillClient::ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback callback) {} WebauthnOfferDialogCallback offer_dialog_callback) {}
void TestAutofillClient::UpdateWebauthnOfferDialogWithError() {}
bool TestAutofillClient::CloseWebauthnOfferDialog() { bool TestAutofillClient::CloseWebauthnOfferDialog() {
return true; return true;
} }
void TestAutofillClient::ShowWebauthnVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) {}
void TestAutofillClient::CloseWebauthnVerifyPendingDialog() {}
#endif
void TestAutofillClient::ConfirmSaveAutofillProfile( void TestAutofillClient::ConfirmSaveAutofillProfile(
const AutofillProfile& profile, const AutofillProfile& profile,
base::OnceClosure callback) { base::OnceClosure callback) {
......
...@@ -66,12 +66,14 @@ class TestAutofillClient : public AutofillClient { ...@@ -66,12 +66,14 @@ class TestAutofillClient : public AutofillClient {
const std::vector<MigratableCreditCard>& migratable_credit_cards, const std::vector<MigratableCreditCard>& migratable_credit_cards,
MigrationDeleteCardCallback delete_local_card_callback) override; MigrationDeleteCardCallback delete_local_card_callback) override;
#if !defined(OS_ANDROID) && !defined(OS_IOS) #if !defined(OS_ANDROID) && !defined(OS_IOS)
void ShowVerifyPendingDialog( void ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback offer_dialog_callback) override;
void UpdateWebauthnOfferDialogWithError() override;
bool CloseWebauthnOfferDialog() override;
void ShowWebauthnVerifyPendingDialog(
base::OnceClosure cancel_card_verification_callback) override; base::OnceClosure cancel_card_verification_callback) override;
void CloseVerifyPendingDialog() override; void CloseWebauthnVerifyPendingDialog() override;
#endif #endif
void ShowWebauthnOfferDialog(WebauthnOfferDialogCallback callback) override;
bool CloseWebauthnOfferDialog() override;
void ConfirmSaveAutofillProfile(const AutofillProfile& profile, void ConfirmSaveAutofillProfile(const AutofillProfile& profile,
base::OnceClosure callback) override; base::OnceClosure callback) override;
void ConfirmSaveCreditCardLocally( void ConfirmSaveCreditCardLocally(
......
...@@ -82,7 +82,6 @@ class ChromeAutofillClientIOS : public AutofillClient { ...@@ -82,7 +82,6 @@ class ChromeAutofillClientIOS : public AutofillClient {
const base::string16& tip_message, const base::string16& tip_message,
const std::vector<MigratableCreditCard>& migratable_credit_cards, const std::vector<MigratableCreditCard>& migratable_credit_cards,
MigrationDeleteCardCallback delete_local_card_callback) override; MigrationDeleteCardCallback delete_local_card_callback) override;
void ShowWebauthnOfferDialog(WebauthnOfferDialogCallback callback) override;
void ConfirmSaveAutofillProfile(const AutofillProfile& profile, void ConfirmSaveAutofillProfile(const AutofillProfile& profile,
base::OnceClosure callback) override; base::OnceClosure callback) override;
void ConfirmSaveCreditCardLocally( void ConfirmSaveCreditCardLocally(
......
...@@ -241,11 +241,6 @@ void ChromeAutofillClientIOS::ShowLocalCardMigrationResults( ...@@ -241,11 +241,6 @@ void ChromeAutofillClientIOS::ShowLocalCardMigrationResults(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void ChromeAutofillClientIOS::ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback callback) {
NOTIMPLEMENTED();
}
void ChromeAutofillClientIOS::ConfirmSaveAutofillProfile( void ChromeAutofillClientIOS::ConfirmSaveAutofillProfile(
const AutofillProfile& profile, const AutofillProfile& profile,
base::OnceClosure callback) { base::OnceClosure callback) {
......
...@@ -73,7 +73,6 @@ class WebViewAutofillClientIOS : public AutofillClient { ...@@ -73,7 +73,6 @@ class WebViewAutofillClientIOS : public AutofillClient {
const base::string16& tip_message, const base::string16& tip_message,
const std::vector<MigratableCreditCard>& migratable_credit_cards, const std::vector<MigratableCreditCard>& migratable_credit_cards,
MigrationDeleteCardCallback delete_local_card_callback) override; MigrationDeleteCardCallback delete_local_card_callback) override;
void ShowWebauthnOfferDialog(WebauthnOfferDialogCallback callback) override;
void ConfirmSaveAutofillProfile(const AutofillProfile& profile, void ConfirmSaveAutofillProfile(const AutofillProfile& profile,
base::OnceClosure callback) override; base::OnceClosure callback) override;
void ConfirmSaveCreditCardLocally( void ConfirmSaveCreditCardLocally(
......
...@@ -163,11 +163,6 @@ void WebViewAutofillClientIOS::ShowLocalCardMigrationResults( ...@@ -163,11 +163,6 @@ void WebViewAutofillClientIOS::ShowLocalCardMigrationResults(
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void WebViewAutofillClientIOS::ShowWebauthnOfferDialog(
WebauthnOfferDialogCallback callback) {
NOTIMPLEMENTED();
}
void WebViewAutofillClientIOS::ConfirmSaveAutofillProfile( void WebViewAutofillClientIOS::ConfirmSaveAutofillProfile(
const AutofillProfile& profile, const AutofillProfile& profile,
base::OnceClosure callback) { base::OnceClosure callback) {
......
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