| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cronet/url_request_context_config.h" | 5 #include "components/cronet/url_request_context_config.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 void URLRequestContextConfig::ConfigureURLRequestContextBuilder( | 270 void URLRequestContextConfig::ConfigureURLRequestContextBuilder( |
| 271 net::URLRequestContextBuilder* context_builder, | 271 net::URLRequestContextBuilder* context_builder, |
| 272 net::NetLog* net_log, | 272 net::NetLog* net_log, |
| 273 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) { | 273 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner) { |
| 274 std::string config_cache; | 274 std::string config_cache; |
| 275 if (http_cache != DISABLED) { | 275 if (http_cache != DISABLED) { |
| 276 net::URLRequestContextBuilder::HttpCacheParams cache_params; | 276 net::URLRequestContextBuilder::HttpCacheParams cache_params; |
| 277 if (http_cache == DISK && !storage_path.empty()) { | 277 if (http_cache == DISK && !storage_path.empty()) { |
| 278 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK; | 278 cache_params.type = net::URLRequestContextBuilder::HttpCacheParams::DISK; |
| 279 cache_params.path = base::FilePath(storage_path); | 279 cache_params.path = |
| 280 base::FilePath(storage_path).Append(FILE_PATH_LITERAL("disk_cache")); |
| 280 } else { | 281 } else { |
| 281 cache_params.type = | 282 cache_params.type = |
| 282 net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY; | 283 net::URLRequestContextBuilder::HttpCacheParams::IN_MEMORY; |
| 283 } | 284 } |
| 284 cache_params.max_size = http_cache_max_size; | 285 cache_params.max_size = http_cache_max_size; |
| 285 context_builder->EnableHttpCache(cache_params); | 286 context_builder->EnableHttpCache(cache_params); |
| 286 } else { | 287 } else { |
| 287 context_builder->DisableHttpCache(); | 288 context_builder->DisableHttpCache(); |
| 288 } | 289 } |
| 289 context_builder->set_user_agent(user_agent); | 290 context_builder->set_user_agent(user_agent); |
| 290 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); | 291 context_builder->SetSpdyAndQuicEnabled(enable_spdy, enable_quic); |
| 291 context_builder->set_sdch_enabled(enable_sdch); | 292 context_builder->set_sdch_enabled(enable_sdch); |
| 292 if (enable_quic) | 293 if (enable_quic) |
| 293 context_builder->set_quic_user_agent_id(quic_user_agent_id); | 294 context_builder->set_quic_user_agent_id(quic_user_agent_id); |
| 294 | 295 |
| 295 ParseAndSetExperimentalOptions(experimental_options, context_builder, net_log, | 296 ParseAndSetExperimentalOptions(experimental_options, context_builder, net_log, |
| 296 file_task_runner); | 297 file_task_runner); |
| 297 | 298 |
| 298 if (mock_cert_verifier) | 299 if (mock_cert_verifier) |
| 299 context_builder->SetCertVerifier(std::move(mock_cert_verifier)); | 300 context_builder->SetCertVerifier(std::move(mock_cert_verifier)); |
| 300 // TODO(mef): Use |config| to set cookies. | 301 // TODO(mef): Use |config| to set cookies. |
| 301 } | 302 } |
| 302 | 303 |
| 303 } // namespace cronet | 304 } // namespace cronet |
| OLD | NEW |