| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 RemoveChildView(supervised_user_avatar_label_); | 208 RemoveChildView(supervised_user_avatar_label_); |
| 209 delete supervised_user_avatar_label_; | 209 delete supervised_user_avatar_label_; |
| 210 supervised_user_avatar_label_ = nullptr; | 210 supervised_user_avatar_label_ = nullptr; |
| 211 } | 211 } |
| 212 #endif | 212 #endif |
| 213 RemoveChildView(avatar_button_); | 213 RemoveChildView(avatar_button_); |
| 214 delete avatar_button_; | 214 delete avatar_button_; |
| 215 avatar_button_ = nullptr; | 215 avatar_button_ = nullptr; |
| 216 frame_->GetRootView()->Layout(); | 216 frame_->GetRootView()->Layout(); |
| 217 } | 217 } |
| 218 |
| 219 gfx::Image avatar; |
| 220 gfx::Image taskbar_badge_avatar; |
| 221 bool is_rectangle = false; |
| 222 |
| 223 // Update the avatar button in the window frame and the taskbar overlay. |
| 224 bool should_show_avatar_menu = |
| 225 avatar_button_ || AvatarMenu::ShouldShowAvatarMenu(); |
| 226 |
| 227 if (!AvatarMenuButton::GetAvatarImages( |
| 228 browser_view_->browser()->profile(), should_show_avatar_menu, &avatar, |
| 229 &taskbar_badge_avatar, &is_rectangle)) { |
| 230 return; |
| 231 } |
| 232 |
| 233 // Disable the menu when we should not show the menu. |
| 234 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu()) |
| 235 avatar_button_->SetEnabled(false); |
| 236 if (avatar_button_) |
| 237 avatar_button_->SetAvatarIcon(avatar, is_rectangle); |
| 218 } | 238 } |
| 219 | 239 |
| 220 void BrowserNonClientFrameView::UpdateNewAvatarButton( | 240 void BrowserNonClientFrameView::UpdateNewAvatarButton( |
| 221 views::ButtonListener* listener, | 241 views::ButtonListener* listener, |
| 222 const NewAvatarButton::AvatarButtonStyle style) { | 242 const NewAvatarButton::AvatarButtonStyle style) { |
| 223 DCHECK(switches::IsNewAvatarMenu()); | 243 DCHECK(switches::IsNewAvatarMenu()); |
| 224 // This should never be called in incognito mode. | 244 // This should never be called in incognito mode. |
| 225 DCHECK(browser_view_->IsRegularOrGuestSession()); | 245 DCHECK(browser_view_->IsRegularOrGuestSession()); |
| 226 | 246 |
| 227 if (browser_view_->ShouldShowAvatar()) { | 247 if (browser_view_->ShouldShowAvatar()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 const ProfileInfoCache& cache = | 310 const ProfileInfoCache& cache = |
| 291 g_browser_process->profile_manager()->GetProfileInfoCache(); | 311 g_browser_process->profile_manager()->GetProfileInfoCache(); |
| 292 show_decoration = show_decoration && cache.GetNumberOfProfiles() > 1; | 312 show_decoration = show_decoration && cache.GetNumberOfProfiles() > 1; |
| 293 } | 313 } |
| 294 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), | 314 chrome::DrawTaskbarDecoration(frame_->GetNativeWindow(), |
| 295 show_decoration | 315 show_decoration |
| 296 ? (taskbar_badge_avatar.IsEmpty() ? &avatar : &taskbar_badge_avatar) | 316 ? (taskbar_badge_avatar.IsEmpty() ? &avatar : &taskbar_badge_avatar) |
| 297 : nullptr); | 317 : nullptr); |
| 298 } | 318 } |
| 299 } | 319 } |
| OLD | NEW |