summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authormarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-19 17:07:05 +0000
committermarja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-19 17:07:05 +0000
commit7c5048cb78980caeb134eec8748ab892df2237fb (patch)
tree8e47680be239803476b42edc67ed7b2bcb0acb64 /webkit
parent02c16bd0c8331530943c35ab08f4c805bb56feba (diff)
downloadchromium_src-7c5048cb78980caeb134eec8748ab892df2237fb.zip
chromium_src-7c5048cb78980caeb134eec8748ab892df2237fb.tar.gz
chromium_src-7c5048cb78980caeb134eec8748ab892df2237fb.tar.bz2
Session-only local storage cleared on exit.
BUG=47049 TEST=DOMStorageTest.SessionOnly Review URL: http://codereview.chromium.org/7619010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/quota/mock_special_storage_policy.cc4
-rw-r--r--webkit/quota/mock_special_storage_policy.h8
-rw-r--r--webkit/quota/special_storage_policy.h4
3 files changed, 16 insertions, 0 deletions
diff --git a/webkit/quota/mock_special_storage_policy.cc b/webkit/quota/mock_special_storage_policy.cc
index 8b75073..5787be9 100644
--- a/webkit/quota/mock_special_storage_policy.cc
+++ b/webkit/quota/mock_special_storage_policy.cc
@@ -21,6 +21,10 @@ bool MockSpecialStoragePolicy::IsStorageUnlimited(const GURL& origin) {
return unlimited_.find(origin) != unlimited_.end();
}
+bool MockSpecialStoragePolicy::IsStorageSessionOnly(const GURL& origin) {
+ return session_only_.find(origin) != session_only_.end();
+}
+
bool MockSpecialStoragePolicy::IsFileHandler(const std::string& extension_id) {
return file_handlers_.find(extension_id) != file_handlers_.end();
}
diff --git a/webkit/quota/mock_special_storage_policy.h b/webkit/quota/mock_special_storage_policy.h
index b04d16d..7e54a6e 100644
--- a/webkit/quota/mock_special_storage_policy.h
+++ b/webkit/quota/mock_special_storage_policy.h
@@ -19,6 +19,7 @@ class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
virtual bool IsStorageProtected(const GURL& origin);
virtual bool IsStorageUnlimited(const GURL& origin);
+ virtual bool IsStorageSessionOnly(const GURL& origin);
virtual bool IsFileHandler(const std::string& extension_id);
void AddProtected(const GURL& origin) {
@@ -29,6 +30,10 @@ class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
unlimited_.insert(origin);
}
+ void AddSessionOnly(const GURL& origin) {
+ session_only_.insert(origin);
+ }
+
void AddFileHandler(const std::string& id) {
file_handlers_.insert(id);
}
@@ -40,7 +45,9 @@ class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
void Reset() {
protected_.clear();
unlimited_.clear();
+ session_only_.clear();
file_handlers_.clear();
+ all_unlimited_ = false;
}
void NotifyChanged() {
@@ -50,6 +57,7 @@ class MockSpecialStoragePolicy : public quota::SpecialStoragePolicy {
private:
std::set<GURL> protected_;
std::set<GURL> unlimited_;
+ std::set<GURL> session_only_;
std::set<std::string> file_handlers_;
bool all_unlimited_;
diff --git a/webkit/quota/special_storage_policy.h b/webkit/quota/special_storage_policy.h
index cc1af6b..ed8989c 100644
--- a/webkit/quota/special_storage_policy.h
+++ b/webkit/quota/special_storage_policy.h
@@ -42,6 +42,10 @@ class SpecialStoragePolicy
// file handler.
virtual bool IsFileHandler(const std::string& extension_id) = 0;
+ // Some origins are only allowed to store session-only data which is deleted
+ // when the session ends.
+ virtual bool IsStorageSessionOnly(const GURL& origin) = 0;
+
// Adds/removes an observer, the policy does not take
// ownership of the observer. Should only be called on the IO thread.
void AddObserver(Observer* observer);