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..249ad7191977a969500404bcaf66682847d8e4d9 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,27 @@ 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. |
+ UpdateOldAvatarButton(); |
Peter Kasting
2015/09/25 23:42:52
Nit: Hopefully one of your subsequent cleanup chan
anthonyvd
2015/09/29 20:23:16
I absolutely agree with that. Along with functiona
Peter Kasting
2015/09/29 20:34:16
Seems OK. It would be nice if it were possible to
anthonyvd
2015/09/30 18:34:03
There should be a few places at least where specif
|
+ OnProfileAvatarChanged(base::FilePath()); |
+#else |
+ // On desktop, the old avatar button only shows up when in incognito mode. |
Peter Kasting
2015/09/25 23:42:52
Nit: I'd combine this comment with the one above a
anthonyvd
2015/09/29 20:23:15
Done.
|
+ |
// 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. |
Peter Kasting
2015/09/25 23:42:52
It's not obvious to me how this comment is related
anthonyvd
2015/09/29 20:23:15
I take it as an explanation of why we're calling t
Peter Kasting
2015/09/29 20:34:16
If it's a comment about how this containing functi
anthonyvd
2015/09/30 18:34:03
Good point. Since it's pertinent only to this spec
|
- 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. |
Peter Kasting
2015/09/25 23:42:52
Nit: Fix this comment's grammar while here?
anthonyvd
2015/09/29 20:23:16
Done.
|
- if (!browser_view_->IsGuestSession() || !switches::IsNewAvatarMenu()) |
+ if (!browser_view_->IsGuestSession()) { |
Peter Kasting
2015/09/25 23:42:52
Nit: No {}
anthonyvd
2015/09/29 20:23:16
Done.
|
OnProfileAvatarChanged(base::FilePath()); |
+ } |
+#endif |
} |
void BrowserNonClientFrameView::ChildPreferredSizeChanged(View* child) { |
@@ -179,9 +188,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 +257,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 +292,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() { |