Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 } | 292 } |
| 293 | 293 |
| 294 virtual MessageLoop* GetNotificationLoop() { | 294 virtual MessageLoop* GetNotificationLoop() { |
| 295 return loop_; | 295 return loop_; |
| 296 } | 296 } |
| 297 | 297 |
| 298 virtual const char* GetDataSource() { | 298 virtual const char* GetDataSource() { |
| 299 return "gconf"; | 299 return "gconf"; |
| 300 } | 300 } |
| 301 | 301 |
| 302 virtual bool GetString(Setting key, std::string* result) { | 302 virtual bool GetString(StringSetting key, std::string* result) { |
| 303 switch (key) { | 303 switch (key) { |
| 304 case PROXY_MODE: | 304 case PROXY_MODE: |
| 305 return GetStringByPath("/system/proxy/mode", result); | 305 return GetStringByPath("/system/proxy/mode", result); |
| 306 case PROXY_AUTOCONF_URL: | 306 case PROXY_AUTOCONF_URL: |
| 307 return GetStringByPath("/system/proxy/autoconfig_url", result); | 307 return GetStringByPath("/system/proxy/autoconfig_url", result); |
| 308 case PROXY_HTTP_HOST: | 308 case PROXY_HTTP_HOST: |
| 309 return GetStringByPath("/system/http_proxy/host", result); | 309 return GetStringByPath("/system/http_proxy/host", result); |
| 310 case PROXY_HTTPS_HOST: | 310 case PROXY_HTTPS_HOST: |
| 311 return GetStringByPath("/system/proxy/secure_host", result); | 311 return GetStringByPath("/system/proxy/secure_host", result); |
| 312 case PROXY_FTP_HOST: | 312 case PROXY_FTP_HOST: |
| 313 return GetStringByPath("/system/proxy/ftp_host", result); | 313 return GetStringByPath("/system/proxy/ftp_host", result); |
| 314 case PROXY_SOCKS_HOST: | 314 case PROXY_SOCKS_HOST: |
| 315 return GetStringByPath("/system/proxy/socks_host", result); | 315 return GetStringByPath("/system/proxy/socks_host", result); |
| 316 default: | |
| 317 return false; | |
| 318 } | 316 } |
| 317 return false; // placate compiler | |
|
vandebo (ex-Chrome)
2011/05/20 20:05:49
nit: Comments should be sentences... "Placate comp
Mike Mammarella
2011/05/20 20:42:36
Done.
| |
| 319 } | 318 } |
| 320 virtual bool GetBool(Setting key, bool* result) { | 319 virtual bool GetBool(BoolSetting key, bool* result) { |
| 321 switch (key) { | 320 switch (key) { |
| 322 case PROXY_USE_HTTP_PROXY: | 321 case PROXY_USE_HTTP_PROXY: |
| 323 return GetBoolByPath("/system/http_proxy/use_http_proxy", result); | 322 return GetBoolByPath("/system/http_proxy/use_http_proxy", result); |
| 324 case PROXY_USE_SAME_PROXY: | 323 case PROXY_USE_SAME_PROXY: |
| 325 return GetBoolByPath("/system/http_proxy/use_same_proxy", result); | 324 return GetBoolByPath("/system/http_proxy/use_same_proxy", result); |
| 326 case PROXY_USE_AUTHENTICATION: | 325 case PROXY_USE_AUTHENTICATION: |
| 327 return GetBoolByPath("/system/http_proxy/use_authentication", result); | 326 return GetBoolByPath("/system/http_proxy/use_authentication", result); |
| 328 default: | |
| 329 return false; | |
| 330 } | 327 } |
| 328 return false; // placate compiler | |
| 331 } | 329 } |
| 332 virtual bool GetInt(Setting key, int* result) { | 330 virtual bool GetInt(IntSetting key, int* result) { |
| 333 switch (key) { | 331 switch (key) { |
| 334 case PROXY_HTTP_PORT: | 332 case PROXY_HTTP_PORT: |
| 335 return GetIntByPath("/system/http_proxy/port", result); | 333 return GetIntByPath("/system/http_proxy/port", result); |
| 336 case PROXY_HTTPS_PORT: | 334 case PROXY_HTTPS_PORT: |
| 337 return GetIntByPath("/system/proxy/secure_port", result); | 335 return GetIntByPath("/system/proxy/secure_port", result); |
| 338 case PROXY_FTP_PORT: | 336 case PROXY_FTP_PORT: |
| 339 return GetIntByPath("/system/proxy/ftp_port", result); | 337 return GetIntByPath("/system/proxy/ftp_port", result); |
| 340 case PROXY_SOCKS_PORT: | 338 case PROXY_SOCKS_PORT: |
| 341 return GetIntByPath("/system/proxy/socks_port", result); | 339 return GetIntByPath("/system/proxy/socks_port", result); |
| 342 default: | |
| 343 return false; | |
| 344 } | 340 } |
| 341 return false; // placate compiler | |
| 345 } | 342 } |
| 346 virtual bool GetStringList(Setting key, std::vector<std::string>* result) { | 343 virtual bool GetStringList(StringListSetting key, |
| 344 std::vector<std::string>* result) { | |
| 347 switch (key) { | 345 switch (key) { |
| 348 case PROXY_IGNORE_HOSTS: | 346 case PROXY_IGNORE_HOSTS: |
| 349 return GetStringListByPath("/system/http_proxy/ignore_hosts", result); | 347 return GetStringListByPath("/system/http_proxy/ignore_hosts", result); |
| 350 default: | |
| 351 return false; | |
| 352 } | 348 } |
| 349 return false; // placate compiler | |
| 353 } | 350 } |
| 354 | 351 |
| 355 virtual bool BypassListIsReversed() { | 352 virtual bool BypassListIsReversed() { |
| 356 // This is a KDE-specific setting. | 353 // This is a KDE-specific setting. |
| 357 return false; | 354 return false; |
| 358 } | 355 } |
| 359 | 356 |
| 360 virtual bool MatchHostsUsingSuffixMatching() { | 357 virtual bool MatchHostsUsingSuffixMatching() { |
| 361 return false; | 358 return false; |
| 362 } | 359 } |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 } | 581 } |
| 585 | 582 |
| 586 virtual MessageLoop* GetNotificationLoop() { | 583 virtual MessageLoop* GetNotificationLoop() { |
| 587 return loop_; | 584 return loop_; |
| 588 } | 585 } |
| 589 | 586 |
| 590 virtual const char* GetDataSource() { | 587 virtual const char* GetDataSource() { |
| 591 return "gsettings"; | 588 return "gsettings"; |
| 592 } | 589 } |
| 593 | 590 |
| 594 virtual bool GetString(Setting key, std::string* result) { | 591 virtual bool GetString(StringSetting key, std::string* result) { |
| 595 DCHECK(client_); | 592 DCHECK(client_); |
| 596 switch (key) { | 593 switch (key) { |
| 597 case PROXY_MODE: | 594 case PROXY_MODE: |
| 598 return GetStringByPath(client_, "mode", result); | 595 return GetStringByPath(client_, "mode", result); |
| 599 case PROXY_AUTOCONF_URL: | 596 case PROXY_AUTOCONF_URL: |
| 600 return GetStringByPath(client_, "autoconfig-url", result); | 597 return GetStringByPath(client_, "autoconfig-url", result); |
| 601 case PROXY_HTTP_HOST: | 598 case PROXY_HTTP_HOST: |
| 602 return GetStringByPath(http_client_, "host", result); | 599 return GetStringByPath(http_client_, "host", result); |
| 603 case PROXY_HTTPS_HOST: | 600 case PROXY_HTTPS_HOST: |
| 604 return GetStringByPath(https_client_, "host", result); | 601 return GetStringByPath(https_client_, "host", result); |
| 605 case PROXY_FTP_HOST: | 602 case PROXY_FTP_HOST: |
| 606 return GetStringByPath(ftp_client_, "host", result); | 603 return GetStringByPath(ftp_client_, "host", result); |
| 607 case PROXY_SOCKS_HOST: | 604 case PROXY_SOCKS_HOST: |
| 608 return GetStringByPath(socks_client_, "host", result); | 605 return GetStringByPath(socks_client_, "host", result); |
| 609 default: | |
| 610 return false; | |
| 611 } | 606 } |
| 607 return false; // placate compiler | |
| 612 } | 608 } |
| 613 virtual bool GetBool(Setting key, bool* result) { | 609 virtual bool GetBool(BoolSetting key, bool* result) { |
| 614 DCHECK(client_); | 610 DCHECK(client_); |
| 615 switch (key) { | 611 switch (key) { |
| 616 case PROXY_USE_HTTP_PROXY: | 612 case PROXY_USE_HTTP_PROXY: |
| 617 // Although there is an "enabled" boolean in http_client_, it is not set | 613 // Although there is an "enabled" boolean in http_client_, it is not set |
| 618 // to true by the proxy config utility. We ignore it and return false. | 614 // to true by the proxy config utility. We ignore it and return false. |
| 619 return false; | 615 return false; |
| 620 case PROXY_USE_SAME_PROXY: | 616 case PROXY_USE_SAME_PROXY: |
| 621 // Similarly, although there is a "use-same-proxy" boolean in client_, | 617 // Similarly, although there is a "use-same-proxy" boolean in client_, |
| 622 // it is never set to false by the proxy config utility. We ignore it. | 618 // it is never set to false by the proxy config utility. We ignore it. |
| 623 return false; | 619 return false; |
| 624 case PROXY_USE_AUTHENTICATION: | 620 case PROXY_USE_AUTHENTICATION: |
| 625 // There is also no way to set this in the proxy config utility, but it | 621 // There is also no way to set this in the proxy config utility, but it |
| 626 // doesn't hurt us to get the actual setting (unlike the two above). | 622 // doesn't hurt us to get the actual setting (unlike the two above). |
| 627 return GetBoolByPath(http_client_, "use-authentication", result); | 623 return GetBoolByPath(http_client_, "use-authentication", result); |
| 628 default: | |
| 629 return false; | |
| 630 } | 624 } |
| 625 return false; // placate compiler | |
| 631 } | 626 } |
| 632 virtual bool GetInt(Setting key, int* result) { | 627 virtual bool GetInt(IntSetting key, int* result) { |
| 633 DCHECK(client_); | 628 DCHECK(client_); |
| 634 switch (key) { | 629 switch (key) { |
| 635 case PROXY_HTTP_PORT: | 630 case PROXY_HTTP_PORT: |
| 636 return GetIntByPath(http_client_, "port", result); | 631 return GetIntByPath(http_client_, "port", result); |
| 637 case PROXY_HTTPS_PORT: | 632 case PROXY_HTTPS_PORT: |
| 638 return GetIntByPath(https_client_, "port", result); | 633 return GetIntByPath(https_client_, "port", result); |
| 639 case PROXY_FTP_PORT: | 634 case PROXY_FTP_PORT: |
| 640 return GetIntByPath(ftp_client_, "port", result); | 635 return GetIntByPath(ftp_client_, "port", result); |
| 641 case PROXY_SOCKS_PORT: | 636 case PROXY_SOCKS_PORT: |
| 642 return GetIntByPath(socks_client_, "port", result); | 637 return GetIntByPath(socks_client_, "port", result); |
| 643 default: | |
| 644 return false; | |
| 645 } | 638 } |
| 639 return false; // placate compiler | |
| 646 } | 640 } |
| 647 virtual bool GetStringList(Setting key, std::vector<std::string>* result) { | 641 virtual bool GetStringList(StringListSetting key, |
| 642 std::vector<std::string>* result) { | |
| 648 DCHECK(client_); | 643 DCHECK(client_); |
| 649 switch (key) { | 644 switch (key) { |
| 650 case PROXY_IGNORE_HOSTS: | 645 case PROXY_IGNORE_HOSTS: |
| 651 return GetStringListByPath(client_, "ignore-hosts", result); | 646 return GetStringListByPath(client_, "ignore-hosts", result); |
| 652 default: | |
| 653 return false; | |
| 654 } | 647 } |
| 648 return false; // placate compiler | |
| 655 } | 649 } |
| 656 | 650 |
| 657 virtual bool BypassListIsReversed() { | 651 virtual bool BypassListIsReversed() { |
| 658 // This is a KDE-specific setting. | 652 // This is a KDE-specific setting. |
| 659 return false; | 653 return false; |
| 660 } | 654 } |
| 661 | 655 |
| 662 virtual bool MatchHostsUsingSuffixMatching() { | 656 virtual bool MatchHostsUsingSuffixMatching() { |
| 663 return false; | 657 return false; |
| 664 } | 658 } |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 987 OnChangeNotification(); | 981 OnChangeNotification(); |
| 988 } | 982 } |
| 989 void OnFileCanWriteWithoutBlocking(int fd) { | 983 void OnFileCanWriteWithoutBlocking(int fd) { |
| 990 NOTREACHED(); | 984 NOTREACHED(); |
| 991 } | 985 } |
| 992 | 986 |
| 993 virtual const char* GetDataSource() { | 987 virtual const char* GetDataSource() { |
| 994 return "KDE"; | 988 return "KDE"; |
| 995 } | 989 } |
| 996 | 990 |
| 997 virtual bool GetString(Setting key, std::string* result) { | 991 virtual bool GetString(StringSetting key, std::string* result) { |
| 998 string_map_type::iterator it = string_table_.find(key); | 992 string_map_type::iterator it = string_table_.find(key); |
| 999 if (it == string_table_.end()) | 993 if (it == string_table_.end()) |
| 1000 return false; | 994 return false; |
| 1001 *result = it->second; | 995 *result = it->second; |
| 1002 return true; | 996 return true; |
| 1003 } | 997 } |
| 1004 virtual bool GetBool(Setting key, bool* result) { | 998 virtual bool GetBool(BoolSetting key, bool* result) { |
| 1005 // We don't ever have any booleans. | 999 // We don't ever have any booleans. |
| 1006 return false; | 1000 return false; |
| 1007 } | 1001 } |
| 1008 virtual bool GetInt(Setting key, int* result) { | 1002 virtual bool GetInt(IntSetting key, int* result) { |
| 1009 // We don't ever have any integers. (See AddProxy() below about ports.) | 1003 // We don't ever have any integers. (See AddProxy() below about ports.) |
| 1010 return false; | 1004 return false; |
| 1011 } | 1005 } |
| 1012 virtual bool GetStringList(Setting key, std::vector<std::string>* result) { | 1006 virtual bool GetStringList(StringListSetting key, |
| 1007 std::vector<std::string>* result) { | |
| 1013 strings_map_type::iterator it = strings_table_.find(key); | 1008 strings_map_type::iterator it = strings_table_.find(key); |
| 1014 if (it == strings_table_.end()) | 1009 if (it == strings_table_.end()) |
| 1015 return false; | 1010 return false; |
| 1016 *result = it->second; | 1011 *result = it->second; |
| 1017 return true; | 1012 return true; |
| 1018 } | 1013 } |
| 1019 | 1014 |
| 1020 virtual bool BypassListIsReversed() { | 1015 virtual bool BypassListIsReversed() { |
| 1021 return reversed_bypass_list_; | 1016 return reversed_bypass_list_; |
| 1022 } | 1017 } |
| 1023 | 1018 |
| 1024 virtual bool MatchHostsUsingSuffixMatching() { | 1019 virtual bool MatchHostsUsingSuffixMatching() { |
| 1025 return true; | 1020 return true; |
| 1026 } | 1021 } |
| 1027 | 1022 |
| 1028 private: | 1023 private: |
| 1029 void ResetCachedSettings() { | 1024 void ResetCachedSettings() { |
| 1030 string_table_.clear(); | 1025 string_table_.clear(); |
| 1031 strings_table_.clear(); | 1026 strings_table_.clear(); |
| 1032 indirect_manual_ = false; | 1027 indirect_manual_ = false; |
| 1033 auto_no_pac_ = false; | 1028 auto_no_pac_ = false; |
| 1034 reversed_bypass_list_ = false; | 1029 reversed_bypass_list_ = false; |
| 1035 } | 1030 } |
| 1036 | 1031 |
| 1037 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { | 1032 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { |
| 1038 return kde_home.Append("share").Append("config"); | 1033 return kde_home.Append("share").Append("config"); |
| 1039 } | 1034 } |
| 1040 | 1035 |
| 1041 void AddProxy(Setting host_key, const std::string& value) { | 1036 void AddProxy(StringSetting host_key, const std::string& value) { |
| 1042 if (value.empty() || value.substr(0, 3) == "//:") | 1037 if (value.empty() || value.substr(0, 3) == "//:") |
| 1043 // No proxy. | 1038 // No proxy. |
| 1044 return; | 1039 return; |
| 1045 // We don't need to parse the port number out; GetProxyFromSettings() | 1040 // We don't need to parse the port number out; GetProxyFromSettings() |
| 1046 // would only append it right back again. So we just leave the port | 1041 // would only append it right back again. So we just leave the port |
| 1047 // number right in the host string. | 1042 // number right in the host string. |
| 1048 string_table_[host_key] = value; | 1043 string_table_[host_key] = value; |
| 1049 } | 1044 } |
| 1050 | 1045 |
| 1051 void AddHostList(Setting key, const std::string& value) { | 1046 void AddHostList(StringListSetting key, const std::string& value) { |
| 1052 std::vector<std::string> tokens; | 1047 std::vector<std::string> tokens; |
| 1053 StringTokenizer tk(value, ", "); | 1048 StringTokenizer tk(value, ", "); |
| 1054 while (tk.GetNext()) { | 1049 while (tk.GetNext()) { |
| 1055 std::string token = tk.token(); | 1050 std::string token = tk.token(); |
| 1056 if (!token.empty()) | 1051 if (!token.empty()) |
| 1057 tokens.push_back(token); | 1052 tokens.push_back(token); |
| 1058 } | 1053 } |
| 1059 strings_table_[key] = tokens; | 1054 strings_table_[key] = tokens; |
| 1060 } | 1055 } |
| 1061 | 1056 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 base::StringToInt(value, &mode); | 1109 base::StringToInt(value, &mode); |
| 1115 if (mode) { | 1110 if (mode) { |
| 1116 // ProxyConfig does not support authentication parameters, but | 1111 // ProxyConfig does not support authentication parameters, but |
| 1117 // Chrome will prompt for the password later. So we ignore this. | 1112 // Chrome will prompt for the password later. So we ignore this. |
| 1118 LOG(WARNING) << | 1113 LOG(WARNING) << |
| 1119 "Proxy authentication parameters ignored, see bug 16709"; | 1114 "Proxy authentication parameters ignored, see bug 16709"; |
| 1120 } | 1115 } |
| 1121 } | 1116 } |
| 1122 } | 1117 } |
| 1123 | 1118 |
| 1124 void ResolveIndirect(Setting key) { | 1119 void ResolveIndirect(StringSetting key) { |
| 1125 string_map_type::iterator it = string_table_.find(key); | 1120 string_map_type::iterator it = string_table_.find(key); |
| 1126 if (it != string_table_.end()) { | 1121 if (it != string_table_.end()) { |
| 1127 std::string value; | 1122 std::string value; |
| 1128 if (env_var_getter_->GetVar(it->second.c_str(), &value)) | 1123 if (env_var_getter_->GetVar(it->second.c_str(), &value)) |
| 1129 it->second = value; | 1124 it->second = value; |
| 1130 else | 1125 else |
| 1131 string_table_.erase(it); | 1126 string_table_.erase(it); |
| 1132 } | 1127 } |
| 1133 } | 1128 } |
| 1134 | 1129 |
| 1135 void ResolveIndirectList(Setting key) { | 1130 void ResolveIndirectList(StringListSetting key) { |
| 1136 strings_map_type::iterator it = strings_table_.find(key); | 1131 strings_map_type::iterator it = strings_table_.find(key); |
| 1137 if (it != strings_table_.end()) { | 1132 if (it != strings_table_.end()) { |
| 1138 std::string value; | 1133 std::string value; |
| 1139 if (!it->second.empty() && | 1134 if (!it->second.empty() && |
| 1140 env_var_getter_->GetVar(it->second[0].c_str(), &value)) | 1135 env_var_getter_->GetVar(it->second[0].c_str(), &value)) |
| 1141 AddHostList(key, value); | 1136 AddHostList(key, value); |
| 1142 else | 1137 else |
| 1143 strings_table_.erase(it); | 1138 strings_table_.erase(it); |
| 1144 } | 1139 } |
| 1145 } | 1140 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1295 if (kioslaverc_touched) { | 1290 if (kioslaverc_touched) { |
| 1296 // We don't use Reset() because the timer may not yet be running. | 1291 // We don't use Reset() because the timer may not yet be running. |
| 1297 // (In that case Stop() is a no-op.) | 1292 // (In that case Stop() is a no-op.) |
| 1298 debounce_timer_.Stop(); | 1293 debounce_timer_.Stop(); |
| 1299 debounce_timer_.Start(base::TimeDelta::FromMilliseconds( | 1294 debounce_timer_.Start(base::TimeDelta::FromMilliseconds( |
| 1300 kDebounceTimeoutMilliseconds), this, | 1295 kDebounceTimeoutMilliseconds), this, |
| 1301 &SettingGetterImplKDE::OnDebouncedNotification); | 1296 &SettingGetterImplKDE::OnDebouncedNotification); |
| 1302 } | 1297 } |
| 1303 } | 1298 } |
| 1304 | 1299 |
| 1305 typedef std::map<Setting, std::string> string_map_type; | 1300 typedef std::map<StringSetting, std::string> string_map_type; |
| 1306 typedef std::map<Setting, std::vector<std::string> > strings_map_type; | 1301 typedef std::map<StringListSetting, |
| 1302 std::vector<std::string> > strings_map_type; | |
| 1307 | 1303 |
| 1308 int inotify_fd_; | 1304 int inotify_fd_; |
| 1309 base::MessagePumpLibevent::FileDescriptorWatcher inotify_watcher_; | 1305 base::MessagePumpLibevent::FileDescriptorWatcher inotify_watcher_; |
| 1310 ProxyConfigServiceLinux::Delegate* notify_delegate_; | 1306 ProxyConfigServiceLinux::Delegate* notify_delegate_; |
| 1311 base::OneShotTimer<SettingGetterImplKDE> debounce_timer_; | 1307 base::OneShotTimer<SettingGetterImplKDE> debounce_timer_; |
| 1312 FilePath kde_config_dir_; | 1308 FilePath kde_config_dir_; |
| 1313 bool indirect_manual_; | 1309 bool indirect_manual_; |
| 1314 bool auto_no_pac_; | 1310 bool auto_no_pac_; |
| 1315 bool reversed_bypass_list_; | 1311 bool reversed_bypass_list_; |
| 1316 // We don't own |env_var_getter_|. It's safe to hold a pointer to it, since | 1312 // We don't own |env_var_getter_|. It's safe to hold a pointer to it, since |
| 1317 // both it and us are owned by ProxyConfigServiceLinux::Delegate, and have the | 1313 // both it and us are owned by ProxyConfigServiceLinux::Delegate, and have the |
| 1318 // same lifetime. | 1314 // same lifetime. |
| 1319 base::Environment* env_var_getter_; | 1315 base::Environment* env_var_getter_; |
| 1320 | 1316 |
| 1321 // We cache these settings whenever we re-read the kioslaverc file. | 1317 // We cache these settings whenever we re-read the kioslaverc file. |
| 1322 string_map_type string_table_; | 1318 string_map_type string_table_; |
| 1323 strings_map_type strings_table_; | 1319 strings_map_type strings_table_; |
| 1324 | 1320 |
| 1325 // Message loop of the file thread, for reading kioslaverc. If NULL, | 1321 // Message loop of the file thread, for reading kioslaverc. If NULL, |
| 1326 // just read it directly (for testing). We also handle inotify events | 1322 // just read it directly (for testing). We also handle inotify events |
| 1327 // on this thread. | 1323 // on this thread. |
| 1328 MessageLoopForIO* file_loop_; | 1324 MessageLoopForIO* file_loop_; |
| 1329 | 1325 |
| 1330 DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); | 1326 DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); |
| 1331 }; | 1327 }; |
| 1332 | 1328 |
| 1333 } // namespace | 1329 } // namespace |
| 1334 | 1330 |
| 1335 bool ProxyConfigServiceLinux::Delegate::GetProxyFromSettings( | 1331 bool ProxyConfigServiceLinux::Delegate::GetProxyFromSettings( |
| 1336 SettingGetter::Setting host_key, | 1332 SettingGetter::StringSetting host_key, |
| 1337 ProxyServer* result_server) { | 1333 ProxyServer* result_server) { |
| 1338 std::string host; | 1334 std::string host; |
| 1339 if (!setting_getter_->GetString(host_key, &host) || host.empty()) { | 1335 if (!setting_getter_->GetString(host_key, &host) || host.empty()) { |
| 1340 // Unset or empty. | 1336 // Unset or empty. |
| 1341 return false; | 1337 return false; |
| 1342 } | 1338 } |
| 1343 // Check for an optional port. | 1339 // Check for an optional port. |
| 1344 int port = 0; | 1340 int port = 0; |
| 1345 SettingGetter::Setting port_key = | 1341 SettingGetter::IntSetting port_key = |
| 1346 SettingGetter::HostSettingToPortSetting(host_key); | 1342 SettingGetter::HostSettingToPortSetting(host_key); |
| 1347 setting_getter_->GetInt(port_key, &port); | 1343 setting_getter_->GetInt(port_key, &port); |
| 1348 if (port != 0) { | 1344 if (port != 0) { |
| 1349 // If a port is set and non-zero: | 1345 // If a port is set and non-zero: |
| 1350 host += ":" + base::IntToString(port); | 1346 host += ":" + base::IntToString(port); |
| 1351 } | 1347 } |
| 1352 | 1348 |
| 1353 // gconf settings do not appear to distinguish between SOCKS version. We | 1349 // gconf settings do not appear to distinguish between SOCKS version. We |
| 1354 // default to version 5. For more information on this policy decision, see: | 1350 // default to version 5. For more information on this policy decision, see: |
| 1355 // http://code.google.com/p/chromium/issues/detail?id=55912#c2 | 1351 // http://code.google.com/p/chromium/issues/detail?id=55912#c2 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1741 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1737 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
| 1742 delegate_->RemoveObserver(observer); | 1738 delegate_->RemoveObserver(observer); |
| 1743 } | 1739 } |
| 1744 | 1740 |
| 1745 ProxyConfigService::ConfigAvailability | 1741 ProxyConfigService::ConfigAvailability |
| 1746 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1742 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
| 1747 return delegate_->GetLatestProxyConfig(config); | 1743 return delegate_->GetLatestProxyConfig(config); |
| 1748 } | 1744 } |
| 1749 | 1745 |
| 1750 } // namespace net | 1746 } // namespace net |
| OLD | NEW |