Chromium Code Reviews| Index: chrome/browser/ui/views/frame/opaque_browser_frame_view.cc |
| =================================================================== |
| --- chrome/browser/ui/views/frame/opaque_browser_frame_view.cc (revision 145906) |
| +++ chrome/browser/ui/views/frame/opaque_browser_frame_view.cc (working copy) |
| @@ -221,17 +221,15 @@ |
| if (!tabstrip) |
| return gfx::Rect(); |
| - int tabstrip_x = browser_view()->ShouldShowAvatar() ? |
| - (avatar_bounds_.right() + kAvatarRightSpacing) : |
| - NonClientBorderThickness() + kTabStripIndent; |
| - |
| - int maximized_spacing = kNewTabCaptionMaximizedSpacing; |
| - int tabstrip_width = |
| - (minimize_button_ ? minimize_button_->x() : width()) - tabstrip_x - |
| - (frame()->IsMaximized() ? |
| - maximized_spacing : kNewTabCaptionRestoredSpacing); |
| - return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), |
| - std::max(0, tabstrip_width), tabstrip->GetPreferredSize().height()); |
| + gfx::Rect bounds = GetBoundsForTabStripAndAvatarArea(tabstrip); |
| + if (browser_view()->ShouldShowAvatar()) { |
|
Peter Kasting
2012/07/11 19:14:51
Nit: Shorter:
int space_left_of_tabstrip = brow
Alexei Svitkine (slow)
2012/07/11 19:21:41
Done.
|
| + // Adjust tab strip bounds to make room for the avatar. |
| + bounds.Inset(kAvatarLeftSpacing + avatar_bounds_.width() + |
| + kAvatarRightSpacing, 0, 0, 0); |
| + } else { |
| + bounds.Inset(kTabStripIndent, 0, 0, 0); |
| + } |
| + return bounds; |
| } |
| int OpaqueBrowserFrameView::GetHorizontalTabStripVerticalOffset( |
| @@ -267,6 +265,19 @@ |
| } |
| #endif |
| min_size.set_width(std::max(min_size.width(), min_titlebar_width)); |
| + |
| + // Ensure that the minimum width is enough to hold a minimum width tab strip |
| + // and avatar icon at their usual insets. |
| + if (browser_view()->IsTabStripVisible()) { |
| + TabStrip* tabstrip = browser_view()->tabstrip(); |
| + const int min_tabstrip_width = tabstrip->GetMinimumSize().width(); |
| + const int min_tabstrip_area_width = |
| + width() - GetBoundsForTabStripAndAvatarArea(tabstrip).width() + |
| + min_tabstrip_width + browser_view()->GetOTRAvatarIcon().width() + |
| + kAvatarLeftSpacing + kAvatarRightSpacing; |
| + min_size.set_width(std::max(min_size.width(), min_tabstrip_area_width)); |
| + } |
| + |
| return min_size; |
| } |
| @@ -567,6 +578,19 @@ |
| return gfx::Rect(frame_thickness + kIconLeftSpacing, y, size, size); |
| } |
| +gfx::Rect OpaqueBrowserFrameView::GetBoundsForTabStripAndAvatarArea( |
| + views::View* tabstrip) const { |
| + const int available_width = |
| + minimize_button_ ? minimize_button_->x() : width(); |
| + const int caption_spacing = frame()->IsMaximized() ? |
| + kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing; |
| + const int tabstrip_x = NonClientBorderThickness(); |
| + const int tabstrip_width = available_width - tabstrip_x - caption_spacing; |
| + return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), |
| + std::max(0, tabstrip_width), |
| + tabstrip->GetPreferredSize().height()); |
| +} |
| + |
| void OpaqueBrowserFrameView::PaintRestoredFrameBorder(gfx::Canvas* canvas) { |
| frame_background_->set_frame_color(GetFrameColor()); |
| frame_background_->set_theme_image(GetFrameImage()); |