summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 20:59:13 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-29 20:59:13 +0000
commitd03e1e02dcbb2a712ab317443dcefd2354de8e7a (patch)
tree05566348ee3e51fd83ba98fa1f9414a63deec90e /chrome
parent50e0a1c56b14c3083b4a6f143bc56a5601a732b3 (diff)
downloadchromium_src-d03e1e02dcbb2a712ab317443dcefd2354de8e7a.zip
chromium_src-d03e1e02dcbb2a712ab317443dcefd2354de8e7a.tar.gz
chromium_src-d03e1e02dcbb2a712ab317443dcefd2354de8e7a.tar.bz2
Fix dragging a tab out of a window when the only tabs left behind are phantom tabs.
BUG=42698 TEST=per bug. Might want to re-test dragging single tabs and dragging tabs out when there are pinned tabs (not phantoms). Review URL: http://codereview.chromium.org/1727013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45982 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/cocoa/browser_window_controller.mm5
-rw-r--r--chrome/browser/cocoa/tab_view.mm2
-rw-r--r--chrome/browser/cocoa/tab_window_controller.h8
-rw-r--r--chrome/browser/cocoa/tab_window_controller.mm6
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();