[Metrics] Make MetricsStateManager take a callback param to check if UMA is enabled.
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / browser_non_client_frame_view_ash.h
blob6b805eae2ff345740124cfcacae9afa70e4aa62c
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 "ash/shell_observer.h"
9 #include "base/gtest_prod_util.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
12 #include "chrome/browser/ui/views/tab_icon_view_model.h"
14 class TabIconView;
16 namespace ash {
17 class FrameBorderHitTestController;
18 class FrameCaptionButtonContainerView;
19 class HeaderPainter;
21 namespace views {
22 class ImageButton;
23 class ToggleImageButton;
26 class BrowserNonClientFrameViewAsh
27 : public BrowserNonClientFrameView,
28 public ash::ShellObserver,
29 public chrome::TabIconViewModel {
30 public:
31 static const char kViewClassName[];
33 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view);
34 virtual ~BrowserNonClientFrameViewAsh();
36 void Init();
38 // BrowserNonClientFrameView overrides:
39 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE;
40 virtual int GetTopInset() const OVERRIDE;
41 virtual int GetThemeBackgroundXInset() const OVERRIDE;
42 virtual void UpdateThrobber(bool running) OVERRIDE;
44 // views::NonClientFrameView overrides:
45 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE;
46 virtual gfx::Rect GetWindowBoundsForClientBounds(
47 const gfx::Rect& client_bounds) const OVERRIDE;
48 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
49 virtual void GetWindowMask(const gfx::Size& size,
50 gfx::Path* window_mask) OVERRIDE;
51 virtual void ResetWindowControls() OVERRIDE;
52 virtual void UpdateWindowIcon() OVERRIDE;
53 virtual void UpdateWindowTitle() OVERRIDE;
55 // views::View overrides:
56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
57 virtual void Layout() OVERRIDE;
58 virtual const char* GetClassName() const OVERRIDE;
59 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE;
60 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
61 virtual gfx::Size GetMinimumSize() const OVERRIDE;
63 // ash::ShellObserver:
64 virtual void OnMaximizeModeStarted() OVERRIDE;
65 virtual void OnMaximizeModeEnded() OVERRIDE;
67 // Overridden from chrome::TabIconViewModel:
68 virtual bool ShouldTabIconViewAnimate() const OVERRIDE;
69 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE;
71 private:
72 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, WindowHeader);
73 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
74 NonImmersiveFullscreen);
75 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
76 ImmersiveFullscreen);
77 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
78 ToggleMaximizeModeRelayout);
80 // Distance between the left edge of the NonClientFrameView and the tab strip.
81 int GetTabStripLeftInset() const;
83 // Distance between the right edge of the NonClientFrameView and the tab
84 // strip.
85 int GetTabStripRightInset() const;
87 // Returns true if we should use a super short header with light bars instead
88 // of regular tabs. This header is used in immersive fullscreen when the
89 // top-of-window views are not revealed.
90 bool UseImmersiveLightbarHeaderStyle() const;
92 // Returns true if the header should be painted so that it looks the same as
93 // the header used for packaged apps. Packaged apps use a different color
94 // scheme than browser windows.
95 bool UsePackagedAppHeaderStyle() const;
97 // Layout the incognito icon.
98 void LayoutAvatar();
100 // Returns true if there is anything to paint. Some fullscreen windows do not
101 // need their frames painted.
102 bool ShouldPaint() const;
104 // Paints the header background when the frame is in immersive fullscreen and
105 // tab light bar is visible.
106 void PaintImmersiveLightbarStyleHeader(gfx::Canvas* canvas);
108 void PaintToolbarBackground(gfx::Canvas* canvas);
110 // Draws the line under the header for windows without a toolbar and not using
111 // the packaged app header style.
112 void PaintContentEdge(gfx::Canvas* canvas);
114 // View which contains the window controls.
115 ash::FrameCaptionButtonContainerView* caption_button_container_;
117 // For popups, the window icon.
118 TabIconView* window_icon_;
120 // Helper class for painting the header.
121 scoped_ptr<ash::HeaderPainter> header_painter_;
123 // Updates the hittest bounds overrides based on the window show type.
124 scoped_ptr<ash::FrameBorderHitTestController>
125 frame_border_hit_test_controller_;
127 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh);
130 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_