Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1726)

Unified Diff: chrome/browser/cocoa/tab_window_controller.mm

Issue 65011: Flatten down to a single toolbar per window, significantly simplifying the ta... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/tab_window_controller.mm
===================================================================
--- chrome/browser/cocoa/tab_window_controller.mm (revision 13420)
+++ chrome/browser/cocoa/tab_window_controller.mm (working copy)
@@ -13,19 +13,16 @@
@implementation TabWindowController
@synthesize tabStripView = tabStripView_;
+@synthesize tabContentArea = tabContentArea_;
- (void)windowDidLoad {
// Place the tab bar above the content box and add it to the view hierarchy
// as a sibling of the content view so it can overlap with the window frame.
- NSRect tabFrame = [contentBox_ frame];
+ NSRect tabFrame = [tabContentArea_ frame];
TVL 2009/04/09 15:53:00 you could DCheck the class requirements on tabCont
pink (ping after 24hrs) 2009/04/09 16:00:48 do what, though? check that it's not an NSBox? tha
tabFrame.origin = NSMakePoint(0, NSMaxY(tabFrame));
tabFrame.size.height = NSHeight([tabStripView_ frame]);
[tabStripView_ setFrame:tabFrame];
[[[[self window] contentView] superview] addSubview:tabStripView_];
-
- // tab switching will destroy the content area, so nil this out to ensure
- // that nobody tries to use it.
- contentBox_ = nil;
}
- (void)removeOverlay {
@@ -45,6 +42,22 @@
[self setUseOverlay:YES];
}
+- (NSArray*)viewsToMoveToOverlay {
+ return [NSArray arrayWithObject:[self tabStripView]];
+}
+
+- (void)moveViewsBetweenWindowAndOverlay:(BOOL)useOverlay {
+ NSArray* viewsToMove = [self viewsToMoveToOverlay];
+ for (NSView* view in viewsToMove) {
+ // if |useOverlay| is true, we're moving views into the overlay's content
+ // area. If false, we're moving out of the overlay back into the window's
+ // content.
+ NSView* moveTo = useOverlay ?
+ [overlayWindow_ contentView] : [cachedContentView_ superview];
TVL 2009/04/09 15:53:00 move this outside the loop, it doesn't need loop s
pink (ping after 24hrs) 2009/04/09 16:00:48 duh. changed this around at the last minute and mi
+ [moveTo addSubview:view];
+ }
+}
+
// If |useOverlay| is YES, creates a new overlay window and puts the tab strip
// and the content area inside of it. This allows it to have a different opacity
// from the title bar. If NO, returns everything to the previous state and
@@ -66,7 +79,7 @@
NSView *contentView = [overlayWindow_ contentView];
[contentView addSubview:[self tabStripView]];
cachedContentView_ = [[self window] contentView];
- [contentView addSubview:cachedContentView_];
+ [self moveViewsBetweenWindowAndOverlay:useOverlay];
[overlayWindow_ setHasShadow:YES];
[[self window] addChildWindow:overlayWindow_ ordered:NSWindowAbove];
[overlayWindow_ orderFront:nil];
@@ -75,7 +88,7 @@
DCHECK(cachedContentView_);
[[self window] setHasShadow:YES];
[[self window] setContentView:cachedContentView_];
- [[cachedContentView_ superview] addSubview:[self tabStripView]];
+ [self moveViewsBetweenWindowAndOverlay:useOverlay];
[[self window] makeFirstResponder:cachedContentView_];
[[self window] display];
[[self window] removeChildWindow:overlayWindow_];

Powered by Google App Engine
This is Rietveld 408576698