OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/privacy_blacklist/blacklist.h" | 10 #include "chrome/browser/privacy_blacklist/blacklist.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 #else | 250 #else |
251 context->set_ftp_transaction_factory( | 251 context->set_ftp_transaction_factory( |
252 new net::FtpNetworkLayer(context->host_resolver())); | 252 new net::FtpNetworkLayer(context->host_resolver())); |
253 #endif | 253 #endif |
254 | 254 |
255 // setup cookie store | 255 // setup cookie store |
256 if (!context->cookie_store()) { | 256 if (!context->cookie_store()) { |
257 DCHECK(!cookie_store_path_.empty()); | 257 DCHECK(!cookie_store_path_.empty()); |
258 | 258 |
259 scoped_refptr<SQLitePersistentCookieStore> cookie_db = | 259 scoped_refptr<SQLitePersistentCookieStore> cookie_db = |
260 new SQLitePersistentCookieStore( | 260 new SQLitePersistentCookieStore(cookie_store_path_); |
261 cookie_store_path_, | |
262 db_loop_); | |
263 context->set_cookie_store(new net::CookieMonster(cookie_db.get())); | 261 context->set_cookie_store(new net::CookieMonster(cookie_db.get())); |
264 } | 262 } |
265 | 263 |
266 // Create a new AppCacheService (issues fetches through the | 264 // Create a new AppCacheService (issues fetches through the |
267 // main URLRequestContext that we just created). | 265 // main URLRequestContext that we just created). |
268 context->set_appcache_service( | 266 context->set_appcache_service( |
269 new ChromeAppCacheService(profile_dir_path_, false)); | 267 new ChromeAppCacheService(profile_dir_path_, false)); |
270 context->appcache_service()->set_request_context(context); | 268 context->appcache_service()->set_request_context(context); |
271 | 269 |
272 #if defined(OS_LINUX) | 270 #if defined(OS_LINUX) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 309 } |
312 | 310 |
313 ChromeURLRequestContext* FactoryForExtensions::Create() { | 311 ChromeURLRequestContext* FactoryForExtensions::Create() { |
314 ChromeURLRequestContext* context = new ChromeURLRequestContext; | 312 ChromeURLRequestContext* context = new ChromeURLRequestContext; |
315 ApplyProfileParametersToContext(context); | 313 ApplyProfileParametersToContext(context); |
316 | 314 |
317 // All we care about for extensions is the cookie store. | 315 // All we care about for extensions is the cookie store. |
318 DCHECK(!cookie_store_path_.empty()); | 316 DCHECK(!cookie_store_path_.empty()); |
319 | 317 |
320 scoped_refptr<SQLitePersistentCookieStore> cookie_db = | 318 scoped_refptr<SQLitePersistentCookieStore> cookie_db = |
321 new SQLitePersistentCookieStore(cookie_store_path_, db_loop_); | 319 new SQLitePersistentCookieStore(cookie_store_path_); |
322 net::CookieMonster* cookie_monster = new net::CookieMonster(cookie_db.get()); | 320 net::CookieMonster* cookie_monster = new net::CookieMonster(cookie_db.get()); |
323 | 321 |
324 // Enable cookies for extension URLs only. | 322 // Enable cookies for extension URLs only. |
325 const char* schemes[] = {chrome::kExtensionScheme}; | 323 const char* schemes[] = {chrome::kExtensionScheme}; |
326 cookie_monster->SetCookieableSchemes(schemes, 1); | 324 cookie_monster->SetCookieableSchemes(schemes, 1); |
327 context->set_cookie_store(cookie_monster); | 325 context->set_cookie_store(cookie_monster); |
328 | 326 |
329 return context; | 327 return context; |
330 } | 328 } |
331 | 329 |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 return result; | 879 return result; |
882 } | 880 } |
883 | 881 |
884 void ChromeURLRequestContextGetter::GetCookieStoreAsyncHelper( | 882 void ChromeURLRequestContextGetter::GetCookieStoreAsyncHelper( |
885 base::WaitableEvent* completion, | 883 base::WaitableEvent* completion, |
886 net::CookieStore** result) { | 884 net::CookieStore** result) { |
887 // Note that CookieStore is refcounted, yet we do not add a reference. | 885 // Note that CookieStore is refcounted, yet we do not add a reference. |
888 *result = GetURLRequestContext()->cookie_store(); | 886 *result = GetURLRequestContext()->cookie_store(); |
889 completion->Signal(); | 887 completion->Signal(); |
890 } | 888 } |
OLD | NEW |