Commit 86eb73af authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

ui: remove DialogDelegate::GetDialogButtons overrides

These are all straightforward.

Bug: 1011446
Change-Id: I6dacfff7d45b9f344be7c5533e1d810cb8332b69
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2007888
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736892}
parent 02722c96
...@@ -151,6 +151,7 @@ CandidateWindowView::CandidateWindowView(gfx::NativeView parent, ...@@ -151,6 +151,7 @@ CandidateWindowView::CandidateWindowView(gfx::NativeView parent,
should_show_upper_side_(false), should_show_upper_side_(false),
was_candidate_window_open_(false), was_candidate_window_open_(false),
window_shell_id_(window_shell_id) { window_shell_id_(window_shell_id) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
SetCanActivate(false); SetCanActivate(false);
DCHECK(parent); DCHECK(parent);
set_parent_window(parent); set_parent_window(parent);
...@@ -401,10 +402,6 @@ const char* CandidateWindowView::GetClassName() const { ...@@ -401,10 +402,6 @@ const char* CandidateWindowView::GetClassName() const {
return "CandidateWindowView"; return "CandidateWindowView";
} }
int CandidateWindowView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void CandidateWindowView::ButtonPressed(views::Button* sender, void CandidateWindowView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
for (size_t i = 0; i < candidate_views_.size(); ++i) { for (size_t i = 0; i < candidate_views_.size(); ++i) {
......
...@@ -82,7 +82,6 @@ class UI_CHROMEOS_EXPORT CandidateWindowView ...@@ -82,7 +82,6 @@ class UI_CHROMEOS_EXPORT CandidateWindowView
// views::BubbleDialogDelegateView: // views::BubbleDialogDelegateView:
const char* GetClassName() const override; const char* GetClassName() const override;
int GetDialogButtons() const override;
// Overridden from views::ButtonListener: // Overridden from views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override; void ButtonPressed(views::Button* sender, const ui::Event& event) override;
......
...@@ -173,6 +173,7 @@ InfolistWindow::InfolistWindow(views::View* candidate_window, ...@@ -173,6 +173,7 @@ InfolistWindow::InfolistWindow(views::View* candidate_window,
title_font_list_(gfx::Font(kJapaneseFontName, kFontSizeDelta + 15)), title_font_list_(gfx::Font(kJapaneseFontName, kFontSizeDelta + 15)),
description_font_list_( description_font_list_(
gfx::Font(kJapaneseFontName, kFontSizeDelta + 11)) { gfx::Font(kJapaneseFontName, kFontSizeDelta + 11)) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
SetCanActivate(false); SetCanActivate(false);
set_accept_events(false); set_accept_events(false);
set_margins(gfx::Insets()); set_margins(gfx::Insets());
...@@ -275,10 +276,6 @@ const char* InfolistWindow::GetClassName() const { ...@@ -275,10 +276,6 @@ const char* InfolistWindow::GetClassName() const {
return "InfolistWindow"; return "InfolistWindow";
} }
int InfolistWindow::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void InfolistWindow::WindowClosing() { void InfolistWindow::WindowClosing() {
show_hide_timer_.Stop(); show_hide_timer_.Stop();
} }
......
...@@ -45,7 +45,6 @@ class UI_CHROMEOS_EXPORT InfolistWindow ...@@ -45,7 +45,6 @@ class UI_CHROMEOS_EXPORT InfolistWindow
private: private:
// views::BubbleDialogDelegateView: // views::BubbleDialogDelegateView:
const char* GetClassName() const override; const char* GetClassName() const override;
int GetDialogButtons() const override;
// views::WidgetDelegate implementation. // views::WidgetDelegate implementation.
void WindowClosing() override; void WindowClosing() override;
......
...@@ -54,11 +54,11 @@ base::string16 GetArrowName(BubbleBorder::Arrow arrow) { ...@@ -54,11 +54,11 @@ base::string16 GetArrowName(BubbleBorder::Arrow arrow) {
class ExampleBubble : public BubbleDialogDelegateView { class ExampleBubble : public BubbleDialogDelegateView {
public: public:
ExampleBubble(View* anchor, BubbleBorder::Arrow arrow) ExampleBubble(View* anchor, BubbleBorder::Arrow arrow)
: BubbleDialogDelegateView(anchor, arrow) {} : BubbleDialogDelegateView(anchor, arrow) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
}
protected: protected:
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; }
void Init() override { void Init() override {
SetLayoutManager(std::make_unique<BoxLayout>( SetLayoutManager(std::make_unique<BoxLayout>(
BoxLayout::Orientation::kVertical, gfx::Insets(50))); BoxLayout::Orientation::kVertical, gfx::Insets(50)));
......
...@@ -876,7 +876,9 @@ class AdvanceFocusWidgetDelegate : public WidgetDelegate { ...@@ -876,7 +876,9 @@ class AdvanceFocusWidgetDelegate : public WidgetDelegate {
class TestBubbleDialogDelegateView : public BubbleDialogDelegateView { class TestBubbleDialogDelegateView : public BubbleDialogDelegateView {
public: public:
explicit TestBubbleDialogDelegateView(View* anchor) explicit TestBubbleDialogDelegateView(View* anchor)
: BubbleDialogDelegateView(anchor, BubbleBorder::NONE) {} : BubbleDialogDelegateView(anchor, BubbleBorder::NONE) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
}
~TestBubbleDialogDelegateView() override = default; ~TestBubbleDialogDelegateView() override = default;
// If this is called, the bubble will be forced to use a NativeWidgetAura. // If this is called, the bubble will be forced to use a NativeWidgetAura.
...@@ -884,9 +886,6 @@ class TestBubbleDialogDelegateView : public BubbleDialogDelegateView { ...@@ -884,9 +886,6 @@ class TestBubbleDialogDelegateView : public BubbleDialogDelegateView {
// platform and other factors. // platform and other factors.
void UseNativeWidgetAura() { use_native_widget_aura_ = true; } void UseNativeWidgetAura() { use_native_widget_aura_ = true; }
// BubbleDialogDelegateView:
int GetDialogButtons() const override { return 0; }
void OnBeforeBubbleWidgetInit(Widget::InitParams* params, void OnBeforeBubbleWidgetInit(Widget::InitParams* params,
Widget* widget) const override { Widget* widget) const override {
#if defined(USE_AURA) #if defined(USE_AURA)
......
...@@ -41,6 +41,7 @@ TouchSelectionMenuViews::TouchSelectionMenuViews( ...@@ -41,6 +41,7 @@ TouchSelectionMenuViews::TouchSelectionMenuViews(
DCHECK(owner_); DCHECK(owner_);
DCHECK(client_); DCHECK(client_);
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
set_shadow(BubbleBorder::SMALL_SHADOW); set_shadow(BubbleBorder::SMALL_SHADOW);
set_parent_window(context); set_parent_window(context);
constexpr gfx::Insets kMenuMargins = gfx::Insets(1); constexpr gfx::Insets kMenuMargins = gfx::Insets(1);
...@@ -167,10 +168,6 @@ void TouchSelectionMenuViews::WindowClosing() { ...@@ -167,10 +168,6 @@ void TouchSelectionMenuViews::WindowClosing() {
DisconnectOwner(); DisconnectOwner();
} }
int TouchSelectionMenuViews::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void TouchSelectionMenuViews::ButtonPressed(Button* sender, void TouchSelectionMenuViews::ButtonPressed(Button* sender,
const ui::Event& event) { const ui::Event& event) {
CloseMenu(); CloseMenu();
......
...@@ -59,7 +59,6 @@ class VIEWS_EXPORT TouchSelectionMenuViews : public BubbleDialogDelegateView, ...@@ -59,7 +59,6 @@ class VIEWS_EXPORT TouchSelectionMenuViews : public BubbleDialogDelegateView,
// BubbleDialogDelegateView: // BubbleDialogDelegateView:
void OnPaint(gfx::Canvas* canvas) override; void OnPaint(gfx::Canvas* canvas) override;
void WindowClosing() override; void WindowClosing() override;
int GetDialogButtons() const override;
TouchSelectionMenuRunnerViews* owner_; TouchSelectionMenuRunnerViews* owner_;
ui::TouchSelectionMenuClient* const client_; ui::TouchSelectionMenuClient* const client_;
......
...@@ -1109,17 +1109,18 @@ class ModalDialogDelegate : public DialogDelegateView { ...@@ -1109,17 +1109,18 @@ class ModalDialogDelegate : public DialogDelegateView {
: modal_type_(modal_type) {} : modal_type_(modal_type) {}
void set_can_close(bool value) { can_close_ = value; } void set_can_close(bool value) { can_close_ = value; }
void set_buttons(int buttons) { buttons_ = buttons; } void SetButtons(int buttons) {
DialogDelegate::set_buttons(buttons);
DialogModelChanged();
}
// DialogDelegateView: // DialogDelegateView:
int GetDialogButtons() const override { return buttons_; }
ui::ModalType GetModalType() const override { return modal_type_; } ui::ModalType GetModalType() const override { return modal_type_; }
bool Close() override { return can_close_; } bool Close() override { return can_close_; }
private: private:
const ui::ModalType modal_type_; const ui::ModalType modal_type_;
bool can_close_ = true; bool can_close_ = true;
int buttons_ = ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate); DISALLOW_COPY_AND_ASSIGN(ModalDialogDelegate);
}; };
...@@ -2440,7 +2441,7 @@ TEST_F(NativeWidgetMacTest, TouchBar) { ...@@ -2440,7 +2441,7 @@ TEST_F(NativeWidgetMacTest, TouchBar) {
} }
// Remove the cancel button. // Remove the cancel button.
delegate->set_buttons(ui::DIALOG_BUTTON_OK); delegate->SetButtons(ui::DIALOG_BUTTON_OK);
delegate->DialogModelChanged(); delegate->DialogModelChanged();
EXPECT_TRUE(delegate->GetOkButton()); EXPECT_TRUE(delegate->GetOkButton());
EXPECT_FALSE(delegate->GetCancelButton()); EXPECT_FALSE(delegate->GetCancelButton());
......
...@@ -69,7 +69,6 @@ class TestDialog : public DialogDelegateView { ...@@ -69,7 +69,6 @@ class TestDialog : public DialogDelegateView {
} }
base::string16 GetWindowTitle() const override { return title_; } base::string16 GetWindowTitle() const override { return title_; }
View* GetInitiallyFocusedView() override { return input_; } View* GetInitiallyFocusedView() override { return input_; }
int GetDialogButtons() const override { return dialog_buttons_; }
void CheckAndResetStates(bool canceled, void CheckAndResetStates(bool canceled,
bool accepted, bool accepted,
...@@ -94,9 +93,6 @@ class TestDialog : public DialogDelegateView { ...@@ -94,9 +93,6 @@ class TestDialog : public DialogDelegateView {
void set_should_handle_escape(bool should_handle_escape) { void set_should_handle_escape(bool should_handle_escape) {
should_handle_escape_ = should_handle_escape; should_handle_escape_ = should_handle_escape;
} }
void set_dialog_buttons(int dialog_buttons) {
dialog_buttons_ = dialog_buttons;
}
views::Textfield* input() { return input_; } views::Textfield* input() { return input_; }
...@@ -110,7 +106,6 @@ class TestDialog : public DialogDelegateView { ...@@ -110,7 +106,6 @@ class TestDialog : public DialogDelegateView {
base::string16 title_; base::string16 title_;
bool show_close_button_ = true; bool show_close_button_ = true;
bool should_handle_escape_ = false; bool should_handle_escape_ = false;
int dialog_buttons_ = ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
DISALLOW_COPY_AND_ASSIGN(TestDialog); DISALLOW_COPY_AND_ASSIGN(TestDialog);
}; };
...@@ -369,12 +364,11 @@ TEST_F(DialogTest, InitialFocus) { ...@@ -369,12 +364,11 @@ TEST_F(DialogTest, InitialFocus) {
// A dialog for testing initial focus with only an OK button. // A dialog for testing initial focus with only an OK button.
class InitialFocusTestDialog : public DialogDelegateView { class InitialFocusTestDialog : public DialogDelegateView {
public: public:
InitialFocusTestDialog() = default; InitialFocusTestDialog() {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_OK);
}
~InitialFocusTestDialog() override = default; ~InitialFocusTestDialog() override = default;
// DialogDelegateView overrides:
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_OK; }
private: private:
DISALLOW_COPY_AND_ASSIGN(InitialFocusTestDialog); DISALLOW_COPY_AND_ASSIGN(InitialFocusTestDialog);
}; };
......
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