| 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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 ts->Shutdown(); | 259 ts->Shutdown(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 void CronetEnvironment::InitializeOnNetworkThread() { | 262 void CronetEnvironment::InitializeOnNetworkThread() { |
| 263 DCHECK(network_io_thread_->task_runner()->BelongsToCurrentThread()); | 263 DCHECK(network_io_thread_->task_runner()->BelongsToCurrentThread()); |
| 264 base::FeatureList::InitializeInstance(std::string(), std::string()); | 264 base::FeatureList::InitializeInstance(std::string(), std::string()); |
| 265 | 265 |
| 266 static bool ssl_key_log_file_set = false; | 266 static bool ssl_key_log_file_set = false; |
| 267 if (!ssl_key_log_file_set && !ssl_key_log_file_name_.empty()) { | 267 if (!ssl_key_log_file_set && !ssl_key_log_file_name_.empty()) { |
| 268 ssl_key_log_file_set = true; | 268 ssl_key_log_file_set = true; |
| 269 base::FilePath ssl_key_log_file; | 269 base::FilePath ssl_key_log_file(ssl_key_log_file_name_); |
| 270 if (!PathService::Get(base::DIR_HOME, &ssl_key_log_file)) | 270 net::SSLClientSocket::SetSSLKeyLogFile(ssl_key_log_file, |
| 271 return; | 271 file_thread_->task_runner()); |
| 272 net::SSLClientSocket::SetSSLKeyLogFile( | |
| 273 ssl_key_log_file.Append(ssl_key_log_file_name_), | |
| 274 file_thread_->task_runner()); | |
| 275 } | 272 } |
| 276 | 273 |
| 277 if (user_agent_partial_) | 274 if (user_agent_partial_) |
| 278 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); | 275 user_agent_ = web::BuildUserAgentFromProduct(user_agent_); |
| 279 | 276 |
| 280 // Cache | 277 // Cache |
| 281 base::FilePath cache_path; | 278 base::FilePath cache_path; |
| 282 if (!PathService::Get(base::DIR_CACHE, &cache_path)) | 279 if (!PathService::Get(base::DIR_CACHE, &cache_path)) |
| 283 return; | 280 return; |
| 284 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); | 281 cache_path = cache_path.Append(FILE_PATH_LITERAL("cronet")); |
| 285 | 282 |
| 286 URLRequestContextConfigBuilder context_config_builder; | 283 URLRequestContextConfigBuilder context_config_builder; |
| 287 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC. | 284 context_config_builder.enable_quic = quic_enabled_; // Enable QUIC. |
| 288 context_config_builder.enable_spdy = http2_enabled_; // Enable HTTP/2. | 285 context_config_builder.enable_spdy = http2_enabled_; // Enable HTTP/2. |
| 289 context_config_builder.http_cache = http_cache_; // Set HTTP cache | 286 context_config_builder.http_cache = http_cache_; // Set HTTP cache |
| 290 context_config_builder.storage_path = | 287 context_config_builder.storage_path = |
| 291 cache_path.value(); // Storage path for http cache and cookie storage. | 288 cache_path.value(); // Storage path for http cache and cookie storage. |
| 292 context_config_builder.user_agent = | 289 context_config_builder.user_agent = |
| 293 user_agent_; // User-Agent request header field. | 290 user_agent_; // User-Agent request header field. |
| 291 context_config_builder.experimental_options = |
| 292 experimental_options_; // Set experimental Cronet options. |
| 294 context_config_builder.mock_cert_verifier = std::move( | 293 context_config_builder.mock_cert_verifier = std::move( |
| 295 mock_cert_verifier_); // MockCertVerifier to use for testing purposes. | 294 mock_cert_verifier_); // MockCertVerifier to use for testing purposes. |
| 296 std::unique_ptr<URLRequestContextConfig> config = | 295 std::unique_ptr<URLRequestContextConfig> config = |
| 297 context_config_builder.Build(); | 296 context_config_builder.Build(); |
| 298 | 297 |
| 299 net::URLRequestContextBuilder context_builder; | 298 net::URLRequestContextBuilder context_builder; |
| 300 | 299 |
| 301 context_builder.set_accept_language(accept_language_); | 300 context_builder.set_accept_language(accept_language_); |
| 302 | 301 |
| 303 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), | 302 config->ConfigureURLRequestContextBuilder(&context_builder, net_log_.get(), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 event->Signal(); | 373 event->Signal(); |
| 375 } | 374 } |
| 376 | 375 |
| 377 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { | 376 std::string CronetEnvironment::getDefaultQuicUserAgentId() const { |
| 378 return base::SysNSStringToUTF8([[NSBundle mainBundle] | 377 return base::SysNSStringToUTF8([[NSBundle mainBundle] |
| 379 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + | 378 objectForInfoDictionaryKey:@"CFBundleDisplayName"]) + |
| 380 " Cronet/" + CRONET_VERSION; | 379 " Cronet/" + CRONET_VERSION; |
| 381 } | 380 } |
| 382 | 381 |
| 383 } // namespace cronet | 382 } // namespace cronet |
| OLD | NEW |