summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmenke <mmenke@chromium.org>2016-02-12 06:39:20 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-12 14:40:23 +0000
commit3c79a656664b22398da5be0c686b64dcb21ca193 (patch)
tree955afcad1e5645cab651578759ae25c39a213576
parent77e8999c86952308b5bada457d944ae4c55af3c8 (diff)
downloadchromium_src-3c79a656664b22398da5be0c686b64dcb21ca193.zip
chromium_src-3c79a656664b22398da5be0c686b64dcb21ca193.tar.gz
chromium_src-3c79a656664b22398da5be0c686b64dcb21ca193.tar.bz2
Remove CookieMonster::SetKeepExpiredCookies().
Nothing is currently using it. Also remove the unused CookieMonster::default_enable_file_scheme_, which was left over from another refactor. BUG=none Review URL: https://codereview.chromium.org/1685243002 Cr-Commit-Position: refs/heads/master@{#375178}
-rw-r--r--net/cookies/cookie_monster.cc12
-rw-r--r--net/cookies/cookie_monster.h11
-rw-r--r--net/cookies/cookie_monster_unittest.cc29
3 files changed, 2 insertions, 50 deletions
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index 9874610..9c507ea 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -370,7 +370,6 @@ CookieMonster::CookieMonster(PersistentCookieStore* store,
last_access_threshold_milliseconds)),
delegate_(delegate),
last_statistic_record_time_(base::Time::Now()),
- keep_expired_cookies_(false),
persist_session_cookies_(false) {
InitializeHistograms();
cookieable_schemes_.insert(
@@ -1048,10 +1047,6 @@ void CookieMonster::SetCookieableSchemes(
cookieable_schemes_ = schemes;
}
-void CookieMonster::SetKeepExpiredCookies() {
- keep_expired_cookies_ = true;
-}
-
// This function must be called before the CookieMonster is used.
void CookieMonster::SetPersistSessionCookies(bool persist_session_cookies) {
DCHECK(!initialized_);
@@ -1654,7 +1649,7 @@ void CookieMonster::FindCookiesForKey(const std::string& key,
++its.first;
// If the cookie is expired, delete it.
- if (cc->IsExpired(current) && !keep_expired_cookies_) {
+ if (cc->IsExpired(current)) {
InternalDeleteCookie(curit, true, DELETE_COOKIE_EXPIRED);
continue;
}
@@ -1841,7 +1836,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 (!already_expired || keep_expired_cookies_) {
+ if (!already_expired) {
// See InitializeHistograms() for details.
if (cc->IsPersistent()) {
histogram_expiration_duration_minutes_->Add(
@@ -2066,9 +2061,6 @@ size_t CookieMonster::GarbageCollect(const Time& current,
size_t CookieMonster::GarbageCollectExpired(const Time& current,
const CookieMapItPair& itpair,
CookieItVector* cookie_its) {
- if (keep_expired_cookies_)
- return 0;
-
lock_.AssertAcquired();
int num_deleted = 0;
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index dd2b6eb..0ad3c94 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -209,11 +209,6 @@ class NET_EXPORT CookieMonster : public CookieStore {
// instance initialization process).
void SetCookieableSchemes(const std::vector<std::string>& schemes);
- // Instructs the cookie monster to not delete expired cookies. This is used
- // in cases where the cookie monster is used as a data structure to keep
- // arbitrary cookies.
- void SetKeepExpiredCookies();
-
// Enables writing session cookies into the cookie database. If this this
// method is called, it must be called before first use of the instance
// (i.e. as part of the instance initialization process).
@@ -709,14 +704,8 @@ class NET_EXPORT CookieMonster : public CookieStore {
base::Time last_statistic_record_time_;
- bool keep_expired_cookies_;
bool persist_session_cookies_;
- // Static setting for whether or not file scheme cookies are allows when
- // a new CookieMonster is created, or the accepted schemes on a CookieMonster
- // instance are reset back to defaults.
- static bool default_enable_file_scheme_;
-
typedef std::map<std::pair<GURL, std::string>,
linked_ptr<CookieChangedCallbackList>> CookieChangedHookMap;
CookieChangedHookMap hook_map_;
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index 309fcf4..5a48599 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -1989,35 +1989,6 @@ TEST_F(CookieMonsterTest, MAYBE_GarbageCollectionTriggers) {
}
}
-// This test checks that keep expired cookies flag is working.
-TEST_F(CookieMonsterTest, KeepExpiredCookies) {
- scoped_refptr<CookieMonster> cm(new CookieMonster(NULL, NULL));
- cm->SetKeepExpiredCookies();
- CookieOptions options;
-
- // Set a persistent cookie.
- ASSERT_TRUE(SetCookieWithOptions(
- cm.get(), http_www_google_.url(),
- std::string(kValidCookieLine) + "; expires=Mon, 18-Apr-22 22:50:13 GMT",
- options));
-
- // Get the canonical cookie.
- CookieList cookie_list = GetAllCookies(cm.get());
- ASSERT_EQ(1U, cookie_list.size());
-
- // Use a past expiry date to delete the cookie.
- ASSERT_TRUE(SetCookieWithOptions(
- cm.get(), http_www_google_.url(),
- std::string(kValidCookieLine) + "; expires=Mon, 18-Apr-1977 22:50:13 GMT",
- options));
-
- // Check that the cookie with the past expiry date is still there.
- // GetAllCookies() also triggers garbage collection.
- cookie_list = GetAllCookies(cm.get());
- ASSERT_EQ(1U, cookie_list.size());
- ASSERT_TRUE(cookie_list[0].IsExpired(Time::Now()));
-}
-
namespace {
// Mock PersistentCookieStore that keeps track of the number of Flush() calls.