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( ...@@ -28,6 +28,9 @@ AcceleratorConfirmationDialog::AcceleratorConfirmationDialog(
base::OnceClosure on_accept_callback) base::OnceClosure on_accept_callback)
: window_title_(l10n_util::GetStringUTF16(window_title_text_id)), : window_title_(l10n_util::GetStringUTF16(window_title_text_id)),
on_accept_callback_(std::move(on_accept_callback)) { 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>()); SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder( SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType( views::LayoutProvider::Get()->GetDialogInsetsForContentType(
...@@ -69,13 +72,6 @@ base::string16 AcceleratorConfirmationDialog::GetWindowTitle() const { ...@@ -69,13 +72,6 @@ base::string16 AcceleratorConfirmationDialog::GetWindowTitle() const {
return window_title_; 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> base::WeakPtr<AcceleratorConfirmationDialog>
AcceleratorConfirmationDialog::GetWeakPtr() { AcceleratorConfirmationDialog::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr(); return weak_ptr_factory_.GetWeakPtr();
......
...@@ -26,7 +26,6 @@ class AcceleratorConfirmationDialog : public views::DialogDelegateView { ...@@ -26,7 +26,6 @@ class AcceleratorConfirmationDialog : public views::DialogDelegateView {
bool Accept() override; bool Accept() override;
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
base::WeakPtr<AcceleratorConfirmationDialog> GetWeakPtr(); base::WeakPtr<AcceleratorConfirmationDialog> GetWeakPtr();
......
...@@ -30,6 +30,12 @@ RemoveQueryConfirmationDialog::RemoveQueryConfirmationDialog( ...@@ -30,6 +30,12 @@ RemoveQueryConfirmationDialog::RemoveQueryConfirmationDialog(
: confirm_callback_(std::move(confirm_callback)), : confirm_callback_(std::move(confirm_callback)),
event_flags_(event_flags), event_flags_(event_flags),
contents_view_(contents_view) { 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(); const views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, views::BoxLayout::Orientation::kVertical,
...@@ -72,13 +78,6 @@ bool RemoveQueryConfirmationDialog::ShouldShowCloseButton() const { ...@@ -72,13 +78,6 @@ bool RemoveQueryConfirmationDialog::ShouldShowCloseButton() const {
return false; 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() { bool RemoveQueryConfirmationDialog::Accept() {
if (confirm_callback_) if (confirm_callback_)
std::move(confirm_callback_).Run(true, event_flags_); std::move(confirm_callback_).Run(true, event_flags_);
......
...@@ -43,7 +43,6 @@ class RemoveQueryConfirmationDialog ...@@ -43,7 +43,6 @@ class RemoveQueryConfirmationDialog
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
// views::DialogDelegate: // views::DialogDelegate:
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
bool Accept() override; bool Accept() override;
bool Cancel() override; bool Cancel() override;
......
...@@ -57,12 +57,6 @@ int SessionAbortedDialog::GetDialogButtons() const { ...@@ -57,12 +57,6 @@ int SessionAbortedDialog::GetDialogButtons() const {
return ui::DIALOG_BUTTON_OK; 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 { ui::ModalType SessionAbortedDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM; return ui::MODAL_TYPE_SYSTEM;
} }
...@@ -82,7 +76,13 @@ gfx::Size SessionAbortedDialog::CalculatePreferredSize() const { ...@@ -82,7 +76,13 @@ gfx::Size SessionAbortedDialog::CalculatePreferredSize() const {
GetLayoutManager()->GetPreferredHeightForWidth(this, kDefaultWidth)); 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; SessionAbortedDialog::~SessionAbortedDialog() = default;
void SessionAbortedDialog::InitDialog(const std::string& user_email) { void SessionAbortedDialog::InitDialog(const std::string& user_email) {
......
...@@ -21,7 +21,6 @@ class SessionAbortedDialog : public views::DialogDelegateView { ...@@ -21,7 +21,6 @@ class SessionAbortedDialog : public views::DialogDelegateView {
// views::DialogDelegate overrides. // views::DialogDelegate overrides.
bool Accept() override; bool Accept() override;
int GetDialogButtons() const override; int GetDialogButtons() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
// views::WidgetDelegate overrides. // views::WidgetDelegate overrides.
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
......
...@@ -29,6 +29,9 @@ AccessibilityFeatureDisableDialog::AccessibilityFeatureDisableDialog( ...@@ -29,6 +29,9 @@ AccessibilityFeatureDisableDialog::AccessibilityFeatureDisableDialog(
: window_title_(l10n_util::GetStringUTF16(window_title_text_id)), : window_title_(l10n_util::GetStringUTF16(window_title_text_id)),
on_accept_callback_(std::move(on_accept_callback)), on_accept_callback_(std::move(on_accept_callback)),
on_cancel_callback_(std::move(on_cancel_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>()); SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder( SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType( views::LayoutProvider::Get()->GetDialogInsetsForContentType(
...@@ -76,13 +79,6 @@ base::string16 AccessibilityFeatureDisableDialog::GetWindowTitle() const { ...@@ -76,13 +79,6 @@ base::string16 AccessibilityFeatureDisableDialog::GetWindowTitle() const {
return window_title_; 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> base::WeakPtr<AccessibilityFeatureDisableDialog>
AccessibilityFeatureDisableDialog::GetWeakPtr() { AccessibilityFeatureDisableDialog::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr(); return weak_ptr_factory_.GetWeakPtr();
...@@ -92,4 +88,4 @@ const char* AccessibilityFeatureDisableDialog::GetClassName() const { ...@@ -92,4 +88,4 @@ const char* AccessibilityFeatureDisableDialog::GetClassName() const {
return "AccessibilityFeatureDisableDialog"; return "AccessibilityFeatureDisableDialog";
} }
} // namespace ash } // namespace ash
\ No newline at end of file
...@@ -30,7 +30,6 @@ class AccessibilityFeatureDisableDialog : public views::DialogDelegateView { ...@@ -30,7 +30,6 @@ class AccessibilityFeatureDisableDialog : public views::DialogDelegateView {
bool Accept() override; bool Accept() override;
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
base::WeakPtr<AccessibilityFeatureDisableDialog> GetWeakPtr(); base::WeakPtr<AccessibilityFeatureDisableDialog> GetWeakPtr();
...@@ -50,4 +49,4 @@ class AccessibilityFeatureDisableDialog : public views::DialogDelegateView { ...@@ -50,4 +49,4 @@ class AccessibilityFeatureDisableDialog : public views::DialogDelegateView {
} // namespace ash } // namespace ash
#endif // ASH_SYSTEM_ACCESSIBILITY_ACCESSIBILITY_FEATURE_DISABLE_DIALOG_H_ #endif // ASH_SYSTEM_ACCESSIBILITY_ACCESSIBILITY_FEATURE_DISABLE_DIALOG_H_
\ No newline at end of file
...@@ -37,6 +37,10 @@ LogoutConfirmationDialog::LogoutConfirmationDialog( ...@@ -37,6 +37,10 @@ LogoutConfirmationDialog::LogoutConfirmationDialog(
LogoutConfirmationController* controller, LogoutConfirmationController* controller,
base::TimeTicks logout_time) base::TimeTicks logout_time)
: controller_(controller), logout_time_(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>()); SetLayoutManager(std::make_unique<views::FillLayout>());
SetBorder(views::CreateEmptyBorder( SetBorder(views::CreateEmptyBorder(
views::LayoutProvider::Get()->GetDialogInsetsForContentType( views::LayoutProvider::Get()->GetDialogInsetsForContentType(
...@@ -81,13 +85,6 @@ bool LogoutConfirmationDialog::Accept() { ...@@ -81,13 +85,6 @@ bool LogoutConfirmationDialog::Accept() {
return true; 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 { ui::ModalType LogoutConfirmationDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM; return ui::MODAL_TYPE_SYSTEM;
} }
......
...@@ -34,7 +34,6 @@ class LogoutConfirmationDialog : public views::DialogDelegateView { ...@@ -34,7 +34,6 @@ class LogoutConfirmationDialog : public views::DialogDelegateView {
// views::DialogDelegateView: // views::DialogDelegateView:
bool Accept() override; bool Accept() override;
base::string16 GetDialogButtonLabel(ui::DialogButton button) const override;
// views::WidgetDelegate: // views::WidgetDelegate:
ui::ModalType GetModalType() const override; 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