diff options
author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-29 05:52:57 +0000 |
---|---|---|
committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-07-29 05:52:57 +0000 |
commit | 06d31f0faf9bfb5dd23b5b54621781564fed710c (patch) | |
tree | b1b7a993c2f1e60a059879a70559f05e7706ab96 /chrome/browser/tabs/tab_strip_model.cc | |
parent | e4d0ff8452e962af5397fd58b96f4b8124c1e4c2 (diff) | |
download | chromium_src-06d31f0faf9bfb5dd23b5b54621781564fed710c.zip chromium_src-06d31f0faf9bfb5dd23b5b54621781564fed710c.tar.gz chromium_src-06d31f0faf9bfb5dd23b5b54621781564fed710c.tar.bz2 |
Add a return value to InternalCloseTabContentsAt, indicating whether or not the TabContents was closed immediately or if we're waiting for an unload handler to fire.
Adjust indices in Close other tabs handler to take into account the fact that some tabs may not close immediately
B=1295790
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63 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, 13 insertions, 6 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index a5e58f9..614d29a6 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -461,11 +461,17 @@ void TabStripModel::ExecuteContextMenuCommand( case CommandCloseOtherTabs: { UserMetrics::RecordAction(L"TabContextMenu_CloseOtherTabs", profile_); // Remove tabs before the tab to keep. - for (int i = 0; i < context_index; i++) - CloseTabContentsAt(0); + int index = 0; + for (int i = 0; i < context_index; i++) { + if (!CloseTabContentsAt(index)) + ++index; + } // Remove all tabs after the tab to keep. - for (int i = 1, c = count(); i < c; i++) - CloseTabContentsAt(1); + index = 1; + for (int i = 1, c = count(); i < c; i++) { + if (!CloseTabContentsAt(index)) + ++index; + } break; } case CommandCloseTabsToRight: { @@ -513,7 +519,7 @@ void TabStripModel::Observe(NotificationType type, /////////////////////////////////////////////////////////////////////////////// // TabStripModel, private: -void TabStripModel::InternalCloseTabContentsAt(int index, +bool TabStripModel::InternalCloseTabContentsAt(int index, bool create_historical_tab) { TabContents* detached_contents = GetContentsAt(index); @@ -526,7 +532,7 @@ void TabStripModel::InternalCloseTabContentsAt(int index, // If we hit this code path, the tab had better be a WebContents tab. DCHECK(web_contents); web_contents->render_view_host()->AttemptToClosePage(false); - return; + return false; } // TODO: Now that we know the tab has no unload/beforeunload listeners, @@ -548,6 +554,7 @@ void TabStripModel::InternalCloseTabContentsAt(int index, // Closing the TabContents will later call back to us via // NotificationObserver and detach it. } + return true; } TabContents* TabStripModel::GetContentsAt(int index) const { |