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

Side by Side 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: most unittests pass 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/net/sqlite_persistent_cookie_store.h" 5 #include "content/browser/net/sqlite_persistent_cookie_store.h"
6 6
7 #include <list> 7 #include <list>
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) { 1187 void SQLitePersistentCookieStore::Flush(const base::Closure& callback) {
1188 backend_->Flush(callback); 1188 backend_->Flush(callback);
1189 } 1189 }
1190 1190
1191 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() { 1191 SQLitePersistentCookieStore::~SQLitePersistentCookieStore() {
1192 backend_->Close(); 1192 backend_->Close();
1193 // We release our reference to the Backend, though it will probably still have 1193 // We release our reference to the Backend, though it will probably still have
1194 // a reference if the background runner has not run Close() yet. 1194 // a reference if the background runner has not run Close() yet.
1195 } 1195 }
1196 1196
1197 net::CookieStore* CreatePersistentCookieStore( 1197 CookieStoreConfig::CookieStoreConfig(
1198 bool in_memory,
1198 const base::FilePath& path, 1199 const base::FilePath& path,
1199 bool restore_old_session_cookies, 1200 bool restore_old_session_cookies,
1200 quota::SpecialStoragePolicy* storage_policy, 1201 quota::SpecialStoragePolicy* storage_policy,
1201 net::CookieMonster::Delegate* cookie_monster_delegate) { 1202 net::CookieMonsterDelegate* cookie_delegate)
1203 : in_memory(in_memory),
1204 path(path),
1205 restore_old_session_cookies(restore_old_session_cookies),
1206 storage_policy(storage_policy),
1207 cookie_delegate(cookie_delegate) {
1208 }
1209
1210 CookieStoreConfig::~CookieStoreConfig() {
1211 }
1212
1213 CookieStoreConfig CookieStoreConfig::InMemory() {
1214 return CookieStoreConfig(true, base::FilePath(), false, NULL, NULL);
1215 }
1216
1217 CookieStoreConfig CookieStoreConfig::InMemoryWithOptions(
1218 quota::SpecialStoragePolicy* storage_policy,
1219 net::CookieMonsterDelegate* cookie_delegate) {
1220 // TODO(ajwong): Why in the world do we want a storage policy with InMemory?
1221 return CookieStoreConfig(true, base::FilePath(),
1222 false, storage_policy, cookie_delegate);
1223 }
1224
1225 CookieStoreConfig CookieStoreConfig::Persistent(
1226 const base::FilePath& path,
1227 bool restore_old_session_cookies) {
1228 return CookieStoreConfig(false, path, restore_old_session_cookies, NULL,
1229 NULL);
1230 }
1231
1232 CookieStoreConfig CookieStoreConfig::PersistentWithOptions(
1233 const base::FilePath& path,
1234 bool restore_old_session_cookies,
1235 quota::SpecialStoragePolicy* storage_policy,
1236 net::CookieMonsterDelegate* cookie_delegate) {
1237 return CookieStoreConfig(false, path, restore_old_session_cookies,
1238 storage_policy, cookie_delegate);
1239 }
1240
1241 net::CookieStore* CreateCookieStore(const CookieStoreConfig& config) {
1242 if (config.in_memory) {
1243 return new net::CookieMonster(NULL, config.cookie_delegate);
1244 }
1245
1202 SQLitePersistentCookieStore* persistent_store = 1246 SQLitePersistentCookieStore* persistent_store =
1203 new SQLitePersistentCookieStore( 1247 new SQLitePersistentCookieStore(
1204 path, 1248 config.path,
1205 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), 1249 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
1206 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 1250 BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
1207 BrowserThread::GetBlockingPool()->GetSequenceToken()), 1251 BrowserThread::GetBlockingPool()->GetSequenceToken()),
1208 restore_old_session_cookies, 1252 config.restore_old_session_cookies,
1209 storage_policy); 1253 config.storage_policy);
1210 net::CookieMonster* cookie_monster = 1254 return new net::CookieMonster(persistent_store,
1211 new net::CookieMonster(persistent_store, cookie_monster_delegate); 1255 config.cookie_delegate);
1212
1213 const std::string cookie_priority_experiment_group =
1214 base::FieldTrialList::FindFullName("CookieRetentionPriorityStudy");
1215 cookie_monster->SetPriorityAwareGarbageCollection(
1216 cookie_priority_experiment_group == "ExperimentOn");
1217
1218 return cookie_monster;
1219 } 1256 }
1220 1257
1221 } // namespace content 1258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698