OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 context, | 265 context, |
266 proxy_config_service_.release(), | 266 proxy_config_service_.release(), |
267 command_line, | 267 command_line, |
268 MessageLoop::current() /*io_loop*/)); | 268 MessageLoop::current() /*io_loop*/)); |
269 | 269 |
270 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 270 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
271 net::DISK_CACHE, disk_cache_path_, cache_size_, | 271 net::DISK_CACHE, disk_cache_path_, cache_size_, |
272 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::CACHE)); | 272 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::CACHE)); |
273 net::HttpCache* cache = | 273 net::HttpCache* cache = |
274 new net::HttpCache(context->host_resolver(), | 274 new net::HttpCache(context->host_resolver(), |
| 275 context->dnsrr_resolver(), |
275 context->proxy_service(), | 276 context->proxy_service(), |
276 context->ssl_config_service(), | 277 context->ssl_config_service(), |
277 context->http_auth_handler_factory(), | 278 context->http_auth_handler_factory(), |
278 &io_thread_globals->network_delegate, | 279 &io_thread_globals->network_delegate, |
279 io_thread_globals->net_log.get(), | 280 io_thread_globals->net_log.get(), |
280 backend); | 281 backend); |
281 | 282 |
282 if (command_line.HasSwitch(switches::kDisableByteRangeSupport)) | 283 if (command_line.HasSwitch(switches::kDisableByteRangeSupport)) |
283 cache->set_enable_range_support(false); | 284 cache->set_enable_range_support(false); |
284 | 285 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 context->set_host_resolver(original_context->host_resolver()); | 398 context->set_host_resolver(original_context->host_resolver()); |
398 context->set_proxy_service(original_context->proxy_service()); | 399 context->set_proxy_service(original_context->proxy_service()); |
399 context->set_http_auth_handler_factory( | 400 context->set_http_auth_handler_factory( |
400 original_context->http_auth_handler_factory()); | 401 original_context->http_auth_handler_factory()); |
401 | 402 |
402 net::HttpCache::BackendFactory* backend = | 403 net::HttpCache::BackendFactory* backend = |
403 net::HttpCache::DefaultBackend::InMemory(0); | 404 net::HttpCache::DefaultBackend::InMemory(0); |
404 | 405 |
405 net::HttpCache* cache = | 406 net::HttpCache* cache = |
406 new net::HttpCache(context->host_resolver(), | 407 new net::HttpCache(context->host_resolver(), |
| 408 context->dnsrr_resolver(), |
407 context->proxy_service(), | 409 context->proxy_service(), |
408 context->ssl_config_service(), | 410 context->ssl_config_service(), |
409 context->http_auth_handler_factory(), | 411 context->http_auth_handler_factory(), |
410 &io_thread_globals->network_delegate, | 412 &io_thread_globals->network_delegate, |
411 io_thread_globals->net_log.get(), | 413 io_thread_globals->net_log.get(), |
412 backend); | 414 backend); |
413 context->set_cookie_store(new net::CookieMonster(NULL, | 415 context->set_cookie_store(new net::CookieMonster(NULL, |
414 cookie_monster_delegate_)); | 416 cookie_monster_delegate_)); |
415 context->set_cookie_policy( | 417 context->set_cookie_policy( |
416 new ChromeCookiePolicy(host_content_settings_map_)); | 418 new ChromeCookiePolicy(host_content_settings_map_)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 net::HttpNetworkLayer* main_network_layer = | 494 net::HttpNetworkLayer* main_network_layer = |
493 static_cast<net::HttpNetworkLayer*>(main_cache->network_layer()); | 495 static_cast<net::HttpNetworkLayer*>(main_cache->network_layer()); |
494 cache = new net::HttpCache(main_network_layer->GetSession(), backend); | 496 cache = new net::HttpCache(main_network_layer->GetSession(), backend); |
495 // TODO(eroman): Since this is poaching the session from the main | 497 // TODO(eroman): Since this is poaching the session from the main |
496 // context, it should hold a reference to that context preventing the | 498 // context, it should hold a reference to that context preventing the |
497 // session from getting deleted. | 499 // session from getting deleted. |
498 } else { | 500 } else { |
499 // If original HttpCache doesn't exist, simply construct one with a whole | 501 // If original HttpCache doesn't exist, simply construct one with a whole |
500 // new set of network stack. | 502 // new set of network stack. |
501 cache = new net::HttpCache(main_context->host_resolver(), | 503 cache = new net::HttpCache(main_context->host_resolver(), |
| 504 main_context->dnsrr_resolver(), |
502 main_context->proxy_service(), | 505 main_context->proxy_service(), |
503 main_context->ssl_config_service(), | 506 main_context->ssl_config_service(), |
504 main_context->http_auth_handler_factory(), | 507 main_context->http_auth_handler_factory(), |
505 &io_thread_globals->network_delegate, | 508 &io_thread_globals->network_delegate, |
506 io_thread_globals->net_log.get(), | 509 io_thread_globals->net_log.get(), |
507 backend); | 510 backend); |
508 } | 511 } |
509 | 512 |
510 if (CommandLine::ForCurrentProcess()->HasSwitch( | 513 if (CommandLine::ForCurrentProcess()->HasSwitch( |
511 switches::kDisableByteRangeSupport)) | 514 switches::kDisableByteRangeSupport)) |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 prefs::kProxyAutoDetect)); | 963 prefs::kProxyAutoDetect)); |
961 | 964 |
962 if (pref_service->HasPrefPath(prefs::kProxyBypassList)) { | 965 if (pref_service->HasPrefPath(prefs::kProxyBypassList)) { |
963 std::string proxy_bypass = | 966 std::string proxy_bypass = |
964 pref_service->GetString(prefs::kProxyBypassList); | 967 pref_service->GetString(prefs::kProxyBypassList); |
965 proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass); | 968 proxy_config->proxy_rules().bypass_rules.ParseFromString(proxy_bypass); |
966 } | 969 } |
967 | 970 |
968 return proxy_config; | 971 return proxy_config; |
969 } | 972 } |
OLD | NEW |