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

Unified Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.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_mus.cc
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc
index c5da9cc9d8c6481bae2abad1e65c3aaf294d063d..1e3021267d108bc8de56b440b0d2a658237063e2 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.cc
@@ -19,7 +19,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/web_applications/web_app.h"
@@ -55,7 +55,7 @@ namespace {
#if defined(FRAME_AVATAR_BUTTON)
// Space between the new avatar button and the minimize button.
-const int kNewAvatarButtonOffset = 5;
+const int kAvatarButtonOffset = 5;
#endif
// Space between right edge of tabstrip and maximize button.
const int kTabstripRightSpacing = 10;
@@ -278,7 +278,7 @@ void BrowserNonClientFrameViewMus::OnPaint(gfx::Canvas* canvas) {
}
void BrowserNonClientFrameViewMus::Layout() {
- if (avatar_button())
+ if (profile_indicator_icon())
LayoutIncognitoButton();
#if defined(FRAME_AVATAR_BUTTON)
@@ -337,13 +337,13 @@ gfx::ImageSkia BrowserNonClientFrameViewMus::GetFaviconForTabIconView() {
// BrowserNonClientFrameViewMus, protected:
// BrowserNonClientFrameView:
-void BrowserNonClientFrameViewMus::UpdateAvatar() {
+void BrowserNonClientFrameViewMus::UpdateProfileIcons() {
#if defined(FRAME_AVATAR_BUTTON)
if (browser_view()->IsRegularOrGuestSession())
profile_switcher_.Update(AvatarButtonStyle::NATIVE);
else
#endif
- UpdateOldAvatarButton();
+ UpdateProfileIndicatorIcon();
}
///////////////////////////////////////////////////////////////////////////////
@@ -405,8 +405,9 @@ bool BrowserNonClientFrameViewMus::DoesIntersectRect(
int BrowserNonClientFrameViewMus::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() + frame_values().normal_insets.left();
}
@@ -417,7 +418,7 @@ int BrowserNonClientFrameViewMus::GetTabStripRightInset() const {
#if defined(FRAME_AVATAR_BUTTON)
if (profile_switcher_.view()) {
- right_inset += kNewAvatarButtonOffset +
+ right_inset += kAvatarButtonOffset +
profile_switcher_.view()->GetPreferredSize().width();
}
#endif
@@ -450,7 +451,7 @@ bool BrowserNonClientFrameViewMus::UseWebAppHeaderStyle() const {
}
void BrowserNonClientFrameViewMus::LayoutIncognitoButton() {
- DCHECK(avatar_button());
+ DCHECK(profile_indicator_icon());
#if !defined(OS_CHROMEOS)
// ChromeOS shows avatar on V1 app.
DCHECK(browser_view()->IsTabStripVisible());
@@ -474,14 +475,14 @@ void BrowserNonClientFrameViewMus::LayoutIncognitoButton() {
gfx::Rect avatar_bounds(avatar_insets.left(), avatar_y,
incognito_icon.width(), avatar_height);
- avatar_button()->SetBoundsRect(avatar_bounds);
- avatar_button()->SetVisible(avatar_visible);
+ profile_indicator_icon()->SetBoundsRect(avatar_bounds);
+ profile_indicator_icon()->SetVisible(avatar_visible);
}
void BrowserNonClientFrameViewMus::LayoutProfileSwitcher() {
#if defined(FRAME_AVATAR_BUTTON)
gfx::Size button_size = profile_switcher_.view()->GetPreferredSize();
- int button_x = width() - GetTabStripRightInset() + kNewAvatarButtonOffset;
+ int button_x = width() - GetTabStripRightInset() + kAvatarButtonOffset;
profile_switcher_.view()->SetBounds(button_x, 0, button_size.width(),
button_size.height());
#endif
« no previous file with comments | « chrome/browser/ui/views/frame/browser_non_client_frame_view_mus.h ('k') | chrome/browser/ui/views/frame/browser_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698