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/base/hit_test.h" | 9 #include "ui/base/hit_test.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // The bubble attempts to fit within the current screen bounds. | 336 // The bubble attempts to fit within the current screen bounds. |
337 // TODO(scottmg): Native is wrong. http://crbug.com/133312 | 337 // TODO(scottmg): Native is wrong. http://crbug.com/133312 |
338 return gfx::Screen::GetNativeScreen()->GetDisplayNearestPoint( | 338 return gfx::Screen::GetNativeScreen()->GetDisplayNearestPoint( |
339 rect.CenterPoint()).work_area(); | 339 rect.CenterPoint()).work_area(); |
340 } | 340 } |
341 | 341 |
342 bool BubbleFrameView::IsCloseButtonVisible() const { | 342 bool BubbleFrameView::IsCloseButtonVisible() const { |
343 return close_->visible(); | 343 return close_->visible(); |
344 } | 344 } |
345 | 345 |
346 gfx::Rect BubbleFrameView::GetCloseButtonBounds() const { | 346 gfx::Rect BubbleFrameView::GetCloseButtonMirroredBounds() const { |
347 return close_->bounds(); | 347 return close_->GetMirroredBounds(); |
348 } | 348 } |
349 | 349 |
350 void BubbleFrameView::MirrorArrowIfOffScreen( | 350 void BubbleFrameView::MirrorArrowIfOffScreen( |
351 bool vertical, | 351 bool vertical, |
352 const gfx::Rect& anchor_rect, | 352 const gfx::Rect& anchor_rect, |
353 const gfx::Size& client_size) { | 353 const gfx::Size& client_size) { |
354 // Check if the bounds don't fit on screen. | 354 // Check if the bounds don't fit on screen. |
355 gfx::Rect available_bounds(GetAvailableScreenBounds(anchor_rect)); | 355 gfx::Rect available_bounds(GetAvailableScreenBounds(anchor_rect)); |
356 gfx::Rect window_bounds(bubble_border_->GetBounds(anchor_rect, client_size)); | 356 gfx::Rect window_bounds(bubble_border_->GetBounds(anchor_rect, client_size)); |
357 if (GetOffScreenLength(available_bounds, window_bounds, vertical) > 0) { | 357 if (GetOffScreenLength(available_bounds, window_bounds, vertical) > 0) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (titlebar_extra_view_ != NULL) | 428 if (titlebar_extra_view_ != NULL) |
429 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); | 429 title_bar_width += titlebar_extra_view_->GetPreferredSize().width(); |
430 gfx::Size size(client_size); | 430 gfx::Size size(client_size); |
431 size.SetToMax(gfx::Size(title_bar_width, 0)); | 431 size.SetToMax(gfx::Size(title_bar_width, 0)); |
432 const gfx::Insets insets(GetInsets()); | 432 const gfx::Insets insets(GetInsets()); |
433 size.Enlarge(insets.width(), insets.height()); | 433 size.Enlarge(insets.width(), insets.height()); |
434 return size; | 434 return size; |
435 } | 435 } |
436 | 436 |
437 } // namespace views | 437 } // namespace views |
OLD | NEW |