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

Unified Diff: content/browser/in_process_webkit/dom_storage_context.cc

Issue 7619010: Session-only local storage cleared on exit. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Tests. 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_context.cc
diff --git a/content/browser/in_process_webkit/dom_storage_context.cc b/content/browser/in_process_webkit/dom_storage_context.cc
index 3daa66ea5566e670c4ea27da29d7b5be03b16ec6..36648105b1593ff33c55206fac230c0ef7cd78e8 100644
--- a/content/browser/in_process_webkit/dom_storage_context.cc
+++ b/content/browser/in_process_webkit/dom_storage_context.cc
@@ -198,6 +198,27 @@ void DOMStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) {
}
}
+void DOMStorageContext::DeleteSessionOnlyData() {
michaeln 2011/08/17 19:16:41 maybe DCHECK(BrowserThread::CurrentlyOn(BrowserThr
marja 2011/08/18 11:22:14 Done.
+ // Make sure that we don't delete a database that's currently being accessed
+ // by unloading all of the databases temporarily.
+ PurgeMemory();
+
+ file_util::FileEnumerator file_enumerator(
+ data_path_.Append(kLocalStorageDirectory), false,
+ file_util::FileEnumerator::FILES);
+ for (FilePath path = file_enumerator.Next(); !path.value().empty();
+ path = file_enumerator.Next()) {
+ GURL origin(WebSecurityOrigin::createFromDatabaseIdentifier(
+ webkit_glue::FilePathToWebString(path.BaseName())).toString());
+ if (!special_storage_policy_->IsStorageSessionOnly(origin))
+ continue;
+ if (special_storage_policy_->IsStorageProtected(origin))
+ continue;
+
+ file_util::Delete(path, false);
+ }
+}
+
void DOMStorageContext::DeleteLocalStorageFile(const FilePath& file_path) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));

Powered by Google App Engine
This is Rietveld 408576698