Commit 837e6339 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbuiv: remove WebAuthnDialogViewImpl::GetDialogButtons

Replaced with direct use of the setters.

Bug: 1011446
Change-Id: Ia054462bbe3e1585430b3fe4102c694366a78827
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2028197Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736864}
parent baa5695e
......@@ -36,6 +36,10 @@ WebauthnDialogViewImpl::WebauthnDialogViewImpl(
model_->GetAcceptButtonLabel());
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_CANCEL,
model_->GetCancelButtonLabel());
DialogDelegate::set_buttons(model_->IsAcceptButtonVisible()
? ui::DIALOG_BUTTON_OK |
ui::DIALOG_BUTTON_CANCEL
: ui::DIALOG_BUTTON_CANCEL);
}
WebauthnDialogViewImpl::~WebauthnDialogViewImpl() {
......@@ -99,14 +103,6 @@ bool WebauthnDialogViewImpl::Cancel() {
return true;
}
int WebauthnDialogViewImpl::GetDialogButtons() const {
// Cancel button is always visible but OK button depends on dialog state.
DCHECK(model_->IsCancelButtonVisible());
return model_->IsAcceptButtonVisible()
? ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL
: ui::DIALOG_BUTTON_CANCEL;
}
bool WebauthnDialogViewImpl::IsDialogButtonEnabled(
ui::DialogButton button) const {
return button == ui::DIALOG_BUTTON_OK ? model_->IsAcceptButtonEnabled()
......@@ -147,6 +143,12 @@ void WebauthnDialogViewImpl::RefreshContent() {
model_->GetAcceptButtonLabel());
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_CANCEL,
model_->GetCancelButtonLabel());
DCHECK(model_->IsCancelButtonVisible());
DialogDelegate::set_buttons(model_->IsAcceptButtonVisible()
? ui::DIALOG_BUTTON_OK |
ui::DIALOG_BUTTON_CANCEL
: ui::DIALOG_BUTTON_CANCEL);
DialogModelChanged();
Layout();
......
......@@ -35,7 +35,6 @@ class WebauthnDialogViewImpl : public WebauthnDialogView,
gfx::Size CalculatePreferredSize() const override;
bool Accept() override;
bool Cancel() override;
int GetDialogButtons() const override;
bool IsDialogButtonEnabled(ui::DialogButton button) const override;
ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override;
......
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