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)
: delegate_(delegate),
animator_(AssistantContainerViewAnimator::Create(delegate_, this)),
focus_traversable_(this) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
UpdateAnchor();
set_accept_events(true);
......@@ -276,10 +278,6 @@ base::string16 AssistantContainerView::GetAccessibleWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_ASH_ASSISTANT_WINDOW);
}
int AssistantContainerView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
views::FocusTraversable* AssistantContainerView::GetFocusTraversable() {
auto* focus_manager = GetFocusManager();
if (focus_manager && focus_manager->GetFocusedView())
......
......@@ -36,7 +36,6 @@ class COMPONENT_EXPORT(ASSISTANT_UI) AssistantContainerView
void AddedToWidget() override;
ax::mojom::Role GetAccessibleWindowRole() override;
base::string16 GetAccessibleWindowTitle() const override;
int GetDialogButtons() const override;
views::FocusTraversable* GetFocusTraversable() override;
void ChildPreferredSizeChanged(views::View* child) override;
void ViewHierarchyChanged(
......
......@@ -49,6 +49,7 @@ class ModeIndicatorFrameView : public views::BubbleFrameView {
ImeModeIndicatorView::ImeModeIndicatorView(const gfx::Rect& cursor_bounds,
const base::string16& label)
: cursor_bounds_(cursor_bounds), label_view_(new views::Label(label)) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
SetCanActivate(false);
set_accept_events(false);
set_shadow(views::BubbleBorder::BIG_SHADOW);
......@@ -87,10 +88,6 @@ const char* ImeModeIndicatorView::GetClassName() const {
return "ImeModeIndicatorView";
}
int ImeModeIndicatorView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void ImeModeIndicatorView::Init() {
SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(label_view_);
......
......@@ -36,7 +36,6 @@ class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
views::Widget* widget) const override;
gfx::Size CalculatePreferredSize() const override;
const char* GetClassName() const override;
int GetDialogButtons() const override;
void Init() override;
protected:
......
......@@ -62,6 +62,7 @@ class BulletView : public views::View {
PublicAccountWarningDialog::PublicAccountWarningDialog(
base::WeakPtr<LoginExpandedPublicAccountView> controller)
: controller_(controller) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical, gfx::Insets(),
kBetweenLabelPaddingDp));
......@@ -118,10 +119,6 @@ void PublicAccountWarningDialog::Show() {
GetWidget()->Show();
}
int PublicAccountWarningDialog::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void PublicAccountWarningDialog::AddedToWidget() {
std::unique_ptr<views::Label> title_label =
views::BubbleFrameView::CreateDefaultTitleLabel(l10n_util::GetStringUTF16(
......
......@@ -25,7 +25,6 @@ class ASH_EXPORT PublicAccountWarningDialog : public views::DialogDelegateView {
void Show();
// views::DialogDelegate:
int GetDialogButtons() const override;
void AddedToWidget() override;
// views::WidgetDelegate:
......
......@@ -54,10 +54,6 @@ bool SessionAbortedDialog::Accept() {
return true;
}
int SessionAbortedDialog::GetDialogButtons() const {
return ui::DIALOG_BUTTON_OK;
}
ui::ModalType SessionAbortedDialog::GetModalType() const {
return ui::MODAL_TYPE_SYSTEM;
}
......@@ -78,6 +74,7 @@ gfx::Size SessionAbortedDialog::CalculatePreferredSize() const {
}
SessionAbortedDialog::SessionAbortedDialog() {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_OK);
DialogDelegate::set_button_label(
ui::DIALOG_BUTTON_OK,
l10n_util::GetStringUTF16(
......
......@@ -20,7 +20,6 @@ class SessionAbortedDialog : public views::DialogDelegateView {
// views::DialogDelegate overrides.
bool Accept() override;
int GetDialogButtons() const override;
// views::WidgetDelegate overrides.
ui::ModalType GetModalType() const override;
......
......@@ -36,6 +36,7 @@ ShelfBubble::ShelfBubble(views::View* anchor,
/* Don't pass the Shelf so the translucent color is always used. */
nullptr,
Shell::Get()->wallpaper_controller()) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
background_animator_.Init(ShelfBackgroundType::kDefaultBg);
background_animator_.AddObserver(this);
......@@ -65,10 +66,6 @@ void ShelfBubble::CreateBubble() {
GetBubbleFrameView()->SetBackgroundColor(color());
}
int ShelfBubble::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
void ShelfBubble::UpdateShelfBackground(SkColor color) {
set_color(color);
}
......
......@@ -45,9 +45,6 @@ class ASH_EXPORT ShelfBubble : public views::BubbleDialogDelegateView,
void CreateBubble();
private:
// BubbleDialogDelegateView overrides:
int GetDialogButtons() const override;
// ShelfBackgroundAnimatorObserver:
void UpdateShelfBackground(SkColor color) override;
......
......@@ -102,6 +102,7 @@ class NetworkStateListDetailedView::InfoBubble
NetworkStateListDetailedView* detailed_view)
: views::BubbleDialogDelegateView(anchor, views::BubbleBorder::TOP_RIGHT),
detailed_view_(detailed_view) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
set_margins(gfx::Insets(kBubbleMargin));
SetArrow(views::BubbleBorder::NONE);
set_shadow(views::BubbleBorder::NO_ASSETS);
......@@ -138,9 +139,6 @@ class NetworkStateListDetailedView::InfoBubble
detailed_view_->ResetInfoBubble();
}
// BubbleDialogDelegateView:
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; }
void OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
views::Widget* widget) const override {
params->shadow_type = views::Widget::InitParams::ShadowType::kDrop;
......
......@@ -36,6 +36,7 @@ class PaletteWelcomeBubble::WelcomeBubbleView
public:
WelcomeBubbleView(views::View* anchor, views::BubbleBorder::Arrow arrow)
: views::BubbleDialogDelegateView(anchor, arrow) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
set_close_on_deactivate(true);
SetCanActivate(false);
set_accept_events(true);
......@@ -68,8 +69,6 @@ class PaletteWelcomeBubble::WelcomeBubbleView
AddChildView(label);
}
int GetDialogButtons() const override { return ui::DIALOG_BUTTON_NONE; }
// views::View:
const char* GetClassName() const override { return "WelcomeBubbleView"; }
......
......@@ -36,10 +36,6 @@ class CancelCastingDialog : public views::DialogDelegateView {
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 {
std::move(callback_).Run(false);
return true;
......
......@@ -225,6 +225,7 @@ TrayBubbleView::TrayBubbleView(const InitParams& init_params)
owned_bubble_border_(bubble_border_),
is_gesture_dragging_(false),
mouse_actively_entered_(false) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_NONE);
DCHECK(delegate_);
DCHECK(params_.parent_window);
// anchor_widget() is computed by BubbleDialogDelegateView().
......@@ -350,10 +351,6 @@ bool TrayBubbleView::IsAnchoredToStatusArea() const {
return true;
}
int TrayBubbleView::GetDialogButtons() const {
return ui::DIALOG_BUTTON_NONE;
}
ax::mojom::Role TrayBubbleView::GetAccessibleWindowRole() {
// 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
......
......@@ -177,7 +177,6 @@ class ASH_EXPORT TrayBubbleView : public views::BubbleDialogDelegateView,
protected:
// Overridden from views::BubbleDialogDelegateView.
int GetDialogButtons() const override;
ax::mojom::Role GetAccessibleWindowRole() override;
// 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