OLD | NEW |
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 "net/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 network_session_params.enable_quic = http_network_session_params_.enable_quic; | 391 network_session_params.enable_quic = http_network_session_params_.enable_quic; |
392 network_session_params.quic_connection_options = | 392 network_session_params.quic_connection_options = |
393 http_network_session_params_.quic_connection_options; | 393 http_network_session_params_.quic_connection_options; |
394 | 394 |
395 storage->set_http_network_session( | 395 storage->set_http_network_session( |
396 make_scoped_ptr(new HttpNetworkSession(network_session_params))); | 396 make_scoped_ptr(new HttpNetworkSession(network_session_params))); |
397 | 397 |
398 scoped_ptr<HttpTransactionFactory> http_transaction_factory; | 398 scoped_ptr<HttpTransactionFactory> http_transaction_factory; |
399 if (http_cache_enabled_) { | 399 if (http_cache_enabled_) { |
400 scoped_ptr<HttpCache::BackendFactory> http_cache_backend; | 400 scoped_ptr<HttpCache::BackendFactory> http_cache_backend; |
401 if (http_cache_params_.type == HttpCacheParams::DISK) { | 401 if (http_cache_params_.type != HttpCacheParams::IN_MEMORY) { |
| 402 BackendType backend_type = |
| 403 http_cache_params_.type == HttpCacheParams::DISK |
| 404 ? CACHE_BACKEND_DEFAULT |
| 405 : CACHE_BACKEND_SIMPLE; |
402 http_cache_backend.reset(new HttpCache::DefaultBackend( | 406 http_cache_backend.reset(new HttpCache::DefaultBackend( |
403 DISK_CACHE, CACHE_BACKEND_DEFAULT, http_cache_params_.path, | 407 DISK_CACHE, backend_type, http_cache_params_.path, |
404 http_cache_params_.max_size, context->GetFileTaskRunner())); | 408 http_cache_params_.max_size, context->GetFileTaskRunner())); |
405 } else { | 409 } else { |
406 http_cache_backend = | 410 http_cache_backend = |
407 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); | 411 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); |
408 } | 412 } |
409 | 413 |
410 http_transaction_factory.reset(new HttpCache( | 414 http_transaction_factory.reset(new HttpCache( |
411 storage->http_network_session(), http_cache_backend.Pass(), true)); | 415 storage->http_network_session(), http_cache_backend.Pass(), true)); |
412 } else { | 416 } else { |
413 http_transaction_factory.reset( | 417 http_transaction_factory.reset( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 } | 454 } |
451 url_request_interceptors_.weak_clear(); | 455 url_request_interceptors_.weak_clear(); |
452 } | 456 } |
453 storage->set_job_factory(top_job_factory.Pass()); | 457 storage->set_job_factory(top_job_factory.Pass()); |
454 // TODO(willchan): Support sdch. | 458 // TODO(willchan): Support sdch. |
455 | 459 |
456 return context.Pass(); | 460 return context.Pass(); |
457 } | 461 } |
458 | 462 |
459 } // namespace net | 463 } // namespace net |
OLD | NEW |