Index: chrome/browser/sessions/session_restore.cc |
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc |
index db3bc9ddab8a9348e27653a3fe120d85e023bf33..9d5ca3a4dd6b8f914aa9e435be0e5a0af54bece7 100644 |
--- a/chrome/browser/sessions/session_restore.cc |
+++ b/chrome/browser/sessions/session_restore.cc |
@@ -91,6 +91,27 @@ std::set<SessionRestoreImpl*>* active_session_restorers = nullptr; |
} // namespace |
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(RestoreOrigin); |
+ |
+// static |
+void RestoreOrigin::CreateForWebContents(content::WebContents* contents, |
+ RestoreOrigin::Type type) { |
+ DCHECK(contents); |
+ if (!FromWebContents(contents)) |
+ contents->SetUserData(UserDataKey(), |
+ base::WrapUnique(new RestoreOrigin(type))); |
+} |
+ |
+// static |
+void RestoreOrigin::RemoveFromWebContents(content::WebContents* contents) { |
+ if (FromWebContents(contents)) |
+ contents->RemoveUserData(UserDataKey()); |
+} |
+ |
+RestoreOrigin::RestoreOrigin(RestoreOrigin::Type type) : type_(type) {} |
+ |
+RestoreOrigin::~RestoreOrigin() = default; |
+ |
// SessionRestoreImpl --------------------------------------------------------- |
// SessionRestoreImpl is responsible for fetching the set of tabs to create |
@@ -616,7 +637,8 @@ class SessionRestoreImpl : public content::NotificationObserver { |
WebContents* web_contents = chrome::AddRestoredTab( |
browser, tab.navigations, tab_index, selected_index, |
tab.extension_app_id, is_selected_tab, tab.pinned, true, |
- session_storage_namespace.get(), tab.user_agent_override); |
+ session_storage_namespace.get(), tab.user_agent_override, |
+ RestoreOrigin::Type::SESSION_RESTORE); |
// Regression check: if the current tab |is_selected_tab|, it should load |
// immediately, otherwise, tabs should not start loading right away. The |
// focused tab will be loaded by Browser, and TabLoader will load the rest. |