Chromium Code Reviews| 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 71744be17d60c6cdc4fb0c0f045d920e7be54d61..03321a62c725317b47adba48b073e3edaa5b0180 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm |
| @@ -2172,6 +2172,52 @@ 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); |
|
Robert Sesek
2014/09/02 19:01:05
This file has an overwhelming preference against d
erikchen
2014/09/03 00:31:44
I removed all instances of dot notation from this
|
| + 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. |
| + 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(11, buttonY)]; |
|
Robert Sesek
2014/09/02 19:01:05
Pull these magic numbers into method-local magic n
erikchen
2014/09/03 00:31:44
Done.
|
| + [fullscreenWindowControls_ addSubview:closeButton]; |
| + |
| + NSButton* miniaturizeButton = |
| + [NSWindow standardWindowButton:NSWindowMiniaturizeButton |
| + forStyleMask:styleMask]; |
| + [miniaturizeButton setFrameOrigin:NSMakePoint(31, buttonY)]; |
| + [miniaturizeButton setEnabled:NO]; |
| + [fullscreenWindowControls_ addSubview:miniaturizeButton]; |
| + |
| + NSButton* fullscreenButton = |
| + [NSWindow standardWindowButton:NSWindowZoomButton |
| + forStyleMask:styleMask]; |
| + [fullscreenWindowControls_ addSubview:fullscreenButton]; |
| + [fullscreenButton setFrameOrigin:NSMakePoint(51, 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]; |
| } |