Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: net/proxy/proxy_config_service_linux.cc

Issue 10210015: Merge 133802 - Linux: Add support for new KDE space-delimited proxy port numbers. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1084/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 } 1091 }
1092 1092
1093 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { 1093 FilePath KDEHomeToConfigPath(const FilePath& kde_home) {
1094 return kde_home.Append("share").Append("config"); 1094 return kde_home.Append("share").Append("config");
1095 } 1095 }
1096 1096
1097 void AddProxy(StringSetting host_key, const std::string& value) { 1097 void AddProxy(StringSetting host_key, const std::string& value) {
1098 if (value.empty() || value.substr(0, 3) == "//:") 1098 if (value.empty() || value.substr(0, 3) == "//:")
1099 // No proxy. 1099 // No proxy.
1100 return; 1100 return;
1101 // We don't need to parse the port number out; GetProxyFromSettings() 1101 size_t space = value.find(' ');
1102 // would only append it right back again. So we just leave the port 1102 if (space != std::string::npos) {
1103 // number right in the host string. 1103 // Newer versions of KDE use a space rather than a colon to separate the
1104 string_table_[host_key] = value; 1104 // port number from the hostname. If we find this, we need to convert it.
1105 std::string fixed = value;
1106 fixed[space] = ':';
1107 string_table_[host_key] = fixed;
1108 } else {
1109 // We don't need to parse the port number out; GetProxyFromSettings()
1110 // would only append it right back again. So we just leave the port
1111 // number right in the host string.
1112 string_table_[host_key] = value;
1113 }
1105 } 1114 }
1106 1115
1107 void AddHostList(StringListSetting key, const std::string& value) { 1116 void AddHostList(StringListSetting key, const std::string& value) {
1108 std::vector<std::string> tokens; 1117 std::vector<std::string> tokens;
1109 StringTokenizer tk(value, ", "); 1118 StringTokenizer tk(value, ", ");
1110 while (tk.GetNext()) { 1119 while (tk.GetNext()) {
1111 std::string token = tk.token(); 1120 std::string token = tk.token();
1112 if (!token.empty()) 1121 if (!token.empty())
1113 tokens.push_back(token); 1122 tokens.push_back(token);
1114 } 1123 }
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1789 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { 1798 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) {
1790 delegate_->RemoveObserver(observer); 1799 delegate_->RemoveObserver(observer);
1791 } 1800 }
1792 1801
1793 ProxyConfigService::ConfigAvailability 1802 ProxyConfigService::ConfigAvailability
1794 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { 1803 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) {
1795 return delegate_->GetLatestProxyConfig(config); 1804 return delegate_->GetLatestProxyConfig(config);
1796 } 1805 }
1797 1806
1798 } // namespace net 1807 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_config_service_linux_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698