OLD | NEW |
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_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
7 | 7 |
8 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" | 8 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" |
9 #include "ui/views/window/non_client_view.h" | 9 #include "ui/views/window/non_client_view.h" |
10 | 10 |
11 class AvatarLabel; | 11 #if defined(ENABLE_MANAGED_USERS) |
| 12 class SupervisedUserAvatarLabel; |
| 13 #endif |
12 class AvatarMenuButton; | 14 class AvatarMenuButton; |
13 class BrowserFrame; | 15 class BrowserFrame; |
14 class BrowserView; | 16 class BrowserView; |
15 class NewAvatarButton; | 17 class NewAvatarButton; |
16 | 18 |
17 // A specialization of the NonClientFrameView object that provides additional | 19 // A specialization of the NonClientFrameView object that provides additional |
18 // Browser-specific methods. | 20 // Browser-specific methods. |
19 class BrowserNonClientFrameView : public views::NonClientFrameView { | 21 class BrowserNonClientFrameView : public views::NonClientFrameView { |
20 public: | 22 public: |
21 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); | 23 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); |
22 virtual ~BrowserNonClientFrameView(); | 24 virtual ~BrowserNonClientFrameView(); |
23 | 25 |
24 AvatarMenuButton* avatar_button() const { return avatar_button_; } | 26 AvatarMenuButton* avatar_button() const { return avatar_button_; } |
25 | 27 |
26 NewAvatarButton* new_avatar_button() const { return new_avatar_button_; } | 28 NewAvatarButton* new_avatar_button() const { return new_avatar_button_; } |
27 | 29 |
28 AvatarLabel* avatar_label() const { return avatar_label_; } | 30 #if defined(ENABLE_MANAGED_USERS) |
| 31 SupervisedUserAvatarLabel* supervised_user_avatar_label() const { |
| 32 return supervised_user_avatar_label_; |
| 33 } |
| 34 |
| 35 virtual void OnThemeChanged() OVERRIDE; |
| 36 #endif |
29 | 37 |
30 // Retrieves the bounds, in non-client view coordinates within which the | 38 // Retrieves the bounds, in non-client view coordinates within which the |
31 // TabStrip should be laid out. | 39 // TabStrip should be laid out. |
32 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; | 40 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; |
33 | 41 |
34 // Returns the inset of the topmost view in the client view from the top of | 42 // Returns the inset of the topmost view in the client view from the top of |
35 // the non-client view. The topmost view depends on the window type. The | 43 // the non-client view. The topmost view depends on the window type. The |
36 // topmost view is the tab strip for tabbed browser windows, the toolbar for | 44 // topmost view is the tab strip for tabbed browser windows, the toolbar for |
37 // popups, the web contents for app windows and varies for fullscreen windows. | 45 // popups, the web contents for app windows and varies for fullscreen windows. |
38 virtual int GetTopInset() const = 0; | 46 virtual int GetTopInset() const = 0; |
39 | 47 |
40 // Returns the amount that the theme background should be inset. | 48 // Returns the amount that the theme background should be inset. |
41 virtual int GetThemeBackgroundXInset() const = 0; | 49 virtual int GetThemeBackgroundXInset() const = 0; |
42 | 50 |
43 // Updates the throbber. | 51 // Updates the throbber. |
44 virtual void UpdateThrobber(bool running) = 0; | 52 virtual void UpdateThrobber(bool running) = 0; |
45 | 53 |
46 // Overriden from views::View. | 54 // Overriden from views::View. |
47 virtual void VisibilityChanged(views::View* starting_from, | 55 virtual void VisibilityChanged(views::View* starting_from, |
48 bool is_visible) OVERRIDE; | 56 bool is_visible) OVERRIDE; |
49 virtual void OnThemeChanged() OVERRIDE; | |
50 | 57 |
51 protected: | 58 protected: |
52 BrowserView* browser_view() const { return browser_view_; } | 59 BrowserView* browser_view() const { return browser_view_; } |
53 BrowserFrame* frame() const { return frame_; } | 60 BrowserFrame* frame() const { return frame_; } |
54 | 61 |
55 // Updates the title and icon of the avatar button. | 62 // Updates the title and icon of the avatar button. |
56 void UpdateAvatarInfo(); | 63 void UpdateAvatarInfo(); |
57 | 64 |
58 // Updates the title of the avatar button displayed in the caption area. | 65 // Updates the title of the avatar button displayed in the caption area. |
59 // The button uses |style| to match the browser window style and notifies | 66 // The button uses |style| to match the browser window style and notifies |
60 // |listener| when it is clicked. | 67 // |listener| when it is clicked. |
61 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, | 68 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, |
62 const NewAvatarButton::AvatarButtonStyle style); | 69 const NewAvatarButton::AvatarButtonStyle style); |
63 | 70 |
64 private: | 71 private: |
65 // The frame that hosts this view. | 72 // The frame that hosts this view. |
66 BrowserFrame* frame_; | 73 BrowserFrame* frame_; |
67 | 74 |
68 // The BrowserView hosted within this View. | 75 // The BrowserView hosted within this View. |
69 BrowserView* browser_view_; | 76 BrowserView* browser_view_; |
70 | 77 |
71 // Menu button that displays that either the incognito icon or the profile | 78 // Menu button that displays that either the incognito icon or the profile |
72 // icon. May be NULL for some frame styles. | 79 // icon. May be NULL for some frame styles. |
73 AvatarMenuButton* avatar_button_; | 80 AvatarMenuButton* avatar_button_; |
74 | 81 |
75 // Avatar label that is used for a supervised user. | 82 #if defined(ENABLE_MANAGED_USERS) |
76 AvatarLabel* avatar_label_; | 83 SupervisedUserAvatarLabel* supervised_user_avatar_label_; |
| 84 #endif |
77 | 85 |
78 // Menu button that displays the name of the active or guest profile. | 86 // Menu button that displays the name of the active or guest profile. |
79 // May be NULL and will not be displayed for off the record profiles. | 87 // May be NULL and will not be displayed for off the record profiles. |
80 NewAvatarButton* new_avatar_button_; | 88 NewAvatarButton* new_avatar_button_; |
81 }; | 89 }; |
82 | 90 |
83 namespace chrome { | 91 namespace chrome { |
84 | 92 |
85 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 93 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
86 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 94 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
87 BrowserFrame* frame, BrowserView* browser_view); | 95 BrowserFrame* frame, BrowserView* browser_view); |
88 | 96 |
89 } // namespace chrome | 97 } // namespace chrome |
90 | 98 |
91 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 99 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
OLD | NEW |