Index: chrome/browser/cocoa/tab_strip_controller.mm |
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm |
index d2caf62652bfaa99ad8efae27f1be51ebad0ae0a..68bd984fbc734670b066abb77c9fdf17d2463b17 100644 |
--- a/chrome/browser/cocoa/tab_strip_controller.mm |
+++ b/chrome/browser/cocoa/tab_strip_controller.mm |
@@ -653,6 +653,22 @@ private: |
return tabStripModel_->IsContextMenuCommandEnabled(index, command) ? YES : NO; |
} |
+// Returns the index of the tab controller. Returns -1 if not present. |
+// Unlike modelIndexForTabView, this method does not care about whether the tab |
+// is closing or not. |
+- (NSInteger)indexForTabController:(TabController*)controller |
+ inTotal:(NSInteger*)total { |
+ if (total) |
+ *total = [tabArray_ count]; |
+ NSInteger index = 0; |
+ for (TabController* current in tabArray_.get()) { |
+ if (current == controller) |
+ return index; |
+ ++index; |
+ } |
+ return -1; |
+} |
+ |
- (void)insertPlaceholderForTab:(TabView*)tab |
frame:(NSRect)frame |
yStretchiness:(CGFloat)yStretchiness { |