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 // Place the tab bar above the content box and add it to the view hierarchy | 19 // TODO(jrg): a non-normal window (e.g. for pop-ups) needs more work |
20 // as a sibling of the content view so it can overlap with the window frame. | 20 // than just removal of the tab strip offset. But this is enough to |
21 NSRect tabFrame = [tabContentArea_ frame]; | 21 // avoid confusion (e.g. "new tab" on popup gets created in a |
22 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); | 22 // different window). |
pink (ping after 24hrs)
2009/07/01 12:53:00
does the content area need adjusting up? I think i
John Grabowski
2009/07/02 20:28:25
Yes, it is too low. The right answer is a new nib
| |
23 tabFrame.size.height = NSHeight([tabStripView_ frame]); | 23 if ([self isNormalWindow]) { |
24 [tabStripView_ setFrame:tabFrame]; | 24 // 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. | |
26 NSRect tabFrame = [tabContentArea_ frame]; | |
27 tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame)); | |
28 tabFrame.size.height = NSHeight([tabStripView_ frame]); | |
29 [tabStripView_ setFrame:tabFrame]; | |
30 } | |
25 [[[[self window] contentView] superview] addSubview:tabStripView_]; | 31 [[[[self window] contentView] superview] addSubview:tabStripView_]; |
26 } | 32 } |
27 | 33 |
28 - (void)removeOverlay { | 34 - (void)removeOverlay { |
29 [self setUseOverlay:NO]; | 35 [self setUseOverlay:NO]; |
30 } | 36 } |
31 | 37 |
32 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay { | 38 - (void)removeOverlayAfterDelay:(NSTimeInterval)delay { |
33 [NSObject cancelPreviousPerformRequestsWithTarget:self | 39 [NSObject cancelPreviousPerformRequestsWithTarget:self |
34 selector:@selector(removeOverlay) | 40 selector:@selector(removeOverlay) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 NOTIMPLEMENTED(); | 155 NOTIMPLEMENTED(); |
150 return 0; | 156 return 0; |
151 } | 157 } |
152 | 158 |
153 - (NSString*)selectedTabTitle { | 159 - (NSString*)selectedTabTitle { |
154 // subclass must implement | 160 // subclass must implement |
155 NOTIMPLEMENTED(); | 161 NOTIMPLEMENTED(); |
156 return @""; | 162 return @""; |
157 } | 163 } |
158 | 164 |
165 - (BOOL)isNormalWindow { | |
166 // subclass must implement | |
167 NOTIMPLEMENTED(); | |
168 return YES; | |
169 } | |
170 | |
159 @end | 171 @end |
OLD | NEW |