| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Returns the location icon, if this frame has any. | 59 // Returns the location icon, if this frame has any. |
| 60 virtual views::View* GetLocationIconView() const; | 60 virtual views::View* GetLocationIconView() const; |
| 61 | 61 |
| 62 // Overriden from views::View. | 62 // Overriden from views::View. |
| 63 void VisibilityChanged(views::View* starting_from, bool is_visible) override; | 63 void VisibilityChanged(views::View* starting_from, bool is_visible) override; |
| 64 | 64 |
| 65 protected: | 65 protected: |
| 66 BrowserView* browser_view() const { return browser_view_; } | 66 BrowserView* browser_view() const { return browser_view_; } |
| 67 BrowserFrame* frame() const { return frame_; } | 67 BrowserFrame* frame() const { return frame_; } |
| 68 | 68 |
| 69 // Updates the title and icon of the avatar button. | 69 // Updates the avatar button using the old or new UI based on the BrowserView |
| 70 // type, and the presence of the --enable-new-avatar-menu flag. Calls either |
| 71 // UpdateAvatarInfo() or UpdateNewStyleAvatar() accordingly. |
| 72 void UpdateAvatar(); |
| 73 |
| 74 // Updates the title and icon of the old avatar button. |
| 70 void UpdateAvatarInfo(); | 75 void UpdateAvatarInfo(); |
| 71 | 76 |
| 77 // Updates the avatar button displayed in the caption area by calling |
| 78 // UpdateNewStyleAvatarInfo() with an implementation specific |listener| |
| 79 // and button |style|. |
| 80 virtual void UpdateNewStyleAvatar() = 0; |
| 81 |
| 72 // Updates the title of the avatar button displayed in the caption area. | 82 // 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 | 83 // The button uses |style| to match the browser window style and notifies |
| 74 // |listener| when it is clicked. | 84 // |listener| when it is clicked. |
| 75 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, | 85 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, |
| 76 const NewAvatarButton::AvatarButtonStyle style); | 86 const NewAvatarButton::AvatarButtonStyle style); |
| 77 | 87 |
| 78 private: | 88 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. | 89 // Overriden from ProfileInfoCacheObserver. |
| 85 void OnProfileAdded(const base::FilePath& profile_path) override; | 90 void OnProfileAdded(const base::FilePath& profile_path) override; |
| 86 void OnProfileWasRemoved(const base::FilePath& profile_path, | 91 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 87 const base::string16& profile_name) override; | 92 const base::string16& profile_name) override; |
| 88 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 93 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 94 void OnProfileNameChanged(const base::FilePath& profile_path, |
| 95 const base::string16& old_profile_name) override; |
| 96 |
| 97 // Draws a taskbar icon if avatars are enabled, erases it otherwise. |
| 98 void UpdateTaskbarDecoration(); |
| 89 | 99 |
| 90 // The frame that hosts this view. | 100 // The frame that hosts this view. |
| 91 BrowserFrame* frame_; | 101 BrowserFrame* frame_; |
| 92 | 102 |
| 93 // The BrowserView hosted within this View. | 103 // The BrowserView hosted within this View. |
| 94 BrowserView* browser_view_; | 104 BrowserView* browser_view_; |
| 95 | 105 |
| 96 // Menu button that displays that either the incognito icon or the profile | 106 // Menu button that displays that either the incognito icon or the profile |
| 97 // icon. May be null for some frame styles. | 107 // icon. May be null for some frame styles. |
| 98 AvatarMenuButton* avatar_button_; | 108 AvatarMenuButton* avatar_button_; |
| 99 | 109 |
| 100 #if defined(ENABLE_SUPERVISED_USERS) | 110 #if defined(ENABLE_SUPERVISED_USERS) |
| 101 SupervisedUserAvatarLabel* supervised_user_avatar_label_; | 111 SupervisedUserAvatarLabel* supervised_user_avatar_label_; |
| 102 #endif | 112 #endif |
| 103 | 113 |
| 104 // Menu button that displays the name of the active or guest profile. | 114 // 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. | 115 // May be null and will not be displayed for off the record profiles. |
| 106 NewAvatarButton* new_avatar_button_; | 116 NewAvatarButton* new_avatar_button_; |
| 107 }; | 117 }; |
| 108 | 118 |
| 109 namespace chrome { | 119 namespace chrome { |
| 110 | 120 |
| 111 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 121 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
| 112 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 122 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
| 113 BrowserFrame* frame, BrowserView* browser_view); | 123 BrowserFrame* frame, BrowserView* browser_view); |
| 114 | 124 |
| 115 } // namespace chrome | 125 } // namespace chrome |
| 116 | 126 |
| 117 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 127 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
| OLD | NEW |