summaryrefslogtreecommitdiffstats
path: root/net/cookies
diff options
context:
space:
mode:
authorjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 08:31:43 +0000
committerjochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-05 08:31:43 +0000
commitbf510ed89ae0469951d8a9d39ca40e6c171db663 (patch)
tree781235082dd354a4731d32ac9322aff8ff30c73f /net/cookies
parent52d213e0e78f33a43364913c1328cac0bac42299 (diff)
downloadchromium_src-bf510ed89ae0469951d8a9d39ca40e6c171db663.zip
chromium_src-bf510ed89ae0469951d8a9d39ca40e6c171db663.tar.gz
chromium_src-bf510ed89ae0469951d8a9d39ca40e6c171db663.tar.bz2
Unwire the clear on exit preference from the storage systems.
The "session only" rules should cover the functionality now UI changes and migration code will follow BUG=129349 TEST=added unit tests for the chrome/browser/net/sqlite* classes Review URL: https://chromiumcodereview.appspot.com/10447117 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/cookies')
-rw-r--r--net/cookies/cookie_monster.cc9
-rw-r--r--net/cookies/cookie_monster.h13
-rw-r--r--net/cookies/cookie_monster_store_test.cc7
-rw-r--r--net/cookies/cookie_monster_store_test.h5
-rw-r--r--net/cookies/cookie_monster_unittest.cc4
5 files changed, 12 insertions, 26 deletions
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index 8f516ce..63cd002 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -1373,11 +1373,6 @@ void CookieMonster::SetKeepExpiredCookies() {
keep_expired_cookies_ = true;
}
-void CookieMonster::SetClearPersistentStoreOnExit(bool clear_local_store) {
- if (store_)
- store_->SetClearLocalStateOnExit(clear_local_store);
-}
-
// static
void CookieMonster::EnableFileScheme() {
enable_file_scheme_ = true;
@@ -1513,9 +1508,9 @@ void CookieMonster::SetPersistSessionCookies(bool persist_session_cookies) {
persist_session_cookies_ = persist_session_cookies;
}
-void CookieMonster::SaveSessionCookies() {
+void CookieMonster::SetForceKeepSessionState() {
if (store_) {
- store_->SetClearLocalStateOnExit(false);
+ store_->SetForceKeepSessionState();
}
}
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 8eef2ba..e9529bd 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -192,9 +192,8 @@ class NET_EXPORT CookieMonster : public CookieStore {
// arbitrary cookies.
void SetKeepExpiredCookies();
- // Delegates the call to set the |clear_local_store_on_exit_| flag of the
- // PersistentStore if it exists.
- void SetClearPersistentStoreOnExit(bool clear_local_store);
+ // Protects session cookies from deletion on shutdown.
+ void SetForceKeepSessionState();
// There are some unknowns about how to correctly handle file:// cookies,
// and our implementation for this is not robust enough. This allows you
@@ -255,9 +254,6 @@ class NET_EXPORT CookieMonster : public CookieStore {
// (i.e. as part of the instance initialization process).
void SetPersistSessionCookies(bool persist_session_cookies);
- // Protects session cookies from deletion on shutdown.
- void SaveSessionCookies();
-
// Debugging method to perform various validation checks on the map.
// Currently just checking that there are no null CanonicalCookie pointers
// in the map.
@@ -952,9 +948,8 @@ class CookieMonster::PersistentCookieStore
virtual void UpdateCookieAccessTime(const CanonicalCookie& cc) = 0;
virtual void DeleteCookie(const CanonicalCookie& cc) = 0;
- // Sets the value of the user preference whether the persistent storage
- // must be deleted upon destruction.
- virtual void SetClearLocalStateOnExit(bool clear_local_state) = 0;
+ // Instructs the store to not discard session only cookies on shutdown.
+ virtual void SetForceKeepSessionState() = 0;
// Flushes the store and posts |callback| when complete.
virtual void Flush(const base::Closure& callback) = 0;
diff --git a/net/cookies/cookie_monster_store_test.cc b/net/cookies/cookie_monster_store_test.cc
index f347e8d..91f1b84 100644
--- a/net/cookies/cookie_monster_store_test.cc
+++ b/net/cookies/cookie_monster_store_test.cc
@@ -78,9 +78,7 @@ void MockPersistentCookieStore::Flush(const base::Closure& callback) {
MessageLoop::current()->PostTask(FROM_HERE, callback);
}
-// No files are created so nothing to clear either
-void
-MockPersistentCookieStore::SetClearLocalStateOnExit(bool clear_local_state) {
+void MockPersistentCookieStore::SetForceKeepSessionState() {
}
MockPersistentCookieStore::~MockPersistentCookieStore() {}
@@ -193,8 +191,7 @@ void MockSimplePersistentCookieStore::Flush(const base::Closure& callback) {
MessageLoop::current()->PostTask(FROM_HERE, callback);
}
-void MockSimplePersistentCookieStore::SetClearLocalStateOnExit(
- bool clear_local_state) {
+void MockSimplePersistentCookieStore::SetForceKeepSessionState() {
}
CookieMonster* CreateMonsterFromStoreForGC(
diff --git a/net/cookies/cookie_monster_store_test.h b/net/cookies/cookie_monster_store_test.h
index fd4218d..38d6976 100644
--- a/net/cookies/cookie_monster_store_test.h
+++ b/net/cookies/cookie_monster_store_test.h
@@ -98,8 +98,7 @@ class MockPersistentCookieStore
virtual void Flush(const base::Closure& callback) OVERRIDE;
- // No files are created so nothing to clear either
- virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE;
+ virtual void SetForceKeepSessionState() OVERRIDE;
protected:
virtual ~MockPersistentCookieStore();
@@ -178,7 +177,7 @@ class MockSimplePersistentCookieStore
virtual void Flush(const base::Closure& callback) OVERRIDE;
- virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE;
+ virtual void SetForceKeepSessionState() OVERRIDE;
protected:
virtual ~MockSimplePersistentCookieStore();
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index fc570b9..84183d7 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -43,8 +43,8 @@ class NewMockPersistentCookieStore
MOCK_METHOD1(UpdateCookieAccessTime,
void(const CookieMonster::CanonicalCookie& cc));
MOCK_METHOD1(DeleteCookie, void(const CookieMonster::CanonicalCookie& cc));
- MOCK_METHOD1(SetClearLocalStateOnExit, void(bool clear_local_state));
MOCK_METHOD1(Flush, void(const base::Closure& callback));
+ MOCK_METHOD0(SetForceKeepSessionState, void());
private:
virtual ~NewMockPersistentCookieStore() {}
@@ -2220,7 +2220,7 @@ class FlushablePersistentStore : public CookieMonster::PersistentCookieStore {
void AddCookie(const CookieMonster::CanonicalCookie&) {}
void UpdateCookieAccessTime(const CookieMonster::CanonicalCookie&) {}
void DeleteCookie(const CookieMonster::CanonicalCookie&) {}
- void SetClearLocalStateOnExit(bool clear_local_state) {}
+ void SetForceKeepSessionState() {}
void Flush(const base::Closure& callback) {
++flush_count_;