Commit 38a58c54 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

ash: remove GetDialogButtons overrides

These are all straightforward replacements with
DialogDelegate::set_buttons(), where still needed. One of them was
specifying OK | CANCEL, which is the default.

Bug: 1011446
Change-Id: I8c81468bd50425091f8a330b0d4427a1b4b7874f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1992520Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#729852}
parent fa3773a8
...@@ -224,6 +224,8 @@ AssistantContainerView::AssistantContainerView(AssistantViewDelegate* delegate) ...@@ -224,6 +224,8 @@ AssistantContainerView::AssistantContainerView(AssistantViewDelegate* delegate)
: delegate_(delegate), : delegate_(delegate),
animator_(AssistantContainerViewAnimator::Create(delegate_, this)), animator_(AssistantContainerViewAnimator::Create(delegate_, this)),
focus_traversable_(this) { focus_traversable_(this) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
UpdateAnchor(); UpdateAnchor();
set_accept_events(true); set_accept_events(true);
...@@ -276,10 +278,6 @@ base::string16 AssistantContainerView::GetAccessibleWindowTitle() const { ...@@ -276,10 +278,6 @@ base::string16 AssistantContainerView::GetAccessibleWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_WINDOW); return l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_WINDOW);
} }
int AssistantContainerView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
views::FocusTraversable* AssistantContainerView::GetFocusTraversable() { views::FocusTraversable* AssistantContainerView::GetFocusTraversable() {
auto* focus_manager = GetFocusManager(); auto* focus_manager = GetFocusManager();
if (focus_manager && focus_manager->GetFocusedView()) if (focus_manager && focus_manager->GetFocusedView())
......
...@@ -36,7 +36,6 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantContainerView ...@@ -36,7 +36,6 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantContainerView
void AddedToWidget() override; void AddedToWidget() override;
ax::mojom::Role GetAccessibleWindowRole() override; ax::mojom::Role GetAccessibleWindowRole() override;
base::string16 GetAccessibleWindowTitle() const override; base::string16 GetAccessibleWindowTitle() const override;
int GetDialogButtons() const override;
views::FocusTraversable* GetFocusTraversable() override; views::FocusTraversable* GetFocusTraversable() override;
void ChildPreferredSizeChanged(views::View* child) override; void ChildPreferredSizeChanged(views::View* child) override;
void ViewHierarchyChanged( void ViewHierarchyChanged(
......
...@@ -49,6 +49,7 @@ class ModeIndicatorFrameView : public views::BubbleFrameView { ...@@ -49,6 +49,7 @@ class ModeIndicatorFrameView : public views::BubbleFrameView {
ImeModeIndicatorView::ImeModeIndicatorView(const gfx::Rect& cursor_bounds, ImeModeIndicatorView::ImeModeIndicatorView(const gfx::Rect& cursor_bounds,
const base::string16& label) const base::string16& label)
: cursor_bounds_(cursor_bounds), label_view_(new views::Label(label)) { : cursor_bounds_(cursor_bounds), label_view_(new views::Label(label)) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
SetCanActivate(false); SetCanActivate(false);
set_accept_events(false); set_accept_events(false);
set_shadow(views::BubbleBorder::BIG_SHADOW); set_shadow(views::BubbleBorder::BIG_SHADOW);
...@@ -87,10 +88,6 @@ const char* ImeModeIndicatorView::GetClassName() const { ...@@ -87,10 +88,6 @@ const char* ImeModeIndicatorView::GetClassName() const {
return "ImeModeIndicatorView"; return "ImeModeIndicatorView";
} }
int ImeModeIndicatorView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void ImeModeIndicatorView::Init() { void ImeModeIndicatorView::Init() {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(label_view_); AddChildView(label_view_);
......
...@@ -36,7 +36,6 @@ class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView { ...@@ -36,7 +36,6 @@ class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
views::Widget* widget) const override; views::Widget* widget) const override;
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
const char* GetClassName() const override; const char* GetClassName() const override;
int GetDialogButtons() const override;
void Init() override; void Init() override;
protected: protected:
......
...@@ -62,6 +62,7 @@ class BulletView : public views::View { ...@@ -62,6 +62,7 @@ class BulletView : public views::View {
PublicAccountWarningDialog::PublicAccountWarningDialog( PublicAccountWarningDialog::PublicAccountWarningDialog(
base::WeakPtr<LoginExpandedPublicAccountView> controller) base::WeakPtr<LoginExpandedPublicAccountView> controller)
: controller_(controller) { : controller_(controller) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
SetLayoutManager(std::make_unique<views::BoxLayout>( SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(), views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kBetweenLabelPaddingDp)); kBetweenLabelPaddingDp));
...@@ -118,10 +119,6 @@ void PublicAccountWarningDialog::Show() { ...@@ -118,10 +119,6 @@ void PublicAccountWarningDialog::Show() {
GetWidget()->Show(); GetWidget()->Show();
} }
int PublicAccountWarningDialog::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void PublicAccountWarningDialog::AddedToWidget() { void PublicAccountWarningDialog::AddedToWidget() {
std::unique_ptr<views::Label> title_label = std::unique_ptr<views::Label> title_label =
views::BubbleFrameView::CreateDefaultTitleLabel(l10n_util::GetStringUTF16( views::BubbleFrameView::CreateDefaultTitleLabel(l10n_util::GetStringUTF16(
......
...@@ -25,7 +25,6 @@ class ASH_EXPORT PublicAccountWarningDialog : public views::DialogDelegateView { ...@@ -25,7 +25,6 @@ class ASH_EXPORT PublicAccountWarningDialog : public views::DialogDelegateView {
void Show(); void Show();
// views::DialogDelegate: // views::DialogDelegate:
int GetDialogButtons() const override;
void AddedToWidget() override; void AddedToWidget() override;
// views::WidgetDelegate: // views::WidgetDelegate:
......
...@@ -54,10 +54,6 @@ bool SessionAbortedDialog::Accept() { ...@@ -54,10 +54,6 @@ bool SessionAbortedDialog::Accept() {
return true; return true;
} }
int SessionAbortedDialog::GetDialogButtons() const {
return ui::DIALOG_BUTTON_OK;
}
ui::ModalType SessionAbortedDialog::GetModalType() const { ui::ModalType SessionAbortedDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM; return ui::MODAL_TYPE_SYSTEM;
} }
...@@ -78,6 +74,7 @@ gfx::Size SessionAbortedDialog::CalculatePreferredSize() const { ...@@ -78,6 +74,7 @@ gfx::Size SessionAbortedDialog::CalculatePreferredSize() const {
} }
SessionAbortedDialog::SessionAbortedDialog() { SessionAbortedDialog::SessionAbortedDialog() {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_OK);
DialogDelegate::set_button_label( DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK, ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16( l10n_util::GetStringUTF16(
......
...@@ -20,7 +20,6 @@ class SessionAbortedDialog : public views::DialogDelegateView { ...@@ -20,7 +20,6 @@ class SessionAbortedDialog : public views::DialogDelegateView {
// views::DialogDelegate overrides. // views::DialogDelegate overrides.
bool Accept() override; bool Accept() override;
int GetDialogButtons() const override;
// views::WidgetDelegate overrides. // views::WidgetDelegate overrides.
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
......
...@@ -36,6 +36,7 @@ ShelfBubble::ShelfBubble(views::View* anchor, ...@@ -36,6 +36,7 @@ ShelfBubble::ShelfBubble(views::View* anchor,
/* Don't pass the Shelf so the translucent color is always used. */ /* Don't pass the Shelf so the translucent color is always used. */
nullptr, nullptr,
Shell::Get()->wallpaper_controller()) { Shell::Get()->wallpaper_controller()) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
background_animator_.Init(ShelfBackgroundType::kDefaultBg); background_animator_.Init(ShelfBackgroundType::kDefaultBg);
background_animator_.AddObserver(this); background_animator_.AddObserver(this);
...@@ -65,10 +66,6 @@ void ShelfBubble::CreateBubble() { ...@@ -65,10 +66,6 @@ void ShelfBubble::CreateBubble() {
GetBubbleFrameView()->SetBackgroundColor(color()); GetBubbleFrameView()->SetBackgroundColor(color());
} }
int ShelfBubble::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void ShelfBubble::UpdateShelfBackground(SkColor color) { void ShelfBubble::UpdateShelfBackground(SkColor color) {
set_color(color); set_color(color);
} }
......
...@@ -45,9 +45,6 @@ class ASH_EXPORT ShelfBubble : public views::BubbleDialogDelegateView, ...@@ -45,9 +45,6 @@ class ASH_EXPORT ShelfBubble : public views::BubbleDialogDelegateView,
void CreateBubble(); void CreateBubble();
private: private:
// BubbleDialogDelegateView overrides:
int GetDialogButtons() const override;
// ShelfBackgroundAnimatorObserver: // ShelfBackgroundAnimatorObserver:
void UpdateShelfBackground(SkColor color) override; void UpdateShelfBackground(SkColor color) override;
......
...@@ -102,6 +102,7 @@ class NetworkStateListDetailedView::InfoBubble ...@@ -102,6 +102,7 @@ class NetworkStateListDetailedView::InfoBubble
NetworkStateListDetailedView* detailed_view) NetworkStateListDetailedView* detailed_view)
: views::BubbleDialogDelegateView(anchor, views::BubbleBorder::TOP_RIGHT), : views::BubbleDialogDelegateView(anchor, views::BubbleBorder::TOP_RIGHT),
detailed_view_(detailed_view) { detailed_view_(detailed_view) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
set_margins(gfx::Insets(kBubbleMargin)); set_margins(gfx::Insets(kBubbleMargin));
SetArrow(views::BubbleBorder::NONE); SetArrow(views::BubbleBorder::NONE);
set_shadow(views::BubbleBorder::NO_ASSETS); set_shadow(views::BubbleBorder::NO_ASSETS);
...@@ -138,9 +139,6 @@ class NetworkStateListDetailedView::InfoBubble ...@@ -138,9 +139,6 @@ class NetworkStateListDetailedView::InfoBubble
detailed_view_->ResetInfoBubble(); detailed_view_->ResetInfoBubble();
} }
// BubbleDialogDelegateView:
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; }
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params, void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override { views::Widget* widget) const override {
params->shadow_type = views::Widget::InitParams::ShadowType::kDrop; params->shadow_type = views::Widget::InitParams::ShadowType::kDrop;
......
...@@ -36,6 +36,7 @@ class PaletteWelcomeBubble::WelcomeBubbleView ...@@ -36,6 +36,7 @@ class PaletteWelcomeBubble::WelcomeBubbleView
public: public:
WelcomeBubbleView(views::View* anchor, views::BubbleBorder::Arrow arrow) WelcomeBubbleView(views::View* anchor, views::BubbleBorder::Arrow arrow)
: views::BubbleDialogDelegateView(anchor, arrow) { : views::BubbleDialogDelegateView(anchor, arrow) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
set_close_on_deactivate(true); set_close_on_deactivate(true);
SetCanActivate(false); SetCanActivate(false);
set_accept_events(true); set_accept_events(true);
...@@ -68,8 +69,6 @@ class PaletteWelcomeBubble::WelcomeBubbleView ...@@ -68,8 +69,6 @@ class PaletteWelcomeBubble::WelcomeBubbleView
AddChildView(label); AddChildView(label);
} }
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; }
// views::View: // views::View:
const char* GetClassName() const override { return "WelcomeBubbleView"; } const char* GetClassName() const override { return "WelcomeBubbleView"; }
......
...@@ -36,10 +36,6 @@ class CancelCastingDialog : public views::DialogDelegateView { ...@@ -36,10 +36,6 @@ class CancelCastingDialog : public views::DialogDelegateView {
return l10n_util::GetStringUTF16(IDS_DESKTOP_CASTING_ACTIVE_TITLE); return l10n_util::GetStringUTF16(IDS_DESKTOP_CASTING_ACTIVE_TITLE);
} }
int GetDialogButtons() const override {
return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL;
}
bool Cancel() override { bool Cancel() override {
std::move(callback_).Run(false); std::move(callback_).Run(false);
return true; return true;
......
...@@ -225,6 +225,7 @@ TrayBubbleView::TrayBubbleView(const InitParams& init_params) ...@@ -225,6 +225,7 @@ TrayBubbleView::TrayBubbleView(const InitParams& init_params)
owned_bubble_border_(bubble_border_), owned_bubble_border_(bubble_border_),
is_gesture_dragging_(false), is_gesture_dragging_(false),
mouse_actively_entered_(false) { mouse_actively_entered_(false) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
DCHECK(delegate_); DCHECK(delegate_);
DCHECK(params_.parent_window); DCHECK(params_.parent_window);
// anchor_widget() is computed by BubbleDialogDelegateView(). // anchor_widget() is computed by BubbleDialogDelegateView().
...@@ -350,10 +351,6 @@ bool TrayBubbleView::IsAnchoredToStatusArea() const { ...@@ -350,10 +351,6 @@ bool TrayBubbleView::IsAnchoredToStatusArea() const {
return true; return true;
} }
int TrayBubbleView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
ax::mojom::Role TrayBubbleView::GetAccessibleWindowRole() { ax::mojom::Role TrayBubbleView::GetAccessibleWindowRole() {
// We override the role because the base class sets it to alert dialog. // We override the role because the base class sets it to alert dialog.
// This would make screen readers announce the whole of the system tray // This would make screen readers announce the whole of the system tray
......
...@@ -177,7 +177,6 @@ class ASH_EXPORT TrayBubbleView : public views::BubbleDialogDelegateView, ...@@ -177,7 +177,6 @@ class ASH_EXPORT TrayBubbleView : public views::BubbleDialogDelegateView,
protected: protected:
// Overridden from views::BubbleDialogDelegateView. // Overridden from views::BubbleDialogDelegateView.
int GetDialogButtons() const override;
ax::mojom::Role GetAccessibleWindowRole() override; ax::mojom::Role GetAccessibleWindowRole() override;
// Overridden from views::View. // Overridden from views::View.
......
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