| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/window/dialog_client_view.h" | 5 #include "ui/views/window/dialog_client_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/base/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
| 10 #include "ui/views/controls/button/label_button.h" | 10 #include "ui/views/controls/button/label_button.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 size.set_width(std::max(size.width(), contents_size.width())); | 175 size.set_width(std::max(size.width(), contents_size.width())); |
| 176 return size; | 176 return size; |
| 177 } | 177 } |
| 178 | 178 |
| 179 void DialogClientView::Layout() { | 179 void DialogClientView::Layout() { |
| 180 gfx::Rect bounds = GetContentsBounds(); | 180 gfx::Rect bounds = GetContentsBounds(); |
| 181 bounds.Inset(GetInsets()); | 181 bounds.Inset(GetInsets()); |
| 182 | 182 |
| 183 // Layout the footnote view. | 183 // Layout the footnote view. |
| 184 if (footnote_view_) { | 184 if (footnote_view_) { |
| 185 const int height = footnote_view_->GetPreferredSize().height(); | 185 const int height = footnote_view_->GetHeightForWidth(bounds.width()); |
| 186 footnote_view_->SetBounds(bounds.x(), bounds.bottom() - height, | 186 footnote_view_->SetBounds(bounds.x(), bounds.bottom() - height, |
| 187 bounds.width(), height); | 187 bounds.width(), height); |
| 188 bounds.Inset(0, 0, 0, height + kRelatedControlVerticalSpacing); | 188 bounds.Inset(0, 0, 0, height + kRelatedControlVerticalSpacing); |
| 189 } | 189 } |
| 190 | 190 |
| 191 // Layout the row containing the buttons and the extra view. | 191 // Layout the row containing the buttons and the extra view. |
| 192 if (has_dialog_buttons() || extra_view_) { | 192 if (has_dialog_buttons() || extra_view_) { |
| 193 const int height = GetButtonsAndExtraViewRowHeight(); | 193 const int height = GetButtonsAndExtraViewRowHeight(); |
| 194 gfx::Rect row_bounds(bounds.x(), bounds.bottom() - height, | 194 gfx::Rect row_bounds(bounds.x(), bounds.bottom() - height, |
| 195 bounds.width(), height); | 195 bounds.width(), height); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 DialogDelegate* DialogClientView::GetDialogDelegate() const { | 329 DialogDelegate* DialogClientView::GetDialogDelegate() const { |
| 330 return GetWidget()->widget_delegate()->AsDialogDelegate(); | 330 return GetWidget()->widget_delegate()->AsDialogDelegate(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 void DialogClientView::Close() { | 333 void DialogClientView::Close() { |
| 334 GetWidget()->Close(); | 334 GetWidget()->Close(); |
| 335 GetDialogDelegate()->OnClose(); | 335 GetDialogDelegate()->OnClose(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace views | 338 } // namespace views |
| OLD | NEW |