| 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/bubble/bubble_frame_view.h" | 5 #include "ui/views/bubble/bubble_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 gfx::Insets BubbleFrameView::GetInsets() const { | 252 gfx::Insets BubbleFrameView::GetInsets() const { |
| 253 gfx::Insets insets = content_margins_; | 253 gfx::Insets insets = content_margins_; |
| 254 | 254 |
| 255 const int icon_height = title_icon_->GetPreferredSize().height(); | 255 const int icon_height = title_icon_->GetPreferredSize().height(); |
| 256 const int label_height = title_->GetPreferredSize().height(); | 256 const int label_height = title_->GetPreferredSize().height(); |
| 257 const bool has_title = icon_height > 0 || label_height > 0; | 257 const bool has_title = icon_height > 0 || label_height > 0; |
| 258 const int title_padding = has_title ? title_margins_.height() : 0; | 258 const int title_padding = has_title ? title_margins_.height() : 0; |
| 259 const int title_height = std::max(icon_height, label_height) + title_padding; | 259 const int title_height = std::max(icon_height, label_height) + title_padding; |
| 260 const int close_height = | 260 const int close_height = |
| 261 GetWidget()->widget_delegate()->ShouldShowCloseButton() | 261 GetWidget()->widget_delegate()->ShouldShowCloseButton() |
| 262 ? close_->height() | 262 ? close_->height() + LayoutProvider::Get()->GetDistanceMetric( |
| 263 DISTANCE_CLOSE_BUTTON_MARGIN) |
| 263 : 0; | 264 : 0; |
| 264 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); | 265 insets += gfx::Insets(std::max(title_height, close_height), 0, 0, 0); |
| 265 return insets; | 266 return insets; |
| 266 } | 267 } |
| 267 | 268 |
| 268 gfx::Size BubbleFrameView::GetPreferredSize() const { | 269 gfx::Size BubbleFrameView::GetPreferredSize() const { |
| 269 // Get the preferred size of the client area. | 270 // Get the preferred size of the client area. |
| 270 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); | 271 gfx::Size client_size = GetWidget()->client_view()->GetPreferredSize(); |
| 271 // Expand it to include the bubble border and space for the arrow. | 272 // Expand it to include the bubble border and space for the arrow. |
| 272 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); | 273 return GetWindowBoundsForClientBounds(gfx::Rect(client_size)).size(); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 size.Enlarge(client_insets.width(), client_insets.height()); | 531 size.Enlarge(client_insets.width(), client_insets.height()); |
| 531 size.SetToMax(gfx::Size(title_bar_width, 0)); | 532 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 532 | 533 |
| 533 if (footnote_container_) | 534 if (footnote_container_) |
| 534 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 535 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 535 | 536 |
| 536 return size; | 537 return size; |
| 537 } | 538 } |
| 538 | 539 |
| 539 } // namespace views | 540 } // namespace views |
| OLD | NEW |