Index: chrome/browser/ui/views/frame/opaque_browser_frame_view.h |
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h |
index 04095c8a05fc37d230a9246799ca3153b6e82141..67c4cbc3d3f835c0d32c2d7e23b968086b8bdfb1 100644 |
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.h |
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.h |
@@ -6,8 +6,10 @@ |
#define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
#include "base/memory/scoped_ptr.h" |
+#include "chrome/browser/ui/view_ids.h" |
#include "chrome/browser/ui/views/frame/browser_frame.h" |
#include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
+#include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h" |
#include "chrome/browser/ui/views/tab_icon_view_model.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -15,6 +17,7 @@ |
#include "ui/views/window/non_client_view.h" |
class BrowserView; |
+class OpaqueBrowserFrameViewLayout; |
class TabIconView; |
namespace views { |
@@ -26,7 +29,8 @@ class Label; |
class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
public content::NotificationObserver, |
public views::ButtonListener, |
- public chrome::TabIconViewModel { |
+ public chrome::TabIconViewModel, |
+ public OpaqueBrowserFrameViewLayoutDelegate { |
public: |
// Constructs a non-client view for an BrowserFrame. |
OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
@@ -45,16 +49,6 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
views::ImageButton* restore_button() const { return restore_button_; } |
views::ImageButton* close_button() const { return close_button_; } |
- // Used to allow subclasses to reserve height for other components they |
- // will add. The space is reserved below the ClientView. |
- virtual int GetReservedHeight() const; |
- virtual gfx::Rect GetBoundsForReservedArea() const; |
- |
- // Returns the height of the entire nonclient top border, including the window |
- // frame, any title area, and any connected client edge. If |restored| is |
- // true, acts as if the window is restored regardless of the real mode. |
- int NonClientTopBorderHeight(bool restored) const; |
- |
// Overridden from views::NonClientFrameView: |
virtual gfx::Rect GetBoundsForClientView() const OVERRIDE; |
virtual gfx::Rect GetWindowBoundsForClientBounds( |
@@ -68,7 +62,6 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
// Overridden from views::View: |
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
- virtual void Layout() OVERRIDE; |
virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
@@ -85,6 +78,23 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
const content::NotificationSource& source, |
const content::NotificationDetails& details) OVERRIDE; |
+ // OpaqueBrowserFrameViewLayoutDelegate implementation: |
+ virtual bool ShouldShowWindowIcon() const OVERRIDE; |
+ virtual bool ShouldShowWindowTitle() const OVERRIDE; |
+ virtual string16 GetWindowTitle() const OVERRIDE; |
+ virtual int GetIconSize() const OVERRIDE; |
+ virtual bool ShouldLeaveOffsetNearTopBorder() const OVERRIDE; |
+ virtual gfx::Size GetBrowserViewMinimumSize() const OVERRIDE; |
+ virtual bool ShouldShowAvatar() const OVERRIDE; |
+ virtual gfx::ImageSkia GetOTRAvatarIcon() const OVERRIDE; |
+ virtual bool IsMaximized() const OVERRIDE; |
+ virtual bool IsMinimized() const OVERRIDE; |
+ virtual bool IsFullscreen() const OVERRIDE; |
+ virtual bool IsTabStripVisible() const OVERRIDE; |
+ virtual int GetTabStripHeight() const OVERRIDE; |
+ virtual int GetAdditionalReservedSpaceInTabStrip() const OVERRIDE; |
+ virtual gfx::Size GetTabstripPreferredSize() const OVERRIDE; |
+ |
private: |
// Creates, adds and returns a new image button with |this| as its listener. |
// Memory is owned by the caller. |
@@ -92,7 +102,8 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
int hot_image_id, |
int pushed_image_id, |
int mask_image_id, |
- int accessibility_string_id); |
+ int accessibility_string_id, |
+ ViewID view_id); |
// Returns the thickness of the border that makes up the window frame edges. |
// This does not include any client edge. If |restored| is true, acts as if |
@@ -107,26 +118,10 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
// borders, including both the window frame and any client edge. |
int NonClientBorderThickness() const; |
- // Returns the y-coordinate of the caption buttons. If |restored| is true, |
- // acts as if the window is restored regardless of the real mode. |
- int CaptionButtonY(bool restored) const; |
- |
- // Returns the thickness of the 3D edge along the bottom of the titlebar. If |
- // |restored| is true, acts as if the window is restored regardless of the |
- // real mode. |
- int TitlebarBottomThickness(bool restored) const; |
- |
- // Returns the size of the titlebar icon. This is used even when the icon is |
- // not shown, e.g. to set the titlebar height. |
- int IconSize() const; |
- |
// Returns the bounds of the titlebar icon (or where the icon would be if |
// there was one). |
gfx::Rect IconBounds() const; |
- // Returns the combined bounds for the tab strip and avatar area. |
- gfx::Rect GetBoundsForTabStripAndAvatarArea(views::View* tabstrip) const; |
- |
// Paint various sub-components of this view. The *FrameBorder() functions |
// also paint the background of the titlebar area, since the top frame border |
// and titlebar background are a contiguous component. |
@@ -141,16 +136,11 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
gfx::ImageSkia* GetFrameOverlayImage() const; |
int GetTopAreaHeight() const; |
- // Layout various sub-components of this view. |
- void LayoutWindowControls(); |
- void LayoutTitleBar(); |
- void LayoutAvatar(); |
- |
// Returns the bounds of the client area for the specified view size. |
gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
- // The layout rect of the avatar icon, if visible. |
- gfx::Rect avatar_bounds_; |
+ // Our layout manager also calculates various bounds. |
+ OpaqueBrowserFrameViewLayout* layout_; |
// Window controls. |
views::ImageButton* minimize_button_; |
@@ -162,9 +152,6 @@ class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
TabIconView* window_icon_; |
views::Label* window_title_; |
- // The bounds of the ClientView. |
- gfx::Rect client_view_bounds_; |
- |
content::NotificationRegistrar registrar_; |
// Background painter for the window frame. |