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

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

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 8 years, 6 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 bb6cbbe1688c3a14d306c5339f45010a657722aa..830dbe9bd78c12f622427ff70fbbbcf9b80bc3c4 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -32,12 +32,14 @@
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "content/public/browser/dom_storage_context.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
+#include "content/public/browser/session_storage_namespace.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "net/base/network_change_notifier.h"
@@ -875,6 +877,14 @@ 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::GetDOMStorageContext(profile_)->
+ RecreateSessionStorage(tab.session_storage_persistent_id);
+ }
+
WebContents* web_contents =
browser->AddRestoredTab(tab.navigations,
tab_index,
@@ -883,7 +893,7 @@ class SessionRestoreImpl : public content::NotificationObserver {
false, // select
tab.pinned,
true,
- NULL);
+ session_storage_namespace.get());
// 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());
« no previous file with comments | « no previous file | chrome/browser/sessions/session_service.h » ('j') | chrome/browser/sessions/session_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698