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 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/profiles/avatar_menu.h" | 8 #include "chrome/browser/profiles/avatar_menu.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 10 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 return; | 114 return; |
115 text = cache.GetNameOfProfileAtIndex(index); | 115 text = cache.GetNameOfProfileAtIndex(index); |
116 | 116 |
117 AvatarMenu::GetImageForMenuButton(browser_view_->browser()->profile(), | 117 AvatarMenu::GetImageForMenuButton(browser_view_->browser()->profile(), |
118 &avatar, | 118 &avatar, |
119 &is_rectangle); | 119 &is_rectangle); |
120 // Disable the menu when we should not show the menu. | 120 // Disable the menu when we should not show the menu. |
121 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu()) | 121 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu()) |
122 avatar_button_->SetEnabled(false); | 122 avatar_button_->SetEnabled(false); |
123 } | 123 } |
124 if (avatar_button_) { | 124 if (avatar_button_) |
125 avatar_button_->SetAvatarIcon(avatar, is_rectangle); | 125 avatar_button_->SetAvatarIcon(avatar, is_rectangle); |
126 if (!text.empty()) | |
127 avatar_button_->SetText(text); | |
128 } | |
129 | 126 |
130 // For popups and panels which don't have the avatar button, we still | 127 // For popups and panels which don't have the avatar button, we still |
131 // need to draw the taskbar decoration. Even though we have an icon on the | 128 // need to draw the taskbar decoration. Even though we have an icon on the |
132 // window's relaunch details, we draw over it because the user may have pinned | 129 // window's relaunch details, we draw over it because the user may have pinned |
133 // the badge-less Chrome shortcut which will cause windows to ignore the | 130 // the badge-less Chrome shortcut which will cause windows to ignore the |
134 // relaunch details. | 131 // relaunch details. |
135 // TODO(calamity): ideally this should not be necessary but due to issues with | 132 // TODO(calamity): ideally this should not be necessary but due to issues with |
136 // the default shortcut being pinned, we add the runtime badge for safety. | 133 // the default shortcut being pinned, we add the runtime badge for safety. |
137 // See crbug.com/313800. | 134 // See crbug.com/313800. |
138 chrome::DrawTaskbarDecoration( | 135 chrome::DrawTaskbarDecoration( |
(...skipping 19 matching lines...) Expand all Loading... |
158 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); | 155 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
159 AddChildView(new_avatar_button_); | 156 AddChildView(new_avatar_button_); |
160 frame_->GetRootView()->Layout(); | 157 frame_->GetRootView()->Layout(); |
161 } | 158 } |
162 } else if (new_avatar_button_) { | 159 } else if (new_avatar_button_) { |
163 delete new_avatar_button_; | 160 delete new_avatar_button_; |
164 new_avatar_button_ = NULL; | 161 new_avatar_button_ = NULL; |
165 frame_->GetRootView()->Layout(); | 162 frame_->GetRootView()->Layout(); |
166 } | 163 } |
167 } | 164 } |
OLD | NEW |