Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.h

Issue 441803004: Introduce new WebApp header style for hosted apps and fizzy apps on ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put some non-ash code back Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ 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_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_
7 7
8 #include "ash/shell_observer.h" 8 #include "ash/shell_observer.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/command_observer.h"
11 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h"
12 #include "chrome/browser/ui/views/tab_icon_view_model.h" 13 #include "chrome/browser/ui/views/tab_icon_view_model.h"
13 14
14 class TabIconView; 15 class TabIconView;
15 16
16 namespace ash { 17 namespace ash {
17 class FrameBorderHitTestController; 18 class FrameBorderHitTestController;
19 class FrameCaptionButton;
18 class FrameCaptionButtonContainerView; 20 class FrameCaptionButtonContainerView;
19 class HeaderPainter; 21 class HeaderPainter;
20 } 22 }
21 namespace views { 23 namespace views {
22 class ImageButton; 24 class ImageButton;
23 class ToggleImageButton; 25 class ToggleImageButton;
24 } 26 }
25 27
26 class BrowserNonClientFrameViewAsh 28 class BrowserNonClientFrameViewAsh : public BrowserNonClientFrameView,
27 : public BrowserNonClientFrameView, 29 public ash::ShellObserver,
28 public ash::ShellObserver, 30 public chrome::TabIconViewModel,
29 public chrome::TabIconViewModel { 31 public CommandObserver,
32 public views::ButtonListener {
30 public: 33 public:
31 static const char kViewClassName[]; 34 static const char kViewClassName[];
32 35
33 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view); 36 BrowserNonClientFrameViewAsh(BrowserFrame* frame, BrowserView* browser_view);
34 virtual ~BrowserNonClientFrameViewAsh(); 37 virtual ~BrowserNonClientFrameViewAsh();
35 38
36 void Init(); 39 void Init();
37 40
38 // BrowserNonClientFrameView: 41 // BrowserNonClientFrameView:
39 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE; 42 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const OVERRIDE;
(...skipping 20 matching lines...) Expand all
60 virtual gfx::Size GetMinimumSize() const OVERRIDE; 63 virtual gfx::Size GetMinimumSize() const OVERRIDE;
61 64
62 // ash::ShellObserver: 65 // ash::ShellObserver:
63 virtual void OnMaximizeModeStarted() OVERRIDE; 66 virtual void OnMaximizeModeStarted() OVERRIDE;
64 virtual void OnMaximizeModeEnded() OVERRIDE; 67 virtual void OnMaximizeModeEnded() OVERRIDE;
65 68
66 // chrome::TabIconViewModel: 69 // chrome::TabIconViewModel:
67 virtual bool ShouldTabIconViewAnimate() const OVERRIDE; 70 virtual bool ShouldTabIconViewAnimate() const OVERRIDE;
68 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE; 71 virtual gfx::ImageSkia GetFaviconForTabIconView() OVERRIDE;
69 72
73 // CommandObserver:
74 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE;
75
76 // views::ButtonListener:
77 virtual void ButtonPressed(views::Button* sender,
78 const ui::Event& event) OVERRIDE;
79
70 private: 80 private:
71 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, WindowHeader); 81 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, WindowHeader);
72 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, 82 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
73 NonImmersiveFullscreen); 83 NonImmersiveFullscreen);
74 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, 84 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
75 ImmersiveFullscreen); 85 ImmersiveFullscreen);
76 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest, 86 FRIEND_TEST_ALL_PREFIXES(BrowserNonClientFrameViewAshTest,
77 ToggleMaximizeModeRelayout); 87 ToggleMaximizeModeRelayout);
78 88
79 // views::NonClientFrameView: 89 // views::NonClientFrameView:
(...skipping 10 matching lines...) Expand all
90 // Returns true if we should use a super short header with light bars instead 100 // Returns true if we should use a super short header with light bars instead
91 // of regular tabs. This header is used in immersive fullscreen when the 101 // of regular tabs. This header is used in immersive fullscreen when the
92 // top-of-window views are not revealed. 102 // top-of-window views are not revealed.
93 bool UseImmersiveLightbarHeaderStyle() const; 103 bool UseImmersiveLightbarHeaderStyle() const;
94 104
95 // Returns true if the header should be painted so that it looks the same as 105 // Returns true if the header should be painted so that it looks the same as
96 // the header used for packaged apps. Packaged apps use a different color 106 // the header used for packaged apps. Packaged apps use a different color
97 // scheme than browser windows. 107 // scheme than browser windows.
98 bool UsePackagedAppHeaderStyle() const; 108 bool UsePackagedAppHeaderStyle() const;
99 109
110 // Returns true if the header should be painted with a WebApp header style.
111 // The WebApp header style has a back button and title along with the usual
112 // accoutrements.
113 bool UseWebAppHeaderStyle() const;
114
100 // Layout the incognito icon. 115 // Layout the incognito icon.
101 void LayoutAvatar(); 116 void LayoutAvatar();
102 117
103 // Returns true if there is anything to paint. Some fullscreen windows do not 118 // Returns true if there is anything to paint. Some fullscreen windows do not
104 // need their frames painted. 119 // need their frames painted.
105 bool ShouldPaint() const; 120 bool ShouldPaint() const;
106 121
107 // Paints the header background when the frame is in immersive fullscreen and 122 // Paints the header background when the frame is in immersive fullscreen and
108 // tab light bar is visible. 123 // tab light bar is visible.
109 void PaintImmersiveLightbarStyleHeader(gfx::Canvas* canvas); 124 void PaintImmersiveLightbarStyleHeader(gfx::Canvas* canvas);
110 125
111 void PaintToolbarBackground(gfx::Canvas* canvas); 126 void PaintToolbarBackground(gfx::Canvas* canvas);
112 127
113 // Draws the line under the header for windows without a toolbar and not using 128 // Draws the line under the header for windows without a toolbar and not using
114 // the packaged app header style. 129 // the packaged app header style.
115 void PaintContentEdge(gfx::Canvas* canvas); 130 void PaintContentEdge(gfx::Canvas* canvas);
116 131
132 // Update the state of the back button.
133 void UpdateBackButtonState(bool enabled);
134
117 // View which contains the window controls. 135 // View which contains the window controls.
118 ash::FrameCaptionButtonContainerView* caption_button_container_; 136 ash::FrameCaptionButtonContainerView* caption_button_container_;
119 137
138 // View which contains the back button for WebApp style header.
139 ash::FrameCaptionButton* webapp_back_button_;
140
120 // For popups, the window icon. 141 // For popups, the window icon.
121 TabIconView* window_icon_; 142 TabIconView* window_icon_;
122 143
123 // Helper class for painting the header. 144 // Helper class for painting the header.
124 scoped_ptr<ash::HeaderPainter> header_painter_; 145 scoped_ptr<ash::HeaderPainter> header_painter_;
125 146
126 // Updates the hittest bounds overrides based on the window show type. 147 // Updates the hittest bounds overrides based on the window show type.
127 scoped_ptr<ash::FrameBorderHitTestController> 148 scoped_ptr<ash::FrameBorderHitTestController>
128 frame_border_hit_test_controller_; 149 frame_border_hit_test_controller_;
129 150
130 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh); 151 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameViewAsh);
131 }; 152 };
132 153
133 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_ 154 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_ASH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698