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

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

Issue 1119005: [Mac] Re-enable pinned tabs; add support for mini-tabs and phantom tabs. (Closed)
Patch Set: Nits Created 10 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/cocoa/tab_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/browser_window_controller.mm
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm
index 69868858f224f437f5ebee53fbf4c027d1155d31..4dd21260f0583a6f2d0608ee33db0cd62c77314c 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.
@@ -1067,6 +1068,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.
@@ -1075,7 +1080,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];
@@ -1118,7 +1125,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);
@@ -1136,6 +1143,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
@@ -1150,6 +1160,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*>(
« no previous file with comments | « no previous file | chrome/browser/cocoa/tab_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698