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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy Created 8 years, 2 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 | Annotate | Revision Log
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 void BubbleFrameView::SetBubbleBorder(BubbleBorder* border) { 96 void BubbleFrameView::SetBubbleBorder(BubbleBorder* border) {
97 bubble_border_ = border; 97 bubble_border_ = border;
98 set_border(bubble_border_); 98 set_border(bubble_border_);
99 99
100 // Update the background, which relies on the border. 100 // Update the background, which relies on the border.
101 set_background(new views::BubbleBackground(border)); 101 set_background(new views::BubbleBackground(border));
102 } 102 }
103 103
104 gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) { 104 gfx::Rect BubbleFrameView::GetMonitorBounds(const gfx::Rect& rect) {
105 return gfx::Screen::GetDisplayNearestPoint(rect.CenterPoint()).work_area(); 105 return gfx::Screen::GetDisplayNearestPoint(
106 gfx::Screen::BadTwoWorldsContext(), rect.CenterPoint()).work_area();
106 } 107 }
107 108
108 void BubbleFrameView::MirrorArrowIfOffScreen( 109 void BubbleFrameView::MirrorArrowIfOffScreen(
109 bool vertical, 110 bool vertical,
110 const gfx::Rect& anchor_rect, 111 const gfx::Rect& anchor_rect,
111 const gfx::Size& client_size) { 112 const gfx::Size& client_size) {
112 // Check if the bounds don't fit on screen. 113 // Check if the bounds don't fit on screen.
113 gfx::Rect monitor_rect(GetMonitorBounds(anchor_rect)); 114 gfx::Rect monitor_rect(GetMonitorBounds(anchor_rect));
114 gfx::Rect window_bounds(bubble_border_->GetBounds(anchor_rect, client_size)); 115 gfx::Rect window_bounds(bubble_border_->GetBounds(anchor_rect, client_size));
115 if (GetOffScreenLength(monitor_rect, window_bounds, vertical) > 0) { 116 if (GetOffScreenLength(monitor_rect, window_bounds, vertical) > 0) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble 162 // |offscreen_adjust|, e.g. positive |offscreen_adjust| means bubble
162 // window needs to be moved to the right and that means we need to move arrow 163 // window needs to be moved to the right and that means we need to move arrow
163 // to the left, and that means negative offset. 164 // to the left, and that means negative offset.
164 bubble_border_->set_arrow_offset( 165 bubble_border_->set_arrow_offset(
165 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust); 166 bubble_border_->GetArrowOffset(window_bounds.size()) - offscreen_adjust);
166 if (offscreen_adjust) 167 if (offscreen_adjust)
167 SchedulePaint(); 168 SchedulePaint();
168 } 169 }
169 170
170 } // namespace views 171 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698