| 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 13 matching lines...) Expand all Loading... |
| 24 #include "ui/resources/grit/ui_resources.h" | 24 #include "ui/resources/grit/ui_resources.h" |
| 25 #include "ui/strings/grit/ui_strings.h" | 25 #include "ui/strings/grit/ui_strings.h" |
| 26 #include "ui/vector_icons/vector_icons.h" | 26 #include "ui/vector_icons/vector_icons.h" |
| 27 #include "ui/views/bubble/bubble_border.h" | 27 #include "ui/views/bubble/bubble_border.h" |
| 28 #include "ui/views/controls/button/image_button.h" | 28 #include "ui/views/controls/button/image_button.h" |
| 29 #include "ui/views/controls/button/image_button_factory.h" | 29 #include "ui/views/controls/button/image_button_factory.h" |
| 30 #include "ui/views/controls/image_view.h" | 30 #include "ui/views/controls/image_view.h" |
| 31 #include "ui/views/controls/label.h" | 31 #include "ui/views/controls/label.h" |
| 32 #include "ui/views/layout/box_layout.h" | 32 #include "ui/views/layout/box_layout.h" |
| 33 #include "ui/views/layout/layout_constants.h" | 33 #include "ui/views/layout/layout_constants.h" |
| 34 #include "ui/views/layout/layout_provider.h" |
| 34 #include "ui/views/resources/grit/views_resources.h" | 35 #include "ui/views/resources/grit/views_resources.h" |
| 35 #include "ui/views/views_delegate.h" | |
| 36 #include "ui/views/widget/widget.h" | 36 #include "ui/views/widget/widget.h" |
| 37 #include "ui/views/widget/widget_delegate.h" | 37 #include "ui/views/widget/widget_delegate.h" |
| 38 #include "ui/views/window/client_view.h" | 38 #include "ui/views/window/client_view.h" |
| 39 | 39 |
| 40 namespace views { | 40 namespace views { |
| 41 | 41 |
| 42 namespace { | 42 namespace { |
| 43 | 43 |
| 44 // Background color of the footnote view. | 44 // Background color of the footnote view. |
| 45 const SkColor kFootnoteBackgroundColor = SkColorSetRGB(245, 245, 245); | 45 const SkColor kFootnoteBackgroundColor = SkColorSetRGB(245, 245, 245); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // there's no title. | 305 // there's no title. |
| 306 DCHECK(!title_margins_.IsEmpty() || !title_->visible()); | 306 DCHECK(!title_margins_.IsEmpty() || !title_->visible()); |
| 307 | 307 |
| 308 const gfx::Rect contents_bounds = GetContentsBounds(); | 308 const gfx::Rect contents_bounds = GetContentsBounds(); |
| 309 gfx::Rect bounds = contents_bounds; | 309 gfx::Rect bounds = contents_bounds; |
| 310 bounds.Inset(title_margins_); | 310 bounds.Inset(title_margins_); |
| 311 if (bounds.IsEmpty()) | 311 if (bounds.IsEmpty()) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 // The close button is positioned somewhat closer to the edge of the bubble. | 314 // The close button is positioned somewhat closer to the edge of the bubble. |
| 315 const int close_margin = ViewsDelegate::GetInstance()->GetDistanceMetric( | 315 const int close_margin = |
| 316 DistanceMetric::CLOSE_BUTTON_MARGIN); | 316 LayoutProvider::Get()->GetDistanceMetric(DISTANCE_CLOSE_BUTTON_MARGIN); |
| 317 close_->SetPosition( | 317 close_->SetPosition( |
| 318 gfx::Point(contents_bounds.right() - close_margin - close_->width(), | 318 gfx::Point(contents_bounds.right() - close_margin - close_->width(), |
| 319 contents_bounds.y() + close_margin)); | 319 contents_bounds.y() + close_margin)); |
| 320 | 320 |
| 321 gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize()); | 321 gfx::Size title_icon_pref_size(title_icon_->GetPreferredSize()); |
| 322 int padding = 0; | 322 int padding = 0; |
| 323 int title_height = title_icon_pref_size.height(); | 323 int title_height = title_icon_pref_size.height(); |
| 324 | 324 |
| 325 if (title_->visible() && !title_->text().empty()) { | 325 if (title_->visible() && !title_->text().empty()) { |
| 326 if (title_icon_pref_size.width() > 0) | 326 if (title_icon_pref_size.width() > 0) |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 size.Enlarge(client_insets.width(), client_insets.height()); | 528 size.Enlarge(client_insets.width(), client_insets.height()); |
| 529 size.SetToMax(gfx::Size(title_bar_width, 0)); | 529 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 530 | 530 |
| 531 if (footnote_container_) | 531 if (footnote_container_) |
| 532 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 532 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 533 | 533 |
| 534 return size; | 534 return size; |
| 535 } | 535 } |
| 536 | 536 |
| 537 } // namespace views | 537 } // namespace views |
| OLD | NEW |