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_GLASS_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/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_win.h" | 11 #include "chrome/browser/ui/views/frame/browser_frame_win.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 "views/controls/button/button.h" | 13 #include "views/controls/button/button.h" |
14 #include "views/window/non_client_view.h" | 14 #include "views/window/non_client_view.h" |
15 | 15 |
16 class BrowserView; | 16 class BrowserView; |
17 class AvatarMenuButton; | 17 class ProfileMenuButton; |
| 18 class ProfileMenuModel; |
| 19 class ProfileTagView; |
18 class SkBitmap; | 20 class SkBitmap; |
19 | 21 |
20 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 22 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
21 public NotificationObserver { | 23 public NotificationObserver { |
22 public: | 24 public: |
23 // Constructs a non-client view for an BrowserFrame. | 25 // Constructs a non-client view for an BrowserFrame. |
24 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 26 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
25 virtual ~GlassBrowserFrameView(); | 27 virtual ~GlassBrowserFrameView(); |
26 | 28 |
27 // Overridden from BrowserNonClientFrameView: | 29 // Overridden from BrowserNonClientFrameView: |
(...skipping 29 matching lines...) Expand all Loading... |
57 | 59 |
58 // Returns the height of the entire nonclient top border, including the window | 60 // Returns the height of the entire nonclient top border, including the window |
59 // frame, any title area, and any connected client edge. If |restored| is | 61 // frame, any title area, and any connected client edge. If |restored| is |
60 // true, acts as if the window is restored regardless of the real mode. If | 62 // true, acts as if the window is restored regardless of the real mode. If |
61 // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless | 63 // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless |
62 // of the real state. | 64 // of the real state. |
63 int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; | 65 int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; |
64 | 66 |
65 // Paint various sub-components of this view. | 67 // Paint various sub-components of this view. |
66 void PaintToolbarBackground(gfx::Canvas* canvas); | 68 void PaintToolbarBackground(gfx::Canvas* canvas); |
| 69 void PaintOTRAvatar(gfx::Canvas* canvas); |
67 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 70 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
68 | 71 |
69 // Layout various sub-components of this view. | 72 // Layout various sub-components of this view. |
70 void LayoutAvatar(); | 73 void LayoutOTRAvatar(); |
71 void LayoutClientView(); | 74 void LayoutClientView(); |
| 75 void LayoutProfileTag(); |
72 | 76 |
73 // Returns the bounds of the client area for the specified view size. | 77 // Returns the bounds of the client area for the specified view size. |
74 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 78 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
75 | 79 |
76 // Starts/Stops the window throbber running. | 80 // Starts/Stops the window throbber running. |
77 void StartThrobber(); | 81 void StartThrobber(); |
78 void StopThrobber(); | 82 void StopThrobber(); |
79 | 83 |
80 // Displays the next throbber frame. | 84 // Displays the next throbber frame. |
81 void DisplayNextThrobberFrame(); | 85 void DisplayNextThrobberFrame(); |
82 | 86 |
83 // NotificationObserver implementation: | 87 // NotificationObserver implementation: |
84 virtual void Observe(NotificationType type, | 88 virtual void Observe(NotificationType type, |
85 const NotificationSource& source, | 89 const NotificationSource& source, |
86 const NotificationDetails& details) OVERRIDE; | 90 const NotificationDetails& details) OVERRIDE; |
87 | 91 |
88 // Receive notifications when the user's Google services user name changes. | 92 // Receive notifications when the user's Google services user name changes. |
89 void RegisterLoginNotifications(); | 93 void RegisterLoginNotifications(); |
90 | 94 |
91 // The layout rect of the avatar icon, if visible. | 95 // Returns true if the ProfileButton has been created. |
92 gfx::Rect avatar_bounds_; | 96 bool show_profile_button() const { return profile_button_.get() != NULL; } |
| 97 |
| 98 // The layout rect of the OTR avatar icon, if visible. |
| 99 gfx::Rect otr_avatar_bounds_; |
93 | 100 |
94 // The frame that hosts this view. | 101 // The frame that hosts this view. |
95 BrowserFrame* frame_; | 102 BrowserFrame* frame_; |
96 | 103 |
97 // The BrowserView hosted within this View. | 104 // The BrowserView hosted within this View. |
98 BrowserView* browser_view_; | 105 BrowserView* browser_view_; |
99 | 106 |
100 // The bounds of the ClientView. | 107 // The bounds of the ClientView. |
101 gfx::Rect client_view_bounds_; | 108 gfx::Rect client_view_bounds_; |
102 | 109 |
103 // Menu button that displays that either the incognito icon or the profile | 110 // Menu button that displays user's name and multi-profile menu. |
104 // icon. | 111 scoped_ptr<ProfileMenuButton> profile_button_; |
105 scoped_ptr<AvatarMenuButton> avatar_button_; | 112 |
| 113 // Image tag displayed on frame beneath profile_button_. |
| 114 scoped_ptr<ProfileTagView> profile_tag_; |
106 | 115 |
107 // Whether or not the window throbber is currently animating. | 116 // Whether or not the window throbber is currently animating. |
108 bool throbber_running_; | 117 bool throbber_running_; |
109 | 118 |
110 // The index of the current frame of the throbber animation. | 119 // The index of the current frame of the throbber animation. |
111 int throbber_frame_; | 120 int throbber_frame_; |
112 | 121 |
113 // The Google services user name associated with this BrowserView's profile. | 122 // The Google services user name associated with this BrowserView's profile. |
114 StringPrefMember username_pref_; | 123 StringPrefMember username_pref_; |
115 | 124 |
116 static const int kThrobberIconCount = 24; | 125 static const int kThrobberIconCount = 24; |
117 static HICON throbber_icons_[kThrobberIconCount]; | 126 static HICON throbber_icons_[kThrobberIconCount]; |
118 static void InitThrobberIcons(); | 127 static void InitThrobberIcons(); |
119 | 128 |
120 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 129 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
121 }; | 130 }; |
122 | 131 |
123 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 132 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |