From 5b95f25b8ed6e7c673c83d63dbe2164aef4a876e Mon Sep 17 00:00:00 2001 From: "mirandac@chromium.org" Date: Wed, 16 Mar 2011 16:41:02 +0000 Subject: Fix profile menu button and tag in maximized mode. BUG=75709 TEST=profile button looks correct and can be activated in maximized mode. Review URL: http://codereview.chromium.org/6677066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78377 0039d316-1c4b-4281-b951-d872f2087c98 --- .../ui/views/frame/glass_browser_frame_view.cc | 31 +++++++++++++++++++--- .../ui/views/frame/glass_browser_frame_view.h | 1 + 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc index 8a6c309..784914d 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc @@ -69,6 +69,10 @@ const int kNewTabCaptionMaximizedSpacing = 16; const int kMenuDisplayOffset = 7; // Y position for profile button inside the frame. const int kProfileButtonYPosition = 2; +// Y position for profile tag inside the frame. +const int kProfileTagYPosition = 1; +// Offset y position of profile button and tag by this amount when maximized. +const int kProfileElementMaximizedYOffset = 6; } /////////////////////////////////////////////////////////////////////////////// @@ -129,9 +133,14 @@ gfx::Rect GlassBrowserFrameView::GetBoundsForTabStrip( tabstrip_x += otr_avatar_bounds_.x(); minimize_button_offset = width(); } + int maximized_spacing = + kNewTabCaptionMaximizedSpacing + + (show_profile_button() && profile_button_->IsVisible() ? + profile_button_->GetPreferredSize().width() + + views::ProfileMenuButton::kProfileTagHorizontalSpacing : 0); int tabstrip_width = minimize_button_offset - tabstrip_x - (frame_->GetWindow()->IsMaximized() ? - kNewTabCaptionMaximizedSpacing : kNewTabCaptionRestoredSpacing); + maximized_spacing : kNewTabCaptionRestoredSpacing); return gfx::Rect(tabstrip_x, GetHorizontalTabStripVerticalOffset(false), std::max(0, tabstrip_width), tabstrip->GetPreferredSize().height()); @@ -253,6 +262,18 @@ void GlassBrowserFrameView::Layout() { LayoutProfileTag(); } +bool GlassBrowserFrameView::HitTest(const gfx::Point& l) const { + // The ProfileMenuButton intrudes into the client area when the window is + // maximized. + if (frame_->GetWindow()->IsMaximized() && show_profile_button() && + profile_button_->IsVisible() && + profile_button_->GetMirroredBounds().Contains(l)) { + return true; + } else { + return !GetWindow()->client_view()->bounds().Contains(l); + } +} + /////////////////////////////////////////////////////////////////////////////// // GlassBrowserFrameView, private: @@ -504,13 +525,17 @@ void GlassBrowserFrameView::LayoutProfileTag() { profile_button_->GetPreferredSize().width(); profile_button_->SetBounds( x_tag, - kProfileButtonYPosition, + kProfileButtonYPosition + + (frame_->GetWindow()->IsMaximized() ? + kProfileElementMaximizedYOffset : 0), profile_button_->GetPreferredSize().width(), profile_button_->GetPreferredSize().height()); profile_tag_->SetVisible(true); profile_tag_->SetBounds( x_tag, - 1, + kProfileTagYPosition + + (frame_->GetWindow()->IsMaximized() ? + kProfileElementMaximizedYOffset : 0), profile_button_->GetPreferredSize().width(), views::ProfileTagView::kProfileTagHeight); } else { diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.h b/chrome/browser/ui/views/frame/glass_browser_frame_view.h index 22f96c1..711aaad 100644 --- a/chrome/browser/ui/views/frame/glass_browser_frame_view.h +++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.h @@ -55,6 +55,7 @@ class GlassBrowserFrameView : public BrowserNonClientFrameView, // Overridden from views::View: virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; virtual void Layout() OVERRIDE; + virtual bool HitTest(const gfx::Point& l) const OVERRIDE; private: // Returns the thickness of the border that makes up the window frame edges. -- cgit v1.1