| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/cocoa/tab_window_controller.h" | 5 #import "chrome/browser/cocoa/tab_window_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #import "chrome/browser/cocoa/tab_strip_view.h" | 8 #import "chrome/browser/cocoa/tab_strip_view.h" |
| 9 | 9 |
| 10 @interface TabWindowController(PRIVATE) | 10 @interface TabWindowController(PRIVATE) |
| 11 - (void)setUseOverlay:(BOOL)useOverlay; | 11 - (void)setUseOverlay:(BOOL)useOverlay; |
| 12 @end | 12 @end |
| 13 | 13 |
| 14 @implementation TabWindowController | 14 @implementation TabWindowController |
| 15 @synthesize tabStripView = tabStripView_; | 15 @synthesize tabStripView = tabStripView_; |
| 16 @synthesize tabContentArea = tabContentArea_; | 16 @synthesize tabContentArea = tabContentArea_; |
| 17 | 17 |
| 18 - (void)windowDidLoad { | 18 - (void)windowDidLoad { |
| 19 if ([self isNormalWindow]) { | 19 if ([self isNormalWindow]) { |
| 20 // Place the tab bar above the content box and add it to the view hierarchy | 20 // Place the tab bar above the content box and add it to the view hierarchy |
| 21 // as a sibling of the content view so it can overlap with the window frame. | 21 // as a sibling of the content view so it can overlap with the window frame. |
| 22 NSRect tabFrame = [tabContentArea_ frame]; | 22 NSRect tabFrame = [tabContentArea_ frame]; |
| 23 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); | 23 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); |
| 24 tabFrame.size.height = NSHeight([tabStripView_ frame]); | 24 tabFrame.size.height = NSHeight([tabStripView_ frame]); |
| 25 [tabStripView_ setFrame:tabFrame]; | 25 [tabStripView_ setFrame:tabFrame]; |
| 26 [[[[self window] contentView] superview] addSubview:tabStripView_]; | 26 [[[[self window] contentView] superview] addSubview:tabStripView_]; |
| 27 } else { |
| 28 // No tabstrip so remove the tabContentArea offset. |
| 29 NSRect tabFrame = [tabContentArea_ frame]; |
| 30 NSRect contentFrame = [[[self window] contentView] frame]; |
| 31 tabFrame.size.height = contentFrame.size.height; |
| 32 [tabContentArea_ setFrame:tabFrame]; |
| 27 } | 33 } |
| 28 } | 34 } |
| 29 | 35 |
| 30 - (void)removeOverlay { | 36 - (void)removeOverlay { |
| 31 [self setUseOverlay:NO]; | 37 [self setUseOverlay:NO]; |
| 32 } | 38 } |
| 33 | 39 |
| 34 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay { | 40 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay { |
| 35 [NSObject cancelPreviousPerformRequestsWithTarget:self | 41 [NSObject cancelPreviousPerformRequestsWithTarget:self |
| 36 selector:@selector(removeOverlay) | 42 selector:@selector(removeOverlay) |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return @""; | 165 return @""; |
| 160 } | 166 } |
| 161 | 167 |
| 162 - (BOOL)isNormalWindow { | 168 - (BOOL)isNormalWindow { |
| 163 // subclass must implement | 169 // subclass must implement |
| 164 NOTIMPLEMENTED(); | 170 NOTIMPLEMENTED(); |
| 165 return YES; | 171 return YES; |
| 166 } | 172 } |
| 167 | 173 |
| 168 @end | 174 @end |
| OLD | NEW |