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

Unified Diff: chrome/browser/sessions/session_restore.cc

Issue 10850010: Make session restore understand that tabs have multiple SessionStorageNamespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unittest using jam's new PRE_ method Created 8 years, 4 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/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 5298b08da7e3da8ecf9ad7d3e31b42b19b1d741f..7db60b0e5e79be28eff71adc2abb7b25fc2abbeb 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -20,6 +20,7 @@
#include "base/stringprintf.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
@@ -590,7 +591,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
selected_index,
true,
tab.extension_app_id,
- NULL);
+ content::SessionStorageNamespaceMap());
} else {
int tab_index = use_new_window ? 0 : browser->active_index() + 1;
WebContents* web_contents = chrome::AddRestoredTab(
@@ -602,7 +603,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
false, // selected
tab.pinned,
true,
- NULL);
+ content::SessionStorageNamespaceMap());
// Start loading the tab immediately.
web_contents->GetController().LoadIfNecessary();
}
@@ -876,11 +877,18 @@ class SessionRestoreImpl : public content::NotificationObserver {
RecordAppLaunchForTab(browser, tab, selected_index);
// Associate sessionStorage (if any) to the restored tab.
- scoped_refptr<content::SessionStorageNamespace> session_storage_namespace;
- if (!tab.session_storage_persistent_id.empty()) {
- session_storage_namespace =
- content::BrowserContext::GetDefaultDOMStorageContext(profile_)->
- RecreateSessionStorage(tab.session_storage_persistent_id);
+ content::SessionStorageNamespaceMap restored_session_storage_namespaces;
+ for (std::map<std::string, std::string>::const_iterator it =
+ tab.session_storage_persistent_id_map.begin();
+ it != tab.session_storage_persistent_id_map.end();
+ ++it) {
+ using content::BrowserContext;
+ if (BrowserContext::IsValidStoragePartitionId(profile_, it->first)) {
+ restored_session_storage_namespaces[it->first] =
+ BrowserContext::GetDOMStorageContextByPartitionId(profile_,
+ it->first)->
+ RecreateSessionStorage(it->second);
+ }
}
WebContents* web_contents =
@@ -892,7 +900,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
false, // select
tab.pinned,
true,
- session_storage_namespace.get());
+ restored_session_storage_namespaces);
// 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.
DCHECK(web_contents->GetController().NeedsReload());

Powered by Google App Engine
This is Rietveld 408576698