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

Unified Diff: chrome/browser/ui/views/frame/glass_browser_frame_view.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/glass_browser_frame_view.cc
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index c596d600496495a5270763052688065d76efd906..af1471f1d8b5f7024804c4e7ecab15d0c080cd60 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/frame/browser_view.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/tabs/tab.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
@@ -224,8 +224,8 @@ int GlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) {
return HTNOWHERE;
// See if the point is within the incognito icon or the profile switcher menu.
- if ((avatar_button() &&
- avatar_button()->GetMirroredBounds().Contains(point)) ||
+ if ((profile_indicator_icon() &&
+ profile_indicator_icon()->GetMirroredBounds().Contains(point)) ||
(profile_switcher_.view() &&
profile_switcher_.view()->GetMirroredBounds().Contains(point)))
return HTCLIENT;
@@ -284,11 +284,11 @@ void GlassBrowserFrameView::Layout() {
// GlassBrowserFrameView, protected:
// BrowserNonClientFrameView:
-void GlassBrowserFrameView::UpdateAvatar() {
+void GlassBrowserFrameView::UpdateProfileIcons() {
if (browser_view()->IsRegularOrGuestSession())
profile_switcher_.Update(AvatarButtonStyle::NATIVE);
else
- UpdateOldAvatarButton();
+ UpdateProfileIndicatorIcon();
}
///////////////////////////////////////////////////////////////////////////////
@@ -298,8 +298,9 @@ void GlassBrowserFrameView::UpdateAvatar() {
bool GlassBrowserFrameView::DoesIntersectRect(const views::View* target,
const gfx::Rect& rect) const {
CHECK_EQ(target, this);
- bool hit_incognito_icon = avatar_button() &&
- avatar_button()->GetMirroredBounds().Intersects(rect);
+ bool hit_incognito_icon =
+ profile_indicator_icon() &&
+ profile_indicator_icon()->GetMirroredBounds().Intersects(rect);
bool hit_profile_switcher_button =
profile_switcher_.view() &&
profile_switcher_.view()->GetMirroredBounds().Intersects(rect);
@@ -553,7 +554,7 @@ void GlassBrowserFrameView::LayoutIncognitoIcon() {
(profile_switcher_.view() ? (profile_switcher_.view()->width() +
kProfileSwitcherButtonOffset)
: 0);
- } else if (!md && !avatar_button() && IsToolbarVisible() &&
+ } else if (!md && !profile_indicator_icon() && IsToolbarVisible() &&
(base::win::GetVersion() < base::win::VERSION_WIN10)) {
// In non-MD before Win 10, the toolbar has a rounded corner that we don't
// want the tabstrip to overlap.
@@ -566,10 +567,11 @@ void GlassBrowserFrameView::LayoutIncognitoIcon() {
const int y = (md || !frame()->IsMaximized())
? (bottom - size.height())
: FrameTopBorderThickness(false);
- incognito_bounds_.SetRect(x + (avatar_button() ? insets.left() : 0), y,
- avatar_button() ? size.width() : 0, bottom - y);
- if (avatar_button())
- avatar_button()->SetBoundsRect(incognito_bounds_);
+ incognito_bounds_.SetRect(x + (profile_indicator_icon() ? insets.left() : 0),
+ y, profile_indicator_icon() ? size.width() : 0,
+ bottom - y);
+ if (profile_indicator_icon())
+ profile_indicator_icon()->SetBoundsRect(incognito_bounds_);
}
void GlassBrowserFrameView::LayoutClientView() {
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.h ('k') | chrome/browser/ui/views/frame/opaque_browser_frame_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698