| 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. |
| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 } | 592 } |
| 596 | 593 |
| 597 virtual MessageLoop* GetNotificationLoop() { | 594 virtual MessageLoop* GetNotificationLoop() { |
| 598 return loop_; | 595 return loop_; |
| 599 } | 596 } |
| 600 | 597 |
| 601 virtual const char* GetDataSource() { | 598 virtual const char* GetDataSource() { |
| 602 return "gsettings"; | 599 return "gsettings"; |
| 603 } | 600 } |
| 604 | 601 |
| 605 virtual bool GetString(Setting key, std::string* result) { | 602 virtual bool GetString(StringSetting key, std::string* result) { |
| 606 DCHECK(client_); | 603 DCHECK(client_); |
| 607 switch (key) { | 604 switch (key) { |
| 608 case PROXY_MODE: | 605 case PROXY_MODE: |
| 609 return GetStringByPath(client_, "mode", result); | 606 return GetStringByPath(client_, "mode", result); |
| 610 case PROXY_AUTOCONF_URL: | 607 case PROXY_AUTOCONF_URL: |
| 611 return GetStringByPath(client_, "autoconfig-url", result); | 608 return GetStringByPath(client_, "autoconfig-url", result); |
| 612 case PROXY_HTTP_HOST: | 609 case PROXY_HTTP_HOST: |
| 613 return GetStringByPath(http_client_, "host", result); | 610 return GetStringByPath(http_client_, "host", result); |
| 614 case PROXY_HTTPS_HOST: | 611 case PROXY_HTTPS_HOST: |
| 615 return GetStringByPath(https_client_, "host", result); | 612 return GetStringByPath(https_client_, "host", result); |
| 616 case PROXY_FTP_HOST: | 613 case PROXY_FTP_HOST: |
| 617 return GetStringByPath(ftp_client_, "host", result); | 614 return GetStringByPath(ftp_client_, "host", result); |
| 618 case PROXY_SOCKS_HOST: | 615 case PROXY_SOCKS_HOST: |
| 619 return GetStringByPath(socks_client_, "host", result); | 616 return GetStringByPath(socks_client_, "host", result); |
| 620 default: | |
| 621 return false; | |
| 622 } | 617 } |
| 618 return false; // Placate compiler. |
| 623 } | 619 } |
| 624 virtual bool GetBool(Setting key, bool* result) { | 620 virtual bool GetBool(BoolSetting key, bool* result) { |
| 625 DCHECK(client_); | 621 DCHECK(client_); |
| 626 switch (key) { | 622 switch (key) { |
| 627 case PROXY_USE_HTTP_PROXY: | 623 case PROXY_USE_HTTP_PROXY: |
| 628 // Although there is an "enabled" boolean in http_client_, it is not set | 624 // Although there is an "enabled" boolean in http_client_, it is not set |
| 629 // to true by the proxy config utility. We ignore it and return false. | 625 // to true by the proxy config utility. We ignore it and return false. |
| 630 return false; | 626 return false; |
| 631 case PROXY_USE_SAME_PROXY: | 627 case PROXY_USE_SAME_PROXY: |
| 632 // Similarly, although there is a "use-same-proxy" boolean in client_, | 628 // Similarly, although there is a "use-same-proxy" boolean in client_, |
| 633 // it is never set to false by the proxy config utility. We ignore it. | 629 // it is never set to false by the proxy config utility. We ignore it. |
| 634 return false; | 630 return false; |
| 635 case PROXY_USE_AUTHENTICATION: | 631 case PROXY_USE_AUTHENTICATION: |
| 636 // There is also no way to set this in the proxy config utility, but it | 632 // There is also no way to set this in the proxy config utility, but it |
| 637 // doesn't hurt us to get the actual setting (unlike the two above). | 633 // doesn't hurt us to get the actual setting (unlike the two above). |
| 638 return GetBoolByPath(http_client_, "use-authentication", result); | 634 return GetBoolByPath(http_client_, "use-authentication", result); |
| 639 default: | |
| 640 return false; | |
| 641 } | 635 } |
| 636 return false; // Placate compiler. |
| 642 } | 637 } |
| 643 virtual bool GetInt(Setting key, int* result) { | 638 virtual bool GetInt(IntSetting key, int* result) { |
| 644 DCHECK(client_); | 639 DCHECK(client_); |
| 645 switch (key) { | 640 switch (key) { |
| 646 case PROXY_HTTP_PORT: | 641 case PROXY_HTTP_PORT: |
| 647 return GetIntByPath(http_client_, "port", result); | 642 return GetIntByPath(http_client_, "port", result); |
| 648 case PROXY_HTTPS_PORT: | 643 case PROXY_HTTPS_PORT: |
| 649 return GetIntByPath(https_client_, "port", result); | 644 return GetIntByPath(https_client_, "port", result); |
| 650 case PROXY_FTP_PORT: | 645 case PROXY_FTP_PORT: |
| 651 return GetIntByPath(ftp_client_, "port", result); | 646 return GetIntByPath(ftp_client_, "port", result); |
| 652 case PROXY_SOCKS_PORT: | 647 case PROXY_SOCKS_PORT: |
| 653 return GetIntByPath(socks_client_, "port", result); | 648 return GetIntByPath(socks_client_, "port", result); |
| 654 default: | |
| 655 return false; | |
| 656 } | 649 } |
| 650 return false; // Placate compiler. |
| 657 } | 651 } |
| 658 virtual bool GetStringList(Setting key, std::vector<std::string>* result) { | 652 virtual bool GetStringList(StringListSetting key, |
| 653 std::vector<std::string>* result) { |
| 659 DCHECK(client_); | 654 DCHECK(client_); |
| 660 switch (key) { | 655 switch (key) { |
| 661 case PROXY_IGNORE_HOSTS: | 656 case PROXY_IGNORE_HOSTS: |
| 662 return GetStringListByPath(client_, "ignore-hosts", result); | 657 return GetStringListByPath(client_, "ignore-hosts", result); |
| 663 default: | |
| 664 return false; | |
| 665 } | 658 } |
| 659 return false; // Placate compiler. |
| 666 } | 660 } |
| 667 | 661 |
| 668 virtual bool BypassListIsReversed() { | 662 virtual bool BypassListIsReversed() { |
| 669 // This is a KDE-specific setting. | 663 // This is a KDE-specific setting. |
| 670 return false; | 664 return false; |
| 671 } | 665 } |
| 672 | 666 |
| 673 virtual bool MatchHostsUsingSuffixMatching() { | 667 virtual bool MatchHostsUsingSuffixMatching() { |
| 674 return false; | 668 return false; |
| 675 } | 669 } |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 OnChangeNotification(); | 996 OnChangeNotification(); |
| 1003 } | 997 } |
| 1004 void OnFileCanWriteWithoutBlocking(int fd) { | 998 void OnFileCanWriteWithoutBlocking(int fd) { |
| 1005 NOTREACHED(); | 999 NOTREACHED(); |
| 1006 } | 1000 } |
| 1007 | 1001 |
| 1008 virtual const char* GetDataSource() { | 1002 virtual const char* GetDataSource() { |
| 1009 return "KDE"; | 1003 return "KDE"; |
| 1010 } | 1004 } |
| 1011 | 1005 |
| 1012 virtual bool GetString(Setting key, std::string* result) { | 1006 virtual bool GetString(StringSetting key, std::string* result) { |
| 1013 string_map_type::iterator it = string_table_.find(key); | 1007 string_map_type::iterator it = string_table_.find(key); |
| 1014 if (it == string_table_.end()) | 1008 if (it == string_table_.end()) |
| 1015 return false; | 1009 return false; |
| 1016 *result = it->second; | 1010 *result = it->second; |
| 1017 return true; | 1011 return true; |
| 1018 } | 1012 } |
| 1019 virtual bool GetBool(Setting key, bool* result) { | 1013 virtual bool GetBool(BoolSetting key, bool* result) { |
| 1020 // We don't ever have any booleans. | 1014 // We don't ever have any booleans. |
| 1021 return false; | 1015 return false; |
| 1022 } | 1016 } |
| 1023 virtual bool GetInt(Setting key, int* result) { | 1017 virtual bool GetInt(IntSetting key, int* result) { |
| 1024 // We don't ever have any integers. (See AddProxy() below about ports.) | 1018 // We don't ever have any integers. (See AddProxy() below about ports.) |
| 1025 return false; | 1019 return false; |
| 1026 } | 1020 } |
| 1027 virtual bool GetStringList(Setting key, std::vector<std::string>* result) { | 1021 virtual bool GetStringList(StringListSetting key, |
| 1022 std::vector<std::string>* result) { |
| 1028 strings_map_type::iterator it = strings_table_.find(key); | 1023 strings_map_type::iterator it = strings_table_.find(key); |
| 1029 if (it == strings_table_.end()) | 1024 if (it == strings_table_.end()) |
| 1030 return false; | 1025 return false; |
| 1031 *result = it->second; | 1026 *result = it->second; |
| 1032 return true; | 1027 return true; |
| 1033 } | 1028 } |
| 1034 | 1029 |
| 1035 virtual bool BypassListIsReversed() { | 1030 virtual bool BypassListIsReversed() { |
| 1036 return reversed_bypass_list_; | 1031 return reversed_bypass_list_; |
| 1037 } | 1032 } |
| 1038 | 1033 |
| 1039 virtual bool MatchHostsUsingSuffixMatching() { | 1034 virtual bool MatchHostsUsingSuffixMatching() { |
| 1040 return true; | 1035 return true; |
| 1041 } | 1036 } |
| 1042 | 1037 |
| 1043 private: | 1038 private: |
| 1044 void ResetCachedSettings() { | 1039 void ResetCachedSettings() { |
| 1045 string_table_.clear(); | 1040 string_table_.clear(); |
| 1046 strings_table_.clear(); | 1041 strings_table_.clear(); |
| 1047 indirect_manual_ = false; | 1042 indirect_manual_ = false; |
| 1048 auto_no_pac_ = false; | 1043 auto_no_pac_ = false; |
| 1049 reversed_bypass_list_ = false; | 1044 reversed_bypass_list_ = false; |
| 1050 } | 1045 } |
| 1051 | 1046 |
| 1052 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { | 1047 FilePath KDEHomeToConfigPath(const FilePath& kde_home) { |
| 1053 return kde_home.Append("share").Append("config"); | 1048 return kde_home.Append("share").Append("config"); |
| 1054 } | 1049 } |
| 1055 | 1050 |
| 1056 void AddProxy(Setting host_key, const std::string& value) { | 1051 void AddProxy(StringSetting host_key, const std::string& value) { |
| 1057 if (value.empty() || value.substr(0, 3) == "//:") | 1052 if (value.empty() || value.substr(0, 3) == "//:") |
| 1058 // No proxy. | 1053 // No proxy. |
| 1059 return; | 1054 return; |
| 1060 // We don't need to parse the port number out; GetProxyFromSettings() | 1055 // We don't need to parse the port number out; GetProxyFromSettings() |
| 1061 // would only append it right back again. So we just leave the port | 1056 // would only append it right back again. So we just leave the port |
| 1062 // number right in the host string. | 1057 // number right in the host string. |
| 1063 string_table_[host_key] = value; | 1058 string_table_[host_key] = value; |
| 1064 } | 1059 } |
| 1065 | 1060 |
| 1066 void AddHostList(Setting key, const std::string& value) { | 1061 void AddHostList(StringListSetting key, const std::string& value) { |
| 1067 std::vector<std::string> tokens; | 1062 std::vector<std::string> tokens; |
| 1068 StringTokenizer tk(value, ", "); | 1063 StringTokenizer tk(value, ", "); |
| 1069 while (tk.GetNext()) { | 1064 while (tk.GetNext()) { |
| 1070 std::string token = tk.token(); | 1065 std::string token = tk.token(); |
| 1071 if (!token.empty()) | 1066 if (!token.empty()) |
| 1072 tokens.push_back(token); | 1067 tokens.push_back(token); |
| 1073 } | 1068 } |
| 1074 strings_table_[key] = tokens; | 1069 strings_table_[key] = tokens; |
| 1075 } | 1070 } |
| 1076 | 1071 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 base::StringToInt(value, &mode); | 1124 base::StringToInt(value, &mode); |
| 1130 if (mode) { | 1125 if (mode) { |
| 1131 // ProxyConfig does not support authentication parameters, but | 1126 // ProxyConfig does not support authentication parameters, but |
| 1132 // Chrome will prompt for the password later. So we ignore this. | 1127 // Chrome will prompt for the password later. So we ignore this. |
| 1133 LOG(WARNING) << | 1128 LOG(WARNING) << |
| 1134 "Proxy authentication parameters ignored, see bug 16709"; | 1129 "Proxy authentication parameters ignored, see bug 16709"; |
| 1135 } | 1130 } |
| 1136 } | 1131 } |
| 1137 } | 1132 } |
| 1138 | 1133 |
| 1139 void ResolveIndirect(Setting key) { | 1134 void ResolveIndirect(StringSetting key) { |
| 1140 string_map_type::iterator it = string_table_.find(key); | 1135 string_map_type::iterator it = string_table_.find(key); |
| 1141 if (it != string_table_.end()) { | 1136 if (it != string_table_.end()) { |
| 1142 std::string value; | 1137 std::string value; |
| 1143 if (env_var_getter_->GetVar(it->second.c_str(), &value)) | 1138 if (env_var_getter_->GetVar(it->second.c_str(), &value)) |
| 1144 it->second = value; | 1139 it->second = value; |
| 1145 else | 1140 else |
| 1146 string_table_.erase(it); | 1141 string_table_.erase(it); |
| 1147 } | 1142 } |
| 1148 } | 1143 } |
| 1149 | 1144 |
| 1150 void ResolveIndirectList(Setting key) { | 1145 void ResolveIndirectList(StringListSetting key) { |
| 1151 strings_map_type::iterator it = strings_table_.find(key); | 1146 strings_map_type::iterator it = strings_table_.find(key); |
| 1152 if (it != strings_table_.end()) { | 1147 if (it != strings_table_.end()) { |
| 1153 std::string value; | 1148 std::string value; |
| 1154 if (!it->second.empty() && | 1149 if (!it->second.empty() && |
| 1155 env_var_getter_->GetVar(it->second[0].c_str(), &value)) | 1150 env_var_getter_->GetVar(it->second[0].c_str(), &value)) |
| 1156 AddHostList(key, value); | 1151 AddHostList(key, value); |
| 1157 else | 1152 else |
| 1158 strings_table_.erase(it); | 1153 strings_table_.erase(it); |
| 1159 } | 1154 } |
| 1160 } | 1155 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 if (kioslaverc_touched) { | 1305 if (kioslaverc_touched) { |
| 1311 // We don't use Reset() because the timer may not yet be running. | 1306 // We don't use Reset() because the timer may not yet be running. |
| 1312 // (In that case Stop() is a no-op.) | 1307 // (In that case Stop() is a no-op.) |
| 1313 debounce_timer_.Stop(); | 1308 debounce_timer_.Stop(); |
| 1314 debounce_timer_.Start(base::TimeDelta::FromMilliseconds( | 1309 debounce_timer_.Start(base::TimeDelta::FromMilliseconds( |
| 1315 kDebounceTimeoutMilliseconds), this, | 1310 kDebounceTimeoutMilliseconds), this, |
| 1316 &SettingGetterImplKDE::OnDebouncedNotification); | 1311 &SettingGetterImplKDE::OnDebouncedNotification); |
| 1317 } | 1312 } |
| 1318 } | 1313 } |
| 1319 | 1314 |
| 1320 typedef std::map<Setting, std::string> string_map_type; | 1315 typedef std::map<StringSetting, std::string> string_map_type; |
| 1321 typedef std::map<Setting, std::vector<std::string> > strings_map_type; | 1316 typedef std::map<StringListSetting, |
| 1317 std::vector<std::string> > strings_map_type; |
| 1322 | 1318 |
| 1323 int inotify_fd_; | 1319 int inotify_fd_; |
| 1324 base::MessagePumpLibevent::FileDescriptorWatcher inotify_watcher_; | 1320 base::MessagePumpLibevent::FileDescriptorWatcher inotify_watcher_; |
| 1325 ProxyConfigServiceLinux::Delegate* notify_delegate_; | 1321 ProxyConfigServiceLinux::Delegate* notify_delegate_; |
| 1326 base::OneShotTimer<SettingGetterImplKDE> debounce_timer_; | 1322 base::OneShotTimer<SettingGetterImplKDE> debounce_timer_; |
| 1327 FilePath kde_config_dir_; | 1323 FilePath kde_config_dir_; |
| 1328 bool indirect_manual_; | 1324 bool indirect_manual_; |
| 1329 bool auto_no_pac_; | 1325 bool auto_no_pac_; |
| 1330 bool reversed_bypass_list_; | 1326 bool reversed_bypass_list_; |
| 1331 // We don't own |env_var_getter_|. It's safe to hold a pointer to it, since | 1327 // We don't own |env_var_getter_|. It's safe to hold a pointer to it, since |
| 1332 // both it and us are owned by ProxyConfigServiceLinux::Delegate, and have the | 1328 // both it and us are owned by ProxyConfigServiceLinux::Delegate, and have the |
| 1333 // same lifetime. | 1329 // same lifetime. |
| 1334 base::Environment* env_var_getter_; | 1330 base::Environment* env_var_getter_; |
| 1335 | 1331 |
| 1336 // We cache these settings whenever we re-read the kioslaverc file. | 1332 // We cache these settings whenever we re-read the kioslaverc file. |
| 1337 string_map_type string_table_; | 1333 string_map_type string_table_; |
| 1338 strings_map_type strings_table_; | 1334 strings_map_type strings_table_; |
| 1339 | 1335 |
| 1340 // Message loop of the file thread, for reading kioslaverc. If NULL, | 1336 // Message loop of the file thread, for reading kioslaverc. If NULL, |
| 1341 // just read it directly (for testing). We also handle inotify events | 1337 // just read it directly (for testing). We also handle inotify events |
| 1342 // on this thread. | 1338 // on this thread. |
| 1343 MessageLoopForIO* file_loop_; | 1339 MessageLoopForIO* file_loop_; |
| 1344 | 1340 |
| 1345 DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); | 1341 DISALLOW_COPY_AND_ASSIGN(SettingGetterImplKDE); |
| 1346 }; | 1342 }; |
| 1347 | 1343 |
| 1348 } // namespace | 1344 } // namespace |
| 1349 | 1345 |
| 1350 bool ProxyConfigServiceLinux::Delegate::GetProxyFromSettings( | 1346 bool ProxyConfigServiceLinux::Delegate::GetProxyFromSettings( |
| 1351 SettingGetter::Setting host_key, | 1347 SettingGetter::StringSetting host_key, |
| 1352 ProxyServer* result_server) { | 1348 ProxyServer* result_server) { |
| 1353 std::string host; | 1349 std::string host; |
| 1354 if (!setting_getter_->GetString(host_key, &host) || host.empty()) { | 1350 if (!setting_getter_->GetString(host_key, &host) || host.empty()) { |
| 1355 // Unset or empty. | 1351 // Unset or empty. |
| 1356 return false; | 1352 return false; |
| 1357 } | 1353 } |
| 1358 // Check for an optional port. | 1354 // Check for an optional port. |
| 1359 int port = 0; | 1355 int port = 0; |
| 1360 SettingGetter::Setting port_key = | 1356 SettingGetter::IntSetting port_key = |
| 1361 SettingGetter::HostSettingToPortSetting(host_key); | 1357 SettingGetter::HostSettingToPortSetting(host_key); |
| 1362 setting_getter_->GetInt(port_key, &port); | 1358 setting_getter_->GetInt(port_key, &port); |
| 1363 if (port != 0) { | 1359 if (port != 0) { |
| 1364 // If a port is set and non-zero: | 1360 // If a port is set and non-zero: |
| 1365 host += ":" + base::IntToString(port); | 1361 host += ":" + base::IntToString(port); |
| 1366 } | 1362 } |
| 1367 | 1363 |
| 1368 // gconf settings do not appear to distinguish between SOCKS version. We | 1364 // gconf settings do not appear to distinguish between SOCKS version. We |
| 1369 // default to version 5. For more information on this policy decision, see: | 1365 // default to version 5. For more information on this policy decision, see: |
| 1370 // http://code.google.com/p/chromium/issues/detail?id=55912#c2 | 1366 // http://code.google.com/p/chromium/issues/detail?id=55912#c2 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { | 1752 void ProxyConfigServiceLinux::RemoveObserver(Observer* observer) { |
| 1757 delegate_->RemoveObserver(observer); | 1753 delegate_->RemoveObserver(observer); |
| 1758 } | 1754 } |
| 1759 | 1755 |
| 1760 ProxyConfigService::ConfigAvailability | 1756 ProxyConfigService::ConfigAvailability |
| 1761 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { | 1757 ProxyConfigServiceLinux::GetLatestProxyConfig(ProxyConfig* config) { |
| 1762 return delegate_->GetLatestProxyConfig(config); | 1758 return delegate_->GetLatestProxyConfig(config); |
| 1763 } | 1759 } |
| 1764 | 1760 |
| 1765 } // namespace net | 1761 } // namespace net |
| OLD | NEW |