| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/avatar_menu.h" | 9 #include "chrome/browser/profiles/avatar_menu.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu()) | 109 if (avatar_button_ && !AvatarMenu::ShouldShowAvatarMenu()) |
| 110 avatar_button_->SetEnabled(false); | 110 avatar_button_->SetEnabled(false); |
| 111 } | 111 } |
| 112 if (avatar_button_) { | 112 if (avatar_button_) { |
| 113 avatar_button_->SetAvatarIcon(avatar, is_rectangle); | 113 avatar_button_->SetAvatarIcon(avatar, is_rectangle); |
| 114 if (!text.empty()) | 114 if (!text.empty()) |
| 115 avatar_button_->SetText(text); | 115 avatar_button_->SetText(text); |
| 116 } | 116 } |
| 117 | 117 |
| 118 // For popups and panels which don't have the avatar button, we still | 118 // For popups and panels which don't have the avatar button, we still |
| 119 // need to draw the taskbar decoration. Draw the avatar for | 119 // need to draw the taskbar decoration. Even though we have an icon on the |
| 120 // custom-user-data-dir windows which don't support having a shortcut icon. | 120 // window's relaunch details, we draw over it because the user may have pinned |
| 121 // For non-custom-user-data-dir windows, the window's relaunch details are set | 121 // the badge-less Chrome shortcut which will cause windows to ignore the |
| 122 // so that the profile's shortcut icon is used, which includes this badge. | 122 // relaunch details. |
| 123 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUserDataDir)) { | 123 // TODO(calamity): ideally this should not be necessary but due to issues with |
| 124 chrome::DrawTaskbarDecoration( | 124 // the default shortcut being pinned, we add the runtime badge for safety. |
| 125 frame_->GetNativeWindow(), | 125 // See crbug.com/313800. |
| 126 AvatarMenu::ShouldShowAvatarMenu() ? &avatar : NULL); | 126 chrome::DrawTaskbarDecoration( |
| 127 } | 127 frame_->GetNativeWindow(), |
| 128 AvatarMenu::ShouldShowAvatarMenu() ? &avatar : NULL); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void BrowserNonClientFrameView::UpdateNewStyleAvatarInfo( | 131 void BrowserNonClientFrameView::UpdateNewStyleAvatarInfo( |
| 131 views::ButtonListener* listener, | 132 views::ButtonListener* listener, |
| 132 const NewAvatarButton::AvatarButtonStyle style) { | 133 const NewAvatarButton::AvatarButtonStyle style) { |
| 133 DCHECK(profiles::IsNewProfileManagementEnabled()); | 134 DCHECK(profiles::IsNewProfileManagementEnabled()); |
| 134 // This should never be called in incognito mode. | 135 // This should never be called in incognito mode. |
| 135 DCHECK(browser_view_->IsRegularOrGuestSession()); | 136 DCHECK(browser_view_->IsRegularOrGuestSession()); |
| 136 | 137 |
| 137 if (browser_view_->ShouldShowAvatar()) { | 138 if (browser_view_->ShouldShowAvatar()) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 154 void BrowserNonClientFrameView::ShowProfileChooserViewBubble() { | 155 void BrowserNonClientFrameView::ShowProfileChooserViewBubble() { |
| 155 gfx::Point origin; | 156 gfx::Point origin; |
| 156 views::View::ConvertPointToScreen(new_avatar_button(), &origin); | 157 views::View::ConvertPointToScreen(new_avatar_button(), &origin); |
| 157 gfx::Rect bounds(origin, size()); | 158 gfx::Rect bounds(origin, size()); |
| 158 | 159 |
| 159 ProfileChooserView::ShowBubble( | 160 ProfileChooserView::ShowBubble( |
| 160 new_avatar_button(), views::BubbleBorder::TOP_RIGHT, | 161 new_avatar_button(), views::BubbleBorder::TOP_RIGHT, |
| 161 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, | 162 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, |
| 162 browser_view_->browser()); | 163 browser_view_->browser()); |
| 163 } | 164 } |
| OLD | NEW |