| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/ios_chrome_io_thread.h" | 5 #include "ios/chrome/browser/ios_chrome_io_thread.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // If hostname remappings were specified on the command-line, layer these | 119 // If hostname remappings were specified on the command-line, layer these |
| 120 // rules on top of the real host resolver. This allows forwarding all requests | 120 // rules on top of the real host resolver. This allows forwarding all requests |
| 121 // through a designated test server. | 121 // through a designated test server. |
| 122 if (!command_line.HasSwitch(switches::kIOSHostResolverRules)) | 122 if (!command_line.HasSwitch(switches::kIOSHostResolverRules)) |
| 123 return global_host_resolver; | 123 return global_host_resolver; |
| 124 | 124 |
| 125 std::unique_ptr<net::MappedHostResolver> remapped_resolver( | 125 std::unique_ptr<net::MappedHostResolver> remapped_resolver( |
| 126 new net::MappedHostResolver(std::move(global_host_resolver))); | 126 new net::MappedHostResolver(std::move(global_host_resolver))); |
| 127 remapped_resolver->SetRulesFromString( | 127 remapped_resolver->SetRulesFromString( |
| 128 command_line.GetSwitchValueASCII(switches::kIOSHostResolverRules)); | 128 command_line.GetSwitchValueASCII(switches::kIOSHostResolverRules)); |
| 129 // TODO(crbug.com/703565): remove std::move() once Xcode 9.0+ is required. |
| 129 return std::move(remapped_resolver); | 130 return std::move(remapped_resolver); |
| 130 } | 131 } |
| 131 | 132 |
| 132 int GetSwitchValueAsInt(const base::CommandLine& command_line, | 133 int GetSwitchValueAsInt(const base::CommandLine& command_line, |
| 133 const std::string& switch_name) { | 134 const std::string& switch_name) { |
| 134 int value; | 135 int value; |
| 135 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), | 136 if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), |
| 136 &value)) { | 137 &value)) { |
| 137 return 0; | 138 return 0; |
| 138 } | 139 } |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 | 568 |
| 568 globals->system_http_network_session.reset( | 569 globals->system_http_network_session.reset( |
| 569 new net::HttpNetworkSession(system_params)); | 570 new net::HttpNetworkSession(system_params)); |
| 570 globals->system_http_transaction_factory.reset( | 571 globals->system_http_transaction_factory.reset( |
| 571 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 572 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
| 572 context->set_http_transaction_factory( | 573 context->set_http_transaction_factory( |
| 573 globals->system_http_transaction_factory.get()); | 574 globals->system_http_transaction_factory.get()); |
| 574 | 575 |
| 575 return context; | 576 return context; |
| 576 } | 577 } |
| OLD | NEW |