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 c6dfa624f0ef37063166cb708b2cc7b1306d5482..78c6738d95d0067ea11345ff7b7262f30c9c2d36 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_window_controller.mm |
| @@ -47,7 +47,10 @@ |
| @implementation TabWindowController |
| - (id)initTabWindowControllerWithTabStrip:(BOOL)hasTabStrip { |
| - NSRect contentRect = NSMakeRect(60, 229, 750, 600); |
| + CGFloat defaultWidth = 750; |
| + CGFloat defaultHeight = 600; |
|
Scott Hess - ex-Googler
2014/07/11 21:10:52
In this case - const, and kDefaultWidth/kDefaultHe
erikchen
2014/07/11 21:18:19
Done.
|
| + |
| + NSRect contentRect = NSMakeRect(60, 229, defaultWidth, defaultHeight); |
| base::scoped_nsobject<FramedBrowserWindow> window( |
| [[FramedBrowserWindow alloc] initWithContentRect:contentRect |
| hasTabStrip:hasTabStrip]); |
| @@ -57,14 +60,20 @@ |
| 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, defaultWidth, defaultHeight)]); |
| + [chromeContentView_ |
| + setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; |
| + [[[self window] contentView] addSubview:chromeContentView_]; |
| + |
| + tabContentArea_.reset( |
| + [[FastResizeView alloc] initWithFrame:[chromeContentView_ bounds]]); |
| [tabContentArea_ setAutoresizingMask:NSViewWidthSizable | |
| NSViewHeightSizable]; |
| - [[[self window] contentView] addSubview:tabContentArea_]; |
| + [chromeContentView_ addSubview:tabContentArea_]; |
| - tabStripView_.reset([[TabStripView alloc] initWithFrame: |
| - NSMakeRect(0, 0, 750, 37)]); |
| + tabStripView_.reset([[TabStripView alloc] |
| + initWithFrame:NSMakeRect(0, 0, defaultWidth, 37)]); |
| [tabStripView_ setAutoresizingMask:NSViewWidthSizable | |
| NSViewMinYMargin]; |
| if (hasTabStrip) |
| @@ -81,6 +90,10 @@ |
| return tabContentArea_; |
| } |
| +- (NSView*)chromeContentView { |
| + return chromeContentView_; |
| +} |
| + |
| // 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. |
| @@ -127,7 +140,7 @@ |
| [overlayWindow_ setOpaque:NO]; |
| [overlayWindow_ setDelegate:self]; |
| - originalContentView_ = [window contentView]; |
| + originalContentView_ = self.chromeContentView; |
| [window addChildWindow:overlayWindow_ ordered:NSWindowAbove]; |
| // Explicitly set the responder to be nil here (for restoring later). |
| @@ -153,7 +166,9 @@ |
| // 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_]; |
| + [[window contentView] addSubview:originalContentView_ |
| + positioned:NSWindowBelow |
| + relativeTo:nil]; |
| [[window cr_windowView] addSubview:[self tabStripView]]; |
| [[window cr_windowView] updateTrackingAreas]; |