summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 19:28:26 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 19:28:26 +0000
commit9536018ab8d6b01ccbd3d769fff5c41a2b4f791b (patch)
tree202a5e38581fbee40f5ca2c986e4c64a89058484 /chrome
parenteeb8ed05784919955abbdb206e0d19d471ed5104 (diff)
downloadchromium_src-9536018ab8d6b01ccbd3d769fff5c41a2b4f791b.zip
chromium_src-9536018ab8d6b01ccbd3d769fff5c41a2b4f791b.tar.gz
chromium_src-9536018ab8d6b01ccbd3d769fff5c41a2b4f791b.tar.bz2
Put local storage files in "Local Storage" instead of "localStorage" directory to match existing convention.
This includes a one-time attempt to migrate the directory. Once this occurs, older versions will not have access to the data. I'll send out a chromium-dev post announcing this before I check in. TEST=none BUG=none Review URL: http://codereview.chromium.org/378020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31584 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_context.cc19
1 files changed, 17 insertions, 2 deletions
diff --git a/chrome/browser/in_process_webkit/dom_storage_context.cc b/chrome/browser/in_process_webkit/dom_storage_context.cc
index 821f798..3de5f6d 100644
--- a/chrome/browser/in_process_webkit/dom_storage_context.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_context.cc
@@ -5,11 +5,24 @@
#include "chrome/browser/in_process_webkit/dom_storage_context.h"
#include "base/file_path.h"
+#include "base/file_util.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/in_process_webkit/storage_area.h"
#include "chrome/browser/in_process_webkit/storage_namespace.h"
#include "chrome/browser/in_process_webkit/webkit_context.h"
+static const char* kLocalStorageDirectory = "Local Storage";
+
+// 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");
+ if (!file_util::DirectoryExists(new_path) &&
+ file_util::DirectoryExists(old_path)) {
+ file_util::Move(old_path, new_path);
+ }
+}
+
DOMStorageContext::DOMStorageContext(WebKitContext* webkit_context)
: last_storage_area_id_(kFirstStorageAreaId),
last_storage_namespace_id_(kFirstStorageNamespaceId),
@@ -42,8 +55,10 @@ StorageNamespace* DOMStorageContext::LocalStorage() {
FilePath data_path = webkit_context_->data_path();
FilePath dir_path;
- if (!data_path.empty())
- dir_path = data_path.AppendASCII("localStorage");
+ if (!data_path.empty()) {
+ MigrateLocalStorageDirectory(data_path);
+ dir_path = data_path.AppendASCII(kLocalStorageDirectory);
+ }
return StorageNamespace::CreateLocalStorageNamespace(this, dir_path);
}