| 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 MONITOR_DEFAULTTONEAREST), &monitor_info); | 655 MONITOR_DEFAULTTONEAREST), &monitor_info); |
| 656 gfx::Rect monitor_rect(monitor_info.rcWork); | 656 gfx::Rect monitor_rect(monitor_info.rcWork); |
| 657 #else | 657 #else |
| 658 gfx::Rect monitor_rect; | 658 gfx::Rect monitor_rect; |
| 659 NOTIMPLEMENTED(); | 659 NOTIMPLEMENTED(); |
| 660 #endif | 660 #endif |
| 661 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); | 661 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); |
| 662 | 662 |
| 663 if (bubble_bottom_y + offset > monitor_rect.height() || | 663 if (bubble_bottom_y + offset > monitor_rect.height() || |
| 664 (download_shelf_is_visible_ && | 664 (download_shelf_is_visible_ && |
| 665 view_->GetStyle() == StatusView::STYLE_FLOATING)) { | 665 (view_->GetStyle() == StatusView::STYLE_FLOATING || |
| 666 view_->GetStyle() == StatusView::STYLE_BOTTOM))) { |
| 666 // The offset is still too large. Move the bubble to the right and reset | 667 // The offset is still too large. Move the bubble to the right and reset |
| 667 // Y offset_ to zero. | 668 // Y offset_ to zero. |
| 668 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); | 669 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); |
| 669 offset_ = 0; | 670 offset_ = 0; |
| 670 | 671 |
| 671 // Substract border width + bubble width. | 672 // Substract border width + bubble width. |
| 672 int right_position_x = window_width - (position_.x() + size_.width()); | 673 int right_position_x = window_width - (position_.x() + size_.width()); |
| 673 popup_->SetBounds(gfx::Rect(top_left.x() + right_position_x, | 674 popup_->SetBounds(gfx::Rect(top_left.x() + right_position_x, |
| 674 top_left.y() + position_.y(), | 675 top_left.y() + position_.y(), |
| 675 size_.width(), size_.height())); | 676 size_.width(), size_.height())); |
| 676 } else { | 677 } else { |
| 677 offset_ = offset; | 678 offset_ = offset; |
| 678 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), | 679 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), |
| 679 top_left.y() + position_.y() + offset_, | 680 top_left.y() + position_.y() + offset_, |
| 680 size_.width(), size_.height())); | 681 size_.width(), size_.height())); |
| 681 } | 682 } |
| 682 } else if (offset_ != 0 || | 683 } else if (offset_ != 0 || |
| 683 view_->GetStyle() == StatusView::STYLE_STANDARD_RIGHT) { | 684 view_->GetStyle() == StatusView::STYLE_STANDARD_RIGHT) { |
| 684 offset_ = 0; | 685 offset_ = 0; |
| 685 view_->SetStyle(StatusView::STYLE_STANDARD); | 686 view_->SetStyle(StatusView::STYLE_STANDARD); |
| 686 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), | 687 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), |
| 687 top_left.y() + position_.y(), | 688 top_left.y() + position_.y(), |
| 688 size_.width(), size_.height())); | 689 size_.width(), size_.height())); |
| 689 } | 690 } |
| 690 } | 691 } |
| OLD | NEW |