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

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

Issue 8172011: [Mac] Properly show and hide the avatar button for the one-profile case. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 9 years, 2 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_window_controller.mm ('k') | chrome/chrome_browser.gypi » ('j') | 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 35a8ebba45d9114c669574fd8dd7c7486dd0390b..8ecabb2302cb37b52eb26c0eaa9fb064cba47fdd 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -14,7 +14,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
#include "chrome/browser/ui/browser_list.h"
-#import "chrome/browser/ui/cocoa/browser/avatar_button.h"
+#import "chrome/browser/ui/cocoa/browser/avatar_button_controller.h"
#import "chrome/browser/ui/cocoa/fast_resize_view.h"
#import "chrome/browser/ui/cocoa/find_bar/find_bar_cocoa_controller.h"
#import "chrome/browser/ui/cocoa/floating_bar_backing_view.h"
@@ -355,19 +355,20 @@ willPositionSheet:(NSWindow*)sheet
[tabStripController_ layoutTabsWithoutAnimation];
// Now lay out incognito badge together with the tab strip.
- if (avatarButton_.get()) {
- [avatarButton_ setFrameSize:NSMakeSize(tabStripHeight,
- tabStripHeight - 5.0)];
+ if ([self shouldShowAvatar]) {
+ NSView* avatarButton = [avatarButtonController_ view];
+ [avatarButton setFrameSize:NSMakeSize(tabStripHeight,
+ tabStripHeight - 5.0)];
// Actually place the badge *above* |maxY|, by +2 to miss the divider. On
// Lion or later, shift the badge left to move it away from the fullscreen
// button.
CGFloat badgeOffset = kAvatarRightOffset + possibleExtraShiftForLion;
NSPoint origin =
- NSMakePoint(width - NSWidth([avatarButton_ frame]) - badgeOffset,
+ NSMakePoint(width - NSWidth([avatarButton frame]) - badgeOffset,
maxY + 2);
- [avatarButton_ setFrameOrigin:origin];
- [avatarButton_ setHidden:NO]; // Make sure it's shown.
+ [avatarButton setFrameOrigin:origin];
+ [avatarButton setHidden:NO]; // Make sure it's shown.
}
return maxY;
@@ -625,10 +626,11 @@ willPositionSheet:(NSWindow*)sheet
[destWindow setContentView:contentView];
// Move the incognito badge if present.
- if (avatarButton_.get()) {
- [avatarButton_ removeFromSuperview];
- [avatarButton_ setHidden:YES]; // Will be shown in layout.
- [[[destWindow contentView] superview] addSubview:avatarButton_];
+ if ([self shouldShowAvatar]) {
+ [[avatarButtonController_ view] removeFromSuperview];
+ [[avatarButtonController_ view] setHidden:YES]; // Will be shown in layout.
+ [[[destWindow contentView] superview] addSubview:
+ [avatarButtonController_ view]];
}
// Add the tab strip after setting the content view and moving the incognito
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller.mm ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698