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_util.h" | 10 #include "base/string_util.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( | 250 net::HttpCache::DefaultBackend* backend = new net::HttpCache::DefaultBackend( |
251 net::DISK_CACHE, disk_cache_path_, cache_size_, | 251 net::DISK_CACHE, disk_cache_path_, cache_size_, |
252 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::CACHE)); | 252 ChromeThread::GetMessageLoopProxyForThread(ChromeThread::CACHE)); |
253 net::HttpCache* cache = | 253 net::HttpCache* cache = |
254 new net::HttpCache(io_thread()->globals()->network_change_notifier.get(), | 254 new net::HttpCache(io_thread()->globals()->network_change_notifier.get(), |
255 context->host_resolver(), | 255 context->host_resolver(), |
256 context->proxy_service(), | 256 context->proxy_service(), |
257 context->ssl_config_service(), | 257 context->ssl_config_service(), |
258 context->http_auth_handler_factory(), | 258 context->http_auth_handler_factory(), |
| 259 io_thread()->globals()->net_log.get(), |
259 backend); | 260 backend); |
260 | 261 |
261 if (command_line.HasSwitch(switches::kDisableByteRangeSupport)) | 262 if (command_line.HasSwitch(switches::kDisableByteRangeSupport)) |
262 cache->set_enable_range_support(false); | 263 cache->set_enable_range_support(false); |
263 | 264 |
264 bool record_mode = chrome::kRecordModeEnabled && | 265 bool record_mode = chrome::kRecordModeEnabled && |
265 command_line.HasSwitch(switches::kRecordMode); | 266 command_line.HasSwitch(switches::kRecordMode); |
266 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); | 267 bool playback_mode = command_line.HasSwitch(switches::kPlaybackMode); |
267 | 268 |
268 if (record_mode || playback_mode) { | 269 if (record_mode || playback_mode) { |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 373 |
373 net::HttpCache::BackendFactory* backend = | 374 net::HttpCache::BackendFactory* backend = |
374 net::HttpCache::DefaultBackend::InMemory(0); | 375 net::HttpCache::DefaultBackend::InMemory(0); |
375 | 376 |
376 net::HttpCache* cache = | 377 net::HttpCache* cache = |
377 new net::HttpCache(io_thread()->globals()->network_change_notifier.get(), | 378 new net::HttpCache(io_thread()->globals()->network_change_notifier.get(), |
378 context->host_resolver(), | 379 context->host_resolver(), |
379 context->proxy_service(), | 380 context->proxy_service(), |
380 context->ssl_config_service(), | 381 context->ssl_config_service(), |
381 context->http_auth_handler_factory(), | 382 context->http_auth_handler_factory(), |
| 383 io_thread()->globals()->net_log.get(), |
382 backend); | 384 backend); |
383 context->set_cookie_store(new net::CookieMonster(NULL, | 385 context->set_cookie_store(new net::CookieMonster(NULL, |
384 cookie_monster_delegate_)); | 386 cookie_monster_delegate_)); |
385 context->set_cookie_policy( | 387 context->set_cookie_policy( |
386 new ChromeCookiePolicy(host_content_settings_map_)); | 388 new ChromeCookiePolicy(host_content_settings_map_)); |
387 context->set_http_transaction_factory(cache); | 389 context->set_http_transaction_factory(cache); |
388 | 390 |
389 if (CommandLine::ForCurrentProcess()->HasSwitch( | 391 if (CommandLine::ForCurrentProcess()->HasSwitch( |
390 switches::kDisableByteRangeSupport)) | 392 switches::kDisableByteRangeSupport)) |
391 cache->set_enable_range_support(false); | 393 cache->set_enable_range_support(false); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 // session from getting deleted. | 469 // session from getting deleted. |
468 } else { | 470 } else { |
469 // If original HttpCache doesn't exist, simply construct one with a whole | 471 // If original HttpCache doesn't exist, simply construct one with a whole |
470 // new set of network stack. | 472 // new set of network stack. |
471 cache = new net::HttpCache( | 473 cache = new net::HttpCache( |
472 io_thread()->globals()->network_change_notifier.get(), | 474 io_thread()->globals()->network_change_notifier.get(), |
473 main_context->host_resolver(), | 475 main_context->host_resolver(), |
474 main_context->proxy_service(), | 476 main_context->proxy_service(), |
475 main_context->ssl_config_service(), | 477 main_context->ssl_config_service(), |
476 main_context->http_auth_handler_factory(), | 478 main_context->http_auth_handler_factory(), |
| 479 io_thread()->globals()->net_log.get(), |
477 backend); | 480 backend); |
478 } | 481 } |
479 | 482 |
480 if (CommandLine::ForCurrentProcess()->HasSwitch( | 483 if (CommandLine::ForCurrentProcess()->HasSwitch( |
481 switches::kDisableByteRangeSupport)) | 484 switches::kDisableByteRangeSupport)) |
482 cache->set_enable_range_support(false); | 485 cache->set_enable_range_support(false); |
483 | 486 |
484 context->set_http_transaction_factory(cache); | 487 context->set_http_transaction_factory(cache); |
485 | 488 |
486 // Use the same appcache service as the profile's main context. | 489 // Use the same appcache service as the profile's main context. |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 } | 1063 } |
1061 | 1064 |
1062 if (command_line.HasSwitch(switches::kProxyBypassList)) { | 1065 if (command_line.HasSwitch(switches::kProxyBypassList)) { |
1063 proxy_config->proxy_rules().bypass_rules.ParseFromString( | 1066 proxy_config->proxy_rules().bypass_rules.ParseFromString( |
1064 WideToASCII(command_line.GetSwitchValue( | 1067 WideToASCII(command_line.GetSwitchValue( |
1065 switches::kProxyBypassList))); | 1068 switches::kProxyBypassList))); |
1066 } | 1069 } |
1067 | 1070 |
1068 return proxy_config; | 1071 return proxy_config; |
1069 } | 1072 } |
OLD | NEW |