summaryrefslogtreecommitdiffstats
path: root/net/base/cookie_monster.cc
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-30 08:33:55 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-30 08:33:55 +0000
commite7c590e576157f7b60acb7b708da84b494f389e1 (patch)
treea5cca3570609f0286e675235d738c4ea65f7c97d /net/base/cookie_monster.cc
parentd032529458275dd3bdda61de5e3447a279e4d680 (diff)
downloadchromium_src-e7c590e576157f7b60acb7b708da84b494f389e1.zip
chromium_src-e7c590e576157f7b60acb7b708da84b494f389e1.tar.gz
chromium_src-e7c590e576157f7b60acb7b708da84b494f389e1.tar.bz2
Adding 'explicit_expiration' cause to 'OnCookieChanged'
BUG=77298 TEST=browser_tests Review URL: http://codereview.chromium.org/6730049 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/cookie_monster.cc')
-rw-r--r--net/base/cookie_monster.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/base/cookie_monster.cc b/net/base/cookie_monster.cc
index 09bee76..b850bbe 100644
--- a/net/base/cookie_monster.cc
+++ b/net/base/cookie_monster.cc
@@ -376,6 +376,8 @@ ChangeCausePair ChangeCauseMapping[] = {
{ CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
// DELETE_COOKIE_EVICTED_DOMAIN_POST_SAFE
{ CookieMonster::Delegate::CHANGE_COOKIE_EVICTED, true },
+ // DELETE_COOKIE_EXPIRED_OVERWRITE
+ { CookieMonster::Delegate::CHANGE_COOKIE_EXPIRED_OVERWRITE, true },
// DELETE_COOKIE_LAST_ENTRY
{ CookieMonster::Delegate::CHANGE_COOKIE_EXPLICIT, false }
};
@@ -1239,7 +1241,8 @@ void CookieMonster::FindCookiesForKey(
bool CookieMonster::DeleteAnyEquivalentCookie(const std::string& key,
const CanonicalCookie& ecc,
- bool skip_httponly) {
+ bool skip_httponly,
+ bool already_expired) {
lock_.AssertAcquired();
ValidateMapWhileLockHeld(0);
@@ -1259,7 +1262,8 @@ bool CookieMonster::DeleteAnyEquivalentCookie(const std::string& key,
if (skip_httponly && cc->IsHttpOnly()) {
skipped_httponly = true;
} else {
- InternalDeleteCookie(curit, true, DELETE_COOKIE_OVERWRITE);
+ InternalDeleteCookie(curit, true, already_expired ?
+ DELETE_COOKIE_EXPIRED_OVERWRITE : DELETE_COOKIE_OVERWRITE);
}
found_equivalent_cookie = true;
}
@@ -1338,7 +1342,9 @@ bool CookieMonster::SetCanonicalCookie(scoped_ptr<CanonicalCookie>* cc,
const Time& creation_time,
const CookieOptions& options) {
const std::string key(GetKey((*cc)->Domain()));
- if (DeleteAnyEquivalentCookie(key, **cc, options.exclude_httponly())) {
+ bool already_expired = (*cc)->IsExpired(creation_time);
+ if (DeleteAnyEquivalentCookie(key, **cc, options.exclude_httponly(),
+ already_expired)) {
VLOG(kVlogSetCookies) << "SetCookie() not clobbering httponly cookie";
return false;
}
@@ -1348,7 +1354,7 @@ bool CookieMonster::SetCanonicalCookie(scoped_ptr<CanonicalCookie>* cc,
// Realize that we might be setting an expired cookie, and the only point
// was to delete the cookie which we've already done.
- if (!(*cc)->IsExpired(creation_time) || keep_expired_cookies_) {
+ if (!already_expired || keep_expired_cookies_) {
// See InitializeHistograms() for details.
if ((*cc)->DoesExpire()) {
histogram_expiration_duration_minutes_->Add(