Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ios/cronet_environment.h" | 5 #include "components/cronet/ios/cronet_environment.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 | 263 |
| 264 if (user_agent_partial_) | 264 if (user_agent_partial_) |
| 265 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); | 265 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); |
| 266 | 266 |
| 267 // Cache | 267 // Cache |
| 268 base::FilePath cache_path; | 268 base::FilePath cache_path; |
| 269 if (!PathService::Get(base::DIR_CACHE, &cache_path)) | 269 if (!PathService::Get(base::DIR_CACHE, &cache_path)) |
| 270 return; | 270 return; |
| 271 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); | 271 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); |
| 272 | 272 |
| 273 std::unique_ptr<URLRequestContextConfig> config(new URLRequestContextConfig( | 273 URLRequestContextConfigBuilder context_config_builder; |
| 274 quic_enabled_, // Enable QUIC. | 274 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC. |
| 275 quic_enabled_ && quic_user_agent_id_.empty() | 275 context_config_builder.enable_spdy = http2_enabled_; // Enable SPDY |
|
mef
2017/01/10 17:36:18
nit: Enable HTTP/2. (including period).
lilyhoughton
2017/01/10 18:25:36
Done. Should the member itself be changed as well
mef
2017/01/10 18:36:13
If anything we should rename it as spdy is depreca
| |
| 276 ? getDefaultQuicUserAgentId() | 276 context_config_builder.storage_path = |
| 277 : quic_user_agent_id_, // QUIC User Agent ID. | 277 cache_path.value(); // Storage path for http cache and cookie storage. |
|
mef
2017/01/10 17:36:18
I'd set http_cache = URLRequestContextConfig::DISK
lilyhoughton
2017/01/10 18:25:36
Done.
| |
| 278 http2_enabled_, // Enable SPDY. | 278 context_config_builder.user_agent = |
| 279 false, // Enable SDCH | 279 user_agent_; // User-Agent request header field. |
| 280 URLRequestContextConfig::DISK, // Type of http cache. | 280 context_config_builder.mock_cert_verifier = std::move( |
| 281 0, // Max size of http cache in bytes. | 281 mock_cert_verifier_); // MockCertVerifier to use for testing purposes. |
| 282 false, // Disable caching for HTTP responses. | 282 std::unique_ptr<URLRequestContextConfig> config = |
| 283 cache_path.value(), // Storage path for http cache and cookie storage. | 283 context_config_builder.Build(); |
| 284 user_agent_, // User-Agent request header field. | |
| 285 "{}", // JSON encoded experimental options. | |
| 286 "", // Data reduction proxy key. | |
| 287 "", // Data reduction proxy. | |
| 288 "", // Fallback data reduction proxy. | |
| 289 "", // Data reduction proxy secure proxy check URL. | |
| 290 std::move(mock_cert_verifier_), // MockCertVerifier to use for testing | |
| 291 // purposes. | |
| 292 false, // Enable network quality estimator. | |
| 293 true, // Enable bypassing of public key pinning for local trust anchors | |
| 294 "")); // Certificate verifier cache data. | |
| 295 | 284 |
| 296 net::URLRequestContextBuilder context_builder; | 285 net::URLRequestContextBuilder context_builder; |
| 297 | 286 |
| 298 context_builder.set_accept_language(accept_language_); | 287 context_builder.set_accept_language(accept_language_); |
| 299 | 288 |
| 300 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), | 289 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), |
| 301 file_thread_.get()->task_runner()); | 290 file_thread_.get()->task_runner()); |
| 302 | 291 |
| 303 std::unique_ptr<net::MappedHostResolver> mapped_host_resolver( | 292 std::unique_ptr<net::MappedHostResolver> mapped_host_resolver( |
| 304 new net::MappedHostResolver( | 293 new net::MappedHostResolver( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 event->Signal(); | 355 event->Signal(); |
| 367 } | 356 } |
| 368 | 357 |
| 369 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { | 358 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { |
| 370 return base::SysNSStringToUTF8([[NSBundle mainBundle] | 359 return base::SysNSStringToUTF8([[NSBundle mainBundle] |
| 371 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | 360 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + |
| 372 " Cronet/" + CRONET_VERSION; | 361 " Cronet/" + CRONET_VERSION; |
| 373 } | 362 } |
| 374 | 363 |
| 375 } // namespace cronet | 364 } // namespace cronet |
| OLD | NEW |