Commit 2729cc5f authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: remove VerifyPendingDialog GetDialogButtonLabel

Migrate to the new DialogDelegate::set_button_label() pattern. Also, since the
string is static, use it directly from the view.

Bug: 1011446
Change-Id: I067d07b75d7d02c628f009328e36afdfd1d1f7ee
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1876467Reviewed-by: default avatarSiyu An <siyua@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708699}
parent 6b78ee0e
...@@ -18,7 +18,6 @@ class VerifyPendingDialogController { ...@@ -18,7 +18,6 @@ class VerifyPendingDialogController {
virtual ~VerifyPendingDialogController() = default; virtual ~VerifyPendingDialogController() = default;
virtual base::string16 GetDialogTitle() const = 0; virtual base::string16 GetDialogTitle() const = 0;
virtual base::string16 GetCancelButtonLabel() const = 0;
virtual void OnCancel() = 0; virtual void OnCancel() = 0;
virtual void OnDialogClosed() = 0; virtual void OnDialogClosed() = 0;
......
...@@ -44,11 +44,6 @@ base::string16 VerifyPendingDialogControllerImpl::GetDialogTitle() const { ...@@ -44,11 +44,6 @@ base::string16 VerifyPendingDialogControllerImpl::GetDialogTitle() const {
return l10n_util::GetStringUTF16(IDS_AUTOFILL_VERIFY_PENDING_DIALOG_TITLE); return l10n_util::GetStringUTF16(IDS_AUTOFILL_VERIFY_PENDING_DIALOG_TITLE);
} }
base::string16 VerifyPendingDialogControllerImpl::GetCancelButtonLabel() const {
return l10n_util::GetStringUTF16(
IDS_AUTOFILL_VERIFY_PENDING_DIALOG_CANCEL_BUTTON_LABEL);
}
void VerifyPendingDialogControllerImpl::OnCancel() { void VerifyPendingDialogControllerImpl::OnCancel() {
if (cancel_card_verification_callback_) if (cancel_card_verification_callback_)
std::move(cancel_card_verification_callback_).Run(); std::move(cancel_card_verification_callback_).Run();
......
...@@ -30,7 +30,6 @@ class VerifyPendingDialogControllerImpl ...@@ -30,7 +30,6 @@ class VerifyPendingDialogControllerImpl
// VerifyPendingDialogController: // VerifyPendingDialogController:
base::string16 GetDialogTitle() const override; base::string16 GetDialogTitle() const override;
base::string16 GetCancelButtonLabel() const override;
void OnCancel() override; void OnCancel() override;
void OnDialogClosed() override; void OnDialogClosed() override;
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include "chrome/browser/ui/autofill/payments/verify_pending_dialog_controller.h" #include "chrome/browser/ui/autofill/payments/verify_pending_dialog_controller.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "components/constrained_window/constrained_window_views.h" #include "components/constrained_window/constrained_window_views.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/window/dialog_client_view.h" #include "ui/views/window/dialog_client_view.h"
...@@ -15,6 +17,10 @@ namespace autofill { ...@@ -15,6 +17,10 @@ namespace autofill {
VerifyPendingDialogViewImpl::VerifyPendingDialogViewImpl( VerifyPendingDialogViewImpl::VerifyPendingDialogViewImpl(
VerifyPendingDialogController* controller) VerifyPendingDialogController* controller)
: controller_(controller) { : controller_(controller) {
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_CANCEL,
l10n_util::GetStringUTF16(
IDS_AUTOFILL_VERIFY_PENDING_DIALOG_CANCEL_BUTTON_LABEL));
// TODO(crbug.com/1014278): Should get correct width automatically when // TODO(crbug.com/1014278): Should get correct width automatically when
// snapping. // snapping.
const int width = ChromeLayoutProvider::Get()->GetDistanceMetric( const int width = ChromeLayoutProvider::Get()->GetDistanceMetric(
...@@ -61,12 +67,6 @@ int VerifyPendingDialogViewImpl::GetDialogButtons() const { ...@@ -61,12 +67,6 @@ int VerifyPendingDialogViewImpl::GetDialogButtons() const {
return ui::DIALOG_BUTTON_CANCEL; return ui::DIALOG_BUTTON_CANCEL;
} }
base::string16 VerifyPendingDialogViewImpl::GetDialogButtonLabel(
ui::DialogButton button) const {
DCHECK_EQ(button, ui::DIALOG_BUTTON_CANCEL);
return controller_->GetCancelButtonLabel();
}
ui::ModalType VerifyPendingDialogViewImpl::GetModalType() const { ui::ModalType VerifyPendingDialogViewImpl::GetModalType() const {
return ui::MODAL_TYPE_CHILD; return ui::MODAL_TYPE_CHILD;
} }
......
...@@ -30,7 +30,6 @@ class VerifyPendingDialogViewImpl : public VerifyPendingDialogView, ...@@ -30,7 +30,6 @@ class VerifyPendingDialogViewImpl : public VerifyPendingDialogView,
void AddedToWidget() override; void AddedToWidget() override;
bool Cancel() override; bool Cancel() override;
int GetDialogButtons() const override; int GetDialogButtons() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() 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