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 | 8 |
9 #include "ui/gfx/screen.h" | 9 #include "ui/gfx/screen.h" |
10 #include "ui/views/bubble/bubble_border.h" | 10 #include "ui/views/bubble/bubble_border.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 MirrorArrowIfOffScreen(false, anchor_rect, client_size); | 84 MirrorArrowIfOffScreen(false, anchor_rect, client_size); |
85 } | 85 } |
86 | 86 |
87 // Calculate the bounds with the arrow in its updated location. | 87 // Calculate the bounds with the arrow in its updated location. |
88 return bubble_border_->GetBounds(anchor_rect, client_size); | 88 return bubble_border_->GetBounds(anchor_rect, client_size); |
89 } | 89 } |
90 | 90 |
91 void BubbleFrameView::SetBubbleBorder(BubbleBorder* border) { | 91 void BubbleFrameView::SetBubbleBorder(BubbleBorder* border) { |
92 bubble_border_ = border; | 92 bubble_border_ = border; |
93 set_border(bubble_border_); | 93 set_border(bubble_border_); |
| 94 |
| 95 // Update the background, which relies on the border. |
| 96 set_background(new views::BubbleBackground(border)); |
94 } | 97 } |
95 | 98 |
96 gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) { | 99 gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) { |
97 return gfx::Screen::GetDisplayNearestPoint(rect.CenterPoint()).work_area(); | 100 return gfx::Screen::GetDisplayNearestPoint(rect.CenterPoint()).work_area(); |
98 } | 101 } |
99 | 102 |
100 void BubbleFrameView::MirrorArrowIfOffScreen( | 103 void BubbleFrameView::MirrorArrowIfOffScreen( |
101 bool vertical, | 104 bool vertical, |
102 const gfx::Rect& anchor_rect, | 105 const gfx::Rect& anchor_rect, |
103 const gfx::Size& client_size) { | 106 const gfx::Size& client_size) { |
(...skipping 11 matching lines...) Expand all Loading... |
115 // Restore the original arrow if mirroring doesn't show more of the bubble. | 118 // Restore the original arrow if mirroring doesn't show more of the bubble. |
116 if (GetOffScreenLength(monitor_rect, mirror_bounds, vertical) >= | 119 if (GetOffScreenLength(monitor_rect, mirror_bounds, vertical) >= |
117 GetOffScreenLength(monitor_rect, window_bounds, vertical)) | 120 GetOffScreenLength(monitor_rect, window_bounds, vertical)) |
118 bubble_border_->set_arrow_location(arrow); | 121 bubble_border_->set_arrow_location(arrow); |
119 else | 122 else |
120 SchedulePaint(); | 123 SchedulePaint(); |
121 } | 124 } |
122 } | 125 } |
123 | 126 |
124 } // namespace views | 127 } // namespace views |
OLD | NEW |