summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/browser_window_controller.mm
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 22:33:08 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 22:33:08 +0000
commitaee746fa720bec218bec090746df7e04f26d9f5b (patch)
tree96e679e635f5be8fbeb008bad5c11ac8e4ecf69d /chrome/browser/cocoa/browser_window_controller.mm
parentd26b4418ab4d417e87b1d3fd5367dea0cf978a7c (diff)
downloadchromium_src-aee746fa720bec218bec090746df7e04f26d9f5b.zip
chromium_src-aee746fa720bec218bec090746df7e04f26d9f5b.tar.gz
chromium_src-aee746fa720bec218bec090746df7e04f26d9f5b.tar.bz2
[Mac] Re-enable pinned tabs; add support for mini-tabs and phantom tabs.
This CL rewires the old support for pinned tabs to support mini-tabs. This also removes the kEnablePinnedTabs browser default now that all platforms support it. Note that pinning is now only accessible through the context menu; drag-to-pin has been removed. BUG=36798, 32845 TEST=Right-click and pin two tabs. Test dragging on and off and around the tab strip. TEST=Cmd+W a pinned tab and it should go phantom (renderer closes down) and the tab is made alpha. Review URL: http://codereview.chromium.org/1119005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/browser_window_controller.mm')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm20
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 2be2960..62aba3d 100644
--- a/chrome/browser/cocoa/browser_window_controller.mm
+++ b/chrome/browser/cocoa/browser_window_controller.mm
@@ -365,7 +365,8 @@
// from this method.
- (void)windowWillClose:(NSNotification*)notification {
DCHECK_EQ([notification object], [self window]);
- DCHECK(!browser_->tabstrip_model()->count());
+ DCHECK(!browser_->tabstrip_model()->HasNonPhantomTabs() ||
+ !browser_->tabstrip_model()->count());
[savedRegularWindow_ close];
// We delete statusBubble here because we need to kill off the dependency
// that its window has on our window before our window goes away.
@@ -1063,6 +1064,10 @@
tabOrigin = [[self tabStripView] convertPoint:tabOrigin fromView:nil];
destinationFrame.origin = tabOrigin;
+ // Before the tab is detached from its originating tab strip, store the
+ // pinned state so that it can be maintained between the windows.
+ bool isPinned = dragBWC->browser_->tabstrip_model()->IsTabPinned(index);
+
// Now that we have enough information about the tab, we can remove it from
// the dragging window. We need to do this *before* we add it to the new
// window as this will remove the TabContents' delegate.
@@ -1071,7 +1076,9 @@
// Deposit it into our model at the appropriate location (it already knows
// where it should go from tracking the drag). Doing this sets the tab's
// delegate to be the Browser.
- [tabStripController_ dropTabContents:contents withFrame:destinationFrame];
+ [tabStripController_ dropTabContents:contents
+ withFrame:destinationFrame
+ asPinnedTab:isPinned];
} else {
// Moving within a window.
int index = [tabStripController_ modelIndexForTabView:view];
@@ -1114,7 +1121,7 @@
// Disable screen updates so that this appears as a single visual change.
base::ScopedNSDisableScreenUpdates disabler;
- // Fetch the tab contents for the tab being dragged
+ // Fetch the tab contents for the tab being dragged.
int index = [tabStripController_ modelIndexForTabView:tabView];
TabContents* contents = browser_->tabstrip_model()->GetTabContentsAt(index);
@@ -1132,6 +1139,9 @@
NSRect tabRect = [tabView frame];
+ // Before detaching the tab, store the pinned state.
+ bool isPinned = browser_->tabstrip_model()->IsTabPinned(index);
+
// Detach it from the source window, which just updates the model without
// deleting the tab contents. This needs to come before creating the new
// Browser because it clears the TabContents' delegate, which gets hooked
@@ -1146,6 +1156,10 @@
browserRect,
dockInfo);
+ // Propagate the tab pinned state of the new tab (which is the only tab in
+ // this new window).
+ newBrowser->tabstrip_model()->SetTabPinned(0, isPinned);
+
// Get the new controller by asking the new window for its delegate.
BrowserWindowController* controller =
reinterpret_cast<BrowserWindowController*>(