Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: ui/views/bubble/bubble_frame_view.cc

Issue 10808066: Fix position of web notification bubble and arrow (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
44 const gfx::Insets& margins)
45 : bubble_border_(NULL), 43 : bubble_border_(NULL),
46 content_margins_(margins) { 44 content_margins_(margins) {
47 if (base::i18n::IsRTL())
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 } 45 }
55 46
56 BubbleFrameView::~BubbleFrameView() {} 47 BubbleFrameView::~BubbleFrameView() {}
57 48
58 gfx::Rect BubbleFrameView::GetBoundsForClientView() const { 49 gfx::Rect BubbleFrameView::GetBoundsForClientView() const {
59 gfx::Insets margin; 50 gfx::Insets margin;
60 bubble_border()->GetInsets(&margin); 51 bubble_border()->GetInsets(&margin);
61 margin += content_margins(); 52 margin += content_margins();
62 return gfx::Rect(margin.left(), margin.top(), 53 return gfx::Rect(margin.left(), margin.top(),
63 std::max(width() - margin.width(), 0), 54 std::max(width() - margin.width(), 0),
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Restore the original arrow if mirroring doesn't show more of the bubble. 113 // Restore the original arrow if mirroring doesn't show more of the bubble.
123 if (GetOffScreenLength(monitor_rect, mirror_bounds, vertical) >= 114 if (GetOffScreenLength(monitor_rect, mirror_bounds, vertical) >=
124 GetOffScreenLength(monitor_rect, window_bounds, vertical)) 115 GetOffScreenLength(monitor_rect, window_bounds, vertical))
125 bubble_border_->set_arrow_location(arrow); 116 bubble_border_->set_arrow_location(arrow);
126 else 117 else
127 SchedulePaint(); 118 SchedulePaint();
128 } 119 }
129 } 120 }
130 121
131 } // namespace views 122 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698