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" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 // construction needs ot happen on the UI thread. | 211 // construction needs ot happen on the UI thread. |
212 return net::ERR_NOT_IMPLEMENTED; | 212 return net::ERR_NOT_IMPLEMENTED; |
213 #else | 213 #else |
214 config_service->reset( | 214 config_service->reset( |
215 net::ProxyService::CreateSystemProxyConfigService( | 215 net::ProxyService::CreateSystemProxyConfigService( |
216 MessageLoop::current(), NULL)); | 216 MessageLoop::current(), NULL)); |
217 return net::OK; | 217 return net::OK; |
218 #endif | 218 #endif |
219 } | 219 } |
220 | 220 |
| 221 #if !defined(OS_ANDROID) |
221 static int FirefoxProxySettingsTask( | 222 static int FirefoxProxySettingsTask( |
222 FirefoxProxySettings* firefox_settings) { | 223 FirefoxProxySettings* firefox_settings) { |
223 if (!FirefoxProxySettings::GetSettings(firefox_settings)) | 224 if (!FirefoxProxySettings::GetSettings(firefox_settings)) |
224 return net::ERR_FILE_NOT_FOUND; | 225 return net::ERR_FILE_NOT_FOUND; |
225 return net::OK; | 226 return net::OK; |
226 } | 227 } |
227 | 228 |
228 void FirefoxProxySettingsReply( | 229 void FirefoxProxySettingsReply( |
229 scoped_ptr<net::ProxyConfigService>* config_service, | 230 scoped_ptr<net::ProxyConfigService>* config_service, |
230 FirefoxProxySettings* firefox_settings, | 231 FirefoxProxySettings* firefox_settings, |
231 base::Callback<void(int)> callback, | 232 base::Callback<void(int)> callback, |
232 int rv) { | 233 int rv) { |
233 if (rv == net::OK) { | 234 if (rv == net::OK) { |
234 if (FirefoxProxySettings::SYSTEM == firefox_settings->config_type()) { | 235 if (FirefoxProxySettings::SYSTEM == firefox_settings->config_type()) { |
235 rv = CreateSystemProxyConfigService(config_service); | 236 rv = CreateSystemProxyConfigService(config_service); |
236 } else { | 237 } else { |
237 net::ProxyConfig config; | 238 net::ProxyConfig config; |
238 if (firefox_settings->ToProxyConfig(&config)) | 239 if (firefox_settings->ToProxyConfig(&config)) |
239 config_service->reset(new net::ProxyConfigServiceFixed(config)); | 240 config_service->reset(new net::ProxyConfigServiceFixed(config)); |
240 else | 241 else |
241 rv = net::ERR_FAILED; | 242 rv = net::ERR_FAILED; |
242 } | 243 } |
243 } | 244 } |
244 callback.Run(rv); | 245 callback.Run(rv); |
245 } | 246 } |
| 247 #endif |
246 | 248 |
247 // Creates a fixed proxy config service that is initialized using Firefox's | 249 // Creates a fixed proxy config service that is initialized using Firefox's |
248 // current proxy settings. On success returns net::OK and fills | 250 // current proxy settings. On success returns net::OK and fills |
249 // |config_service| with a new pointer. Otherwise returns a network error | 251 // |config_service| with a new pointer. Otherwise returns a network error |
250 // code. | 252 // code. |
251 int CreateFirefoxProxyConfigService( | 253 int CreateFirefoxProxyConfigService( |
252 scoped_ptr<net::ProxyConfigService>* config_service, | 254 scoped_ptr<net::ProxyConfigService>* config_service, |
253 base::Callback<void(int)> callback) { | 255 base::Callback<void(int)> callback) { |
254 #if defined(OS_ANDROID) | 256 #if defined(OS_ANDROID) |
255 // Chrome on Android does not support Firefox settings. | 257 // Chrome on Android does not support Firefox settings. |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 514 |
513 // Notify the delegate of completion. | 515 // Notify the delegate of completion. |
514 delegate_->OnCompletedConnectionTestExperiment(current, result); | 516 delegate_->OnCompletedConnectionTestExperiment(current, result); |
515 | 517 |
516 if (remaining_experiments_.empty()) { | 518 if (remaining_experiments_.empty()) { |
517 delegate_->OnCompletedConnectionTestSuite(); | 519 delegate_->OnCompletedConnectionTestSuite(); |
518 } else { | 520 } else { |
519 StartNextExperiment(); | 521 StartNextExperiment(); |
520 } | 522 } |
521 } | 523 } |
OLD | NEW |