| 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_linux.h" | 5 #include "net/proxy/proxy_config_service_linux.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #if defined(USE_GCONF) | 9 #if defined(USE_GCONF) |
| 10 #include <gconf/gconf-client.h> | 10 #include <gconf/gconf-client.h> |
| (...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 } | 1092 } |
| 1093 | 1093 |
| 1094 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { | 1094 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { |
| 1095 return kde_home.Append("share").Append("config"); | 1095 return kde_home.Append("share").Append("config"); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 void AddProxy(StringSetting host_key, const std::string& value) { | 1098 void AddProxy(StringSetting host_key, const std::string& value) { |
| 1099 if (value.empty() || value.substr(0, 3) == "//:") | 1099 if (value.empty() || value.substr(0, 3) == "//:") |
| 1100 // No proxy. | 1100 // No proxy. |
| 1101 return; | 1101 return; |
| 1102 // We don't need to parse the port number out; GetProxyFromSettings() | 1102 size_t space = value.find(' '); |
| 1103 // would only append it right back again. So we just leave the port | 1103 if (space != std::string::npos) { |
| 1104 // number right in the host string. | 1104 // Newer versions of KDE use a space rather than a colon to separate the |
| 1105 string_table_[host_key] = value; | 1105 // port number from the hostname. If we find this, we need to convert it. |
| 1106 std::string fixed = value; |
| 1107 fixed[space] = ':'; |
| 1108 string_table_[host_key] = fixed; |
| 1109 } else { |
| 1110 // We don't need to parse the port number out; GetProxyFromSettings() |
| 1111 // would only append it right back again. So we just leave the port |
| 1112 // number right in the host string. |
| 1113 string_table_[host_key] = value; |
| 1114 } |
| 1106 } | 1115 } |
| 1107 | 1116 |
| 1108 void AddHostList(StringListSetting key, const std::string& value) { | 1117 void AddHostList(StringListSetting key, const std::string& value) { |
| 1109 std::vector<std::string> tokens; | 1118 std::vector<std::string> tokens; |
| 1110 StringTokenizer tk(value, ", "); | 1119 StringTokenizer tk(value, ", "); |
| 1111 while (tk.GetNext()) { | 1120 while (tk.GetNext()) { |
| 1112 std::string token = tk.token(); | 1121 std::string token = tk.token(); |
| 1113 if (!token.empty()) | 1122 if (!token.empty()) |
| 1114 tokens.push_back(token); | 1123 tokens.push_back(token); |
| 1115 } | 1124 } |
| (...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1796 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1805 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
| 1797 delegate_->RemoveObserver(observer); | 1806 delegate_->RemoveObserver(observer); |
| 1798 } | 1807 } |
| 1799 | 1808 |
| 1800 ProxyConfigService::ConfigAvailability | 1809 ProxyConfigService::ConfigAvailability |
| 1801 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1810 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
| 1802 return delegate_->GetLatestProxyConfig(config); | 1811 return delegate_->GetLatestProxyConfig(config); |
| 1803 } | 1812 } |
| 1804 | 1813 |
| 1805 } // namespace net | 1814 } // namespace net |
| OLD | NEW |