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 21 matching lines...) Expand all Loading... |
32 return std::max(0, monitor_bounds.y() - window_bounds.y()) + | 32 return std::max(0, monitor_bounds.y() - window_bounds.y()) + |
33 std::max(0, window_bounds.bottom() - monitor_bounds.bottom()); | 33 std::max(0, window_bounds.bottom() - monitor_bounds.bottom()); |
34 return std::max(0, monitor_bounds.x() - window_bounds.x()) + | 34 return std::max(0, monitor_bounds.x() - window_bounds.x()) + |
35 std::max(0, window_bounds.right() - monitor_bounds.right()); | 35 std::max(0, window_bounds.right() - monitor_bounds.right()); |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 namespace views { | 40 namespace views { |
41 | 41 |
42 BubbleFrameView::BubbleFrameView(BubbleBorder::ArrowLocation arrow_location, | 42 BubbleFrameView::BubbleFrameView(const gfx::Insets& margins, |
43 SkColor color, | 43 BubbleBorder* border) |
44 const gfx::Insets& margins) | 44 : bubble_border_(border), |
45 : bubble_border_(NULL), | |
46 content_margins_(margins) { | 45 content_margins_(margins) { |
47 if (base::i18n::IsRTL()) | 46 set_border(bubble_border_); |
48 arrow_location = BubbleBorder::horizontal_mirror(arrow_location); | |
49 // TODO(alicet): Expose the shadow option in BorderContentsView when we make | |
50 // the fullscreen exit bubble use the new bubble code. | |
51 SetBubbleBorder(new BubbleBorder(arrow_location, BubbleBorder::NO_SHADOW)); | |
52 set_background(new BubbleBackground(bubble_border_)); | |
53 bubble_border()->set_background_color(color); | |
54 } | 47 } |
55 | 48 |
56 BubbleFrameView::~BubbleFrameView() {} | 49 BubbleFrameView::~BubbleFrameView() {} |
57 | 50 |
58 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { | 51 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { |
59 gfx::Insets margin; | 52 gfx::Insets margin; |
60 bubble_border()->GetInsets(&margin); | 53 bubble_border()->GetInsets(&margin); |
61 margin += content_margins(); | 54 margin += content_margins(); |
62 return gfx::Rect(margin.left(), margin.top(), | 55 return gfx::Rect(margin.left(), margin.top(), |
63 std::max(width() - margin.width(), 0), | 56 std::max(width() - margin.width(), 0), |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Restore the original arrow if mirroring doesn't show more of the bubble. | 115 // Restore the original arrow if mirroring doesn't show more of the bubble. |
123 if (GetOffScreenLength(monitor_rect, mirror_bounds, vertical) >= | 116 if (GetOffScreenLength(monitor_rect, mirror_bounds, vertical) >= |
124 GetOffScreenLength(monitor_rect, window_bounds, vertical)) | 117 GetOffScreenLength(monitor_rect, window_bounds, vertical)) |
125 bubble_border_->set_arrow_location(arrow); | 118 bubble_border_->set_arrow_location(arrow); |
126 else | 119 else |
127 SchedulePaint(); | 120 SchedulePaint(); |
128 } | 121 } |
129 } | 122 } |
130 | 123 |
131 } // namespace views | 124 } // namespace views |
OLD | NEW |