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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 // topmost view is the tab strip for tabbed browser windows, the toolbar for | 45 // topmost view is the tab strip for tabbed browser windows, the toolbar for |
46 // popups, the web contents for app windows and varies for fullscreen windows. | 46 // popups, the web contents for app windows and varies for fullscreen windows. |
47 virtual int GetTopInset() const = 0; | 47 virtual int GetTopInset() const = 0; |
48 | 48 |
49 // Returns the amount that the theme background should be inset. | 49 // Returns the amount that the theme background should be inset. |
50 virtual int GetThemeBackgroundXInset() const = 0; | 50 virtual int GetThemeBackgroundXInset() const = 0; |
51 | 51 |
52 // Updates the throbber. | 52 // Updates the throbber. |
53 virtual void UpdateThrobber(bool running) = 0; | 53 virtual void UpdateThrobber(bool running) = 0; |
54 | 54 |
55 virtual void UpdateNewStyleAvatar() = 0; | |
56 | |
55 // Updates any toolbar components in the frame. The default implementation | 57 // Updates any toolbar components in the frame. The default implementation |
56 // does nothing. | 58 // does nothing. |
57 virtual void UpdateToolbar(); | 59 virtual void UpdateToolbar(); |
58 | 60 |
59 // Returns the location icon, if this frame has any. | 61 // Returns the location icon, if this frame has any. |
60 virtual views::View* GetLocationIconView() const; | 62 virtual views::View* GetLocationIconView() const; |
61 | 63 |
62 // Overriden from views::View. | 64 // Overriden from views::View. |
63 void VisibilityChanged(views::View* starting_from, bool is_visible) override; | 65 void VisibilityChanged(views::View* starting_from, bool is_visible) override; |
64 | 66 |
65 protected: | 67 protected: |
66 BrowserView* browser_view() const { return browser_view_; } | 68 BrowserView* browser_view() const { return browser_view_; } |
67 BrowserFrame* frame() const { return frame_; } | 69 BrowserFrame* frame() const { return frame_; } |
68 | 70 |
71 // Updates the avatar button using the old or new UI based on the BrowserView | |
72 // type, and the presence of the --enable-new-avatar-menu flag. Calls either | |
73 // UpdateAvatarInfo() or UpdateNewStyleAvatar() accordingly. | |
74 void UpdateAvatar(); | |
75 | |
69 // Updates the title and icon of the avatar button. | 76 // Updates the title and icon of the avatar button. |
70 void UpdateAvatarInfo(); | 77 void UpdateAvatarInfo(); |
noms
2015/02/20 21:24:34
For what it's worth, I have a plan of renaming the
| |
71 | 78 |
72 // Updates the title of the avatar button displayed in the caption area. | 79 // Updates the title of the avatar button displayed in the caption area. |
73 // The button uses |style| to match the browser window style and notifies | 80 // The button uses |style| to match the browser window style and notifies |
74 // |listener| when it is clicked. | 81 // |listener| when it is clicked. |
75 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, | 82 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, |
76 const NewAvatarButton::AvatarButtonStyle style); | 83 const NewAvatarButton::AvatarButtonStyle style); |
77 | 84 |
78 private: | 85 private: |
79 // Draws a taskbar icon if avatar are enabled, erases it otherwise. If | |
80 // |taskbar_badge_avatar| is null, then |avatar| is used. | |
81 void DrawTaskbarDecoration(const gfx::Image& avatar, | |
82 const gfx::Image& taskbar_badge_avatar); | |
83 | |
84 // Overriden from ProfileInfoCacheObserver. | 86 // Overriden from ProfileInfoCacheObserver. |
85 void OnProfileAdded(const base::FilePath& profile_path) override; | 87 void OnProfileAdded(const base::FilePath& profile_path) override; |
86 void OnProfileWasRemoved(const base::FilePath& profile_path, | 88 void OnProfileWasRemoved(const base::FilePath& profile_path, |
87 const base::string16& profile_name) override; | 89 const base::string16& profile_name) override; |
88 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 90 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
91 void OnProfileNameChanged(const base::FilePath& profile_path, | |
92 const base::string16& old_profile_name) override; | |
93 | |
94 // Draws a taskbar icon if avatars are enabled, erases it otherwise. | |
95 void BrowserNonClientFrameView::UpdateTaskbarDecoration(); | |
sky
2015/02/20 21:43:19
nuke BrowserNonClientFrameView::.
noms
2015/02/23 15:46:52
oops! done.
| |
89 | 96 |
90 // The frame that hosts this view. | 97 // The frame that hosts this view. |
91 BrowserFrame* frame_; | 98 BrowserFrame* frame_; |
92 | 99 |
93 // The BrowserView hosted within this View. | 100 // The BrowserView hosted within this View. |
94 BrowserView* browser_view_; | 101 BrowserView* browser_view_; |
95 | 102 |
96 // Menu button that displays that either the incognito icon or the profile | 103 // Menu button that displays that either the incognito icon or the profile |
97 // icon. May be null for some frame styles. | 104 // icon. May be null for some frame styles. |
98 AvatarMenuButton* avatar_button_; | 105 AvatarMenuButton* avatar_button_; |
99 | 106 |
100 #if defined(ENABLE_SUPERVISED_USERS) | 107 #if defined(ENABLE_SUPERVISED_USERS) |
101 SupervisedUserAvatarLabel* supervised_user_avatar_label_; | 108 SupervisedUserAvatarLabel* supervised_user_avatar_label_; |
102 #endif | 109 #endif |
103 | 110 |
104 // Menu button that displays the name of the active or guest profile. | 111 // Menu button that displays the name of the active or guest profile. |
105 // May be null and will not be displayed for off the record profiles. | 112 // May be null and will not be displayed for off the record profiles. |
106 NewAvatarButton* new_avatar_button_; | 113 NewAvatarButton* new_avatar_button_; |
107 }; | 114 }; |
108 | 115 |
109 namespace chrome { | 116 namespace chrome { |
110 | 117 |
111 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 118 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
112 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 119 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
113 BrowserFrame* frame, BrowserView* browser_view); | 120 BrowserFrame* frame, BrowserView* browser_view); |
114 | 121 |
115 } // namespace chrome | 122 } // namespace chrome |
116 | 123 |
117 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 124 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
OLD | NEW |