1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_
8 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
9 #include "chrome/browser/ui/views/tab_icon_view_model.h"
10 #include "ui/views/controls/button/button.h"
20 // The frame view which is used for Application Panels.
21 // TODO(rafaelw): Refactor. This shares much duplicated code with
22 // OpaqueBrowserFrameView.
23 class AppPanelBrowserFrameView
: public BrowserNonClientFrameView
,
24 public views::ButtonListener
,
25 public chrome::TabIconViewModel
{
27 // Constructs a non-client view for an BrowserFrame.
28 AppPanelBrowserFrameView(BrowserFrame
* frame
, BrowserView
* browser_view
);
29 virtual ~AppPanelBrowserFrameView();
31 // Overridden from BrowserNonClientFrameView:
32 virtual gfx::Rect
GetBoundsForTabStrip(views::View
* tabstrip
) const OVERRIDE
;
33 virtual int GetTopInset() const OVERRIDE
;
34 virtual int GetThemeBackgroundXInset() const OVERRIDE
;
35 virtual void UpdateThrobber(bool running
) OVERRIDE
;
36 virtual gfx::Size
GetMinimumSize() OVERRIDE
;
39 // Overridden from views::NonClientFrameView:
40 virtual gfx::Rect
GetBoundsForClientView() const OVERRIDE
;
41 virtual gfx::Rect
GetWindowBoundsForClientBounds(
42 const gfx::Rect
& client_bounds
) const OVERRIDE
;
43 virtual int NonClientHitTest(const gfx::Point
& point
) OVERRIDE
;
44 virtual void GetWindowMask(const gfx::Size
& size
,
45 gfx::Path
* window_mask
) OVERRIDE
;
46 virtual void ResetWindowControls() OVERRIDE
;
47 virtual void UpdateWindowIcon() OVERRIDE
;
49 // Overridden from views::View:
50 virtual void OnPaint(gfx::Canvas
* canvas
) OVERRIDE
;
51 virtual void Layout() OVERRIDE
;
53 // Overridden from views::ButtonListener:
54 virtual void ButtonPressed(views::Button
* sender
,
55 const ui::Event
& event
) OVERRIDE
;
57 // Overridden from chrome::TabIconViewModel:
58 virtual bool ShouldTabIconViewAnimate() const OVERRIDE
;
59 virtual gfx::ImageSkia
GetFaviconForTabIconView() OVERRIDE
;
62 // Returns the thickness of the border that makes up the window frame edges.
63 // This does not include any client edge.
64 int FrameBorderThickness() const;
66 // Returns the thickness of the entire nonclient left, right, and bottom
67 // borders, including both the window frame and any client edge.
68 int NonClientBorderThickness() const;
70 // Returns the height of the entire nonclient top border, including the window
71 // frame, any title area, and any connected client edge.
72 int NonClientTopBorderHeight() const;
74 // Returns the thickness of the nonclient portion of the 3D edge along the
75 // bottom of the titlebar.
76 int TitlebarBottomThickness() const;
78 // Returns the size of the titlebar icon.
81 // Returns the bounds of the titlebar icon.
82 gfx::Rect
IconBounds() const;
84 // Paint various sub-components of this view. The *FrameBorder() function
85 // also paints the background of the titlebar area, since the top frame border
86 // and titlebar background are a contiguous component.
87 void PaintRestoredFrameBorder(gfx::Canvas
* canvas
);
88 void PaintMaximizedFrameBorder(gfx::Canvas
* canvas
);
89 void PaintTitleBar(gfx::Canvas
* canvas
);
90 void PaintRestoredClientEdge(gfx::Canvas
* canvas
);
92 // Layout various sub-components of this view.
93 void LayoutWindowControls();
94 void LayoutTitleBar();
96 // Returns the bounds of the client area for the specified view size.
97 gfx::Rect
CalculateClientAreaBounds(int width
, int height
) const;
99 // The layout rect of the title, if visible.
100 gfx::Rect title_bounds_
;
103 views::ImageButton
* close_button_
;
106 TabIconView
* window_icon_
;
108 // The bounds of the ClientView.
109 gfx::Rect client_view_bounds_
;
111 DISALLOW_COPY_AND_ASSIGN(AppPanelBrowserFrameView
);
114 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_APP_PANEL_BROWSER_FRAME_VIEW_H_