| Index: chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
|
| diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
|
| index ffb8d21bd23d0a06cbff7fb09c9cf5633799f72b..ea07a5e0bf38819193c6cea259f3c90244ef8861 100644
|
| --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
|
| +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
|
| @@ -2172,6 +2172,56 @@ NSImage* Overlay(NSImage* ground, NSImage* overlay, CGFloat alpha) {
|
| return [tabContentsArray_ objectAtIndex:index];
|
| }
|
|
|
| +- (void)addWindowControls {
|
| + if (!fullscreenWindowControls_) {
|
| + // Make the container view.
|
| + CGFloat height = NSHeight([tabStripView_ frame]);
|
| + NSRect frame = NSMakeRect(0, 0, [self leftIndentForControls], height);
|
| + fullscreenWindowControls_.reset([[NSView alloc] initWithFrame:frame]);
|
| + [fullscreenWindowControls_
|
| + setAutoresizingMask:NSViewMaxXMargin | NSViewHeightSizable];
|
| +
|
| + // Add the traffic light buttons. The horizontal layout was determined by
|
| + // manual inspection on Yosemite.
|
| + CGFloat closeButtonX = 11;
|
| + CGFloat miniButtonX = 31;
|
| + CGFloat zoomButtonX = 51;
|
| +
|
| + NSUInteger styleMask = [[tabStripView_ window] styleMask];
|
| + NSButton* closeButton = [NSWindow standardWindowButton:NSWindowCloseButton
|
| + forStyleMask:styleMask];
|
| +
|
| + // Vertically center the buttons in the tab strip.
|
| + CGFloat buttonY = floor((height - NSHeight([closeButton bounds])) / 2);
|
| + [closeButton setFrameOrigin:NSMakePoint(closeButtonX, buttonY)];
|
| + [fullscreenWindowControls_ addSubview:closeButton];
|
| +
|
| + NSButton* miniaturizeButton =
|
| + [NSWindow standardWindowButton:NSWindowMiniaturizeButton
|
| + forStyleMask:styleMask];
|
| + [miniaturizeButton setFrameOrigin:NSMakePoint(miniButtonX, buttonY)];
|
| + [miniaturizeButton setEnabled:NO];
|
| + [fullscreenWindowControls_ addSubview:miniaturizeButton];
|
| +
|
| + NSButton* zoomButton =
|
| + [NSWindow standardWindowButton:NSWindowZoomButton
|
| + forStyleMask:styleMask];
|
| + [fullscreenWindowControls_ addSubview:zoomButton];
|
| + [zoomButton setFrameOrigin:NSMakePoint(zoomButtonX, buttonY)];
|
| + }
|
| +
|
| + if (![permanentSubviews_ containsObject:fullscreenWindowControls_]) {
|
| + [self addSubviewToPermanentList:fullscreenWindowControls_];
|
| + [self regenerateSubviewList];
|
| + }
|
| +}
|
| +
|
| +- (void)removeWindowControls {
|
| + if (fullscreenWindowControls_)
|
| + [permanentSubviews_ removeObject:fullscreenWindowControls_];
|
| + [self regenerateSubviewList];
|
| +}
|
| +
|
| - (void)themeDidChangeNotification:(NSNotification*)notification {
|
| [self setNewTabImages];
|
| }
|
|
|