Commit 5bd27806 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: remove AuthenticatorRequestDialogView GetDialogButtonLabel

This dialog's button labels can change as its model is updated, so always reset
them in UpdateUIForCurrentSheet() before calling DialogModelChanged().

Bug: 1011446
Change-Id: I3125ffe6e9b13c5f365c473de0b5eb226a7ebfb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878629
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709885}
parent b8bb8b26
......@@ -59,7 +59,6 @@ base::string16 WebauthnOfferDialogModel::GetCancelButtonLabel() const {
case DialogState::kUnknown:
break;
}
NOTREACHED();
return base::string16();
}
......
......@@ -155,20 +155,6 @@ int AuthenticatorRequestDialogView::GetDialogButtons() const {
return button_mask;
}
base::string16 AuthenticatorRequestDialogView::GetDialogButtonLabel(
ui::DialogButton button) const {
switch (button) {
case ui::DIALOG_BUTTON_NONE:
break;
case ui::DIALOG_BUTTON_OK:
return sheet()->model()->GetAcceptButtonLabel();
case ui::DIALOG_BUTTON_CANCEL:
return sheet()->model()->GetCancelButtonLabel();
}
NOTREACHED();
return base::string16();
}
bool AuthenticatorRequestDialogView::IsDialogButtonEnabled(
ui::DialogButton button) const {
switch (button) {
......@@ -332,6 +318,10 @@ void AuthenticatorRequestDialogView::UpdateUIForCurrentSheet() {
DialogDelegate::set_default_button(sheet_->model()->IsAcceptButtonVisible()
? ui::DIALOG_BUTTON_OK
: ui::DIALOG_BUTTON_NONE);
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_OK,
sheet_->model()->GetAcceptButtonLabel());
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_CANCEL,
sheet_->model()->GetCancelButtonLabel());
// Whether to show the `Choose another option` button, or other dialog
// configuration is delegated to the |sheet_|, and the new sheet likely wants
......
......@@ -70,7 +70,6 @@ class AuthenticatorRequestDialogView
bool Cancel() override;
bool Close() override;
int GetDialogButtons() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
bool IsDialogButtonEnabled(ui::DialogButton button) const override;
View* GetInitiallyFocusedView() override;
ui::ModalType GetModalType() const override;
......
......@@ -86,12 +86,10 @@ bool AuthenticatorSheetModelBase::IsAcceptButtonVisible() const {
}
bool AuthenticatorSheetModelBase::IsAcceptButtonEnabled() const {
NOTREACHED();
return false;
}
base::string16 AuthenticatorSheetModelBase::GetAcceptButtonLabel() const {
NOTREACHED();
return base::string16();
}
......
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