Chromium Code Reviews| 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 b5069cb862f85d692f195ce06f9ca0fefd9026bd..e32e51057c818b18f1d1d86ab50ec841fee3b562 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
| @@ -49,7 +49,10 @@ |
| @implementation TabWindowController |
| - (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip { |
| - NSRect contentRect = NSMakeRect(60, 229, 750, 600); |
| + const CGFloat kDefaultWidth = 750; |
| + const CGFloat kDefaultHeight = 600; |
| + |
| + NSRect contentRect = NSMakeRect(60, 229, kDefaultWidth, kDefaultHeight); |
| base::scoped_nsobject<FramedBrowserWindow> window( |
| [[FramedBrowserWindow alloc] initWithContentRect:contentRect |
| hasTabStrip:hasTabStrip]); |
| @@ -59,11 +62,18 @@ |
| if ((self = [super initWithWindow:window])) { |
| [[self window] setDelegate:self]; |
| - tabContentArea_.reset([[FastResizeView alloc] initWithFrame: |
| - NSMakeRect(0, 0, 750, 600)]); |
| + chromeContentView_.reset([[NSView alloc] |
| + initWithFrame:NSMakeRect(0, 0, kDefaultWidth, kDefaultHeight)]); |
| + [chromeContentView_ |
| + setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; |
| + [chromeContentView_ setWantsLayer:YES]; |
| + [[[self window] contentView] addSubview:chromeContentView_]; |
| + |
| + tabContentArea_.reset( |
| + [[FastResizeView alloc] initWithFrame:[chromeContentView_ bounds]]); |
| [tabContentArea_ setAutoresizingMask:NSViewWidthSizable | |
| NSViewHeightSizable]; |
| - [[[self window] contentView] addSubview:tabContentArea_]; |
| + [chromeContentView_ addSubview:tabContentArea_]; |
| // tabStripBackgroundView_ draws the theme image behind the tab strip area. |
| // When making a tab dragging window (setUseOverlay:), this view stays in |
| @@ -78,14 +88,13 @@ |
| kBrowserFrameViewPaintHeight)]); |
| [tabStripBackgroundView_ |
| setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin]; |
| - [windowView addSubview:tabStripBackgroundView_ |
| - positioned:NSWindowBelow |
| - relativeTo:nil]; |
| + [self insertTabStripBackgroundViewIntoWindow:window]; |
|
erikchen
2014/10/09 21:24:39
It's unclear that tabStripBackgroundView should be
|
| [self moveContentViewToBack:[window contentView]]; |
| tabStripView_.reset([[TabStripView alloc] |
| - initWithFrame:NSMakeRect(0, 0, 750, chrome::kTabStripHeight)]); |
| + initWithFrame:NSMakeRect( |
| + 0, 0, kDefaultWidth, chrome::kTabStripHeight)]); |
| [tabStripView_ setAutoresizingMask:NSViewWidthSizable | |
| NSViewMinYMargin]; |
| if (hasTabStrip) |
| @@ -106,6 +115,10 @@ |
| return tabContentArea_; |
| } |
| +- (NSView*)chromeContentView { |
| + return chromeContentView_; |
| +} |
| + |
| - (void)removeOverlay { |
| [self setUseOverlay:NO]; |
| if (closeDeferred_) { |
| @@ -141,8 +154,9 @@ |
| [overlayWindow_ setBackgroundColor:[NSColor clearColor]]; |
| [overlayWindow_ setOpaque:NO]; |
| [overlayWindow_ setDelegate:self]; |
| + [[overlayWindow_ contentView] setWantsLayer:YES]; |
| - originalContentView_ = [window contentView]; |
| + originalContentView_ = self.chromeContentView; |
| [window addChildWindow:overlayWindow_ ordered:NSWindowAbove]; |
| // Explicitly set the responder to be nil here (for restoring later). |
| @@ -168,8 +182,10 @@ |
| // places. The TabStripView always needs to be in front of the window's |
| // content view and therefore it should always be added after the content |
| // view is set. |
| - [window setContentView:originalContentView_]; |
| - [self moveContentViewToBack:originalContentView_]; |
| + [[window contentView] addSubview:originalContentView_ |
| + positioned:NSWindowBelow |
| + relativeTo:nil]; |
| + originalContentView_.frame = [[window contentView] bounds]; |
| [self insertTabStripView:[self tabStripView] intoWindow:window]; |
| [[window cr_windowView] updateTrackingAreas]; |
| @@ -334,6 +350,14 @@ |
| } |
| } |
| +- (void)insertTabStripBackgroundViewIntoWindow:(NSWindow*)window { |
| + DCHECK(tabStripBackgroundView_); |
| + NSView* rootView = [[window contentView] superview]; |
| + [rootView addSubview:tabStripBackgroundView_ |
| + positioned:NSWindowBelow |
| + relativeTo:nil]; |
| +} |
| + |
| // Called when the size of the window content area has changed. Override to |
| // position specific views. Base class implementation does nothing. |
| - (void)layoutSubviews { |