| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 ChromeURLRequestContext* FactoryForOriginal::Create() { | 257 ChromeURLRequestContext* FactoryForOriginal::Create() { |
| 258 ChromeURLRequestContext* context = new ChromeURLRequestContext; | 258 ChromeURLRequestContext* context = new ChromeURLRequestContext; |
| 259 ApplyProfileParametersToContext(context); | 259 ApplyProfileParametersToContext(context); |
| 260 | 260 |
| 261 IOThread::Globals* io_thread_globals = io_thread()->globals(); | 261 IOThread::Globals* io_thread_globals = io_thread()->globals(); |
| 262 | 262 |
| 263 // Global host resolver for the context. | 263 // Global host resolver for the context. |
| 264 context->set_host_resolver(io_thread_globals->host_resolver.get()); | 264 context->set_host_resolver(io_thread_globals->host_resolver.get()); |
| 265 context->set_cert_verifier(io_thread_globals->cert_verifier.get()); |
| 265 context->set_dnsrr_resolver(io_thread_globals->dnsrr_resolver.get()); | 266 context->set_dnsrr_resolver(io_thread_globals->dnsrr_resolver.get()); |
| 266 context->set_http_auth_handler_factory( | 267 context->set_http_auth_handler_factory( |
| 267 io_thread_globals->http_auth_handler_factory.get()); | 268 io_thread_globals->http_auth_handler_factory.get()); |
| 268 | 269 |
| 269 context->set_dns_cert_checker( | 270 context->set_dns_cert_checker( |
| 270 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), | 271 CreateDnsCertProvenanceChecker(io_thread_globals->dnsrr_resolver.get(), |
| 271 context)); | 272 context)); |
| 272 | 273 |
| 273 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 274 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 274 | 275 |
| 275 context->set_proxy_service( | 276 context->set_proxy_service( |
| 276 CreateProxyService(io_thread()->net_log(), | 277 CreateProxyService(io_thread()->net_log(), |
| 277 context, | 278 context, |
| 278 proxy_config_service_.release(), | 279 proxy_config_service_.release(), |
| 279 command_line, | 280 command_line, |
| 280 io_thread())); | 281 io_thread())); |
| 281 | 282 |
| 282 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 283 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
| 283 net::DISK_CACHE, disk_cache_path_, cache_size_, | 284 net::DISK_CACHE, disk_cache_path_, cache_size_, |
| 284 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 285 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); |
| 285 net::HttpCache* cache = | 286 net::HttpCache* cache = |
| 286 new net::HttpCache(context->host_resolver(), | 287 new net::HttpCache(context->host_resolver(), |
| 288 context->cert_verifier(), |
| 287 context->dnsrr_resolver(), | 289 context->dnsrr_resolver(), |
| 288 context->dns_cert_checker(), | 290 context->dns_cert_checker(), |
| 289 context->proxy_service(), | 291 context->proxy_service(), |
| 290 context->ssl_config_service(), | 292 context->ssl_config_service(), |
| 291 context->http_auth_handler_factory(), | 293 context->http_auth_handler_factory(), |
| 292 &io_thread_globals->network_delegate, | 294 &io_thread_globals->network_delegate, |
| 293 io_thread()->net_log(), | 295 io_thread()->net_log(), |
| 294 backend); | 296 backend); |
| 295 | 297 |
| 296 bool record_mode = chrome::kRecordModeEnabled && | 298 bool record_mode = chrome::kRecordModeEnabled && |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 context->set_host_resolver(original_context->host_resolver()); | 407 context->set_host_resolver(original_context->host_resolver()); |
| 406 context->set_proxy_service(original_context->proxy_service()); | 408 context->set_proxy_service(original_context->proxy_service()); |
| 407 context->set_http_auth_handler_factory( | 409 context->set_http_auth_handler_factory( |
| 408 original_context->http_auth_handler_factory()); | 410 original_context->http_auth_handler_factory()); |
| 409 | 411 |
| 410 net::HttpCache::BackendFactory* backend = | 412 net::HttpCache::BackendFactory* backend = |
| 411 net::HttpCache::DefaultBackend::InMemory(0); | 413 net::HttpCache::DefaultBackend::InMemory(0); |
| 412 | 414 |
| 413 net::HttpCache* cache = | 415 net::HttpCache* cache = |
| 414 new net::HttpCache(context->host_resolver(), | 416 new net::HttpCache(context->host_resolver(), |
| 417 context->cert_verifier(), |
| 415 context->dnsrr_resolver(), | 418 context->dnsrr_resolver(), |
| 416 NULL /* dns_cert_checker */, | 419 NULL /* dns_cert_checker */, |
| 417 context->proxy_service(), | 420 context->proxy_service(), |
| 418 context->ssl_config_service(), | 421 context->ssl_config_service(), |
| 419 context->http_auth_handler_factory(), | 422 context->http_auth_handler_factory(), |
| 420 &io_thread_globals->network_delegate, | 423 &io_thread_globals->network_delegate, |
| 421 io_thread()->net_log(), | 424 io_thread()->net_log(), |
| 422 backend); | 425 backend); |
| 423 context->set_cookie_store(new net::CookieMonster(NULL, | 426 context->set_cookie_store(new net::CookieMonster(NULL, |
| 424 cookie_monster_delegate_)); | 427 cookie_monster_delegate_)); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 net::HttpNetworkLayer* main_network_layer = | 501 net::HttpNetworkLayer* main_network_layer = |
| 499 static_cast<net::HttpNetworkLayer*>(main_cache->network_layer()); | 502 static_cast<net::HttpNetworkLayer*>(main_cache->network_layer()); |
| 500 cache = new net::HttpCache(main_network_layer->GetSession(), backend); | 503 cache = new net::HttpCache(main_network_layer->GetSession(), backend); |
| 501 // TODO(eroman): Since this is poaching the session from the main | 504 // TODO(eroman): Since this is poaching the session from the main |
| 502 // context, it should hold a reference to that context preventing the | 505 // context, it should hold a reference to that context preventing the |
| 503 // session from getting deleted. | 506 // session from getting deleted. |
| 504 } else { | 507 } else { |
| 505 // If original HttpCache doesn't exist, simply construct one with a whole | 508 // If original HttpCache doesn't exist, simply construct one with a whole |
| 506 // new set of network stack. | 509 // new set of network stack. |
| 507 cache = new net::HttpCache(main_context->host_resolver(), | 510 cache = new net::HttpCache(main_context->host_resolver(), |
| 511 main_context->cert_verifier(), |
| 508 main_context->dnsrr_resolver(), | 512 main_context->dnsrr_resolver(), |
| 509 NULL /* dns_cert_checker */, | 513 NULL /* dns_cert_checker */, |
| 510 main_context->proxy_service(), | 514 main_context->proxy_service(), |
| 511 main_context->ssl_config_service(), | 515 main_context->ssl_config_service(), |
| 512 main_context->http_auth_handler_factory(), | 516 main_context->http_auth_handler_factory(), |
| 513 &io_thread_globals->network_delegate, | 517 &io_thread_globals->network_delegate, |
| 514 io_thread()->net_log(), | 518 io_thread()->net_log(), |
| 515 backend); | 519 backend); |
| 516 } | 520 } |
| 517 | 521 |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 context->set_host_zoom_map(host_zoom_map_); | 945 context->set_host_zoom_map(host_zoom_map_); |
| 942 context->set_transport_security_state( | 946 context->set_transport_security_state( |
| 943 transport_security_state_); | 947 transport_security_state_); |
| 944 context->set_ssl_config_service(ssl_config_service_); | 948 context->set_ssl_config_service(ssl_config_service_); |
| 945 context->set_appcache_service(appcache_service_); | 949 context->set_appcache_service(appcache_service_); |
| 946 context->set_database_tracker(database_tracker_); | 950 context->set_database_tracker(database_tracker_); |
| 947 context->set_blob_storage_context(blob_storage_context_); | 951 context->set_blob_storage_context(blob_storage_context_); |
| 948 context->set_browser_file_system_context(browser_file_system_context_); | 952 context->set_browser_file_system_context(browser_file_system_context_); |
| 949 context->set_extension_info_map(extension_info_map_); | 953 context->set_extension_info_map(extension_info_map_); |
| 950 } | 954 } |
| OLD | NEW |