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

Unified Diff: chrome/browser/ui/cocoa/browser_window_controller_private.mm

Issue 139343016: [Mac] Fix new avatar button bugs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« no previous file with comments | « chrome/browser/ui/cocoa/browser/avatar_icon_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/browser_window_controller_private.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index af920e646c1fb2a11bd84b4bdddd8178933c0139..647bb62a00473c437493fff6888f4c7b366c0c48 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -319,26 +319,23 @@ willPositionSheet:(NSWindow*)sheet
// Lay out the icognito/avatar badge because calculating the indentation on
// the right depends on it.
+ NSView* avatarButton = [avatarButtonController_ view];
if ([self shouldShowAvatar]) {
- NSView* avatarButton = [avatarButtonController_ view];
CGFloat badgeXOffset = -kAvatarRightOffset;
CGFloat badgeYOffset = 0;
- CGFloat buttonHeight;
+ CGFloat buttonHeight = NSHeight([avatarButton frame]);
if ([self shouldUseNewAvatarButton]) {
// The fullscreen icon is displayed to the right of the avatar button.
if (![self isFullscreen])
badgeXOffset -= kFullscreenIconWidth;
-
// Center the button vertically on the tabstrip.
- buttonHeight = NSHeight([avatarButton frame]);
badgeYOffset = (tabStripHeight - buttonHeight) / 2;
} else {
- buttonHeight = static_cast<CGFloat>(profiles::kAvatarIconHeight);
// Actually place the badge *above* |maxY|, by +2 to miss the divider.
badgeYOffset = 2 * [[avatarButton superview] cr_lineWidth];
-
}
+
[avatarButton setFrameSize:NSMakeSize(NSWidth([avatarButton frame]),
std::min(buttonHeight, tabStripHeight))];
NSPoint origin =
@@ -358,18 +355,14 @@ willPositionSheet:(NSWindow*)sheet
FramedBrowserWindow* window =
static_cast<FramedBrowserWindow*>([self window]);
rightIndent += -[window fullScreenButtonOriginAdjustment].x;
+
+ // The new avatar is wider than the default indentation, so we need to
+ // account for its width.
+ if ([self shouldUseNewAvatarButton])
+ rightIndent += NSWidth([avatarButton frame]) + kAvatarTabStripShrink;
} else if ([self shouldShowAvatar]) {
- rightIndent += kAvatarTabStripShrink;
- if ([self shouldUseNewAvatarButton]) {
- rightIndent += NSWidth([[avatarButtonController_ view] frame])
- + kAvatarTabStripShrink;
- } else {
- NSButton* labelButton =
- [static_cast<AvatarIconController*>(avatarButtonController_)
- labelButtonView];
- if (labelButton)
- rightIndent += NSWidth([labelButton frame]) + kAvatarRightOffset;
- }
+ rightIndent += kAvatarTabStripShrink +
+ NSWidth([avatarButton frame]) + kAvatarRightOffset;
}
[tabStripController_ setRightIndentForControls:rightIndent];
« no previous file with comments | « chrome/browser/ui/cocoa/browser/avatar_icon_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698