Index: net/proxy/proxy_config_service_linux.cc |
=================================================================== |
--- net/proxy/proxy_config_service_linux.cc (revision 85972) |
+++ net/proxy/proxy_config_service_linux.cc (working copy) |
@@ -299,7 +299,7 @@ |
return "gconf"; |
} |
- virtual bool GetString(Setting key, std::string* result) { |
+ virtual bool GetString(StringSetting key, std::string* result) { |
switch (key) { |
case PROXY_MODE: |
return GetStringByPath("/system/proxy/mode", result); |
@@ -313,11 +313,10 @@ |
return GetStringByPath("/system/proxy/ftp_host", result); |
case PROXY_SOCKS_HOST: |
return GetStringByPath("/system/proxy/socks_host", result); |
- default: |
- return false; |
} |
+ 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.
|
} |
- virtual bool GetBool(Setting key, bool* result) { |
+ virtual bool GetBool(BoolSetting key, bool* result) { |
switch (key) { |
case PROXY_USE_HTTP_PROXY: |
return GetBoolByPath("/system/http_proxy/use_http_proxy", result); |
@@ -325,11 +324,10 @@ |
return GetBoolByPath("/system/http_proxy/use_same_proxy", result); |
case PROXY_USE_AUTHENTICATION: |
return GetBoolByPath("/system/http_proxy/use_authentication", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
- virtual bool GetInt(Setting key, int* result) { |
+ virtual bool GetInt(IntSetting key, int* result) { |
switch (key) { |
case PROXY_HTTP_PORT: |
return GetIntByPath("/system/http_proxy/port", result); |
@@ -339,17 +337,16 @@ |
return GetIntByPath("/system/proxy/ftp_port", result); |
case PROXY_SOCKS_PORT: |
return GetIntByPath("/system/proxy/socks_port", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
- virtual bool GetStringList(Setting key, std::vector<std::string>* result) { |
+ virtual bool GetStringList(StringListSetting key, |
+ std::vector<std::string>* result) { |
switch (key) { |
case PROXY_IGNORE_HOSTS: |
return GetStringListByPath("/system/http_proxy/ignore_hosts", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
virtual bool BypassListIsReversed() { |
@@ -591,7 +588,7 @@ |
return "gsettings"; |
} |
- virtual bool GetString(Setting key, std::string* result) { |
+ virtual bool GetString(StringSetting key, std::string* result) { |
DCHECK(client_); |
switch (key) { |
case PROXY_MODE: |
@@ -606,11 +603,10 @@ |
return GetStringByPath(ftp_client_, "host", result); |
case PROXY_SOCKS_HOST: |
return GetStringByPath(socks_client_, "host", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
- virtual bool GetBool(Setting key, bool* result) { |
+ virtual bool GetBool(BoolSetting key, bool* result) { |
DCHECK(client_); |
switch (key) { |
case PROXY_USE_HTTP_PROXY: |
@@ -625,11 +621,10 @@ |
// There is also no way to set this in the proxy config utility, but it |
// doesn't hurt us to get the actual setting (unlike the two above). |
return GetBoolByPath(http_client_, "use-authentication", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
- virtual bool GetInt(Setting key, int* result) { |
+ virtual bool GetInt(IntSetting key, int* result) { |
DCHECK(client_); |
switch (key) { |
case PROXY_HTTP_PORT: |
@@ -640,18 +635,17 @@ |
return GetIntByPath(ftp_client_, "port", result); |
case PROXY_SOCKS_PORT: |
return GetIntByPath(socks_client_, "port", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
- virtual bool GetStringList(Setting key, std::vector<std::string>* result) { |
+ virtual bool GetStringList(StringListSetting key, |
+ std::vector<std::string>* result) { |
DCHECK(client_); |
switch (key) { |
case PROXY_IGNORE_HOSTS: |
return GetStringListByPath(client_, "ignore-hosts", result); |
- default: |
- return false; |
} |
+ return false; // placate compiler |
} |
virtual bool BypassListIsReversed() { |
@@ -994,22 +988,23 @@ |
return "KDE"; |
} |
- virtual bool GetString(Setting key, std::string* result) { |
+ virtual bool GetString(StringSetting key, std::string* result) { |
string_map_type::iterator it = string_table_.find(key); |
if (it == string_table_.end()) |
return false; |
*result = it->second; |
return true; |
} |
- virtual bool GetBool(Setting key, bool* result) { |
+ virtual bool GetBool(BoolSetting key, bool* result) { |
// We don't ever have any booleans. |
return false; |
} |
- virtual bool GetInt(Setting key, int* result) { |
+ virtual bool GetInt(IntSetting key, int* result) { |
// We don't ever have any integers. (See AddProxy() below about ports.) |
return false; |
} |
- virtual bool GetStringList(Setting key, std::vector<std::string>* result) { |
+ virtual bool GetStringList(StringListSetting key, |
+ std::vector<std::string>* result) { |
strings_map_type::iterator it = strings_table_.find(key); |
if (it == strings_table_.end()) |
return false; |
@@ -1038,7 +1033,7 @@ |
return kde_home.Append("share").Append("config"); |
} |
- void AddProxy(Setting host_key, const std::string& value) { |
+ void AddProxy(StringSetting host_key, const std::string& value) { |
if (value.empty() || value.substr(0, 3) == "//:") |
// No proxy. |
return; |
@@ -1048,7 +1043,7 @@ |
string_table_[host_key] = value; |
} |
- void AddHostList(Setting key, const std::string& value) { |
+ void AddHostList(StringListSetting key, const std::string& value) { |
std::vector<std::string> tokens; |
StringTokenizer tk(value, ", "); |
while (tk.GetNext()) { |
@@ -1121,7 +1116,7 @@ |
} |
} |
- void ResolveIndirect(Setting key) { |
+ void ResolveIndirect(StringSetting key) { |
string_map_type::iterator it = string_table_.find(key); |
if (it != string_table_.end()) { |
std::string value; |
@@ -1132,7 +1127,7 @@ |
} |
} |
- void ResolveIndirectList(Setting key) { |
+ void ResolveIndirectList(StringListSetting key) { |
strings_map_type::iterator it = strings_table_.find(key); |
if (it != strings_table_.end()) { |
std::string value; |
@@ -1302,8 +1297,9 @@ |
} |
} |
- typedef std::map<Setting, std::string> string_map_type; |
- typedef std::map<Setting, std::vector<std::string> > strings_map_type; |
+ typedef std::map<StringSetting, std::string> string_map_type; |
+ typedef std::map<StringListSetting, |
+ std::vector<std::string> > strings_map_type; |
int inotify_fd_; |
base::MessagePumpLibevent::FileDescriptorWatcher inotify_watcher_; |
@@ -1333,7 +1329,7 @@ |
} // namespace |
bool ProxyConfigServiceLinux::Delegate::GetProxyFromSettings( |
- SettingGetter::Setting host_key, |
+ SettingGetter::StringSetting host_key, |
ProxyServer* result_server) { |
std::string host; |
if (!setting_getter_->GetString(host_key, &host) || host.empty()) { |
@@ -1342,7 +1338,7 @@ |
} |
// Check for an optional port. |
int port = 0; |
- SettingGetter::Setting port_key = |
+ SettingGetter::IntSetting port_key = |
SettingGetter::HostSettingToPortSetting(host_key); |
setting_getter_->GetInt(port_key, &port); |
if (port != 0) { |