Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Unified Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reinstate ash browser test fix Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index 358ab571de760510956a544d8daeb33902a8afe6..19ba74d9f51b2884fdb8f867fe31e297bf299c11 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -17,6 +17,7 @@
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/themes/theme_properties.h"
+#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/layout_constants.h"
@@ -25,7 +26,7 @@
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
#include "chrome/browser/ui/views/frame/web_app_left_header_view_ash.h"
-#include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
+#include "chrome/browser/ui/views/profiles/profile_indicator_icon.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
@@ -305,8 +306,8 @@ void BrowserNonClientFrameViewAsh::Layout() {
header_painter_->SetHeaderHeightForPainting(painted_height);
- if (avatar_button())
- LayoutAvatar();
+ if (profile_indicator_icon())
+ LayoutProfileIndicatorIcon();
BrowserNonClientFrameView::Layout();
}
@@ -380,8 +381,13 @@ gfx::ImageSkia BrowserNonClientFrameViewAsh::GetFaviconForTabIconView() {
// BrowserNonClientFrameViewAsh, protected:
// BrowserNonClientFrameView:
-void BrowserNonClientFrameViewAsh::UpdateAvatar() {
- UpdateOldAvatarButton();
+void BrowserNonClientFrameViewAsh::UpdateProfileIcons() {
+ Browser* browser = browser_view()->browser();
+ if ((browser->is_type_tabbed() || browser->is_app()) &&
+ chrome::MultiUserWindowManager::ShouldShowAvatar(
+ browser_view()->GetNativeWindow())) {
+ UpdateProfileIndicatorIcon();
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -417,8 +423,9 @@ bool BrowserNonClientFrameViewAsh::DoesIntersectRect(
int BrowserNonClientFrameViewAsh::GetTabStripLeftInset() const {
const gfx::Insets insets(GetLayoutInsets(AVATAR_ICON));
- const int avatar_right =
- avatar_button() ? (insets.left() + GetOTRAvatarIcon().width()) : 0;
+ const int avatar_right = profile_indicator_icon()
+ ? (insets.left() + GetOTRAvatarIcon().width())
+ : 0;
return avatar_right + insets.right();
}
@@ -448,8 +455,8 @@ bool BrowserNonClientFrameViewAsh::UseWebAppHeaderStyle() const {
Browser::FEATURE_WEBAPPFRAME);
}
-void BrowserNonClientFrameViewAsh::LayoutAvatar() {
- DCHECK(avatar_button());
+void BrowserNonClientFrameViewAsh::LayoutProfileIndicatorIcon() {
+ DCHECK(profile_indicator_icon());
#if !defined(OS_CHROMEOS)
// ChromeOS shows avatar on V1 app.
DCHECK(browser_view()->IsTabStripVisible());
@@ -471,9 +478,9 @@ void BrowserNonClientFrameViewAsh::LayoutAvatar() {
// recognizable.
const bool avatar_visible = !UseImmersiveLightbarHeaderStyle();
const int avatar_height = avatar_visible ? (avatar_bottom - avatar_y) : 0;
- avatar_button()->SetBounds(avatar_insets.left(), avatar_y,
- incognito_icon.width(), avatar_height);
- avatar_button()->SetVisible(avatar_visible);
+ profile_indicator_icon()->SetBounds(avatar_insets.left(), avatar_y,
+ incognito_icon.width(), avatar_height);
+ profile_indicator_icon()->SetVisible(avatar_visible);
}
bool BrowserNonClientFrameViewAsh::ShouldPaint() const {

Powered by Google App Engine
This is Rietveld 408576698