summaryrefslogtreecommitdiffstats
path: root/chrome/browser/in_process_webkit
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 14:47:31 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 14:47:31 +0000
commit0da7636f1e91b05a407a310800d6fe79796931a4 (patch)
treeaed2e394e82f5ee4127bdf66ab9416bda0576d01 /chrome/browser/in_process_webkit
parent32c5626f902813453bc20ff0bf8449f88d443141 (diff)
downloadchromium_src-0da7636f1e91b05a407a310800d6fe79796931a4.zip
chromium_src-0da7636f1e91b05a407a310800d6fe79796931a4.tar.gz
chromium_src-0da7636f1e91b05a407a310800d6fe79796931a4.tar.bz2
Clear cookies, local storage and databases when an extension gets uninstalled.
BUG=27938 TEST=Unittest in extension_service_unitttest.cc Review URL: http://codereview.chromium.org/1095003 Patch from Mattias Nissler. git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42467 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit')
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_context.cc14
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_context.h7
2 files changed, 21 insertions, 0 deletions
diff --git a/chrome/browser/in_process_webkit/dom_storage_context.cc b/chrome/browser/in_process_webkit/dom_storage_context.cc
index 279ecb5..bea4611 100644
--- a/chrome/browser/in_process_webkit/dom_storage_context.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_context.cc
@@ -190,6 +190,11 @@ void DOMStorageContext::DeleteLocalStorageFile(const FilePath& file_path) {
file_util::Delete(file_path, false);
}
+void DOMStorageContext::DeleteLocalStorageForOrigin(const string16& origin_id) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
+ DeleteLocalStorageFile(GetLocalStorageFilePath(origin_id));
+}
+
void DOMStorageContext::DeleteAllLocalStorageFiles() {
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::WEBKIT));
@@ -264,3 +269,12 @@ void DOMStorageContext::ClearLocalState(const FilePath& profile_path,
}
}
}
+
+FilePath DOMStorageContext::GetLocalStorageFilePath(
+ const string16& origin_id) const {
+ FilePath storageDir = webkit_context_->data_path().Append(
+ DOMStorageContext::kLocalStorageDirectory);
+ FilePath::StringType id =
+ webkit_glue::WebStringToFilePathString(origin_id);
+ return storageDir.Append(id.append(kLocalStorageExtension));
+}
diff --git a/chrome/browser/in_process_webkit/dom_storage_context.h b/chrome/browser/in_process_webkit/dom_storage_context.h
index 81276c2..2b9e1d1 100644
--- a/chrome/browser/in_process_webkit/dom_storage_context.h
+++ b/chrome/browser/in_process_webkit/dom_storage_context.h
@@ -9,6 +9,7 @@
#include <set>
#include "base/file_path.h"
+#include "base/string16.h"
#include "base/time.h"
class DOMStorageArea;
@@ -70,6 +71,9 @@ class DOMStorageContext {
// Deletes a single local storage file.
void DeleteLocalStorageFile(const FilePath& file_path);
+ // Deletes the local storage file for the given origin.
+ void DeleteLocalStorageForOrigin(const string16& origin_id);
+
// Deletes all local storage files.
void DeleteAllLocalStorageFiles();
@@ -83,6 +87,9 @@ class DOMStorageContext {
static void ClearLocalState(const FilePath& profile_path,
const char* url_scheme_to_be_skipped);
+ // Get the file name of the local storage file for the given origin.
+ FilePath GetLocalStorageFilePath(const string16& origin_id) const;
+
private:
// Get the local storage instance. The object is owned by this class.
DOMStorageNamespace* CreateLocalStorage();