summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sessions
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 19:26:23 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-07 19:26:23 +0000
commit91f6e88fefedf3b70fbe5e73a58beabe1dfc4763 (patch)
tree8331a2c51b8720bb1800947235e1c4222f301443 /chrome/browser/sessions
parent0a402745f9e2e36c11de74e23c230295f2b2e7d7 (diff)
downloadchromium_src-91f6e88fefedf3b70fbe5e73a58beabe1dfc4763.zip
chromium_src-91f6e88fefedf3b70fbe5e73a58beabe1dfc4763.tar.gz
chromium_src-91f6e88fefedf3b70fbe5e73a58beabe1dfc4763.tar.bz2
Revert 51748 - [Mac] Restore the individually selected tab from a window when using the History menu, rather than always (mistakenly) restoring the first one.
BUG=47779 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/2802029 TBR=rsesek@chromium.org Review URL: http://codereview.chromium.org/2806051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51759 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions')
-rw-r--r--chrome/browser/sessions/tab_restore_service.cc22
1 files changed, 5 insertions, 17 deletions
diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc
index 30bff26..1c0f064 100644
--- a/chrome/browser/sessions/tab_restore_service.cc
+++ b/chrome/browser/sessions/tab_restore_service.cc
@@ -210,11 +210,7 @@ void TabRestoreService::BrowserClosing(Browser* browser) {
Window* window = new Window();
window->selected_tab_index = browser->selected_index();
window->timestamp = TimeNow();
- // 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());
- }
+ window->tabs.resize(browser->tab_count());
size_t entry_index = 0;
for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) {
PopulateTab(&(window->tabs[entry_index]),
@@ -346,11 +342,10 @@ 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) {
- (*tab_j).browser_id = browser->session_id().id();
+ UpdateTabBrowserIDs((*tab_j).browser_id,
+ browser->session_id().id());
}
}
break;
@@ -848,15 +843,8 @@ Browser* TabRestoreService::RestoreTab(const Tab& tab,
tab.from_last_session,
tab.extension_app_id);
} else {
- if (tab.has_browser()) {
- // The tab's browser may not exist anymore. If it does not, then do not
- // force creation of a new browser by setting |browser| to NULL; instead,
- // use the instance passed in.
- Browser* tab_browser = BrowserList::FindBrowserWithID(tab.browser_id);
- if (tab_browser) {
- browser = tab_browser;
- }
- }
+ if (tab.has_browser())
+ browser = BrowserList::FindBrowserWithID(tab.browser_id);
int tab_index = -1;
if (browser) {