Chromium Code Reviews| Index: ui/views/window/dialog_client_view.cc |
| diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc |
| index ee88f8654e741d8370cbb236fb3f1f24aeef8efb..d68730d56f08772b49346458611710adfd7c480e 100644 |
| --- a/ui/views/window/dialog_client_view.cc |
| +++ b/ui/views/window/dialog_client_view.cc |
| @@ -42,9 +42,7 @@ bool ShouldShow(View* view) { |
| } |
| // Do the layout for a button. |
| -void LayoutButton(LabelButton* button, |
| - gfx::Rect* row_bounds, |
| - int button_height) { |
| +void LayoutButton(View* button, gfx::Rect* row_bounds, int button_height) { |
| if (!button) |
| return; |
| @@ -81,9 +79,6 @@ DialogClientView::DialogClientView(Widget* owner, View* contents_view) |
| // Doing this now ensures this accelerator will have lower priority than |
| // one set by the contents view. |
| AddAccelerator(ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_NONE)); |
| - |
| - if (ViewsDelegate::GetInstance()) |
|
Bret
2017/02/01 00:05:30
This is redundant with the first line of the funct
|
| - button_row_insets_ = ViewsDelegate::GetInstance()->GetDialogButtonInsets(); |
| } |
| DialogClientView::~DialogClientView() { |
| @@ -178,9 +173,12 @@ gfx::Size DialogClientView::GetPreferredSize() const { |
| : 0), |
| 0); |
| - int buttons_height = GetButtonsAndExtraViewRowHeight(); |
| - if (buttons_height != 0) { |
| - size.Enlarge(0, buttons_height + GetButtonsAndExtraViewRowTopPadding()); |
| + int buttons_row_height = GetButtonsAndExtraViewRowHeight(); |
| + if (buttons_row_height != 0) { |
| + // Harmony does not use the extra padding. |
| + if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) |
| + buttons_row_height += GetButtonsAndExtraViewRowTopPadding(); |
| + size.Enlarge(0, buttons_row_height); |
| // Inset the buttons and extra view. |
| const gfx::Insets insets = GetButtonRowInsets(); |
| size.Enlarge(insets.width(), insets.height()); |
| @@ -225,9 +223,13 @@ void DialogClientView::Layout() { |
| custom_padding -= GetButtonsAndExtraViewRowTopPadding(); |
| row_bounds.set_width(row_bounds.width() - custom_padding); |
| } |
| - row_bounds.set_width(std::min(row_bounds.width(), |
| - extra_view_->GetPreferredSize().width())); |
| - extra_view_->SetBoundsRect(row_bounds); |
| + if (GetDialogDelegate()->GroupExtraViewWithButtons()) { |
| + LayoutButton(extra_view_, &row_bounds, button_height); |
| + } else { |
| + row_bounds.set_width(std::min(row_bounds.width(), |
| + extra_view_->GetPreferredSize().width())); |
| + extra_view_->SetBoundsRect(row_bounds); |
| + } |
| } |
| if (height > 0) |
| @@ -346,8 +348,11 @@ LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) { |
| button = MdTextButton::CreateSecondaryUiButton(this, title); |
| } |
| - const int kDialogMinButtonWidth = 75; |
| - button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0)); |
| + const int minimum_button_width = |
| + ViewsDelegate::GetInstance() |
| + ? ViewsDelegate::GetInstance()->GetDialogButtonMinimumWidth() |
|
tapted
2017/02/01 00:52:48
I feel like this isn't the best place to bake in t
Bret
2017/02/01 02:21:46
Oh you're right, that's odd. I was told to make th
Peter Kasting
2017/02/02 00:32:30
The spec I have ( https://folio.googleplex.com/chr
Bret
2017/02/03 01:47:17
I think I understand. I changed the minimum width
|
| + : kDialogMinimumButtonWidth; |
| + button->SetMinSize(gfx::Size(minimum_button_width, 0)); |
| button->SetGroup(kButtonGroup); |
| return button; |
| } |