| 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 "net/proxy/proxy_config_service_android.h" | 5 #include "net/proxy/proxy_config_service_android.h" |
| 6 | 6 |
| 7 #include <sys/system_properties.h> | 7 #include <sys/system_properties.h> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 using base::android::ScopedJavaGlobalRef; | 32 using base::android::ScopedJavaGlobalRef; |
| 33 | 33 |
| 34 namespace net { | 34 namespace net { |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 typedef ProxyConfigServiceAndroid::GetPropertyCallback GetPropertyCallback; | 38 typedef ProxyConfigServiceAndroid::GetPropertyCallback GetPropertyCallback; |
| 39 | 39 |
| 40 // Returns whether the provided string was successfully converted to a port. | 40 // Returns whether the provided string was successfully converted to a port. |
| 41 bool ConvertStringToPort(const std::string& port, int* output) { | 41 bool ConvertStringToPort(const std::string& port, int* output) { |
| 42 url_parse::Component component(0, port.size()); | 42 url::Component component(0, port.size()); |
| 43 int result = url_parse::ParsePort(port.c_str(), component); | 43 int result = url::ParsePort(port.c_str(), component); |
| 44 if (result == url_parse::PORT_INVALID || | 44 if (result == url::PORT_INVALID || result == url::PORT_UNSPECIFIED) |
| 45 result == url_parse::PORT_UNSPECIFIED) | |
| 46 return false; | 45 return false; |
| 47 *output = result; | 46 *output = result; |
| 48 return true; | 47 return true; |
| 49 } | 48 } |
| 50 | 49 |
| 51 ProxyServer ConstructProxyServer(ProxyServer::Scheme scheme, | 50 ProxyServer ConstructProxyServer(ProxyServer::Scheme scheme, |
| 52 const std::string& proxy_host, | 51 const std::string& proxy_host, |
| 53 const std::string& proxy_port) { | 52 const std::string& proxy_port) { |
| 54 DCHECK(!proxy_host.empty()); | 53 DCHECK(!proxy_host.empty()); |
| 55 int port_as_int = 0; | 54 int port_as_int = 0; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 network_task_runner, jni_task_runner, get_property_callback)) { | 357 network_task_runner, jni_task_runner, get_property_callback)) { |
| 359 delegate_->SetupJNI(); | 358 delegate_->SetupJNI(); |
| 360 delegate_->FetchInitialConfig(); | 359 delegate_->FetchInitialConfig(); |
| 361 } | 360 } |
| 362 | 361 |
| 363 void ProxyConfigServiceAndroid::ProxySettingsChanged() { | 362 void ProxyConfigServiceAndroid::ProxySettingsChanged() { |
| 364 delegate_->ProxySettingsChanged(); | 363 delegate_->ProxySettingsChanged(); |
| 365 } | 364 } |
| 366 | 365 |
| 367 } // namespace net | 366 } // namespace net |
| OLD | NEW |