Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Unified Diff: content/browser/net/sqlite_persistent_cookie_store.cc

Issue 12546016: Remove the Extensions URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android webview init fix merged in. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/net/cookie_store_map.cc ('k') | content/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/net/sqlite_persistent_cookie_store.cc
diff --git a/content/browser/net/sqlite_persistent_cookie_store.cc b/content/browser/net/sqlite_persistent_cookie_store.cc
index c23692d475071502c2b8d1d081fab3ffdebd6095..55be9e9d71fde6df5939b2cd56e589275a50815a 100644
--- a/content/browser/net/sqlite_persistent_cookie_store.cc
+++ b/content/browser/net/sqlite_persistent_cookie_store.cc
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/location.h"
@@ -28,6 +29,7 @@
#include "base/time/time.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
+#include "content/public/common/content_switches.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/cookies/canonical_cookie.h"
#include "net/cookies/cookie_constants.h"
@@ -1194,28 +1196,60 @@ SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
// a reference if the background runner has not run Close() yet.
}
-net::CookieStore* CreatePersistentCookieStore(
+CookieStoreConfig::CookieStoreConfig(
const base::FilePath& path,
- bool restore_old_session_cookies,
+ SessionCookieMode session_cookie_mode,
quota::SpecialStoragePolicy* storage_policy,
- net::CookieMonster::Delegate* cookie_monster_delegate) {
+ net::CookieMonsterDelegate* cookie_delegate)
+ : path(path),
+ session_cookie_mode(session_cookie_mode),
+ storage_policy(storage_policy),
+ cookie_delegate(cookie_delegate) {
+ CHECK(!path.empty() || session_cookie_mode == EPHEMERAL_SESSION_COOKIES);
+}
+
+CookieStoreConfig::CookieStoreConfig()
+ : session_cookie_mode(EPHEMERAL_SESSION_COOKIES) {
+ // Default to an in-memory cookie store.
+}
+
+CookieStoreConfig::~CookieStoreConfig() {
+}
+
+net::CookieStore* CreateCookieStore(const CookieStoreConfig& config) {
+ if (config.path.empty()) {
+ return new net::CookieMonster(NULL, config.cookie_delegate);
+ }
+
SQLitePersistentCookieStore* persistent_store =
new SQLitePersistentCookieStore(
- path,
+ config.path,
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
BrowserThread::GetBlockingPool()->GetSequenceToken()),
- restore_old_session_cookies,
- storage_policy);
+ (config.session_cookie_mode ==
+ CookieStoreConfig::RESTORED_SESSION_COOKIES),
+ config.storage_policy);
net::CookieMonster* cookie_monster =
- new net::CookieMonster(persistent_store, cookie_monster_delegate);
+ new net::CookieMonster(persistent_store, config.cookie_delegate);
+ if ((config.session_cookie_mode ==
+ CookieStoreConfig::PERSISTANT_SESSION_COOKIES) ||
+ (config.session_cookie_mode ==
+ CookieStoreConfig::RESTORED_SESSION_COOKIES)) {
+ cookie_monster->SetPersistSessionCookies(true);
+ }
+
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableFileCookies)) {
+ cookie_monster->SetEnableFileScheme(true);
+ }
const std::string cookie_priority_experiment_group =
base::FieldTrialList::FindFullName("CookieRetentionPriorityStudy");
cookie_monster->SetPriorityAwareGarbageCollection(
cookie_priority_experiment_group == "ExperimentOn");
- return cookie_monster;
+ return cookie_monster;
}
} // namespace content
« no previous file with comments | « content/browser/net/cookie_store_map.cc ('k') | content/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698