Chromium Code Reviews| 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 #include "chrome/browser/importer/firefox_proxy_settings.h" | 15 #include "chrome/browser/importer/firefox_proxy_settings.h" |
|
eroman
2012/03/01 02:21:12
You should probably if-def this out too
| |
| 16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 17 #include "net/base/cert_verifier.h" | 17 #include "net/base/cert_verifier.h" |
| 18 #include "net/base/cookie_monster.h" | 18 #include "net/base/cookie_monster.h" |
| 19 #include "net/base/host_resolver.h" | 19 #include "net/base/host_resolver.h" |
| 20 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
| 21 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 22 #include "net/base/net_util.h" | 22 #include "net/base/net_util.h" |
| 23 #include "net/base/ssl_config_service_defaults.h" | 23 #include "net/base/ssl_config_service_defaults.h" |
| 24 #include "net/ftp/ftp_network_layer.h" | 24 #include "net/ftp/ftp_network_layer.h" |
| 25 #include "net/http/http_auth_handler_factory.h" | 25 #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; | 220 return net::OK; |
| 221 #endif | 221 #endif |
| 222 } | 222 } |
| 223 | 223 |
| 224 // Creates a fixed proxy config service that is initialized using Firefox's | 224 // Creates a fixed proxy config service that is initialized using Firefox's |
| 225 // current proxy settings. On success returns net::OK and fills | 225 // current proxy settings. On success returns net::OK and fills |
| 226 // |config_service| with a new pointer. Otherwise returns a network error | 226 // |config_service| with a new pointer. Otherwise returns a network error |
| 227 // code. | 227 // code. |
| 228 int CreateFirefoxProxyConfigService( | 228 int CreateFirefoxProxyConfigService( |
| 229 scoped_ptr<net::ProxyConfigService>* config_service) { | 229 scoped_ptr<net::ProxyConfigService>* config_service) { |
| 230 #if defined(OS_ANDROID) | |
| 231 // Chrome on Android does not support Firefox settings. | |
| 232 return net::ERR_FAILED; | |
|
Yaron
2012/03/01 02:20:31
Looking above, it seems like theres' precedent for
| |
| 233 #else | |
| 230 // Fetch Firefox's proxy settings (can fail if Firefox is not installed). | 234 // Fetch Firefox's proxy settings (can fail if Firefox is not installed). |
| 231 FirefoxProxySettings firefox_settings; | 235 FirefoxProxySettings firefox_settings; |
| 232 if (!FirefoxProxySettings::GetSettings(&firefox_settings)) | 236 if (!FirefoxProxySettings::GetSettings(&firefox_settings)) |
| 233 return net::ERR_FILE_NOT_FOUND; | 237 return net::ERR_FILE_NOT_FOUND; |
| 234 | 238 |
| 235 if (FirefoxProxySettings::SYSTEM == firefox_settings.config_type()) | 239 if (FirefoxProxySettings::SYSTEM == firefox_settings.config_type()) |
| 236 return CreateSystemProxyConfigService(config_service); | 240 return CreateSystemProxyConfigService(config_service); |
| 237 | 241 |
| 238 net::ProxyConfig config; | 242 net::ProxyConfig config; |
| 239 if (firefox_settings.ToProxyConfig(&config)) { | 243 if (firefox_settings.ToProxyConfig(&config)) { |
| 240 config_service->reset(new net::ProxyConfigServiceFixed(config)); | 244 config_service->reset(new net::ProxyConfigServiceFixed(config)); |
| 241 return net::OK; | 245 return net::OK; |
| 242 } | 246 } |
| 243 | 247 |
| 244 return net::ERR_FAILED; | 248 return net::ERR_FAILED; |
| 249 #endif | |
| 245 } | 250 } |
| 246 | 251 |
| 247 const scoped_refptr<net::URLRequestContext> proxy_request_context_; | 252 const scoped_refptr<net::URLRequestContext> proxy_request_context_; |
| 248 net::URLRequestContextStorage storage_; | 253 net::URLRequestContextStorage storage_; |
| 249 }; | 254 }; |
| 250 | 255 |
| 251 } // namespace | 256 } // namespace |
| 252 | 257 |
| 253 // ConnectionTester::TestRunner ---------------------------------------------- | 258 // ConnectionTester::TestRunner ---------------------------------------------- |
| 254 | 259 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 461 | 466 |
| 462 // Notify the delegate of completion. | 467 // Notify the delegate of completion. |
| 463 delegate_->OnCompletedConnectionTestExperiment(current, result); | 468 delegate_->OnCompletedConnectionTestExperiment(current, result); |
| 464 | 469 |
| 465 if (remaining_experiments_.empty()) { | 470 if (remaining_experiments_.empty()) { |
| 466 delegate_->OnCompletedConnectionTestSuite(); | 471 delegate_->OnCompletedConnectionTestSuite(); |
| 467 } else { | 472 } else { |
| 468 StartNextExperiment(); | 473 StartNextExperiment(); |
| 469 } | 474 } |
| 470 } | 475 } |
| OLD | NEW |