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

Unified Diff: content/browser/in_process_webkit/dom_storage_namespace.h

Issue 7480041: Adding session-only localStorage. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Streamlining: Moving ResourceContext& from DOMStorageContext to DOMMessageFilter. Created 9 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: content/browser/in_process_webkit/dom_storage_namespace.h
diff --git a/content/browser/in_process_webkit/dom_storage_namespace.h b/content/browser/in_process_webkit/dom_storage_namespace.h
index 1a6f1245ca35a5fc26dbceed445026288ba3933d..5fa8aeff9066978f3603db1193382c82f327baad 100644
--- a/content/browser/in_process_webkit/dom_storage_namespace.h
+++ b/content/browser/in_process_webkit/dom_storage_namespace.h
@@ -31,7 +31,8 @@ class DOMStorageNamespace {
~DOMStorageNamespace();
- DOMStorageArea* GetStorageArea(const string16& origin);
+ DOMStorageArea* GetStorageArea(const string16& origin,
+ bool enforce_session_only_storage);
DOMStorageNamespace* Copy(int64 clone_namespace_id);
void PurgeMemory();
@@ -57,6 +58,21 @@ class DOMStorageNamespace {
// Creates the underlying WebStorageNamespace on demand.
void CreateWebStorageNamespaceIfNecessary();
+ // Helpers for creating DOMStorageAreas.
+ DOMStorageArea* GetExistingStorageArea(const string16& origin);
+ DOMStorageArea* CreateStorageArea(const string16& origin);
+
+ // Returns true if this DOMStorageNamespace represents localStorage and should
+ // have a pointer to a session-only localStorage DOMStorageNamespace (which is
+ // lazily created). Returns false if this DOMStorageNamespace is a
+ // sessionStorage, or a session-only localStorage, or a localStorage
+ // associated with an off the record profile.
+ bool ShouldHaveSessionOnlyLocalStorage() const;
+
+ // Lazy creation of the DOMStorageNamespace representing session-only
+ // localStorage.
+ void EnsureSessionOnlyLocalStorageCreated();
+
// All the storage areas we own.
typedef base::hash_map<string16, DOMStorageArea*> OriginToStorageAreaMap;
OriginToStorageAreaMap origin_to_storage_area_;
@@ -77,6 +93,9 @@ class DOMStorageNamespace {
// SessionStorage vs. LocalStorage.
const DOMStorageType dom_storage_type_;
+ // Session-only version of the same localStorage (lazily created).
+ scoped_ptr<DOMStorageNamespace> session_only_local_storage_;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(DOMStorageNamespace);
};

Powered by Google App Engine
This is Rietveld 408576698