OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h" | 41 #include "chrome/browser/net/spdyproxy/http_auth_handler_spdyproxy.h" |
42 #include "chrome/common/chrome_content_client.h" | 42 #include "chrome/common/chrome_content_client.h" |
43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
44 #include "chrome/common/chrome_version_info.h" | 44 #include "chrome/common/chrome_version_info.h" |
45 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
46 #include "chrome/common/url_constants.h" | 46 #include "chrome/common/url_constants.h" |
47 #include "components/policy/core/common/policy_service.h" | 47 #include "components/policy/core/common/policy_service.h" |
48 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/cookie_store_factory.h" | 49 #include "content/public/browser/cookie_store_factory.h" |
50 #include "net/base/host_mapping_rules.h" | 50 #include "net/base/host_mapping_rules.h" |
51 #include "net/base/ip_mapping_rules.h" | |
52 #include "net/base/net_util.h" | 51 #include "net/base/net_util.h" |
53 #include "net/base/network_time_notifier.h" | 52 #include "net/base/network_time_notifier.h" |
54 #include "net/base/sdch_manager.h" | 53 #include "net/base/sdch_manager.h" |
55 #include "net/cert/cert_verifier.h" | 54 #include "net/cert/cert_verifier.h" |
56 #include "net/cert/cert_verify_proc.h" | 55 #include "net/cert/cert_verify_proc.h" |
57 #include "net/cert/ct_known_logs.h" | 56 #include "net/cert/ct_known_logs.h" |
58 #include "net/cert/ct_verifier.h" | 57 #include "net/cert/ct_verifier.h" |
59 #include "net/cert/multi_threaded_cert_verifier.h" | 58 #include "net/cert/multi_threaded_cert_verifier.h" |
60 #include "net/cookies/cookie_store.h" | 59 #include "net/cookies/cookie_store.h" |
61 #include "net/dns/host_cache.h" | 60 #include "net/dns/host_cache.h" |
62 #include "net/dns/host_resolver.h" | 61 #include "net/dns/host_resolver.h" |
63 #include "net/dns/mapped_host_resolver.h" | 62 #include "net/dns/mapped_host_resolver.h" |
64 #include "net/dns/mapped_ip_resolver.h" | |
65 #include "net/ftp/ftp_network_layer.h" | 63 #include "net/ftp/ftp_network_layer.h" |
66 #include "net/http/http_auth_filter.h" | 64 #include "net/http/http_auth_filter.h" |
67 #include "net/http/http_auth_handler_factory.h" | 65 #include "net/http/http_auth_handler_factory.h" |
68 #include "net/http/http_network_layer.h" | 66 #include "net/http/http_network_layer.h" |
69 #include "net/http/http_server_properties_impl.h" | 67 #include "net/http/http_server_properties_impl.h" |
70 #include "net/proxy/proxy_config_service.h" | 68 #include "net/proxy/proxy_config_service.h" |
71 #include "net/proxy/proxy_script_fetcher_impl.h" | 69 #include "net/proxy/proxy_script_fetcher_impl.h" |
72 #include "net/proxy/proxy_service.h" | 70 #include "net/proxy/proxy_service.h" |
73 #include "net/quic/quic_protocol.h" | 71 #include "net/quic/quic_protocol.h" |
74 #include "net/socket/tcp_client_socket.h" | 72 #include "net/socket/tcp_client_socket.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 | 192 |
195 // Determine if we should disable IPv6 support. | 193 // Determine if we should disable IPv6 support. |
196 if (command_line.HasSwitch(switches::kEnableIPv6)) { | 194 if (command_line.HasSwitch(switches::kEnableIPv6)) { |
197 // Disable IPv6 probing. | 195 // Disable IPv6 probing. |
198 global_host_resolver->SetDefaultAddressFamily( | 196 global_host_resolver->SetDefaultAddressFamily( |
199 net::ADDRESS_FAMILY_UNSPECIFIED); | 197 net::ADDRESS_FAMILY_UNSPECIFIED); |
200 } else if (command_line.HasSwitch(switches::kDisableIPv6)) { | 198 } else if (command_line.HasSwitch(switches::kDisableIPv6)) { |
201 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); | 199 global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4); |
202 } | 200 } |
203 | 201 |
204 // If hostname or IP remappings were specified on the command-line, layer | 202 // If hostname remappings were specified on the command-line, layer these |
205 // these rules on top of the real host resolver. Hostname remapping allows | 203 // rules on top of the real host resolver. This allows forwarding all requests |
206 // forwarding of all requests to hosts (matching a pattern) through a | 204 // through a designated test server. |
207 // designated test server. IP remapping allows for all IP resolutions that | 205 if (!command_line.HasSwitch(switches::kHostResolverRules)) |
208 // match a given pattern, such as those destined for a specific CDN, to be | 206 return global_host_resolver.PassAs<net::HostResolver>(); |
209 // instead directed to a specific/alternate IP address. | |
210 if (command_line.HasSwitch(switches::kHostResolverRules)) { | |
211 scoped_ptr<net::MappedHostResolver> remapped_resolver( | |
212 new net::MappedHostResolver(global_host_resolver.Pass())); | |
213 remapped_resolver->SetRulesFromString( | |
214 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); | |
215 global_host_resolver = remapped_resolver.Pass(); | |
216 } | |
217 | 207 |
218 if (command_line.HasSwitch(switches::kIpResolverRules)) { | 208 scoped_ptr<net::MappedHostResolver> remapped_resolver( |
219 scoped_ptr<net::MappedIPResolver> remapped_resolver( | 209 new net::MappedHostResolver(global_host_resolver.Pass())); |
220 new net::MappedIPResolver(global_host_resolver.Pass())); | 210 remapped_resolver->SetRulesFromString( |
221 remapped_resolver->SetRulesFromString( | 211 command_line.GetSwitchValueASCII(switches::kHostResolverRules)); |
222 command_line.GetSwitchValueASCII(switches::kIpResolverRules)); | 212 return remapped_resolver.PassAs<net::HostResolver>(); |
223 global_host_resolver = remapped_resolver.Pass(); | |
224 } | |
225 return global_host_resolver.Pass(); | |
226 } | 213 } |
227 | 214 |
228 // TODO(willchan): Remove proxy script fetcher context since it's not necessary | 215 // TODO(willchan): Remove proxy script fetcher context since it's not necessary |
229 // now that I got rid of refcounting URLRequestContexts. | 216 // now that I got rid of refcounting URLRequestContexts. |
230 // See IOThread::Globals for details. | 217 // See IOThread::Globals for details. |
231 net::URLRequestContext* | 218 net::URLRequestContext* |
232 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, | 219 ConstructProxyScriptFetcherContext(IOThread::Globals* globals, |
233 net::NetLog* net_log) { | 220 net::NetLog* net_log) { |
234 net::URLRequestContext* context = new net::URLRequestContext; | 221 net::URLRequestContext* context = new net::URLRequestContext; |
235 context->set_net_log(net_log); | 222 context->set_net_log(net_log); |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 std::string version_flag = | 1225 std::string version_flag = |
1239 command_line.GetSwitchValueASCII(switches::kQuicVersion); | 1226 command_line.GetSwitchValueASCII(switches::kQuicVersion); |
1240 for (size_t i = 0; i < supported_versions.size(); ++i) { | 1227 for (size_t i = 0; i < supported_versions.size(); ++i) { |
1241 net::QuicVersion version = supported_versions[i]; | 1228 net::QuicVersion version = supported_versions[i]; |
1242 if (net::QuicVersionToString(version) == version_flag) { | 1229 if (net::QuicVersionToString(version) == version_flag) { |
1243 return version; | 1230 return version; |
1244 } | 1231 } |
1245 } | 1232 } |
1246 return net::QUIC_VERSION_UNSUPPORTED; | 1233 return net::QUIC_VERSION_UNSUPPORTED; |
1247 } | 1234 } |
OLD | NEW |