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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // there's no title. | 307 // there's no title. |
308 DCHECK(!title_margins_.IsEmpty() || !title_->visible()); | 308 DCHECK(!title_margins_.IsEmpty() || !title_->visible()); |
309 | 309 |
310 const gfx::Rect contents_bounds = GetContentsBounds(); | 310 const gfx::Rect contents_bounds = GetContentsBounds(); |
311 gfx::Rect bounds = contents_bounds; | 311 gfx::Rect bounds = contents_bounds; |
312 bounds.Inset(title_margins_); | 312 bounds.Inset(title_margins_); |
313 if (bounds.IsEmpty()) | 313 if (bounds.IsEmpty()) |
314 return; | 314 return; |
315 | 315 |
316 // The close button is positioned somewhat closer to the edge of the bubble. | 316 // The close button is positioned somewhat closer to the edge of the bubble. |
317 const int close_margin = | 317 const int close_margin = ViewsDelegate::GetInstance()->GetDistanceMetric( |
318 ViewsDelegate::GetInstance()->GetDialogCloseButtonMargin(); | 318 DistanceMetric::CLOSE_BUTTON_MARGIN); |
319 close_->SetPosition( | 319 close_->SetPosition( |
320 gfx::Point(contents_bounds.right() - close_margin - close_->width(), | 320 gfx::Point(contents_bounds.right() - close_margin - close_->width(), |
321 contents_bounds.y() + close_margin)); | 321 contents_bounds.y() + close_margin)); |
322 | 322 |
323 gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize()); | 323 gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize()); |
324 int padding = 0; | 324 int padding = 0; |
325 int title_height = title_icon_pref_size.height(); | 325 int title_height = title_icon_pref_size.height(); |
326 | 326 |
327 if (title_->visible() && !title_->text().empty()) { | 327 if (title_->visible() && !title_->text().empty()) { |
328 if (title_icon_pref_size.width() > 0) | 328 if (title_icon_pref_size.width() > 0) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 size.Enlarge(client_insets.width(), client_insets.height()); | 530 size.Enlarge(client_insets.width(), client_insets.height()); |
531 size.SetToMax(gfx::Size(title_bar_width, 0)); | 531 size.SetToMax(gfx::Size(title_bar_width, 0)); |
532 | 532 |
533 if (footnote_container_) | 533 if (footnote_container_) |
534 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 534 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
535 | 535 |
536 return size; | 536 return size; |
537 } | 537 } |
538 | 538 |
539 } // namespace views | 539 } // namespace views |
OLD | NEW |