Commit 59a80ba8 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: remove CredentialLeakDialogView GetDialogButtonLabel

This dialog gets its strings from a CredentialLeakDialogController. The
only subclass of that class, CredentialLeakDialogControllerImpl, returns
a string depending solely on its leak_type_ member, which is const. It
is therefore safe to fetch the strings once at construction time and
keep them.

Bug: 1011446
Change-Id: I795b98548e084b1c3cf9ae389d2f41017452fb09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872571Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708259}
parent 1ab11757
......@@ -102,6 +102,11 @@ CredentialLeakDialogView::CredentialLeakDialogView(
: controller_(controller), web_contents_(web_contents) {
DCHECK(controller);
DCHECK(web_contents);
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_OK,
controller_->GetAcceptButtonLabel());
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_CANCEL,
controller_->GetCancelButtonLabel());
}
CredentialLeakDialogView::~CredentialLeakDialogView() = default;
......@@ -128,12 +133,6 @@ gfx::Size CredentialLeakDialogView::CalculatePreferredSize() const {
return gfx::Size(width, GetHeightForWidth(width));
}
base::string16 CredentialLeakDialogView::GetDialogButtonLabel(
ui::DialogButton button) const {
return button == ui::DIALOG_BUTTON_OK ? controller_->GetAcceptButtonLabel()
: controller_->GetCancelButtonLabel();
}
bool CredentialLeakDialogView::Cancel() {
if (controller_)
// Since OnCancelDialog() synchronously invokes Close() on this instance, we
......
......@@ -31,7 +31,6 @@ class CredentialLeakDialogView : public views::DialogDelegateView,
// views::DialogDelegateView:
ui::ModalType GetModalType() const override;
gfx::Size CalculatePreferredSize() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
bool Cancel() override;
bool Accept() override;
bool Close() 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