diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-26 17:13:47 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-26 17:13:47 +0000 |
commit | 2db5a2048dfcacfe5ad4311c2b1e435c4c67febc (patch) | |
tree | b67f8935e1566876ad4b3e851c444d3585463af1 /chrome/browser/tabs/tab_strip_model.cc | |
parent | 5f1d4bfc647a6caf4d9bbc1ba7798a3ccdd4f3c4 (diff) | |
download | chromium_src-2db5a2048dfcacfe5ad4311c2b1e435c4c67febc.zip chromium_src-2db5a2048dfcacfe5ad4311c2b1e435c4c67febc.tar.gz chromium_src-2db5a2048dfcacfe5ad4311c2b1e435c4c67febc.tar.bz2 |
chromeos: fix bug where "aw snap" page replaces first tab if it was a NTP when closing window with > 1 tab.
BUG=chromium-os:12088
TEST=verify bug per bug report.
Review URL: http://codereview.chromium.org/6882058
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs/tab_strip_model.cc')
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index fc6e57e..7acb656c5 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -1100,12 +1100,15 @@ bool TabStripModel::IsNewTabAtEndOfTabStrip( contents->controller().entry_count() == 1; } -bool TabStripModel::InternalCloseTabs(const std::vector<int>& indices, +bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, uint32 close_types) { - if (indices.empty()) + if (in_indices.empty()) return true; - bool retval = true; + std::vector<int> indices(in_indices); + bool retval = delegate_->CanCloseContents(&indices); + if (indices.empty()) + return retval; // Map the indices to TabContents, that way if deleting a tab deletes other // tabs we're ok. Crashes seem to indicate during tab deletion other tabs are @@ -1122,11 +1125,6 @@ bool TabStripModel::InternalCloseTabs(const std::vector<int>& indices, // closing. std::map<RenderProcessHost*, size_t> processes; for (size_t i = 0; i < indices.size(); ++i) { - if (!delegate_->CanCloseContentsAt(indices[i])) { - retval = false; - continue; - } - TabContentsWrapper* detached_contents = GetContentsAt(indices[i]); RenderProcessHost* process = detached_contents->tab_contents()->GetRenderProcessHost(); @@ -1157,11 +1155,6 @@ bool TabStripModel::InternalCloseTabs(const std::vector<int>& indices, detached_contents->tab_contents()->OnCloseStarted(); - if (!delegate_->CanCloseContentsAt(index)) { - retval = false; - continue; - } - // Update the explicitly closed state. If the unload handlers cancel the // close the state is reset in Browser. We don't update the explicitly // closed state if already marked as explicitly closed as unload handlers |