Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / glass_browser_frame_view.h
blob292d56e1c71936b86d868ebc94560c282d1d08e6
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"
13 class BrowserView;
15 class GlassBrowserFrameView : public BrowserNonClientFrameView,
16 public views::ButtonListener {
17 public:
18 // Constructs a non-client view for an BrowserFrame.
19 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view);
20 ~GlassBrowserFrameView() override;
22 // BrowserNonClientFrameView:
23 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override;
24 int GetTopInset() const override;
25 int GetThemeBackgroundXInset() const override;
26 void UpdateThrobber(bool running) override;
27 gfx::Size GetMinimumSize() const override;
29 // views::NonClientFrameView:
30 gfx::Rect GetBoundsForClientView() const override;
31 gfx::Rect GetWindowBoundsForClientBounds(
32 const gfx::Rect& client_bounds) const override;
33 int NonClientHitTest(const gfx::Point& point) override;
34 void GetWindowMask(const gfx::Size& size, gfx::Path* window_mask) override {}
35 void ResetWindowControls() override {}
36 void UpdateWindowIcon() override {}
37 void UpdateWindowTitle() override {}
38 void SizeConstraintsChanged() override {}
40 protected:
41 // views::View:
42 void OnPaint(gfx::Canvas* canvas) override;
43 void Layout() override;
45 // views::ButtonListener:
46 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
48 // BrowserNonClientFrameView:
49 void UpdateNewAvatarButtonImpl() override;
51 private:
52 // views::NonClientFrameView:
53 bool DoesIntersectRect(const views::View* target,
54 const gfx::Rect& rect) const override;
56 // Returns the thickness of the border that makes up the window frame edges.
57 // This does not include any client edge.
58 int FrameBorderThickness() const;
60 // Returns the thickness of the entire nonclient left, right, and bottom
61 // borders, including both the window frame and any client edge.
62 int NonClientBorderThickness() const;
64 // Returns the height of the entire nonclient top border, including the window
65 // frame, any title area, and any connected client edge.
66 int NonClientTopBorderHeight() const;
68 // Paint various sub-components of this view.
69 void PaintToolbarBackground(gfx::Canvas* canvas);
70 void PaintRestoredClientEdge(gfx::Canvas* canvas);
72 // Layout various sub-components of this view.
73 void LayoutAvatar();
74 void LayoutNewStyleAvatar();
75 void LayoutClientView();
77 // Returns the insets of the client area.
78 gfx::Insets GetClientAreaInsets() const;
80 // Returns the bounds of the client area for the specified view size.
81 gfx::Rect CalculateClientAreaBounds(int width, int height) const;
83 // Starts/Stops the window throbber running.
84 void StartThrobber();
85 void StopThrobber();
87 // Displays the next throbber frame.
88 void DisplayNextThrobberFrame();
90 // The layout rect of the avatar icon, if visible.
91 gfx::Rect avatar_bounds_;
93 // The bounds of the ClientView.
94 gfx::Rect client_view_bounds_;
96 // Whether or not the window throbber is currently animating.
97 bool throbber_running_;
99 // The index of the current frame of the throbber animation.
100 int throbber_frame_;
102 static const int kThrobberIconCount = 24;
103 static HICON throbber_icons_[kThrobberIconCount];
104 static void InitThrobberIcons();
106 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView);
109 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_