summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 14:35:27 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-08 14:35:27 +0000
commit40058d45f093fff1a816b45021a4d47f2e825fce (patch)
treeb3f3cc1704fa714ed3b53ec90c1f2f6c8941bb9b /chrome
parent31dfc2a5c134e7e2135137489b507ed409c5d88d (diff)
downloadchromium_src-40058d45f093fff1a816b45021a4d47f2e825fce.zip
chromium_src-40058d45f093fff1a816b45021a4d47f2e825fce.tar.gz
chromium_src-40058d45f093fff1a816b45021a4d47f2e825fce.tar.bz2
[Mac] Restore the individually selected tab from a window when using the History menu,
rather than always (mistakenly) restoring the first one. Original review: http://codereview.chromium.org/2802029 (r51748). Reverted at r51759. BUG=47779,48489 TEST=Open a new window, navigate three tabs. Close the window. Select History-->3 Tabs and then choose the middle tab. It is restored properly. Review URL: http://codereview.chromium.org/2815050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 1c0f064..46f1859 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -210,7 +210,11 @@ void TabRestoreService::BrowserClosing(Browser* browser) {
Window* window = new Window();
window->selected_tab_index = browser->selected_index();
window->timestamp = TimeNow();
- window->tabs.resize(browser->tab_count());
+ // Don't use std::vector::resize() because it will push copies of an empty tab
+ // into the vector, which will give all tabs in a window the same ID.
+ for (int i = 0; i < browser->tab_count(); ++i) {
+ window->tabs.push_back(Tab());
+ }
size_t entry_index = 0;
for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) {
PopulateTab(&(window->tabs[entry_index]),
@@ -342,10 +346,11 @@ void TabRestoreService::RestoreEntryById(Browser* browser,
// Update the browser ID of the rest of the tabs in the window so if
// any one is restored, it goes into the same window as the tab
// being restored now.
+ UpdateTabBrowserIDs(tab.browser_id,
+ browser->session_id().id());
for (std::vector<Tab>::iterator tab_j = window->tabs.begin();
tab_j != window->tabs.end(); ++tab_j) {
- UpdateTabBrowserIDs((*tab_j).browser_id,
- browser->session_id().id());
+ (*tab_j).browser_id = browser->session_id().id();
}
}
break;