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