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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/feature_list.h" |
12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
14 #include "base/files/scoped_file.h" | 15 #include "base/files/scoped_file.h" |
15 #include "base/json/json_writer.h" | 16 #include "base/json/json_writer.h" |
16 #include "base/mac/bind_objc_block.h" | 17 #include "base/mac/bind_objc_block.h" |
17 #include "base/mac/foundation_util.h" | 18 #include "base/mac/foundation_util.h" |
18 #include "base/macros.h" | 19 #include "base/macros.h" |
19 #include "base/metrics/statistics_recorder.h" | 20 #include "base/metrics/statistics_recorder.h" |
20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
21 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 228 |
228 CronetEnvironment::~CronetEnvironment() { | 229 CronetEnvironment::~CronetEnvironment() { |
229 // net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); | 230 // net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); |
230 #if defined(USE_NSS_CERTS) | 231 #if defined(USE_NSS_CERTS) |
231 net::SetURLRequestContextForNSSHttpIO(nullptr); | 232 net::SetURLRequestContextForNSSHttpIO(nullptr); |
232 #endif | 233 #endif |
233 } | 234 } |
234 | 235 |
235 void CronetEnvironment::InitializeOnNetworkThread() { | 236 void CronetEnvironment::InitializeOnNetworkThread() { |
236 DCHECK(network_io_thread_->task_runner()->BelongsToCurrentThread()); | 237 DCHECK(network_io_thread_->task_runner()->BelongsToCurrentThread()); |
| 238 base::FeatureList::InitializeInstance(std::string(), std::string()); |
237 // TODO(mef): Use net:UrlRequestContextBuilder instead of manual build. | 239 // TODO(mef): Use net:UrlRequestContextBuilder instead of manual build. |
238 main_context_.reset(new net::URLRequestContext); | 240 main_context_.reset(new net::URLRequestContext); |
239 main_context_->set_net_log(net_log_.get()); | 241 main_context_->set_net_log(net_log_.get()); |
240 std::string user_agent(user_agent_product_name_ + | 242 std::string user_agent(user_agent_product_name_ + |
241 " (iOS); Cronet/" CRONET_VERSION); | 243 " (iOS); Cronet/" CRONET_VERSION); |
242 main_context_->set_http_user_agent_settings( | 244 main_context_->set_http_user_agent_settings( |
243 new net::StaticHttpUserAgentSettings("en", user_agent)); | 245 new net::StaticHttpUserAgentSettings("en", user_agent)); |
244 | 246 |
245 main_context_->set_ssl_config_service(new net::SSLConfigServiceDefaults); | 247 main_context_->set_ssl_config_service(new net::SSLConfigServiceDefaults); |
246 main_context_->set_transport_security_state( | 248 main_context_->set_transport_security_state( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 const net::HttpUserAgentSettings* user_agent_settings = | 344 const net::HttpUserAgentSettings* user_agent_settings = |
343 main_context_->http_user_agent_settings(); | 345 main_context_->http_user_agent_settings(); |
344 if (!user_agent_settings) { | 346 if (!user_agent_settings) { |
345 return nullptr; | 347 return nullptr; |
346 } | 348 } |
347 | 349 |
348 return user_agent_settings->GetUserAgent(); | 350 return user_agent_settings->GetUserAgent(); |
349 } | 351 } |
350 | 352 |
351 } // namespace cronet | 353 } // namespace cronet |
OLD | NEW |