| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/views/status_bubble_views.h" | 5 #include "chrome/browser/views/status_bubble_views.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/gfx/canvas.h" | 9 #include "app/gfx/canvas.h" |
| 10 #include "app/gfx/text_elider.h" | 10 #include "app/gfx/text_elider.h" |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 | 648 |
| 649 if (bubble_bottom_y + offset > monitor_rect.height() || | 649 if (bubble_bottom_y + offset > monitor_rect.height() || |
| 650 (download_shelf_is_visible_ && | 650 (download_shelf_is_visible_ && |
| 651 (view_->GetStyle() == StatusView::STYLE_FLOATING || | 651 (view_->GetStyle() == StatusView::STYLE_FLOATING || |
| 652 view_->GetStyle() == StatusView::STYLE_BOTTOM))) { | 652 view_->GetStyle() == StatusView::STYLE_BOTTOM))) { |
| 653 // The offset is still too large. Move the bubble to the right and reset | 653 // The offset is still too large. Move the bubble to the right and reset |
| 654 // Y offset_ to zero. | 654 // Y offset_ to zero. |
| 655 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); | 655 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); |
| 656 offset_ = 0; | 656 offset_ = 0; |
| 657 | 657 |
| 658 // Substract border width + bubble width. | 658 // Subtract border width + bubble width. |
| 659 int right_position_x = window_width - (position_.x() + size_.width()); | 659 int right_position_x = window_width - (position_.x() + size_.width()); |
| 660 popup_->SetBounds(gfx::Rect(top_left.x() + right_position_x, | 660 popup_->SetBounds(gfx::Rect(top_left.x() + right_position_x, |
| 661 top_left.y() + position_.y(), | 661 top_left.y() + position_.y(), |
| 662 size_.width(), size_.height())); | 662 size_.width(), size_.height())); |
| 663 } else { | 663 } else { |
| 664 offset_ = offset; | 664 offset_ = offset; |
| 665 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), | 665 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), |
| 666 top_left.y() + position_.y() + offset_, | 666 top_left.y() + position_.y() + offset_, |
| 667 size_.width(), size_.height())); | 667 size_.width(), size_.height())); |
| 668 } | 668 } |
| 669 } else if (offset_ != 0 || | 669 } else if (offset_ != 0 || |
| 670 view_->GetStyle() == StatusView::STYLE_STANDARD_RIGHT) { | 670 view_->GetStyle() == StatusView::STYLE_STANDARD_RIGHT) { |
| 671 offset_ = 0; | 671 offset_ = 0; |
| 672 view_->SetStyle(StatusView::STYLE_STANDARD); | 672 view_->SetStyle(StatusView::STYLE_STANDARD); |
| 673 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), | 673 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), |
| 674 top_left.y() + position_.y(), | 674 top_left.y() + position_.y(), |
| 675 size_.width(), size_.height())); | 675 size_.width(), size_.height())); |
| 676 } | 676 } |
| 677 } | 677 } |
| 678 | 678 |
| 679 bool StatusBubbleViews::IsFrameVisible() { | 679 bool StatusBubbleViews::IsFrameVisible() { |
| 680 if (!frame_->IsVisible()) | 680 if (!frame_->IsVisible()) |
| 681 return false; | 681 return false; |
| 682 | 682 |
| 683 views::Window* window = frame_->GetWindow(); | 683 views::Window* window = frame_->GetWindow(); |
| 684 return !window || !window->IsMinimized(); | 684 return !window || !window->IsMinimized(); |
| 685 } | 685 } |
| OLD | NEW |