| 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" |
| 11 #include "ui/base/default_style.h" | 11 #include "ui/base/default_style.h" |
| 12 #include "ui/base/hit_test.h" | 12 #include "ui/base/hit_test.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/compositor/paint_context.h" | 15 #include "ui/compositor/paint_context.h" |
| 16 #include "ui/compositor/paint_recorder.h" | 16 #include "ui/compositor/paint_recorder.h" |
| 17 #include "ui/display/screen.h" |
| 17 #include "ui/gfx/geometry/vector2d.h" | 18 #include "ui/gfx/geometry/vector2d.h" |
| 18 #include "ui/gfx/path.h" | 19 #include "ui/gfx/path.h" |
| 19 #include "ui/gfx/screen.h" | |
| 20 #include "ui/gfx/skia_util.h" | 20 #include "ui/gfx/skia_util.h" |
| 21 #include "ui/native_theme/native_theme.h" | 21 #include "ui/native_theme/native_theme.h" |
| 22 #include "ui/resources/grit/ui_resources.h" | 22 #include "ui/resources/grit/ui_resources.h" |
| 23 #include "ui/strings/grit/ui_strings.h" | 23 #include "ui/strings/grit/ui_strings.h" |
| 24 #include "ui/views/bubble/bubble_border.h" | 24 #include "ui/views/bubble/bubble_border.h" |
| 25 #include "ui/views/controls/button/label_button.h" | 25 #include "ui/views/controls/button/label_button.h" |
| 26 #include "ui/views/controls/image_view.h" | 26 #include "ui/views/controls/image_view.h" |
| 27 #include "ui/views/layout/box_layout.h" | 27 #include "ui/views/layout/box_layout.h" |
| 28 #include "ui/views/layout/layout_constants.h" | 28 #include "ui/views/layout/layout_constants.h" |
| 29 #include "ui/views/resources/grit/views_resources.h" | 29 #include "ui/views/resources/grit/views_resources.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 | 408 |
| 409 // Calculate the bounds with the arrow in its updated location and offset. | 409 // Calculate the bounds with the arrow in its updated location and offset. |
| 410 return bubble_border_->GetBounds(anchor_rect, size); | 410 return bubble_border_->GetBounds(anchor_rect, size); |
| 411 } | 411 } |
| 412 | 412 |
| 413 gfx::Rect BubbleFrameView::GetAvailableScreenBounds( | 413 gfx::Rect BubbleFrameView::GetAvailableScreenBounds( |
| 414 const gfx::Rect& rect) const { | 414 const gfx::Rect& rect) const { |
| 415 // The bubble attempts to fit within the current screen bounds. | 415 // The bubble attempts to fit within the current screen bounds. |
| 416 return gfx::Screen::GetScreen() | 416 return display::Screen::GetScreen() |
| 417 ->GetDisplayNearestPoint(rect.CenterPoint()) | 417 ->GetDisplayNearestPoint(rect.CenterPoint()) |
| 418 .work_area(); | 418 .work_area(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 bool BubbleFrameView::IsCloseButtonVisible() const { | 421 bool BubbleFrameView::IsCloseButtonVisible() const { |
| 422 return close_->visible(); | 422 return close_->visible(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 gfx::Rect BubbleFrameView::GetCloseButtonMirroredBounds() const { | 425 gfx::Rect BubbleFrameView::GetCloseButtonMirroredBounds() const { |
| 426 return close_->GetMirroredBounds(); | 426 return close_->GetMirroredBounds(); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 size.Enlarge(client_insets.width(), client_insets.height()); | 510 size.Enlarge(client_insets.width(), client_insets.height()); |
| 511 size.SetToMax(gfx::Size(title_bar_width, 0)); | 511 size.SetToMax(gfx::Size(title_bar_width, 0)); |
| 512 | 512 |
| 513 if (footnote_container_) | 513 if (footnote_container_) |
| 514 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); | 514 size.Enlarge(0, footnote_container_->GetHeightForWidth(size.width())); |
| 515 | 515 |
| 516 return size; | 516 return size; |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace views | 519 } // namespace views |
| OLD | NEW |