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_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_
8 #include "base/gtest_prod_util.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
11 #include "chrome/browser/ui/views/tab_icon_view_model.h"
16 class FrameBorderHitTestController;
17 class FrameCaptionButtonContainerView;
22 class ToggleImageButton;
25 class BrowserNonClientFrameViewAsh
26 : public BrowserNonClientFrameView,
27 public chrome::TabIconViewModel {
29 static const char kViewClassName[];
31 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view);
32 virtual ~BrowserNonClientFrameViewAsh();
36 // BrowserNonClientFrameView overrides:
37 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE;
38 virtual TabStripInsets GetTabStripInsets(bool force_restored) const OVERRIDE;
39 virtual int GetThemeBackgroundXInset() const OVERRIDE;
40 virtual void UpdateThrobber(bool running) OVERRIDE;
42 // views::NonClientFrameView overrides:
43 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
44 virtual gfx::Rect GetWindowBoundsForClientBounds(
45 const gfx::Rect& client_bounds) const OVERRIDE;
46 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
47 virtual void GetWindowMask(const gfx::Size& size,
48 gfx::Path* window_mask) OVERRIDE;
49 virtual void ResetWindowControls() OVERRIDE;
50 virtual void UpdateWindowIcon() OVERRIDE;
51 virtual void UpdateWindowTitle() OVERRIDE;
53 // views::View overrides:
54 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
55 virtual void Layout() OVERRIDE;
56 virtual const char* GetClassName() const OVERRIDE;
57 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
58 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE;
59 virtual gfx::Size GetMinimumSize() OVERRIDE;
60 virtual void OnThemeChanged() OVERRIDE;
62 // Overridden from chrome::TabIconViewModel:
63 virtual bool ShouldTabIconViewAnimate() const OVERRIDE;
64 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE;
67 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, WindowHeader);
68 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
69 NonImmersiveFullscreen);
70 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
73 // Distance between top of window and client area.
74 int NonClientTopBorderHeight() const;
76 // Returns true if we should use a short header, such as for popup windows.
77 bool UseShortHeader() const;
79 // Returns true if we should use a super short header with light bars instead
80 // of regular tabs. This header is used in immersive fullscreen when the
81 // top-of-window views are not revealed.
82 bool UseImmersiveLightbarHeaderStyle() const;
84 // Layout the incognito icon.
87 // Returns true if there is anything to paint. Some fullscreen windows do not
88 // need their frames painted.
89 bool ShouldPaint() const;
91 // Paints the header background when the frame is in immersive fullscreen and
92 // tab light bar is visible.
93 void PaintImmersiveLightbarStyleHeader(gfx::Canvas* canvas);
95 void PaintToolbarBackground(gfx::Canvas* canvas);
97 // Windows without a toolbar need to draw their own line under the header,
98 // above the content area.
99 void PaintContentEdge(gfx::Canvas* canvas);
101 // Returns the id of the header frame image based on the browser type,
102 // activation state and incognito mode.
103 int GetThemeFrameImageId() const;
105 // Returns the id of the header frame overlay image based on the activation
106 // state and incognito mode.
107 // Returns 0 if no overlay image should be used.
108 int GetThemeFrameOverlayImageId() const;
110 // View which contains the window controls.
111 ash::FrameCaptionButtonContainerView* caption_button_container_;
113 // For popups, the window icon.
114 TabIconView* window_icon_;
116 // Helper class for painting the header.
117 scoped_ptr<ash::HeaderPainter> header_painter_;
119 // Updates the hittest bounds overrides based on the window show type.
120 scoped_ptr<ash::FrameBorderHitTestController>
121 frame_border_hit_test_controller_;
123 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh);
126 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_