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

Side by Side Diff: chrome/browser/ui/views/status_bubble_views.cc

Issue 2747143005: Revert of Add display::GetDisplayNearestView (Closed)
Patch Set: Created 3 years, 9 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 "chrome/browser/ui/views/status_bubble_views.h" 5 #include "chrome/browser/ui/views/status_bubble_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 offset = size_.height() - kShadowThickness * 2; 860 offset = size_.height() - kShadowThickness * 2;
861 view_->SetStyle(StatusView::STYLE_BOTTOM); 861 view_->SetStyle(StatusView::STYLE_BOTTOM);
862 } else if (offset > kBubbleCornerRadius / 2 - kShadowThickness) { 862 } else if (offset > kBubbleCornerRadius / 2 - kShadowThickness) {
863 view_->SetStyle(StatusView::STYLE_FLOATING); 863 view_->SetStyle(StatusView::STYLE_FLOATING);
864 } else { 864 } else {
865 view_->SetStyle(StatusView::STYLE_STANDARD); 865 view_->SetStyle(StatusView::STYLE_STANDARD);
866 } 866 }
867 867
868 // Check if the bubble sticks out from the monitor or will obscure 868 // Check if the bubble sticks out from the monitor or will obscure
869 // download shelf. 869 // download shelf.
870 gfx::NativeView view = base_view_->GetWidget()->GetNativeView(); 870 gfx::NativeView window = base_view_->GetWidget()->GetNativeView();
871 gfx::Rect monitor_rect = 871 gfx::Rect monitor_rect = display::Screen::GetScreen()
872 display::Screen::GetScreen()->GetDisplayNearestView(view).work_area(); 872 ->GetDisplayNearestWindow(window)
873 .work_area();
873 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); 874 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height();
874 875
875 if (bubble_bottom_y + offset > monitor_rect.height() || 876 if (bubble_bottom_y + offset > monitor_rect.height() ||
876 (download_shelf_is_visible_ && 877 (download_shelf_is_visible_ &&
877 (view_->style() == StatusView::STYLE_FLOATING || 878 (view_->style() == StatusView::STYLE_FLOATING ||
878 view_->style() == StatusView::STYLE_BOTTOM))) { 879 view_->style() == StatusView::STYLE_BOTTOM))) {
879 // The offset is still too large. Move the bubble to the right and reset 880 // The offset is still too large. Move the bubble to the right and reset
880 // Y offset_ to zero. 881 // Y offset_ to zero.
881 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); 882 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT);
882 offset_ = 0; 883 offset_ = 0;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 void StatusBubbleViews::SetBubbleWidth(int width) { 949 void StatusBubbleViews::SetBubbleWidth(int width) {
949 size_.set_width(width); 950 size_.set_width(width);
950 SetBounds(original_position_.x(), original_position_.y(), 951 SetBounds(original_position_.x(), original_position_.y(),
951 size_.width(), size_.height()); 952 size_.width(), size_.height());
952 } 953 }
953 954
954 void StatusBubbleViews::CancelExpandTimer() { 955 void StatusBubbleViews::CancelExpandTimer() {
955 if (expand_timer_factory_.HasWeakPtrs()) 956 if (expand_timer_factory_.HasWeakPtrs())
956 expand_timer_factory_.InvalidateWeakPtrs(); 957 expand_timer_factory_.InvalidateWeakPtrs();
957 } 958 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698