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 569944542f94a7623b6c4c9f96f84cc393728a72..55d58b55cd3871d5da749166487ccd470cd01c55 100644 |
--- a/ui/views/window/dialog_client_view.cc |
+++ b/ui/views/window/dialog_client_view.cc |
@@ -54,12 +54,14 @@ void LayoutButton(LabelButton* button, gfx::Rect* row_bounds) { |
DialogClientView::DialogClientView(Widget* owner, View* contents_view) |
: ClientView(owner, contents_view), |
+ button_row_insets_(gfx::Insets(0, |
+ kButtonHEdgeMarginNew, |
+ kButtonVEdgeMarginNew, |
+ kButtonHEdgeMarginNew)), |
ok_button_(NULL), |
cancel_button_(NULL), |
extra_view_(NULL), |
- footnote_view_(NULL), |
- notified_delegate_(false) { |
-} |
+ notified_delegate_(false) {} |
DialogClientView::~DialogClientView() { |
} |
@@ -87,8 +89,6 @@ void DialogClientView::UpdateDialogButtons() { |
if (buttons & ui::DIALOG_BUTTON_OK) { |
if (!ok_button_) { |
ok_button_ = CreateDialogButton(ui::DIALOG_BUTTON_OK); |
- if (!(buttons & ui::DIALOG_BUTTON_CANCEL)) |
- ok_button_->AddAccelerator(escape); |
msw
2016/02/22 21:43:56
Is this behavior change necessary? It seems tangen
Evan Stade
2016/02/22 22:58:23
It's not a behavior change. I guess I forgot to ex
msw
2016/02/22 23:24:57
Hmm, okay; it seems like this should yield the sam
|
AddChildView(ok_button_); |
} |
@@ -111,8 +111,8 @@ void DialogClientView::UpdateDialogButtons() { |
cancel_button_ = NULL; |
} |
- // Use the escape key to close the window if there are no dialog buttons. |
- if (!has_dialog_buttons()) |
+ // Use the escape key to close the window if there's no cancel button. |
+ if (!cancel_button_) |
AddAccelerator(escape); |
else |
ResetAccelerators(); |
@@ -174,31 +174,12 @@ gfx::Size DialogClientView::GetPreferredSize() const { |
size.Enlarge(0, contents_size.height()); |
size.set_width(std::max(size.width(), contents_size.width())); |
- // Increase the size as needed to fit the footnote view. |
- if (ShouldShow(footnote_view_)) { |
- gfx::Size footnote_size = footnote_view_->GetPreferredSize(); |
- if (!footnote_size.IsEmpty()) |
- size.set_width(std::max(size.width(), footnote_size.width())); |
- |
- int footnote_height = footnote_view_->GetHeightForWidth(size.width()); |
- size.Enlarge(0, footnote_height); |
- } |
- |
return size; |
} |
void DialogClientView::Layout() { |
gfx::Rect bounds = GetContentsBounds(); |
- // Layout the footnote view. |
- if (ShouldShow(footnote_view_)) { |
- const int height = footnote_view_->GetHeightForWidth(bounds.width()); |
- footnote_view_->SetBounds(bounds.x(), bounds.bottom() - height, |
- bounds.width(), height); |
- if (height != 0) |
- bounds.Inset(0, 0, 0, height); |
- } |
- |
// Layout the row containing the buttons and the extra view. |
if (has_dialog_buttons() || ShouldShow(extra_view_)) { |
bounds.Inset(GetButtonRowInsets()); |
@@ -249,7 +230,6 @@ void DialogClientView::ViewHierarchyChanged( |
if (details.is_add && details.child == this) { |
UpdateDialogButtons(); |
CreateExtraView(); |
- CreateFootnoteView(); |
} else if (!details.is_add && details.child != this) { |
if (details.child == ok_button_) |
ok_button_ = NULL; |
@@ -293,7 +273,6 @@ DialogClientView::DialogClientView(View* contents_view) |
ok_button_(NULL), |
cancel_button_(NULL), |
extra_view_(NULL), |
- footnote_view_(NULL), |
notified_delegate_(false) {} |
DialogDelegate* DialogClientView::GetDialogDelegate() const { |
@@ -311,17 +290,8 @@ void DialogClientView::CreateExtraView() { |
} |
} |
-void DialogClientView::CreateFootnoteView() { |
- if (footnote_view_) |
- return; |
- |
- footnote_view_ = GetDialogDelegate()->CreateFootnoteView(); |
- if (footnote_view_) |
- AddChildView(footnote_view_); |
-} |
- |
void DialogClientView::ChildPreferredSizeChanged(View* child) { |
- if (child == footnote_view_ || child == extra_view_) |
+ if (child == extra_view_) |
Layout(); |
} |
@@ -370,9 +340,8 @@ int DialogClientView::GetButtonsAndExtraViewRowHeight() const { |
gfx::Insets DialogClientView::GetButtonRowInsets() const { |
// NOTE: The insets only apply to the buttons, extra view, and footnote view. |
msw
2016/02/22 21:43:56
nit: remove mention of footnote view
Evan Stade
2016/02/22 22:58:23
I just removed the comment because it seems fairly
|
- return GetButtonsAndExtraViewRowHeight() == 0 ? gfx::Insets() : |
- gfx::Insets(0, kButtonHEdgeMarginNew, |
- kButtonVEdgeMarginNew, kButtonHEdgeMarginNew); |
+ return GetButtonsAndExtraViewRowHeight() == 0 ? gfx::Insets() |
+ : button_row_insets_; |
} |
void DialogClientView::Close() { |