Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: chrome/browser/views/status_bubble_views.cc

Issue 159878: Ensure that status bubble does not obscure download shelf.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 625
626 // Check if the bubble sticks out from the monitor or will obscure 626 // Check if the bubble sticks out from the monitor or will obscure
627 // download shelf. 627 // download shelf.
628 gfx::NativeWindow window = frame_->GetWindow()->GetNativeWindow(); 628 gfx::NativeWindow window = frame_->GetWindow()->GetNativeWindow();
629 gfx::Rect monitor_rect = 629 gfx::Rect monitor_rect =
630 views::Screen::GetMonitorWorkAreaNearestWindow(window); 630 views::Screen::GetMonitorWorkAreaNearestWindow(window);
631 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height(); 631 const int bubble_bottom_y = top_left.y() + position_.y() + size_.height();
632 632
633 if (bubble_bottom_y + offset > monitor_rect.height() || 633 if (bubble_bottom_y + offset > monitor_rect.height() ||
634 (download_shelf_is_visible_ && 634 (download_shelf_is_visible_ &&
635 view_->GetStyle() == StatusView::STYLE_FLOATING)) { 635 (view_->GetStyle() == StatusView::STYLE_FLOATING ||
636 view_->GetStyle() == StatusView::STYLE_BOTTOM))) {
636 // The offset is still too large. Move the bubble to the right and reset 637 // The offset is still too large. Move the bubble to the right and reset
637 // Y offset_ to zero. 638 // Y offset_ to zero.
638 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT); 639 view_->SetStyle(StatusView::STYLE_STANDARD_RIGHT);
639 offset_ = 0; 640 offset_ = 0;
640 641
641 // Substract border width + bubble width. 642 // Substract border width + bubble width.
642 int right_position_x = window_width - (position_.x() + size_.width()); 643 int right_position_x = window_width - (position_.x() + size_.width());
643 popup_->SetBounds(gfx::Rect(top_left.x() + right_position_x, 644 popup_->SetBounds(gfx::Rect(top_left.x() + right_position_x,
644 top_left.y() + position_.y(), 645 top_left.y() + position_.y(),
645 size_.width(), size_.height())); 646 size_.width(), size_.height()));
646 } else { 647 } else {
647 offset_ = offset; 648 offset_ = offset;
648 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), 649 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(),
649 top_left.y() + position_.y() + offset_, 650 top_left.y() + position_.y() + offset_,
650 size_.width(), size_.height())); 651 size_.width(), size_.height()));
651 } 652 }
652 } else if (offset_ != 0 || 653 } else if (offset_ != 0 ||
653 view_->GetStyle() == StatusView::STYLE_STANDARD_RIGHT) { 654 view_->GetStyle() == StatusView::STYLE_STANDARD_RIGHT) {
654 offset_ = 0; 655 offset_ = 0;
655 view_->SetStyle(StatusView::STYLE_STANDARD); 656 view_->SetStyle(StatusView::STYLE_STANDARD);
656 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(), 657 popup_->SetBounds(gfx::Rect(top_left.x() + position_.x(),
657 top_left.y() + position_.y(), 658 top_left.y() + position_.y(),
658 size_.width(), size_.height())); 659 size_.width(), size_.height()));
659 } 660 }
660 } 661 }
OLDNEW
« no previous file with comments | « chrome/browser/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698