diff options
-rw-r--r-- | chrome/browser/cocoa/browser_window_controller.mm | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_view.mm | 2 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.h | 8 | ||||
-rw-r--r-- | chrome/browser/cocoa/tab_window_controller.mm | 6 |
4 files changed, 19 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index 6da85b2..afe2124 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -1272,9 +1272,14 @@ } - (NSInteger)numberOfTabs { + // count() includes pinned tabs (both live and phantom). return browser_->tabstrip_model()->count(); } +- (BOOL)hasLiveTabs { + return browser_->tabstrip_model()->HasNonPhantomTabs(); +} + - (NSString*)selectedTabTitle { TabContents* contents = browser_->tabstrip_model()->GetSelectedTabContents(); return base::SysUTF16ToNSString(contents->GetTitle()); diff --git a/chrome/browser/cocoa/tab_view.mm b/chrome/browser/cocoa/tab_view.mm index 8873727..7507166 100644 --- a/chrome/browser/cocoa/tab_view.mm +++ b/chrome/browser/cocoa/tab_view.mm @@ -412,7 +412,7 @@ const CGFloat kRapidCloseDist = 2.5; draggedController_ = [sourceController_ detachTabToNewWindow:self]; dragWindow_ = [draggedController_ window]; [dragWindow_ setAlphaValue:0.0]; - if (![sourceController_ numberOfTabs]) { + if (![sourceController_ hasLiveTabs]) { sourceController_ = draggedController_; sourceWindow_ = dragWindow_; } diff --git a/chrome/browser/cocoa/tab_window_controller.h b/chrome/browser/cocoa/tab_window_controller.h index 011915a..64fe78a 100644 --- a/chrome/browser/cocoa/tab_window_controller.h +++ b/chrome/browser/cocoa/tab_window_controller.h @@ -108,9 +108,15 @@ fromController:(TabWindowController*)controller; // Number of tabs in the tab strip. Useful, for example, to know if we're -// dragging the only tab in the window. +// dragging the only tab in the window. This includes pinned tabs (both live +// and not). - (NSInteger)numberOfTabs; +// YES if there are tabs in the tab strip which have content, allowing for +// the notion of tabs in the tab strip that are placeholders, or phantoms, but +// currently have no content. +- (BOOL)hasLiveTabs; + // Return the view of the selected tab. - (NSView *)selectedTabView; diff --git a/chrome/browser/cocoa/tab_window_controller.mm b/chrome/browser/cocoa/tab_window_controller.mm index 17fe56a..2338483 100644 --- a/chrome/browser/cocoa/tab_window_controller.mm +++ b/chrome/browser/cocoa/tab_window_controller.mm @@ -219,6 +219,12 @@ return 0; } +- (BOOL)hasLiveTabs { + // subclass must implement + NOTIMPLEMENTED(); + return NO; +} + - (NSString*)selectedTabTitle { // subclass must implement NOTIMPLEMENTED(); |