summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
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: