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

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: Code review comments (tiny). 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..d86b089039ca8d3c714c09502e0b6c827abd06fa 100644
--- a/content/browser/in_process_webkit/dom_storage_context.cc
+++ b/content/browser/in_process_webkit/dom_storage_context.cc
@@ -198,6 +198,29 @@ void DOMStorageContext::DeleteDataModifiedSince(const base::Time& cutoff) {
}
}
+void DOMStorageContext::DeleteSessionOnlyData() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::WEBKIT));
+
+ // 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));
« no previous file with comments | « content/browser/in_process_webkit/dom_storage_context.h ('k') | content/browser/in_process_webkit/dom_storage_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698