diff options
author | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 16:37:13 +0000 |
---|---|---|
committer | pinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-23 16:37:13 +0000 |
commit | 52a63f4d1c139345fb3fe0bc294ab27abfcd6db8 (patch) | |
tree | 033fe46019059f06d7b14990f45350543d713a84 /chrome/browser/cocoa/browser_window_controller.mm | |
parent | f15a3b036835167385507265692b626969b305f1 (diff) | |
download | chromium_src-52a63f4d1c139345fb3fe0bc294ab27abfcd6db8.zip chromium_src-52a63f4d1c139345fb3fe0bc294ab27abfcd6db8.tar.gz chromium_src-52a63f4d1c139345fb3fe0bc294ab27abfcd6db8.tar.bz2 |
Implement side tab view and controller and hook up their creation. Parameterize tab strip layout so it can be vertical in addition to horizontal without breaking up the code too much. Abstracted some of the side tab knowledge into TabWindowController with overrides in BrowserWindowController.
Nib change: added a SideTabStripView custom view to BrowserWindow and hooked it to an outlet. Renamed the outlets to better reflect both views.
BUG=44773
TEST=Tab layout, full screen, dragging tabs within and to other windows to make sure they reflow and draw correctly. Side tabs themselves are still behind a flag, but this cl touches many normal codepaths.
Review URL: http://codereview.chromium.org/2846028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_window_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index d189313..ccd632e 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -233,16 +233,7 @@ // this window's Browser and the tab strip view. The controller will handle // registering for the appropriate tab notifications from the back-end and // managing the creation of new tabs. - if (![self useVerticalTabs]) { - tabStripController_.reset([[TabStripController alloc] - initWithView:[self tabStripView] - switchView:[self tabContentArea] - browser:browser_.get()]); - } else { - // TODO(pinkerton): Load SideTabController when written and add it to the - // contentView. This should be abstracted into a separate method like - // the toolbar controller initialization below. - } + [self createTabStripController]; // Create the infobar container view, so we can pass it to the // ToolbarController. @@ -1299,8 +1290,6 @@ // (Override of |TabWindowController| method.) - (BOOL)hasTabStrip { - if ([self useVerticalTabs]) - return NO; return [self supportsWindowFeature:Browser::FEATURE_TABSTRIP]; } @@ -1638,14 +1627,15 @@ willAnimateFromState:(bookmarks::VisualState)oldState isShrinkingFromZoomed_ = NO; } +// Override to swap in the correct tab strip controller based on the new +// tab strip mode. - (void)toggleTabStripDisplayMode { - // TODO(pinkerton) re-initialize tab strip. Finish writing this method. - // Right now, it only switches one direction, which clearly isn't cool. - // [self initTabStrip:browser_->tabstrip_model()]; - [[self tabStripView] removeFromSuperview]; - + [super toggleTabStripDisplayMode]; + [self createTabStripController]; +} - [self layoutSubviews]; +- (BOOL)useVerticalTabs { + return browser_->tabstrip_model()->delegate()->UseVerticalTabs(); } @end // @implementation BrowserWindowController @@ -1699,7 +1689,7 @@ willAnimateFromState:(bookmarks::VisualState)oldState // Retain the tab strip view while we remove it from its superview. scoped_nsobject<NSView> tabStripView; - if ([self hasTabStrip]) { + if ([self hasTabStrip] && ![self useVerticalTabs]) { tabStripView.reset([[self tabStripView] retain]); [tabStripView removeFromSuperview]; } @@ -1745,7 +1735,7 @@ willAnimateFromState:(bookmarks::VisualState)oldState // Add the tab strip after setting the content view and moving the incognito // badge (if any), so that the tab strip will be on top (in the z-order). - if ([self hasTabStrip]) + if ([self hasTabStrip] && ![self useVerticalTabs]) [[[destWindow contentView] superview] addSubview:tabStripView]; [window setWindowController:nil]; |