| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 const gfx::Insets insets = GetButtonRowInsets(); | 185 const gfx::Insets insets = GetButtonRowInsets(); |
| 186 size.Enlarge(insets.width(), insets.height()); | 186 size.Enlarge(insets.width(), insets.height()); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // Increase the size as needed to fit the contents view. | 189 // Increase the size as needed to fit the contents view. |
| 190 // NOTE: The contents view is not inset on the top or side client view edges. | 190 // NOTE: The contents view is not inset on the top or side client view edges. |
| 191 gfx::Size contents_size = contents_view()->GetPreferredSize(); | 191 gfx::Size contents_size = contents_view()->GetPreferredSize(); |
| 192 size.Enlarge(0, contents_size.height()); | 192 size.Enlarge(0, contents_size.height()); |
| 193 size.set_width(std::max(size.width(), contents_size.width())); | 193 size.set_width(std::max(size.width(), contents_size.width())); |
| 194 | 194 |
| 195 size.SetToMax(minimum_size_); |
| 196 |
| 195 return size; | 197 return size; |
| 196 } | 198 } |
| 197 | 199 |
| 198 void DialogClientView::Layout() { | 200 void DialogClientView::Layout() { |
| 199 gfx::Rect bounds = GetContentsBounds(); | 201 gfx::Rect bounds = GetContentsBounds(); |
| 200 | 202 |
| 201 // Layout the row containing the buttons and the extra view. | 203 // Layout the row containing the buttons and the extra view. |
| 202 if (has_dialog_buttons() || ShouldShow(extra_view_)) { | 204 if (has_dialog_buttons() || ShouldShow(extra_view_)) { |
| 203 bounds.Inset(GetButtonRowInsets()); | 205 bounds.Inset(GetButtonRowInsets()); |
| 204 const int height = GetButtonsAndExtraViewRowHeight(); | 206 const int height = GetButtonsAndExtraViewRowHeight(); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 std::remove(child_views.begin(), child_views.end(), nullptr), | 406 std::remove(child_views.begin(), child_views.end(), nullptr), |
| 405 child_views.end()); | 407 child_views.end()); |
| 406 | 408 |
| 407 // Setup focus by reordering views. It is not safe to use SetNextFocusableView | 409 // Setup focus by reordering views. It is not safe to use SetNextFocusableView |
| 408 // since child views may be added externally to this view. | 410 // since child views may be added externally to this view. |
| 409 for (size_t i = 0; i < child_views.size(); i++) | 411 for (size_t i = 0; i < child_views.size(); i++) |
| 410 ReorderChildView(child_views[i], i); | 412 ReorderChildView(child_views[i], i); |
| 411 } | 413 } |
| 412 | 414 |
| 413 } // namespace views | 415 } // namespace views |
| OLD | NEW |