Index: chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
diff --git a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
index c6dfa624f0ef37063166cb708b2cc7b1306d5482..6cca97080f79e08ab8343926edac80fc25e8f215 100644 |
--- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
+++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
@@ -51,6 +51,7 @@ |
base::scoped_nsobject<FramedBrowserWindow> window( |
[[FramedBrowserWindow alloc] initWithContentRect:contentRect |
hasTabStrip:hasTabStrip]); |
+ [self moveContentViewToBack:[window contentView]]; |
[window setReleasedWhenClosed:YES]; |
[window setAutorecalculatesKeyViewLoop:YES]; |
@@ -68,7 +69,7 @@ |
[tabStripView_ setAutoresizingMask:NSViewWidthSizable | |
NSViewMinYMargin]; |
if (hasTabStrip) |
- [self addTabStripToWindow]; |
+ [self insertTabStripView:tabStripView_ intoWindow:[self window]]; |
} |
return self; |
} |
@@ -81,16 +82,6 @@ |
return tabContentArea_; |
} |
-// Add the top tab strop to the window, above the content box and add it to the |
-// view hierarchy as a sibling of the content view so it can overlap with the |
-// window frame. |
-- (void)addTabStripToWindow { |
- // The frame doesn't matter. This class relies on subclasses to do tab strip |
- // layout. |
- NSView* contentParent = [[self window] cr_windowView]; |
- [contentParent addSubview:tabStripView_]; |
-} |
- |
- (void)removeOverlay { |
[self setUseOverlay:NO]; |
if (closeDeferred_) { |
@@ -154,7 +145,8 @@ |
// content view and therefore it should always be added after the content |
// view is set. |
[window setContentView:originalContentView_]; |
- [[window cr_windowView] addSubview:[self tabStripView]]; |
+ [self moveContentViewToBack:originalContentView_]; |
+ [self insertTabStripView:[self tabStripView] intoWindow:window]; |
[[window cr_windowView] updateTrackingAreas]; |
[focusBeforeOverlay_ restoreFocusInWindow:window]; |
@@ -292,6 +284,25 @@ |
closeDeferred_ = YES; |
} |
+- (void)moveContentViewToBack:(NSView*)cv { |
+ base::scoped_nsobject<NSView> contentView([cv retain]); |
+ NSView* superview = [contentView superview]; |
+ [contentView removeFromSuperview]; |
+ [superview addSubview:contentView positioned:NSWindowBelow relativeTo:nil]; |
+} |
+ |
+- (void)insertTabStripView:(NSView*)tabStripView intoWindow:(NSWindow*)window { |
+ NSView* contentParent = [window cr_windowView]; |
+ if (contentParent == [[window contentView] superview]) { |
+ // Add the tab strip directly above the content view, if they are siblings. |
+ [contentParent addSubview:tabStripView |
+ positioned:NSWindowAbove |
+ relativeTo:[window contentView]]; |
+ } else { |
+ [contentParent addSubview:tabStripView]; |
+ } |
+} |
+ |
// Called when the size of the window content area has changed. Override to |
// position specific views. Base class implementation does nothing. |
- (void)layoutSubviews { |