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