diff options
-rw-r--r-- | ash/wm/custom_frame_view_ash.cc | 4 | ||||
-rw-r--r-- | ash/wm/custom_frame_view_ash.h | 1 | ||||
-rw-r--r-- | ash/wm/frame_painter.cc | 26 | ||||
-rw-r--r-- | ash/wm/frame_painter.h | 4 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc | 6 | ||||
-rw-r--r-- | chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h | 1 |
6 files changed, 38 insertions, 4 deletions
diff --git a/ash/wm/custom_frame_view_ash.cc b/ash/wm/custom_frame_view_ash.cc index ba34468..103f4f8 100644 --- a/ash/wm/custom_frame_view_ash.cc +++ b/ash/wm/custom_frame_view_ash.cc @@ -124,6 +124,10 @@ std::string CustomFrameViewAsh::GetClassName() const { return kViewClassName; } +gfx::Size CustomFrameViewAsh::GetMinimumSize() { + return frame_painter_->GetMinimumSize(this); +} + //////////////////////////////////////////////////////////////////////////////// // views::ButtonListener overrides: void CustomFrameViewAsh::ButtonPressed(views::Button* sender, diff --git a/ash/wm/custom_frame_view_ash.h b/ash/wm/custom_frame_view_ash.h index 8535cc9..681af56 100644 --- a/ash/wm/custom_frame_view_ash.h +++ b/ash/wm/custom_frame_view_ash.h @@ -54,6 +54,7 @@ class ASH_EXPORT CustomFrameViewAsh : public views::NonClientFrameView, virtual void Layout() OVERRIDE; virtual std::string GetClassName() const OVERRIDE; virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; + virtual gfx::Size GetMinimumSize() OVERRIDE; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, diff --git a/ash/wm/frame_painter.cc b/ash/wm/frame_painter.cc index 4541df8..177a7f7 100644 --- a/ash/wm/frame_painter.cc +++ b/ash/wm/frame_painter.cc @@ -198,6 +198,22 @@ int FramePainter::NonClientHitTest(views::NonClientFrameView* view, return HTCAPTION; } +gfx::Size FramePainter::GetMinimumSize(views::NonClientFrameView* view) { + gfx::Size min_size = frame_->client_view()->GetMinimumSize(); + // Ensure we can display the top of the caption area. + gfx::Rect client_bounds = view->GetBoundsForClientView(); + min_size.Enlarge(0, client_bounds.y()); + // Ensure we have enough space for the window icon and buttons. We allow + // the title string to collapse to zero width. + int title_width = GetTitleOffsetX() + + maximize_button_->width() + + button_separator_->width() + + close_button_->width(); + if (title_width > min_size.width()) + min_size.set_width(title_width); + return min_size; +} + void FramePainter::PaintHeader(views::NonClientFrameView* view, gfx::Canvas* canvas, const SkBitmap* theme_frame, @@ -277,9 +293,7 @@ void FramePainter::PaintTitleBar(views::NonClientFrameView* view, // The window icon is painted by its own views::View. views::WidgetDelegate* delegate = frame_->widget_delegate(); if (delegate && delegate->ShouldShowWindowTitle()) { - int title_x = window_icon_ ? - window_icon_->bounds().right() + kTitleIconOffsetX : - kTitleNoIconOffsetX; + int title_x = GetTitleOffsetX(); gfx::Rect title_bounds( title_x, kTitleOffsetY, @@ -353,4 +367,10 @@ void FramePainter::SetButtonImages(views::ImageButton* button, theme_provider->GetBitmapNamed(pushed_bitmap_id)); } +int FramePainter::GetTitleOffsetX() const { + return window_icon_ ? + window_icon_->bounds().right() + kTitleIconOffsetX : + kTitleNoIconOffsetX; +} + } // namespace ash diff --git a/ash/wm/frame_painter.h b/ash/wm/frame_painter.h index 7dac596..2cf474d 100644 --- a/ash/wm/frame_painter.h +++ b/ash/wm/frame_painter.h @@ -47,6 +47,7 @@ class ASH_EXPORT FramePainter { const gfx::Rect& client_bounds) const; int NonClientHitTest(views::NonClientFrameView* view, const gfx::Point& point); + gfx::Size GetMinimumSize(views::NonClientFrameView* view); // Paints the frame header. void PaintHeader(views::NonClientFrameView* view, @@ -79,6 +80,9 @@ class ASH_EXPORT FramePainter { int hot_bitmap_id, int pushed_bitmap_id); + // Returns the offset between window left edge and title string. + int GetTitleOffsetX() const; + // Not owned views::Widget* frame_; views::View* window_icon_; // May be NULL. diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc index 965f090..a2ba1d1 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.cc @@ -83,7 +83,7 @@ gfx::Rect BrowserNonClientFrameViewAura::GetBoundsForTabStrip( bool restored = !frame()->IsMaximized(); return gfx::Rect(kTabstripLeftSpacing, GetHorizontalTabStripVerticalOffset(restored), - maximize_button_->x() - kTabstripRightSpacing, + std::max(0, maximize_button_->x() - kTabstripRightSpacing), tabstrip->GetPreferredSize().height()); } @@ -184,6 +184,10 @@ void BrowserNonClientFrameViewAura::GetAccessibleState( state->role = ui::AccessibilityTypes::ROLE_TITLEBAR; } +gfx::Size BrowserNonClientFrameViewAura::GetMinimumSize() { + return frame_painter_->GetMinimumSize(this); +} + /////////////////////////////////////////////////////////////////////////////// // views::ButtonListener overrides: diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h index 675c749..f8b417a 100644 --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_aura.h @@ -47,6 +47,7 @@ class BrowserNonClientFrameViewAura : public BrowserNonClientFrameView, virtual void Layout() OVERRIDE; virtual bool HitTest(const gfx::Point& l) const OVERRIDE; virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; + virtual gfx::Size GetMinimumSize() OVERRIDE; // views::ButtonListener overrides: virtual void ButtonPressed(views::Button* sender, |