Chromium Code Reviews| Index: chrome/browser/ui/views/frame/browser_non_client_frame_view.cc |
| diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc |
| index c4d6a7ca719158b18466c7dcdf66705d39ce22b1..54d2e2c3d0881ef3b7b52eea393ae28b79ed8f49 100644 |
| --- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc |
| +++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc |
| @@ -73,18 +73,25 @@ void BrowserNonClientFrameView::VisibilityChanged(views::View* starting_from, |
| if (!is_visible) |
| return; |
| +#if defined(OS_CHROMEOS) |
| + // On ChromeOS we always need to give the old avatar button a chance to update |
| + // in case we're in a teleported window. On desktop, the old avatar button |
| + // only shows up when in incognito mode. |
| + UpdateOldAvatarButton(); |
| + OnProfileAvatarChanged(base::FilePath()); |
| +#else |
| // The first time UpdateOldAvatarButton() is called the window is not visible |
| // so DrawTaskBarDecoration() has no effect. Therefore we need to call it |
| // again once the window is visible. |
| - if (!browser_view_->IsRegularOrGuestSession() || |
| - !switches::IsNewAvatarMenu()) { |
| + if (!browser_view_->IsRegularOrGuestSession()) { |
| UpdateOldAvatarButton(); |
| } |
| - // Make sure the task bar icon is correctly updated call |
| - // |OnProfileAvatarChanged()| in this case, but only for non guest profiles. |
| - if (!browser_view_->IsGuestSession() || !switches::IsNewAvatarMenu()) |
| + // Call |OnProfileAvatarChanged()| in this case to make sure the task bar icon |
|
Peter Kasting
2015/09/29 20:34:16
Nit: No || on function names
anthonyvd
2015/09/30 18:34:03
Done.
|
| + // is correctly updated, but only for non guest profiles. |
|
Peter Kasting
2015/09/29 20:34:16
Nit: Is this because guest profiles don't badge th
anthonyvd
2015/09/30 18:34:03
Done.
|
| + if (!browser_view_->IsGuestSession()) |
| OnProfileAvatarChanged(base::FilePath()); |
| +#endif |
| } |
| void BrowserNonClientFrameView::ChildPreferredSizeChanged(View* child) { |
| @@ -179,9 +186,11 @@ int BrowserNonClientFrameView::GetTopAreaHeight() const { |
| } |
| void BrowserNonClientFrameView::UpdateAvatar() { |
| - if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu()) |
| +#if !defined(OS_CHROMEOS) |
| + if (browser_view()->IsRegularOrGuestSession()) |
| UpdateNewAvatarButtonImpl(); |
| else |
| +#endif |
| UpdateOldAvatarButton(); |
| } |
| @@ -246,7 +255,6 @@ void BrowserNonClientFrameView::UpdateOldAvatarButton() { |
| void BrowserNonClientFrameView::UpdateNewAvatarButton( |
| views::ButtonListener* listener, |
| const NewAvatarButton::AvatarButtonStyle style) { |
| - DCHECK(switches::IsNewAvatarMenu()); |
| // This should never be called in incognito mode. |
| DCHECK(browser_view_->IsRegularOrGuestSession()); |
| @@ -282,11 +290,12 @@ void BrowserNonClientFrameView::OnProfileWasRemoved( |
| void BrowserNonClientFrameView::OnProfileAvatarChanged( |
| const base::FilePath& profile_path) { |
| UpdateTaskbarDecoration(); |
| - // Profile avatars are only displayed in the old UI or incognito. |
| - if ((!browser_view()->IsGuestSession() && browser_view()->IsOffTheRecord()) || |
| - !switches::IsNewAvatarMenu()) { |
| + // Profile avatars are only displayed in incognito or on ChromeOS teleported |
| + // windows. |
| +#if !defined(OS_CHROMEOS) |
| + if (!browser_view()->IsGuestSession() && browser_view()->IsOffTheRecord()) |
| +#endif |
| UpdateOldAvatarButton(); |
| - } |
| } |
| void BrowserNonClientFrameView::UpdateTaskbarDecoration() { |