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

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

Issue 546081: Adds local storage nodes to cookie tree model and cookies view. ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 11 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
« no previous file with comments | « chrome/browser/in_process_webkit/dom_storage_context.h ('k') | chrome/browser/views/options/cookies_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/in_process_webkit/dom_storage_context.cc
===================================================================
--- chrome/browser/in_process_webkit/dom_storage_context.cc (revision 36552)
+++ chrome/browser/in_process_webkit/dom_storage_context.cc (working copy)
@@ -11,13 +11,22 @@
#include "chrome/browser/in_process_webkit/dom_storage_namespace.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
#include "chrome/common/dom_storage_common.h"
+#include "webkit/glue/glue_util.h"
-static const char* kLocalStorageDirectory = "Local Storage";
+const FilePath::CharType DOMStorageContext::kLocalStorageDirectory[] =
+ FILE_PATH_LITERAL("Local Storage");
+const FilePath::CharType DOMStorageContext::kLocalStorageExtension[] =
+ FILE_PATH_LITERAL(".localstorage");
+
+static const FilePath::CharType kLocalStorageOldPath[] =
+ FILE_PATH_LITERAL("localStorage");
+
// TODO(jorlow): Remove after Chrome 4 ships.
static void MigrateLocalStorageDirectory(const FilePath& data_path) {
- FilePath new_path = data_path.AppendASCII(kLocalStorageDirectory);
- FilePath old_path = data_path.AppendASCII("localStorage");
+ FilePath new_path = data_path.Append(
+ DOMStorageContext::kLocalStorageDirectory);
+ FilePath old_path = data_path.Append(kLocalStorageOldPath);
if (!file_util::DirectoryExists(new_path) &&
file_util::DirectoryExists(old_path)) {
file_util::Move(old_path, new_path);
@@ -59,7 +68,7 @@
FilePath dir_path;
if (!data_path.empty()) {
MigrateLocalStorageDirectory(data_path);
- dir_path = data_path.AppendASCII(kLocalStorageDirectory);
+ dir_path = data_path.Append(kLocalStorageDirectory);
}
return DOMStorageNamespace::CreateLocalStorageNamespace(this, dir_path);
}
@@ -175,7 +184,7 @@
PurgeMemory();
file_util::FileEnumerator file_enumerator(
- webkit_context_->data_path().AppendASCII(kLocalStorageDirectory), false,
+ webkit_context_->data_path().Append(kLocalStorageDirectory), false,
file_util::FileEnumerator::FILES);
for (FilePath path = file_enumerator.Next(); !path.value().empty();
path = file_enumerator.Next()) {
@@ -186,6 +195,35 @@
}
}
+void DOMStorageContext::DeleteLocalStorageFile(const FilePath& file_path) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
+
+ // Make sure that we don't delete a database that's currently being accessed
+ // by unloading all of the databases temporarily.
+ // TODO(bulach): both this method and DeleteDataModifiedSince could purge
+ // only the memory used by the specific file instead of all memory at once.
+ // See http://code.google.com/p/chromium/issues/detail?id=32000
+ PurgeMemory();
+ file_util::Delete(file_path, false);
+}
+
+void DOMStorageContext::DeleteAllLocalStorageFiles() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::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(
+ webkit_context_->data_path().Append(kLocalStorageDirectory), false,
+ file_util::FileEnumerator::FILES);
+ for (FilePath file_path = file_enumerator.Next(); !file_path.empty();
+ file_path = file_enumerator.Next()) {
+ if (file_path.Extension() == kLocalStorageExtension)
+ file_util::Delete(file_path, false);
+ }
+}
+
void DOMStorageContext::CompleteCloningSessionStorage(
DOMStorageContext* context, int64 existing_id, int64 clone_id) {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
« no previous file with comments | « chrome/browser/in_process_webkit/dom_storage_context.h ('k') | chrome/browser/views/options/cookies_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698