Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3129)

Unified Diff: chrome/browser/ui/browser_live_tab_context.cc

Issue 2727663004: Use TabLoader in TabRestoreService. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_live_tab_context.cc
diff --git a/chrome/browser/ui/browser_live_tab_context.cc b/chrome/browser/ui/browser_live_tab_context.cc
index 40892e261ed5cb7523550112b62e3e05a7a7459a..62250394054e5b13dc585f38517658fe63a41ce5 100644
--- a/chrome/browser/ui/browser_live_tab_context.cc
+++ b/chrome/browser/ui/browser_live_tab_context.cc
@@ -15,6 +15,10 @@
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/session_storage_namespace.h"
+#if BUILDFLAG(ENABLE_SESSION_SERVICE)
+#include "chrome/browser/sessions/tab_loader.h"
+#endif
+
using content::NavigationController;
using content::SessionStorageNamespace;
using content::WebContents;
@@ -74,6 +78,24 @@ sessions::LiveTab* BrowserLiveTabContext::AddRestoredTab(
browser_, navigations, tab_index, selected_navigation, extension_app_id,
select, pin, from_last_session, storage_namespace, user_agent_override);
+#if BUILDFLAG(ENABLE_SESSION_SERVICE)
+ // The focused tab will be loaded by Browser, and TabLoader will load the
+ // rest.
+ if (!select) {
+ // Regression check: make sure that the tab hasn't started to load
+ // immediately.
+ DCHECK(web_contents->GetController().NeedsReload());
+ DCHECK(!web_contents->IsLoading());
+ }
+ std::vector<TabLoader::RestoredTab> restoredTabs;
sky 2017/03/02 19:12:05 restored_tabs
Michael K. (Yandex Team) 2017/03/03 08:26:37 Done.
+ restoredTabs.emplace_back(web_contents, select, !extension_app_id.empty(),
+ pin);
+ TabLoader::RestoreTabs(restoredTabs, base::TimeTicks::Now());
+#else // BUILDFLAG(ENABLE_SESSION_SERVICE)
+ // Load the tab manually if there is no TabLoader.
+ web_contents->GetController().LoadIfNecessary();
+#endif // BUILDFLAG(ENABLE_SESSION_SERVICE)
+
return sessions::ContentLiveTab::GetForWebContents(web_contents);
}

Powered by Google App Engine
This is Rietveld 408576698