| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 | 700 |
| 701 void StatusBubbleViews::UpdateDownloadShelfVisibility(bool visible) { | 701 void StatusBubbleViews::UpdateDownloadShelfVisibility(bool visible) { |
| 702 download_shelf_is_visible_ = visible; | 702 download_shelf_is_visible_ = visible; |
| 703 } | 703 } |
| 704 | 704 |
| 705 void StatusBubbleViews::AvoidMouse(const gfx::Point& location) { | 705 void StatusBubbleViews::AvoidMouse(const gfx::Point& location) { |
| 706 // Get the position of the frame. | 706 // Get the position of the frame. |
| 707 gfx::Point top_left; | 707 gfx::Point top_left; |
| 708 views::View::ConvertPointToScreen(base_view_, &top_left); | 708 views::View::ConvertPointToScreen(base_view_, &top_left); |
| 709 // Border included. | 709 // Border included. |
| 710 int window_width = base_view_->GetContentsBounds().width(); | 710 int window_width = base_view_->GetLocalBounds().width(); |
| 711 | 711 |
| 712 // Get the cursor position relative to the popup. | 712 // Get the cursor position relative to the popup. |
| 713 gfx::Point relative_location = location; | 713 gfx::Point relative_location = location; |
| 714 if (base::i18n::IsRTL()) { | 714 if (base::i18n::IsRTL()) { |
| 715 int top_right_x = top_left.x() + window_width; | 715 int top_right_x = top_left.x() + window_width; |
| 716 relative_location.set_x(top_right_x - relative_location.x()); | 716 relative_location.set_x(top_right_x - relative_location.x()); |
| 717 } else { | 717 } else { |
| 718 relative_location.set_x( | 718 relative_location.set_x( |
| 719 relative_location.x() - (top_left.x() + position_.x())); | 719 relative_location.x() - (top_left.x() + position_.x())); |
| 720 } | 720 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 void StatusBubbleViews::SetBubbleWidth(int width) { | 828 void StatusBubbleViews::SetBubbleWidth(int width) { |
| 829 size_.set_width(width); | 829 size_.set_width(width); |
| 830 SetBounds(original_position_.x(), original_position_.y(), | 830 SetBounds(original_position_.x(), original_position_.y(), |
| 831 size_.width(), size_.height()); | 831 size_.width(), size_.height()); |
| 832 } | 832 } |
| 833 | 833 |
| 834 void StatusBubbleViews::CancelExpandTimer() { | 834 void StatusBubbleViews::CancelExpandTimer() { |
| 835 if (!expand_timer_factory_.empty()) | 835 if (!expand_timer_factory_.empty()) |
| 836 expand_timer_factory_.RevokeAll(); | 836 expand_timer_factory_.RevokeAll(); |
| 837 } | 837 } |
| OLD | NEW |