OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/net/connection_tester.h" | 5 #include "chrome/browser/net/connection_tester.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/task.h" | 11 #include "base/task.h" |
12 #include "base/threading/thread_restrictions.h" | 12 #include "base/threading/thread_restrictions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/browser/importer/firefox_proxy_settings.h" | 14 #include "chrome/browser/importer/firefox_proxy_settings.h" |
15 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
16 #include "net/base/cert_verifier.h" | 16 #include "net/base/cert_verifier.h" |
17 #include "net/base/cookie_monster.h" | 17 #include "net/base/cookie_monster.h" |
18 #include "net/base/dnsrr_resolver.h" | 18 #include "net/base/dnsrr_resolver.h" |
19 #include "net/base/host_resolver.h" | 19 #include "net/base/host_resolver.h" |
20 #include "net/base/host_resolver_impl.h" | 20 #include "net/base/host_resolver_impl.h" |
21 #include "net/base/io_buffer.h" | 21 #include "net/base/io_buffer.h" |
22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
23 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
24 #include "net/base/ssl_config_service_defaults.h" | 24 #include "net/base/ssl_config_service_defaults.h" |
25 #include "net/ftp/ftp_network_layer.h" | 25 #include "net/ftp/ftp_network_layer.h" |
26 #include "net/http/http_auth_handler_factory.h" | 26 #include "net/http/http_auth_handler_factory.h" |
27 #include "net/http/http_cache.h" | 27 #include "net/http/http_cache.h" |
28 #include "net/http/http_network_session.h" | 28 #include "net/http/http_network_session.h" |
| 29 #include "net/proxy/dhcp_proxy_script_fetcher_factory.h" |
29 #include "net/proxy/proxy_config_service_fixed.h" | 30 #include "net/proxy/proxy_config_service_fixed.h" |
30 #include "net/proxy/proxy_script_fetcher_impl.h" | 31 #include "net/proxy/proxy_script_fetcher_impl.h" |
31 #include "net/proxy/proxy_service.h" | 32 #include "net/proxy/proxy_service.h" |
32 #include "net/url_request/url_request.h" | 33 #include "net/url_request/url_request.h" |
33 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
34 #include "net/url_request/url_request_context_storage.h" | 35 #include "net/url_request/url_request_context_storage.h" |
35 | 36 |
36 namespace { | 37 namespace { |
37 | 38 |
38 // ExperimentURLRequestContext ------------------------------------------------ | 39 // ExperimentURLRequestContext ------------------------------------------------ |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 if (rv != net::OK) | 176 if (rv != net::OK) |
176 return rv; // Failure. | 177 return rv; // Failure. |
177 | 178 |
178 if (CommandLine::ForCurrentProcess()->HasSwitch( | 179 if (CommandLine::ForCurrentProcess()->HasSwitch( |
179 switches::kSingleProcess)) { | 180 switches::kSingleProcess)) { |
180 // We can't create a standard proxy resolver in single-process mode. | 181 // We can't create a standard proxy resolver in single-process mode. |
181 // Rather than falling-back to some other implementation, fail. | 182 // Rather than falling-back to some other implementation, fail. |
182 return net::ERR_NOT_IMPLEMENTED; | 183 return net::ERR_NOT_IMPLEMENTED; |
183 } | 184 } |
184 | 185 |
| 186 net::DhcpProxyScriptFetcherFactory dhcp_factory; |
| 187 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 188 switches::kEnableDhcpWpad)) { |
| 189 dhcp_factory.set_enabled(true); |
| 190 } |
| 191 |
185 proxy_service->reset(net::ProxyService::CreateUsingV8ProxyResolver( | 192 proxy_service->reset(net::ProxyService::CreateUsingV8ProxyResolver( |
186 config_service.release(), | 193 config_service.release(), |
187 0u, | 194 0u, |
188 new net::ProxyScriptFetcherImpl(proxy_request_context_), | 195 new net::ProxyScriptFetcherImpl(proxy_request_context_), |
| 196 dhcp_factory.Create(proxy_request_context_), |
189 host_resolver(), | 197 host_resolver(), |
190 NULL, | 198 NULL, |
191 NULL)); | 199 NULL)); |
192 | 200 |
193 return net::OK; | 201 return net::OK; |
194 } | 202 } |
195 | 203 |
196 // Creates a proxy config service that pulls from the system proxy settings. | 204 // Creates a proxy config service that pulls from the system proxy settings. |
197 // On success returns net::OK and fills |config_service| with a new pointer. | 205 // On success returns net::OK and fills |config_service| with a new pointer. |
198 // Otherwise returns a network error code. | 206 // Otherwise returns a network error code. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 | 458 |
451 // Notify the delegate of completion. | 459 // Notify the delegate of completion. |
452 delegate_->OnCompletedConnectionTestExperiment(current, result); | 460 delegate_->OnCompletedConnectionTestExperiment(current, result); |
453 | 461 |
454 if (remaining_experiments_.empty()) { | 462 if (remaining_experiments_.empty()) { |
455 delegate_->OnCompletedConnectionTestSuite(); | 463 delegate_->OnCompletedConnectionTestSuite(); |
456 } else { | 464 } else { |
457 StartNextExperiment(); | 465 StartNextExperiment(); |
458 } | 466 } |
459 } | 467 } |
OLD | NEW |