Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / cocoa / profiles / avatar_icon_controller.mm
index 865205b..6b8dbb8 100644 (file)
@@ -4,6 +4,7 @@
 
 #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"
@@ -14,7 +15,7 @@
 #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"
@@ -219,14 +220,12 @@ const CGFloat kAvatarLabelRightSpacing = 2;
   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
@@ -236,6 +235,10 @@ const CGFloat kAvatarLabelRightSpacing = 2;
   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