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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 OnProfileAvatarChanged(base::FilePath()); | 80 OnProfileAvatarChanged(base::FilePath()); |
81 } | 81 } |
82 | 82 |
83 #if defined(ENABLE_SUPERVISED_USERS) | 83 #if defined(ENABLE_SUPERVISED_USERS) |
84 void BrowserNonClientFrameView::OnThemeChanged() { | 84 void BrowserNonClientFrameView::OnThemeChanged() { |
85 if (supervised_user_avatar_label_) | 85 if (supervised_user_avatar_label_) |
86 supervised_user_avatar_label_->UpdateLabelStyle(); | 86 supervised_user_avatar_label_->UpdateLabelStyle(); |
87 } | 87 } |
88 #endif | 88 #endif |
89 | 89 |
| 90 void BrowserNonClientFrameView::UpdateAvatar( |
| 91 views::ButtonListener* listener, |
| 92 const NewAvatarButton::AvatarButtonStyle style) { |
| 93 if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu()) |
| 94 UpdateNewStyleAvatarInfo(listener, style); |
| 95 else |
| 96 UpdateAvatarInfo(); |
| 97 } |
| 98 |
90 void BrowserNonClientFrameView::UpdateAvatarInfo() { | 99 void BrowserNonClientFrameView::UpdateAvatarInfo() { |
91 if (browser_view_->ShouldShowAvatar()) { | 100 if (browser_view_->ShouldShowAvatar()) { |
92 if (!avatar_button_) { | 101 if (!avatar_button_) { |
93 #if defined(ENABLE_SUPERVISED_USERS) | 102 #if defined(ENABLE_SUPERVISED_USERS) |
94 Profile* profile = browser_view_->browser()->profile(); | 103 Profile* profile = browser_view_->browser()->profile(); |
95 if (profile->IsSupervised() && !supervised_user_avatar_label_) { | 104 if (profile->IsSupervised() && !supervised_user_avatar_label_) { |
96 supervised_user_avatar_label_ = | 105 supervised_user_avatar_label_ = |
97 new SupervisedUserAvatarLabel(browser_view_); | 106 new SupervisedUserAvatarLabel(browser_view_); |
98 supervised_user_avatar_label_->set_id( | 107 supervised_user_avatar_label_->set_id( |
99 VIEW_ID_SUPERVISED_USER_AVATAR_LABEL); | 108 VIEW_ID_SUPERVISED_USER_AVATAR_LABEL); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // returns false, don't bother trying to update the taskbar decoration since | 221 // returns false, don't bother trying to update the taskbar decoration since |
213 // the returned images are not initialized. This can happen if the user | 222 // the returned images are not initialized. This can happen if the user |
214 // deletes the current profile. | 223 // deletes the current profile. |
215 if (AvatarMenuButton::GetAvatarImages(browser_view_->browser()->profile(), | 224 if (AvatarMenuButton::GetAvatarImages(browser_view_->browser()->profile(), |
216 AvatarMenu::ShouldShowAvatarMenu(), | 225 AvatarMenu::ShouldShowAvatarMenu(), |
217 &avatar, &taskbar_badge_avatar, | 226 &avatar, &taskbar_badge_avatar, |
218 &is_rectangle)) { | 227 &is_rectangle)) { |
219 DrawTaskbarDecoration(avatar, taskbar_badge_avatar); | 228 DrawTaskbarDecoration(avatar, taskbar_badge_avatar); |
220 } | 229 } |
221 } | 230 } |
OLD | NEW |