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

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

Issue 7033040: Linux: split ProxyConfigServiceLinux::SettingGetter::Setting into several enums. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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.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) 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 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_ 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_ 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 virtual MessageLoop* GetNotificationLoop() = 0; 63 virtual MessageLoop* GetNotificationLoop() = 0;
64 64
65 // Returns the data source's name (e.g. "gconf", "gsettings", "KDE", 65 // Returns the data source's name (e.g. "gconf", "gsettings", "KDE",
66 // "test"). Used only for diagnostic purposes (e.g. VLOG(1) etc.). 66 // "test"). Used only for diagnostic purposes (e.g. VLOG(1) etc.).
67 virtual const char* GetDataSource() = 0; 67 virtual const char* GetDataSource() = 0;
68 68
69 // These are all the values that can be fetched. We used to just use the 69 // These are all the values that can be fetched. We used to just use the
70 // corresponding paths in gconf for these, but gconf is now obsolete and 70 // corresponding paths in gconf for these, but gconf is now obsolete and
71 // in the future we'll be using mostly gsettings/kioslaverc so we 71 // in the future we'll be using mostly gsettings/kioslaverc so we
72 // enumerate them instead to avoid unnecessary string operations. 72 // enumerate them instead to avoid unnecessary string operations.
73 enum Setting { 73 enum StringSetting {
74 PROXY_MODE, // string 74 PROXY_MODE,
75 PROXY_AUTOCONF_URL, // string 75 PROXY_AUTOCONF_URL,
76 PROXY_USE_HTTP_PROXY, // bool 76 PROXY_HTTP_HOST,
77 PROXY_USE_SAME_PROXY, // bool 77 PROXY_HTTPS_HOST,
78 PROXY_USE_AUTHENTICATION, // bool 78 PROXY_FTP_HOST,
79 PROXY_IGNORE_HOSTS, // string list 79 PROXY_SOCKS_HOST,
80 PROXY_HTTP_HOST, // string 80 };
81 PROXY_HTTP_PORT, // int 81 enum BoolSetting {
82 PROXY_HTTPS_HOST, // string 82 PROXY_USE_HTTP_PROXY,
83 PROXY_HTTPS_PORT, // int 83 PROXY_USE_SAME_PROXY,
84 PROXY_FTP_HOST, // string 84 PROXY_USE_AUTHENTICATION,
85 PROXY_FTP_PORT, // int 85 };
86 PROXY_SOCKS_HOST, // string 86 enum IntSetting {
87 PROXY_SOCKS_PORT, // int 87 PROXY_HTTP_PORT,
88 PROXY_HTTPS_PORT,
89 PROXY_FTP_PORT,
90 PROXY_SOCKS_PORT,
91 };
92 enum StringListSetting {
93 PROXY_IGNORE_HOSTS,
88 }; 94 };
89 95
90 // Given a PROXY_*_HOST value, return the corresponding PROXY_*_PORT value. 96 // Given a PROXY_*_HOST value, return the corresponding PROXY_*_PORT value.
91 static Setting HostSettingToPortSetting(Setting host) { 97 static IntSetting HostSettingToPortSetting(StringSetting host) {
92 switch (host) { 98 switch (host) {
93 case PROXY_HTTP_HOST: 99 case PROXY_HTTP_HOST:
94 return PROXY_HTTP_PORT; 100 return PROXY_HTTP_PORT;
95 case PROXY_HTTPS_HOST: 101 case PROXY_HTTPS_HOST:
96 return PROXY_HTTPS_PORT; 102 return PROXY_HTTPS_PORT;
97 case PROXY_FTP_HOST: 103 case PROXY_FTP_HOST:
98 return PROXY_FTP_PORT; 104 return PROXY_FTP_PORT;
99 case PROXY_SOCKS_HOST: 105 case PROXY_SOCKS_HOST:
100 return PROXY_SOCKS_PORT; 106 return PROXY_SOCKS_PORT;
101 default: 107 default:
102 NOTREACHED(); 108 NOTREACHED();
103 return host; // placate compiler 109 return PROXY_HTTP_PORT; // Placate compiler.
104 } 110 }
105 } 111 }
106 112
107 // Gets a string type value from the data source and stores it in 113 // Gets a string type value from the data source and stores it in
108 // |*result|. Returns false if the key is unset or on error. Must only be 114 // |*result|. Returns false if the key is unset or on error. Must only be
109 // called after a successful call to Init(), and not after a failed call 115 // called after a successful call to Init(), and not after a failed call
110 // to SetUpNotifications() or after calling Release(). 116 // to SetUpNotifications() or after calling Release().
111 virtual bool GetString(Setting key, std::string* result) = 0; 117 virtual bool GetString(StringSetting key, std::string* result) = 0;
112 // Same thing for a bool typed value. 118 // Same thing for a bool typed value.
113 virtual bool GetBool(Setting key, bool* result) = 0; 119 virtual bool GetBool(BoolSetting key, bool* result) = 0;
114 // Same for an int typed value. 120 // Same for an int typed value.
115 virtual bool GetInt(Setting key, int* result) = 0; 121 virtual bool GetInt(IntSetting key, int* result) = 0;
116 // And for a string list. 122 // And for a string list.
117 virtual bool GetStringList(Setting key, 123 virtual bool GetStringList(StringListSetting key,
118 std::vector<std::string>* result) = 0; 124 std::vector<std::string>* result) = 0;
119 125
120 // Returns true if the bypass list should be interpreted as a proxy 126 // Returns true if the bypass list should be interpreted as a proxy
121 // whitelist rather than blacklist. (This is KDE-specific.) 127 // whitelist rather than blacklist. (This is KDE-specific.)
122 virtual bool BypassListIsReversed() = 0; 128 virtual bool BypassListIsReversed() = 0;
123 129
124 // Returns true if the bypass rules should be interpreted as 130 // Returns true if the bypass rules should be interpreted as
125 // suffix-matching rules. 131 // suffix-matching rules.
126 virtual bool MatchHostsUsingSuffixMatching() = 0; 132 virtual bool MatchHostsUsingSuffixMatching() = 0;
127 133
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 ProxyServer* result_server); 212 ProxyServer* result_server);
207 // As above but with scheme set to HTTP, for convenience. 213 // As above but with scheme set to HTTP, for convenience.
208 bool GetProxyFromEnvVar(const char* variable, ProxyServer* result_server); 214 bool GetProxyFromEnvVar(const char* variable, ProxyServer* result_server);
209 // Fills proxy config from environment variables. Returns true if 215 // Fills proxy config from environment variables. Returns true if
210 // variables were found and the configuration is valid. 216 // variables were found and the configuration is valid.
211 bool GetConfigFromEnv(ProxyConfig* config); 217 bool GetConfigFromEnv(ProxyConfig* config);
212 218
213 // Obtains host and port config settings and parses a proxy server 219 // Obtains host and port config settings and parses a proxy server
214 // specification from it and puts it in result. Returns true if the 220 // specification from it and puts it in result. Returns true if the
215 // requested variable is defined and the value valid. 221 // requested variable is defined and the value valid.
216 bool GetProxyFromSettings(SettingGetter::Setting host_key, 222 bool GetProxyFromSettings(SettingGetter::StringSetting host_key,
217 ProxyServer* result_server); 223 ProxyServer* result_server);
218 // Fills proxy config from settings. Returns true if settings were found 224 // Fills proxy config from settings. Returns true if settings were found
219 // and the configuration is valid. 225 // and the configuration is valid.
220 bool GetConfigFromSettings(ProxyConfig* config); 226 bool GetConfigFromSettings(ProxyConfig* config);
221 227
222 // This method is posted from the UI thread to the IO thread to 228 // This method is posted from the UI thread to the IO thread to
223 // carry the new config information. 229 // carry the new config information.
224 void SetNewProxyConfig(const ProxyConfig& new_config); 230 void SetNewProxyConfig(const ProxyConfig& new_config);
225 231
226 // This method is run on the getter's notification thread. 232 // This method is run on the getter's notification thread.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 293
288 private: 294 private:
289 scoped_refptr<Delegate> delegate_; 295 scoped_refptr<Delegate> delegate_;
290 296
291 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceLinux); 297 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceLinux);
292 }; 298 };
293 299
294 } // namespace net 300 } // namespace net
295 301
296 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_ 302 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_config_service_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698