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/net/connection_tester.h" | 5 #include "chrome/browser/net/connection_tester.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/threading/thread_restrictions.h" | 13 #include "base/threading/thread_restrictions.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #if !defined(OS_ANDROID) | |
Yaron
2012/03/01 17:38:43
NIT: platform-specific includes are supposed to co
| |
15 #include "chrome/browser/importer/firefox_proxy_settings.h" | 16 #include "chrome/browser/importer/firefox_proxy_settings.h" |
17 #endif | |
16 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
17 #include "net/base/cert_verifier.h" | 19 #include "net/base/cert_verifier.h" |
18 #include "net/base/cookie_monster.h" | 20 #include "net/base/cookie_monster.h" |
19 #include "net/base/host_resolver.h" | 21 #include "net/base/host_resolver.h" |
20 #include "net/base/io_buffer.h" | 22 #include "net/base/io_buffer.h" |
21 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
22 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
23 #include "net/base/ssl_config_service_defaults.h" | 25 #include "net/base/ssl_config_service_defaults.h" |
24 #include "net/ftp/ftp_network_layer.h" | 26 #include "net/ftp/ftp_network_layer.h" |
25 #include "net/http/http_auth_handler_factory.h" | 27 #include "net/http/http_auth_handler_factory.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 return net::OK; | 222 return net::OK; |
221 #endif | 223 #endif |
222 } | 224 } |
223 | 225 |
224 // Creates a fixed proxy config service that is initialized using Firefox's | 226 // Creates a fixed proxy config service that is initialized using Firefox's |
225 // current proxy settings. On success returns net::OK and fills | 227 // current proxy settings. On success returns net::OK and fills |
226 // |config_service| with a new pointer. Otherwise returns a network error | 228 // |config_service| with a new pointer. Otherwise returns a network error |
227 // code. | 229 // code. |
228 int CreateFirefoxProxyConfigService( | 230 int CreateFirefoxProxyConfigService( |
229 scoped_ptr<net::ProxyConfigService>* config_service) { | 231 scoped_ptr<net::ProxyConfigService>* config_service) { |
232 #if defined(OS_ANDROID) | |
233 // Chrome on Android does not support Firefox settings. | |
234 return net::ERR_NOT_IMPLEMENTED; | |
235 #else | |
230 // Fetch Firefox's proxy settings (can fail if Firefox is not installed). | 236 // Fetch Firefox's proxy settings (can fail if Firefox is not installed). |
231 FirefoxProxySettings firefox_settings; | 237 FirefoxProxySettings firefox_settings; |
232 if (!FirefoxProxySettings::GetSettings(&firefox_settings)) | 238 if (!FirefoxProxySettings::GetSettings(&firefox_settings)) |
233 return net::ERR_FILE_NOT_FOUND; | 239 return net::ERR_FILE_NOT_FOUND; |
234 | 240 |
235 if (FirefoxProxySettings::SYSTEM == firefox_settings.config_type()) | 241 if (FirefoxProxySettings::SYSTEM == firefox_settings.config_type()) |
236 return CreateSystemProxyConfigService(config_service); | 242 return CreateSystemProxyConfigService(config_service); |
237 | 243 |
238 net::ProxyConfig config; | 244 net::ProxyConfig config; |
239 if (firefox_settings.ToProxyConfig(&config)) { | 245 if (firefox_settings.ToProxyConfig(&config)) { |
240 config_service->reset(new net::ProxyConfigServiceFixed(config)); | 246 config_service->reset(new net::ProxyConfigServiceFixed(config)); |
241 return net::OK; | 247 return net::OK; |
242 } | 248 } |
243 | 249 |
244 return net::ERR_FAILED; | 250 return net::ERR_FAILED; |
251 #endif | |
245 } | 252 } |
246 | 253 |
247 const scoped_refptr<net::URLRequestContext> proxy_request_context_; | 254 const scoped_refptr<net::URLRequestContext> proxy_request_context_; |
248 net::URLRequestContextStorage storage_; | 255 net::URLRequestContextStorage storage_; |
249 }; | 256 }; |
250 | 257 |
251 } // namespace | 258 } // namespace |
252 | 259 |
253 // ConnectionTester::TestRunner ---------------------------------------------- | 260 // ConnectionTester::TestRunner ---------------------------------------------- |
254 | 261 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
461 | 468 |
462 // Notify the delegate of completion. | 469 // Notify the delegate of completion. |
463 delegate_->OnCompletedConnectionTestExperiment(current, result); | 470 delegate_->OnCompletedConnectionTestExperiment(current, result); |
464 | 471 |
465 if (remaining_experiments_.empty()) { | 472 if (remaining_experiments_.empty()) { |
466 delegate_->OnCompletedConnectionTestSuite(); | 473 delegate_->OnCompletedConnectionTestSuite(); |
467 } else { | 474 } else { |
468 StartNextExperiment(); | 475 StartNextExperiment(); |
469 } | 476 } |
470 } | 477 } |
OLD | NEW |