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 "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 748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 } else if (offset > kBubbleCornerRadius / 2 - kShadowThickness) { | 759 } else if (offset > kBubbleCornerRadius / 2 - kShadowThickness) { |
760 view_->SetStyle(StatusView::STYLE_FLOATING); | 760 view_->SetStyle(StatusView::STYLE_FLOATING); |
761 } else { | 761 } else { |
762 view_->SetStyle(StatusView::STYLE_STANDARD); | 762 view_->SetStyle(StatusView::STYLE_STANDARD); |
763 } | 763 } |
764 | 764 |
765 // Check if the bubble sticks out from the monitor or will obscure | 765 // Check if the bubble sticks out from the monitor or will obscure |
766 // download shelf. | 766 // download shelf. |
767 gfx::NativeView widget = base_view_->GetWidget()->GetNativeView(); | 767 gfx::NativeView widget = base_view_->GetWidget()->GetNativeView(); |
768 gfx::Rect monitor_rect = | 768 gfx::Rect monitor_rect = |
769 gfx::Screen::GetMonitorNearestWindow(widget).work_area(); | 769 gfx::Screen::GetDisplayNearestWindow(widget).work_area(); |
770 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); | 770 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); |
771 | 771 |
772 if (bubble_bottom_y + offset > monitor_rect.height() || | 772 if (bubble_bottom_y + offset > monitor_rect.height() || |
773 (download_shelf_is_visible_ && | 773 (download_shelf_is_visible_ && |
774 (view_->GetStyle() == StatusView::STYLE_FLOATING || | 774 (view_->GetStyle() == StatusView::STYLE_FLOATING || |
775 view_->GetStyle() == StatusView::STYLE_BOTTOM))) { | 775 view_->GetStyle() == StatusView::STYLE_BOTTOM))) { |
776 // The offset is still too large. Move the bubble to the right and reset | 776 // The offset is still too large. Move the bubble to the right and reset |
777 // Y offset_ to zero. | 777 // Y offset_ to zero. |
778 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); | 778 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); |
779 offset_ = 0; | 779 offset_ = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 void StatusBubbleViews::SetBubbleWidth(int width) { | 838 void StatusBubbleViews::SetBubbleWidth(int width) { |
839 size_.set_width(width); | 839 size_.set_width(width); |
840 SetBounds(original_position_.x(), original_position_.y(), | 840 SetBounds(original_position_.x(), original_position_.y(), |
841 size_.width(), size_.height()); | 841 size_.width(), size_.height()); |
842 } | 842 } |
843 | 843 |
844 void StatusBubbleViews::CancelExpandTimer() { | 844 void StatusBubbleViews::CancelExpandTimer() { |
845 if (expand_timer_factory_.HasWeakPtrs()) | 845 if (expand_timer_factory_.HasWeakPtrs()) |
846 expand_timer_factory_.InvalidateWeakPtrs(); | 846 expand_timer_factory_.InvalidateWeakPtrs(); |
847 } | 847 } |
OLD | NEW |