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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 } else if (in_proxy_settings) { | 1208 } else if (in_proxy_settings) { |
1209 // A regular line, in the (a?) proxy settings section. | 1209 // A regular line, in the (a?) proxy settings section. |
1210 char* split = strchr(line, '='); | 1210 char* split = strchr(line, '='); |
1211 // Skip this line if it does not contain an = sign. | 1211 // Skip this line if it does not contain an = sign. |
1212 if (!split) | 1212 if (!split) |
1213 continue; | 1213 continue; |
1214 // Split the line on the = and advance |split|. | 1214 // Split the line on the = and advance |split|. |
1215 *(split++) = 0; | 1215 *(split++) = 0; |
1216 std::string key = line; | 1216 std::string key = line; |
1217 std::string value = split; | 1217 std::string value = split; |
1218 TrimWhitespaceASCII(key, TRIM_ALL, &key); | 1218 base::TrimWhitespaceASCII(key, base::TRIM_ALL, &key); |
1219 TrimWhitespaceASCII(value, TRIM_ALL, &value); | 1219 base::TrimWhitespaceASCII(value, base::TRIM_ALL, &value); |
1220 // Skip this line if the key name is empty. | 1220 // Skip this line if the key name is empty. |
1221 if (key.empty()) | 1221 if (key.empty()) |
1222 continue; | 1222 continue; |
1223 // Is the value name localized? | 1223 // Is the value name localized? |
1224 if (key[key.length() - 1] == ']') { | 1224 if (key[key.length() - 1] == ']') { |
1225 // Find the matching bracket. | 1225 // Find the matching bracket. |
1226 length = key.rfind('['); | 1226 length = key.rfind('['); |
1227 // Skip this line if the localization indicator is malformed. | 1227 // Skip this line if the localization indicator is malformed. |
1228 if (length == std::string::npos) | 1228 if (length == std::string::npos) |
1229 continue; | 1229 continue; |
1230 // Trim the localization indicator off. | 1230 // Trim the localization indicator off. |
1231 key.resize(length); | 1231 key.resize(length); |
1232 // Remove any resulting trailing whitespace. | 1232 // Remove any resulting trailing whitespace. |
1233 TrimWhitespaceASCII(key, TRIM_TRAILING, &key); | 1233 base::TrimWhitespaceASCII(key, base::TRIM_TRAILING, &key); |
1234 // Skip this line if the key name is now empty. | 1234 // Skip this line if the key name is now empty. |
1235 if (key.empty()) | 1235 if (key.empty()) |
1236 continue; | 1236 continue; |
1237 } | 1237 } |
1238 // Now fill in the tables. | 1238 // Now fill in the tables. |
1239 AddKDESetting(key, value); | 1239 AddKDESetting(key, value); |
1240 } | 1240 } |
1241 } | 1241 } |
1242 if (ferror(input.get())) | 1242 if (ferror(input.get())) |
1243 LOG(ERROR) << "error reading " << kioslaverc.value(); | 1243 LOG(ERROR) << "error reading " << kioslaverc.value(); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1757 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
1758 delegate_->RemoveObserver(observer); | 1758 delegate_->RemoveObserver(observer); |
1759 } | 1759 } |
1760 | 1760 |
1761 ProxyConfigService::ConfigAvailability | 1761 ProxyConfigService::ConfigAvailability |
1762 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1762 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
1763 return delegate_->GetLatestProxyConfig(config); | 1763 return delegate_->GetLatestProxyConfig(config); |
1764 } | 1764 } |
1765 | 1765 |
1766 } // namespace net | 1766 } // namespace net |
OLD | NEW |