Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: ui/views/window/dialog_client_view.cc

Issue 2660553005: Harmony - convert hung renderer dialog. (Closed)
Patch Set: merge Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..5fd2009f28d8da6e4a54f38a2155a948bd167ce2 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())
- button_row_insets_ = ViewsDelegate::GetInstance()->GetDialogButtonInsets();
}
DialogClientView::~DialogClientView() {
@@ -225,9 +220,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);
tapted 2017/02/03 02:07:54 I think |extra_view_| is sometimes not a button --
Bret 2017/02/03 21:58:35 Right, LayoutButton is agnostic to whether the vie
+ } else {
+ row_bounds.set_width(std::min(row_bounds.width(),
+ extra_view_->GetPreferredSize().width()));
+ extra_view_->SetBoundsRect(row_bounds);
+ }
}
if (height > 0)
@@ -346,8 +345,9 @@ LabelButton* DialogClientView::CreateDialogButton(ui::DialogButton type) {
button = MdTextButton::CreateSecondaryUiButton(this, title);
}
- const int kDialogMinButtonWidth = 75;
- button->SetMinSize(gfx::Size(kDialogMinButtonWidth, 0));
+ // In harmony the minimum size is handled by MdTextButton.
+ if (!ui::MaterialDesignController::IsSecondaryUiMaterial())
+ button->SetMinSize(gfx::Size(kDialogMinimumButtonWidth, 0));
button->SetGroup(kButtonGroup);
return button;
}
@@ -372,6 +372,10 @@ gfx::Insets DialogClientView::GetButtonRowInsets() const {
}
int DialogClientView::GetButtonsAndExtraViewRowTopPadding() const {
+ // Harmony does not use the extra padding.
+ if (ui::MaterialDesignController::IsSecondaryUiMaterial())
+ return 0;
+
int spacing = button_row_insets_.top();
// Some subclasses of DialogClientView, in order to do their own layout, set
// button_row_insets_ to gfx::Insets(). To avoid breaking behavior of those

Powered by Google App Engine
This is Rietveld 408576698