OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_OPAQUE_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
11 #include "chrome/browser/ui/views/frame/browser_frame.h" | 11 #include "chrome/browser/ui/views/frame/browser_frame.h" |
12 #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" |
13 #include "chrome/browser/ui/views/tab_icon_view.h" | 13 #include "chrome/browser/ui/views/tab_icon_view.h" |
14 #include "views/controls/button/button.h" | 14 #include "views/controls/button/button.h" |
15 #include "views/window/non_client_view.h" | 15 #include "views/window/non_client_view.h" |
16 | 16 |
17 class BrowserView; | 17 class BrowserView; |
18 namespace gfx { | 18 namespace gfx { |
19 class Font; | 19 class Font; |
20 } | 20 } |
21 class ProfileMenuButton; | 21 class AvatarMenuButton; |
22 class ProfileMenuModel; | |
23 class ProfileTagView; | |
24 class TabContents; | 22 class TabContents; |
25 namespace views { | 23 namespace views { |
26 class ImageButton; | 24 class ImageButton; |
27 class ImageView; | 25 class ImageView; |
28 } | 26 } |
29 | 27 |
30 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, | 28 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
31 public NotificationObserver, | 29 public NotificationObserver, |
32 public views::ButtonListener, | 30 public views::ButtonListener, |
33 public TabIconView::TabIconViewModel { | 31 public TabIconView::TabIconViewModel { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // there was one). | 135 // there was one). |
138 gfx::Rect IconBounds() const; | 136 gfx::Rect IconBounds() const; |
139 | 137 |
140 // Paint various sub-components of this view. The *FrameBorder() functions | 138 // Paint various sub-components of this view. The *FrameBorder() functions |
141 // also paint the background of the titlebar area, since the top frame border | 139 // also paint the background of the titlebar area, since the top frame border |
142 // and titlebar background are a contiguous component. | 140 // and titlebar background are a contiguous component. |
143 void PaintRestoredFrameBorder(gfx::Canvas* canvas); | 141 void PaintRestoredFrameBorder(gfx::Canvas* canvas); |
144 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); | 142 void PaintMaximizedFrameBorder(gfx::Canvas* canvas); |
145 void PaintTitleBar(gfx::Canvas* canvas); | 143 void PaintTitleBar(gfx::Canvas* canvas); |
146 void PaintToolbarBackground(gfx::Canvas* canvas); | 144 void PaintToolbarBackground(gfx::Canvas* canvas); |
147 void PaintOTRAvatar(gfx::Canvas* canvas); | |
148 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 145 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
149 | 146 |
150 // Layout various sub-components of this view. | 147 // Layout various sub-components of this view. |
151 void LayoutWindowControls(); | 148 void LayoutWindowControls(); |
152 void LayoutTitleBar(); | 149 void LayoutTitleBar(); |
153 void LayoutOTRAvatar(); | 150 void LayoutAvatar(); |
154 void LayoutProfileTag(); | |
155 | 151 |
156 // Returns the bounds of the client area for the specified view size. | 152 // Returns the bounds of the client area for the specified view size. |
157 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 153 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
158 | 154 |
159 // Receive notifications when the user's Google services user name changes. | 155 // Receive notifications when the user's Google services user name changes. |
160 void RegisterLoginNotifications(); | 156 void RegisterLoginNotifications(); |
161 | 157 |
162 // Returns true if the ProfileButton has been created. | |
163 bool show_profile_button() const { return profile_button_.get() != NULL; } | |
164 | |
165 // The layout rect of the title, if visible. | 158 // The layout rect of the title, if visible. |
166 gfx::Rect title_bounds_; | 159 gfx::Rect title_bounds_; |
167 | 160 |
168 // The layout rect of the OTR avatar icon, if visible. | 161 // The layout rect of the avatar icon, if visible. |
169 gfx::Rect otr_avatar_bounds_; | 162 gfx::Rect avatar_bounds_; |
170 | 163 |
171 // Window controls. | 164 // Window controls. |
172 views::ImageButton* minimize_button_; | 165 views::ImageButton* minimize_button_; |
173 views::ImageButton* maximize_button_; | 166 views::ImageButton* maximize_button_; |
174 views::ImageButton* restore_button_; | 167 views::ImageButton* restore_button_; |
175 views::ImageButton* close_button_; | 168 views::ImageButton* close_button_; |
176 | 169 |
177 // The Window icon. | 170 // The Window icon. |
178 TabIconView* window_icon_; | 171 TabIconView* window_icon_; |
179 | 172 |
180 // The frame that hosts this view. | 173 // The frame that hosts this view. |
181 BrowserFrame* frame_; | 174 BrowserFrame* frame_; |
182 | 175 |
183 // The BrowserView hosted within this View. | 176 // The BrowserView hosted within this View. |
184 BrowserView* browser_view_; | 177 BrowserView* browser_view_; |
185 | 178 |
186 // The bounds of the ClientView. | 179 // The bounds of the ClientView. |
187 gfx::Rect client_view_bounds_; | 180 gfx::Rect client_view_bounds_; |
188 | 181 |
189 // Menu button that displays user's name and multi-profile menu. | 182 // Menu button that displays that either the incognito icon or the profile |
190 scoped_ptr<ProfileMenuButton> profile_button_; | 183 // icon. |
191 | 184 scoped_ptr<AvatarMenuButton> avatar_button_; |
192 // Image tag displayed on frame beneath profile_button_. | |
193 scoped_ptr<ProfileTagView> profile_tag_; | |
194 | 185 |
195 // The Google services user name associated with this BrowserView's profile. | 186 // The Google services user name associated with this BrowserView's profile. |
196 StringPrefMember username_pref_; | 187 StringPrefMember username_pref_; |
197 | 188 |
198 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); | 189 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); |
199 }; | 190 }; |
200 | 191 |
201 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 192 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |