Commit 4657e610 authored by oshima@chromium.org's avatar oshima@chromium.org

Rename is_not_selected_tab to is_selected_tab in SessionRestore::RestoreTab

BUG=None

Review URL: https://codereview.chromium.org/411143004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285727 0039d316-1c4b-4281-b951-d872f2087c98
parent 8b8b9909
...@@ -973,16 +973,16 @@ class SessionRestoreImpl : public content::NotificationObserver { ...@@ -973,16 +973,16 @@ class SessionRestoreImpl : public content::NotificationObserver {
// Loads are scheduled for each restored tab unless the tab is going to // Loads are scheduled for each restored tab unless the tab is going to
// be selected as ShowBrowser() will load the selected tab. // be selected as ShowBrowser() will load the selected tab.
bool is_not_selected_tab = (i != selected_tab_index); bool is_selected_tab = (i == selected_tab_index);
WebContents* restored_tab = WebContents* restored_tab =
RestoreTab(tab, i, browser, is_not_selected_tab); RestoreTab(tab, i, browser, is_selected_tab);
// RestoreTab can return NULL if |tab| doesn't have valid data. // RestoreTab can return NULL if |tab| doesn't have valid data.
if (!restored_tab) if (!restored_tab)
continue; continue;
// If this isn't the selected tab, there's nothing else to do. // If this isn't the selected tab, there's nothing else to do.
if (is_not_selected_tab) if (!is_selected_tab)
continue; continue;
ShowBrowser( ShowBrowser(
...@@ -1003,19 +1003,19 @@ class SessionRestoreImpl : public content::NotificationObserver { ...@@ -1003,19 +1003,19 @@ class SessionRestoreImpl : public content::NotificationObserver {
for (int i = 0; i < static_cast<int>(window.tabs.size()); ++i) { for (int i = 0; i < static_cast<int>(window.tabs.size()); ++i) {
const SessionTab& tab = *(window.tabs[i]); const SessionTab& tab = *(window.tabs[i]);
// Always schedule loads as we will not be calling ShowBrowser(). // Always schedule loads as we will not be calling ShowBrowser().
RestoreTab(tab, tab_index_offset + i, browser, true); RestoreTab(tab, tab_index_offset + i, browser, false);
} }
} }
} }
// |tab_index| is ignored for pinned tabs which will always be pushed behind // |tab_index| is ignored for pinned tabs which will always be pushed behind
// the last existing pinned tab. // the last existing pinned tab.
// |schedule_load| will let |tab_loader_| know that it should schedule this // |tab_loader_| will schedule this tab for loading if |is_selected_tab| is
// tab for loading. // false.
WebContents* RestoreTab(const SessionTab& tab, WebContents* RestoreTab(const SessionTab& tab,
const int tab_index, const int tab_index,
Browser* browser, Browser* browser,
bool schedule_load) { bool is_selected_tab) {
// It's possible (particularly for foreign sessions) to receive a tab // It's possible (particularly for foreign sessions) to receive a tab
// without valid navigations. In that case, just skip it. // without valid navigations. In that case, just skip it.
// See crbug.com/154129. // See crbug.com/154129.
...@@ -1044,14 +1044,14 @@ class SessionRestoreImpl : public content::NotificationObserver { ...@@ -1044,14 +1044,14 @@ class SessionRestoreImpl : public content::NotificationObserver {
tab_index, tab_index,
selected_index, selected_index,
tab.extension_app_id, tab.extension_app_id,
!schedule_load, // select is_selected_tab, // select
tab.pinned, tab.pinned,
true, true,
session_storage_namespace.get(), session_storage_namespace.get(),
tab.user_agent_override); tab.user_agent_override);
// Regression check: check that the tab didn't start loading right away. The // Regression check: check that the tab didn't start loading right away. The
// focused tab will be loaded by Browser, and TabLoader will load the rest. // focused tab will be loaded by Browser, and TabLoader will load the rest.
DCHECK(!schedule_load || web_contents->GetController().NeedsReload()); DCHECK(is_selected_tab || web_contents->GetController().NeedsReload());
// Set up the file access rights for the selected navigation entry. // Set up the file access rights for the selected navigation entry.
const int id = web_contents->GetRenderProcessHost()->GetID(); const int id = web_contents->GetRenderProcessHost()->GetID();
...@@ -1065,7 +1065,7 @@ class SessionRestoreImpl : public content::NotificationObserver { ...@@ -1065,7 +1065,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
*file); *file);
} }
if (schedule_load) if (!is_selected_tab)
tab_loader_->ScheduleLoad(&web_contents->GetController()); tab_loader_->ScheduleLoad(&web_contents->GetController());
return web_contents; return web_contents;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment