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_GLASS_BROWSER_FRAME_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
10 #include "ui/views/controls/button/button.h"
11 #include "ui/views/window/non_client_view.h"
15 class GlassBrowserFrameView
: public BrowserNonClientFrameView
,
16 public views::ButtonListener
{
18 // Constructs a non-client view for an BrowserFrame.
19 GlassBrowserFrameView(BrowserFrame
* frame
, BrowserView
* browser_view
);
20 virtual ~GlassBrowserFrameView();
22 // BrowserNonClientFrameView:
23 virtual gfx::Rect
GetBoundsForTabStrip(views::View
* tabstrip
) const override
;
24 virtual int GetTopInset() const override
;
25 virtual int GetThemeBackgroundXInset() const override
;
26 virtual void UpdateThrobber(bool running
) override
;
27 virtual gfx::Size
GetMinimumSize() const override
;
29 // views::NonClientFrameView:
30 virtual gfx::Rect
GetBoundsForClientView() const override
;
31 virtual gfx::Rect
GetWindowBoundsForClientBounds(
32 const gfx::Rect
& client_bounds
) const override
;
33 virtual int NonClientHitTest(const gfx::Point
& point
) override
;
34 virtual void GetWindowMask(const gfx::Size
& size
, gfx::Path
* window_mask
)
36 virtual void ResetWindowControls() override
{}
37 virtual void UpdateWindowIcon() override
{}
38 virtual void UpdateWindowTitle() override
{}
39 virtual void SizeConstraintsChanged() override
{}
43 virtual void OnPaint(gfx::Canvas
* canvas
) override
;
44 virtual void Layout() override
;
46 // views::ButtonListener:
47 virtual void ButtonPressed(views::Button
* sender
,
48 const ui::Event
& event
) override
;
50 // BrowserNonClientFrameView:
51 void UpdateNewAvatarButtonImpl() override
;
54 // views::NonClientFrameView:
55 virtual bool DoesIntersectRect(const views::View
* target
,
56 const gfx::Rect
& rect
) const override
;
58 // Returns the thickness of the border that makes up the window frame edges.
59 // This does not include any client edge.
60 int FrameBorderThickness() const;
62 // Returns the thickness of the entire nonclient left, right, and bottom
63 // borders, including both the window frame and any client edge.
64 int NonClientBorderThickness() const;
66 // Returns the height of the entire nonclient top border, including the window
67 // frame, any title area, and any connected client edge.
68 int NonClientTopBorderHeight() const;
70 // Paint various sub-components of this view.
71 void PaintToolbarBackground(gfx::Canvas
* canvas
);
72 void PaintRestoredClientEdge(gfx::Canvas
* canvas
);
74 // Layout various sub-components of this view.
76 void LayoutNewStyleAvatar();
77 void LayoutClientView();
79 // Returns the insets of the client area.
80 gfx::Insets
GetClientAreaInsets() const;
82 // Returns the bounds of the client area for the specified view size.
83 gfx::Rect
CalculateClientAreaBounds(int width
, int height
) const;
85 // Starts/Stops the window throbber running.
89 // Displays the next throbber frame.
90 void DisplayNextThrobberFrame();
92 // The layout rect of the avatar icon, if visible.
93 gfx::Rect avatar_bounds_
;
95 // The bounds of the ClientView.
96 gfx::Rect client_view_bounds_
;
98 // Whether or not the window throbber is currently animating.
99 bool throbber_running_
;
101 // The index of the current frame of the throbber animation.
104 static const int kThrobberIconCount
= 24;
105 static HICON throbber_icons_
[kThrobberIconCount
];
106 static void InitThrobberIcons();
108 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView
);
111 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_