Commit 7c39c9ad authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

ash: use DialogDelegate label setters

These are all mechanical.

Bug: 1011446
Change-Id: I7710b18807cad6ad3cb9d6b22d7a07f1c12a8e0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1860095Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705668}
parent e0dffd84
......@@ -28,6 +28,9 @@ AcceleratorConfirmationDialog::AcceleratorConfirmationDialog(
base::OnceClosure on_accept_callback)
: window_title_(l10n_util::GetStringUTF16(window_title_text_id)),
on_accept_callback_(std::move(on_accept_callback)) {
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK, l10n_util::GetStringUTF16(IDS_ASH_CONTINUE_BUTTON));
SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType(
......@@ -69,13 +72,6 @@ base::string16 AcceleratorConfirmationDialog::GetWindowTitle() const {
return window_title_;
}
base::string16 AcceleratorConfirmationDialog::GetDialogButtonLabel(
ui::DialogButton button) const {
if (button == ui::DIALOG_BUTTON_OK)
return l10n_util::GetStringUTF16(IDS_ASH_CONTINUE_BUTTON);
return views::DialogDelegateView::GetDialogButtonLabel(button);
}
base::WeakPtr<AcceleratorConfirmationDialog>
AcceleratorConfirmationDialog::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
......
......@@ -26,7 +26,6 @@ class AcceleratorConfirmationDialog : public views::DialogDelegateView {
bool Accept() override;
ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
base::WeakPtr<AcceleratorConfirmationDialog> GetWeakPtr();
......
......@@ -30,6 +30,12 @@ RemoveQueryConfirmationDialog::RemoveQueryConfirmationDialog(
: confirm_callback_(std::move(confirm_callback)),
event_flags_(event_flags),
contents_view_(contents_view) {
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(IDS_REMOVE_SUGGESTION_BUTTON_LABEL));
DialogDelegate::set_button_label(ui::DIALOG_BUTTON_CANCEL,
l10n_util::GetStringUTF16(IDS_APP_CANCEL));
const views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical,
......@@ -72,13 +78,6 @@ bool RemoveQueryConfirmationDialog::ShouldShowCloseButton() const {
return false;
}
base::string16 RemoveQueryConfirmationDialog::GetDialogButtonLabel(
ui::DialogButton button) const {
return button == ui::DIALOG_BUTTON_CANCEL
? l10n_util::GetStringUTF16(IDS_APP_CANCEL)
: l10n_util::GetStringUTF16(IDS_REMOVE_SUGGESTION_BUTTON_LABEL);
}
bool RemoveQueryConfirmationDialog::Accept() {
if (confirm_callback_)
std::move(confirm_callback_).Run(true, event_flags_);
......
......@@ -43,7 +43,6 @@ class RemoveQueryConfirmationDialog
bool ShouldShowCloseButton() const override;
// views::DialogDelegate:
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
bool Accept() override;
bool Cancel() override;
......
......@@ -57,12 +57,6 @@ int SessionAbortedDialog::GetDialogButtons() const {
return ui::DIALOG_BUTTON_OK;
}
base::string16 SessionAbortedDialog::GetDialogButtonLabel(
ui::DialogButton button) const {
return l10n_util::GetStringUTF16(
IDS_ASH_MULTIPROFILES_SESSION_ABORT_BUTTON_LABEL);
}
ui::ModalType SessionAbortedDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM;
}
......@@ -82,7 +76,13 @@ gfx::Size SessionAbortedDialog::CalculatePreferredSize() const {
GetLayoutManager()->GetPreferredHeightForWidth(this, kDefaultWidth));
}
SessionAbortedDialog::SessionAbortedDialog() = default;
SessionAbortedDialog::SessionAbortedDialog() {
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(
IDS_ASH_MULTIPROFILES_SESSION_ABORT_BUTTON_LABEL));
}
SessionAbortedDialog::~SessionAbortedDialog() = default;
void SessionAbortedDialog::InitDialog(const std::string& user_email) {
......
......@@ -21,7 +21,6 @@ class SessionAbortedDialog : public views::DialogDelegateView {
// views::DialogDelegate overrides.
bool Accept() override;
int GetDialogButtons() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
// views::WidgetDelegate overrides.
ui::ModalType GetModalType() const override;
......
......@@ -29,6 +29,9 @@ AccessibilityFeatureDisableDialog::AccessibilityFeatureDisableDialog(
: window_title_(l10n_util::GetStringUTF16(window_title_text_id)),
on_accept_callback_(std::move(on_accept_callback)),
on_cancel_callback_(std::move(on_cancel_callback)) {
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK, l10n_util::GetStringUTF16(IDS_ASH_YES_BUTTON));
SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType(
......@@ -76,13 +79,6 @@ base::string16 AccessibilityFeatureDisableDialog::GetWindowTitle() const {
return window_title_;
}
base::string16 AccessibilityFeatureDisableDialog::GetDialogButtonLabel(
ui::DialogButton button) const {
if (button == ui::DIALOG_BUTTON_OK)
return l10n_util::GetStringUTF16(IDS_ASH_YES_BUTTON);
return views::DialogDelegateView::GetDialogButtonLabel(button);
}
base::WeakPtr<AccessibilityFeatureDisableDialog>
AccessibilityFeatureDisableDialog::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
......
......@@ -30,7 +30,6 @@ class AccessibilityFeatureDisableDialog : public views::DialogDelegateView {
bool Accept() override;
ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
base::WeakPtr<AccessibilityFeatureDisableDialog> GetWeakPtr();
......
......@@ -37,6 +37,10 @@ LogoutConfirmationDialog::LogoutConfirmationDialog(
LogoutConfirmationController* controller,
base::TimeTicks logout_time)
: controller_(controller), logout_time_(logout_time) {
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_BUTTON));
SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType(
......@@ -81,13 +85,6 @@ bool LogoutConfirmationDialog::Accept() {
return true;
}
base::string16 LogoutConfirmationDialog::GetDialogButtonLabel(
ui::DialogButton button) const {
if (button == ui::DIALOG_BUTTON_OK)
return l10n_util::GetStringUTF16(IDS_ASH_LOGOUT_CONFIRMATION_BUTTON);
return views::DialogDelegateView::GetDialogButtonLabel(button);
}
ui::ModalType LogoutConfirmationDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM;
}
......
......@@ -34,7 +34,6 @@ class LogoutConfirmationDialog : public views::DialogDelegateView {
// views::DialogDelegateView:
bool Accept() override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
// views::WidgetDelegate:
ui::ModalType GetModalType() 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