summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authoridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-15 15:24:46 +0000
committeridanan@chromium.org <idanan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-15 15:24:46 +0000
commit0820ac156d55a3532af12014177dd619cafe216f (patch)
tree7701a3a801e3fc0c50bfe97b9801a7d3af769a9c /net
parent32b8072a2ac29592417255fb6efafee33e46d70e (diff)
downloadchromium_src-0820ac156d55a3532af12014177dd619cafe216f.zip
chromium_src-0820ac156d55a3532af12014177dd619cafe216f.tar.gz
chromium_src-0820ac156d55a3532af12014177dd619cafe216f.tar.bz2
Privacy option added for all cookies to become session cookies.
BUG=10502 Review URL: http://codereview.chromium.org/87047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/cookie_monster.cc4
-rw-r--r--net/base/cookie_monster.h3
-rw-r--r--net/base/cookie_policy.cc4
-rw-r--r--net/base/cookie_policy.h8
4 files changed, 17 insertions, 2 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 470bfc2..7eb487e 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -711,6 +711,10 @@ bool CookieMonster::DeleteCookie(const std::string& domain,
return false;
}
+void CookieMonster::SetStore(PersistentCookieStore* store) {
+ store_ = store;
+}
+
// Mozilla sorts on the path length (longest first), and then it
// sorts by creation time (oldest first).
// The RFC says the sort order for the domain attribute is undefined.
diff --git a/net/base/cookie_monster.h b/net/base/cookie_monster.h
index 24db893..69750e5 100644
--- a/net/base/cookie_monster.h
+++ b/net/base/cookie_monster.h
@@ -134,6 +134,9 @@ class CookieMonster {
const CanonicalCookie& cookie,
bool sync_to_store);
+ // Sets the store, possibly to null for session only cookies.
+ void SetStore(PersistentCookieStore* store);
+
// Override the default list of schemes that are allowed to be set in
// this cookie store. Calling his overrides the value of
// "enable_file_scheme_".
diff --git a/net/base/cookie_policy.cc b/net/base/cookie_policy.cc
index d18db63..8eb1179 100644
--- a/net/base/cookie_policy.cc
+++ b/net/base/cookie_policy.cc
@@ -16,6 +16,8 @@ bool CookiePolicy::CanGetCookies(const GURL& url, const GURL& policy_url) {
return true;
case CookiePolicy::BLOCK_THIRD_PARTY_COOKIES:
return true;
+ case CookiePolicy::SESSION_COOKIES:
+ return true;
case CookiePolicy::BLOCK_ALL_COOKIES:
return false;
default:
@@ -33,6 +35,8 @@ bool CookiePolicy::CanSetCookie(const GURL& url, const GURL& policy_url) {
return true; // Empty policy URL should indicate a first-party request
return net::RegistryControlledDomainService::SameDomainOrHost(url,
policy_url);
+ case CookiePolicy::SESSION_COOKIES:
+ return true;
case CookiePolicy::BLOCK_ALL_COOKIES:
return false;
default:
diff --git a/net/base/cookie_policy.h b/net/base/cookie_policy.h
index 89d490b..6fa6002 100644
--- a/net/base/cookie_policy.h
+++ b/net/base/cookie_policy.h
@@ -25,11 +25,12 @@ class CookiePolicy {
enum Type {
ALLOW_ALL_COOKIES = 0, // do not perform any cookie blocking
BLOCK_THIRD_PARTY_COOKIES, // prevent third-party cookies from being sent
- BLOCK_ALL_COOKIES // disable cookies
+ BLOCK_ALL_COOKIES, // disable cookies
+ SESSION_COOKIES // expire all cookies at end of session
};
static bool ValidType(int32 type) {
- return type >= ALLOW_ALL_COOKIES && type <= BLOCK_ALL_COOKIES;
+ return type >= ALLOW_ALL_COOKIES && type <= SESSION_COOKIES;
}
static Type FromInt(int32 type) {
@@ -40,6 +41,9 @@ class CookiePolicy {
// preferences change.
void SetType(Type type) { type_ = type; }
+ // Get the current policy.
+ Type GetType() const { return type_; }
+
CookiePolicy();
private: