#import "chrome/browser/ui/cocoa/profiles/avatar_icon_controller.h"
+#include "base/mac/foundation_util.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_window.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/profiles/avatar_label_button.h"
-#include "grit/generated_resources.h"
+#include "chrome/grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util_mac.h"
#include "ui/base/resource/resource_bundle.h"
if (browser_->profile()->IsOffTheRecord())
return;
- NSWindowController* wc =
- [browser_->window()->GetNativeWindow() windowController];
- if (![wc isKindOfClass:[BrowserWindowController class]])
+ BrowserWindowController* wc = base::mac::ObjCCast<BrowserWindowController>(
+ [browser_->window()->GetNativeWindow() windowController]);
+ if (!wc)
return;
- [self.view setHidden:
- ![static_cast<BrowserWindowController*>(wc) shouldShowAvatar]];
- [static_cast<BrowserWindowController*>(wc) layoutSubviews];
+ [self.view setHidden:![wc shouldShowAvatar]];
// If the avatar is being added or removed, then the Lion fullscreen button
// needs to be adjusted. Since the fullscreen button is positioned by
NSView* themeFrame = [[[wc window] contentView] superview];
if ([themeFrame respondsToSelector:@selector(_tileTitlebarAndRedisplay:)])
[themeFrame _tileTitlebarAndRedisplay:YES];
+
+ // This needs to be called after the fullscreen button is positioned, because
+ // TabStripController's rightIndentForControls depends on it.
+ [wc layoutSubviews];
}
@end