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 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 view_->SetStyle(StatusView::STYLE_BOTTOM); | 797 view_->SetStyle(StatusView::STYLE_BOTTOM); |
798 } else if (offset > kBubbleCornerRadius / 2 - kShadowThickness) { | 798 } else if (offset > kBubbleCornerRadius / 2 - kShadowThickness) { |
799 view_->SetStyle(StatusView::STYLE_FLOATING); | 799 view_->SetStyle(StatusView::STYLE_FLOATING); |
800 } else { | 800 } else { |
801 view_->SetStyle(StatusView::STYLE_STANDARD); | 801 view_->SetStyle(StatusView::STYLE_STANDARD); |
802 } | 802 } |
803 | 803 |
804 // Check if the bubble sticks out from the monitor or will obscure | 804 // Check if the bubble sticks out from the monitor or will obscure |
805 // download shelf. | 805 // download shelf. |
806 gfx::NativeView window = base_view_->GetWidget()->GetNativeView(); | 806 gfx::NativeView window = base_view_->GetWidget()->GetNativeView(); |
807 gfx::Rect monitor_rect = gfx::Screen::GetScreenFor(window)-> | 807 gfx::Rect monitor_rect = |
808 GetDisplayNearestWindow(window).work_area(); | 808 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
809 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); | 809 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); |
810 | 810 |
811 if (bubble_bottom_y + offset > monitor_rect.height() || | 811 if (bubble_bottom_y + offset > monitor_rect.height() || |
812 (download_shelf_is_visible_ && | 812 (download_shelf_is_visible_ && |
813 (view_->style() == StatusView::STYLE_FLOATING || | 813 (view_->style() == StatusView::STYLE_FLOATING || |
814 view_->style() == StatusView::STYLE_BOTTOM))) { | 814 view_->style() == StatusView::STYLE_BOTTOM))) { |
815 // The offset is still too large. Move the bubble to the right and reset | 815 // The offset is still too large. Move the bubble to the right and reset |
816 // Y offset_ to zero. | 816 // Y offset_ to zero. |
817 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); | 817 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); |
818 offset_ = 0; | 818 offset_ = 0; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 void StatusBubbleViews::SetBubbleWidth(int width) { | 886 void StatusBubbleViews::SetBubbleWidth(int width) { |
887 size_.set_width(width); | 887 size_.set_width(width); |
888 SetBounds(original_position_.x(), original_position_.y(), | 888 SetBounds(original_position_.x(), original_position_.y(), |
889 size_.width(), size_.height()); | 889 size_.width(), size_.height()); |
890 } | 890 } |
891 | 891 |
892 void StatusBubbleViews::CancelExpandTimer() { | 892 void StatusBubbleViews::CancelExpandTimer() { |
893 if (expand_timer_factory_.HasWeakPtrs()) | 893 if (expand_timer_factory_.HasWeakPtrs()) |
894 expand_timer_factory_.InvalidateWeakPtrs(); | 894 expand_timer_factory_.InvalidateWeakPtrs(); |
895 } | 895 } |
OLD | NEW |