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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 if (user_agent_partial_) | 266 if (user_agent_partial_) |
267 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); | 267 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); |
268 | 268 |
269 // Cache | 269 // Cache |
270 base::FilePath cache_path; | 270 base::FilePath cache_path; |
271 if (!PathService::Get(base::DIR_CACHE, &cache_path)) | 271 if (!PathService::Get(base::DIR_CACHE, &cache_path)) |
272 return; | 272 return; |
273 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); | 273 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); |
274 | 274 |
275 std::unique_ptr<URLRequestContextConfig> config(new URLRequestContextConfig( | 275 URLRequestContextConfigBuilder context_config_builder; |
276 quic_enabled_, // Enable QUIC. | 276 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC. |
277 quic_enabled_ && quic_user_agent_id_.empty() | 277 context_config_builder.enable_spdy = http2_enabled_; // Enable HTTP/2. |
278 ? getDefaultQuicUserAgentId() | 278 context_config_builder.http_cache = URLRequestContextConfig::DISK; |
279 : quic_user_agent_id_, // QUIC User Agent ID. | 279 context_config_builder.storage_path = |
280 http2_enabled_, // Enable SPDY. | 280 cache_path.value(); // Storage path for http cache and cookie storage. |
281 false, // Enable SDCH | 281 context_config_builder.user_agent = |
282 URLRequestContextConfig::DISK, // Type of http cache. | 282 user_agent_; // User-Agent request header field. |
283 0, // Max size of http cache in bytes. | 283 context_config_builder.mock_cert_verifier = std::move( |
284 false, // Disable caching for HTTP responses. | 284 mock_cert_verifier_); // MockCertVerifier to use for testing purposes. |
285 cache_path.value(), // Storage path for http cache and cookie storage. | 285 std::unique_ptr<URLRequestContextConfig> config = |
286 user_agent_, // User-Agent request header field. | 286 context_config_builder.Build(); |
287 "{}", // JSON encoded experimental options. | |
288 "", // Data reduction proxy key. | |
289 "", // Data reduction proxy. | |
290 "", // Fallback data reduction proxy. | |
291 "", // Data reduction proxy secure proxy check URL. | |
292 std::move(mock_cert_verifier_), // MockCertVerifier to use for testing | |
293 // purposes. | |
294 false, // Enable network quality estimator. | |
295 true, // Enable bypassing of public key pinning for local trust anchors | |
296 "")); // Certificate verifier cache data. | |
297 | 287 |
298 net::URLRequestContextBuilder context_builder; | 288 net::URLRequestContextBuilder context_builder; |
299 | 289 |
300 context_builder.set_accept_language(accept_language_); | 290 context_builder.set_accept_language(accept_language_); |
301 | 291 |
302 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), | 292 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), |
303 file_thread_.get()->task_runner()); | 293 file_thread_.get()->task_runner()); |
304 | 294 |
305 std::unique_ptr<net::MappedHostResolver> mapped_host_resolver( | 295 std::unique_ptr<net::MappedHostResolver> mapped_host_resolver( |
306 new net::MappedHostResolver( | 296 new net::MappedHostResolver( |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 event->Signal(); | 358 event->Signal(); |
369 } | 359 } |
370 | 360 |
371 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { | 361 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { |
372 return base::SysNSStringToUTF8([[NSBundle mainBundle] | 362 return base::SysNSStringToUTF8([[NSBundle mainBundle] |
373 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | 363 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + |
374 " Cronet/" + CRONET_VERSION; | 364 " Cronet/" + CRONET_VERSION; |
375 } | 365 } |
376 | 366 |
377 } // namespace cronet | 367 } // namespace cronet |
OLD | NEW |