| 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 // TODO(jrg): a non-normal window (e.g. for pop-ups) needs more work | |
| 20 // than just removal of the tab strip offset. But this is enough to | |
| 21 // avoid confusion (e.g. "new tab" on popup gets created in a | |
| 22 // different window). | |
| 23 if ([self isNormalWindow]) { | 19 if ([self isNormalWindow]) { |
| 24 // 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 |
| 25 // 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. |
| 26 NSRect tabFrame = [tabContentArea_ frame]; | 22 NSRect tabFrame = [tabContentArea_ frame]; |
| 27 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); | 23 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); |
| 28 tabFrame.size.height = NSHeight([tabStripView_ frame]); | 24 tabFrame.size.height = NSHeight([tabStripView_ frame]); |
| 29 [tabStripView_ setFrame:tabFrame]; | 25 [tabStripView_ setFrame:tabFrame]; |
| 26 [[[[self window] contentView] superview] addSubview:tabStripView_]; |
| 30 } | 27 } |
| 31 [[[[self window] contentView] superview] addSubview:tabStripView_]; | |
| 32 } | 28 } |
| 33 | 29 |
| 34 - (void)removeOverlay { | 30 - (void)removeOverlay { |
| 35 [self setUseOverlay:NO]; | 31 [self setUseOverlay:NO]; |
| 36 } | 32 } |
| 37 | 33 |
| 38 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay { | 34 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay { |
| 39 [NSObject cancelPreviousPerformRequestsWithTarget:self | 35 [NSObject cancelPreviousPerformRequestsWithTarget:self |
| 40 selector:@selector(removeOverlay) | 36 selector:@selector(removeOverlay) |
| 41 object:nil]; | 37 object:nil]; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return @""; | 159 return @""; |
| 164 } | 160 } |
| 165 | 161 |
| 166 - (BOOL)isNormalWindow { | 162 - (BOOL)isNormalWindow { |
| 167 // subclass must implement | 163 // subclass must implement |
| 168 NOTIMPLEMENTED(); | 164 NOTIMPLEMENTED(); |
| 169 return YES; | 165 return YES; |
| 170 } | 166 } |
| 171 | 167 |
| 172 @end | 168 @end |
| OLD | NEW |