Chromium Code Reviews| 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_) { |
|
msw
2014/06/18 00:29:38
nit: you could remove these curly braces.
| |
| 125 avatar_button_->SetAvatarIcon(avatar, is_rectangle); | 125 avatar_button_->SetAvatarIcon(avatar, is_rectangle); |
| 126 if (!text.empty()) | |
| 127 avatar_button_->SetText(text); | |
| 128 } | 126 } |
| 129 | 127 |
| 130 // For popups and panels which don't have the avatar button, we still | 128 // 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 | 129 // 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 | 130 // 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 | 131 // the badge-less Chrome shortcut which will cause windows to ignore the |
| 134 // relaunch details. | 132 // relaunch details. |
| 135 // TODO(calamity): ideally this should not be necessary but due to issues with | 133 // 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. | 134 // the default shortcut being pinned, we add the runtime badge for safety. |
| 137 // See crbug.com/313800. | 135 // See crbug.com/313800. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 158 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); | 156 new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON); |
| 159 AddChildView(new_avatar_button_); | 157 AddChildView(new_avatar_button_); |
| 160 frame_->GetRootView()->Layout(); | 158 frame_->GetRootView()->Layout(); |
| 161 } | 159 } |
| 162 } else if (new_avatar_button_) { | 160 } else if (new_avatar_button_) { |
| 163 delete new_avatar_button_; | 161 delete new_avatar_button_; |
| 164 new_avatar_button_ = NULL; | 162 new_avatar_button_ = NULL; |
| 165 frame_->GetRootView()->Layout(); | 163 frame_->GetRootView()->Layout(); |
| 166 } | 164 } |
| 167 } | 165 } |
| OLD | NEW |