summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/tab_strip_controller.mm
diff options
context:
space:
mode:
authorpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 16:34:45 +0000
committerpinkerton@chromium.org <pinkerton@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-27 16:34:45 +0000
commit31f2bff6d9c109d6b4eb91cc0549c9d5b076ed5c (patch)
tree25f89dfb2e4cf781d019f839ac7dd320f196e234 /chrome/browser/cocoa/tab_strip_controller.mm
parent280a4207de1c817dc7177cd75b6e7b295092ce30 (diff)
downloadchromium_src-31f2bff6d9c109d6b4eb91cc0549c9d5b076ed5c.zip
chromium_src-31f2bff6d9c109d6b4eb91cc0549c9d5b076ed5c.tar.gz
chromium_src-31f2bff6d9c109d6b4eb91cc0549c9d5b076ed5c.tar.bz2
Hook up close button in tabs. Patch from rohitrao@google.com.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12656 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/tab_strip_controller.mm')
-rw-r--r--chrome/browser/cocoa/tab_strip_controller.mm9
1 files changed, 8 insertions, 1 deletions
diff --git a/chrome/browser/cocoa/tab_strip_controller.mm b/chrome/browser/cocoa/tab_strip_controller.mm
index a11279f..46a98df 100644
--- a/chrome/browser/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/cocoa/tab_strip_controller.mm
@@ -165,11 +165,18 @@ class TabStripBridge : public TabStripModelObserver {
// Called when the user clicks a tab. Tell the model the selection has changed,
// which feeds back into us via a notification.
- (void)selectTab:(id)sender {
- int index = [self indexForTabView:sender]; // for testing...
+ int index = [self indexForTabView:sender];
if (index >= 0 && tabModel_->ContainsIndex(index))
tabModel_->SelectTabContentsAt(index, true);
}
+// Called when the user closes a tab. Asks the model to close the tab.
+- (void)closeTab:(id)sender {
+ int index = [self indexForTabView:sender];
+ if (index >= 0 && tabModel_->ContainsIndex(index))
+ tabModel_->CloseTabContentsAt(index);
+}
+
// Lay out all tabs in the order of their TabContentsControllers, which matches
// the ordering in the TabStripModel. This call isn't that expensive, though
// it is O(n) in the number of tabs. Tabs will animate to their new position