summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/tabs/tab_strip.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-15 15:06:57 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-15 15:06:57 +0000
commitb0ec32a200c9af7ce35cdb54edab06b3907b025d (patch)
tree3a314ed169809dcf294711658eb8a755adecd8e3 /chrome/browser/views/tabs/tab_strip.cc
parentca0a0caf5b257c4c57dfe30db8e73390ff56df81 (diff)
downloadchromium_src-b0ec32a200c9af7ce35cdb54edab06b3907b025d.zip
chromium_src-b0ec32a200c9af7ce35cdb54edab06b3907b025d.tar.gz
chromium_src-b0ec32a200c9af7ce35cdb54edab06b3907b025d.tar.bz2
Fixes bug in tabstrip where close was always treated as if the user
closed the tab by way of mouse. BUG=none TEST=none Review URL: http://codereview.chromium.org/2106006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs/tab_strip.cc')
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc38
1 files changed, 20 insertions, 18 deletions
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index 79a1399..49db8cc 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -397,24 +397,26 @@ void TabStrip::AddTabAt(int model_index,
}
}
-void TabStrip::RemoveTabAt(int model_index) {
- int model_count = GetModelCount();
- if (model_index != model_count && model_count > 0) {
- Tab* last_tab = GetTabAtModelIndex(model_count - 1);
- // Limit the width available to the TabStrip for laying out Tabs, so that
- // Tabs are not resized until a later time (when the mouse pointer leaves
- // the TabStrip).
- available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab);
- needs_resize_layout_ = true;
- AddMessageLoopObserver();
- } else if (model_count) {
- Tab* last_tab = GetTabAtModelIndex(model_count);
- // Limit the width available to the TabStrip for laying out Tabs, so that
- // Tabs are not resized until a later time (when the mouse pointer leaves
- // the TabStrip).
- available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab);
- needs_resize_layout_ = true;
- AddMessageLoopObserver();
+void TabStrip::RemoveTabAt(int model_index, bool initiated_close) {
+ if (initiated_close) {
+ int model_count = GetModelCount();
+ if (model_index != model_count && model_count > 0) {
+ Tab* last_tab = GetTabAtModelIndex(model_count - 1);
+ // Limit the width available to the TabStrip for laying out Tabs, so that
+ // Tabs are not resized until a later time (when the mouse pointer leaves
+ // the TabStrip).
+ available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab);
+ needs_resize_layout_ = true;
+ AddMessageLoopObserver();
+ } else if (model_count) {
+ Tab* last_tab = GetTabAtModelIndex(model_count);
+ // Limit the width available to the TabStrip for laying out Tabs, so that
+ // Tabs are not resized until a later time (when the mouse pointer leaves
+ // the TabStrip).
+ available_width_for_tabs_ = GetAvailableWidthForTabs(last_tab);
+ needs_resize_layout_ = true;
+ AddMessageLoopObserver();
+ }
}
StartRemoveTabAnimation(model_index);