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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
OLDNEW
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 #ifndef NET_PROXY_PROXY_CONFIG_H_ 5 #ifndef NET_PROXY_PROXY_CONFIG_H_
6 #define NET_PROXY_PROXY_CONFIG_H_ 6 #define NET_PROXY_PROXY_CONFIG_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 TYPE_NO_RULES, 44 TYPE_NO_RULES,
45 TYPE_SINGLE_PROXY, 45 TYPE_SINGLE_PROXY,
46 TYPE_PROXY_PER_SCHEME, 46 TYPE_PROXY_PER_SCHEME,
47 }; 47 };
48 48
49 // Note that the default of TYPE_NO_RULES results in direct connections 49 // Note that the default of TYPE_NO_RULES results in direct connections
50 // being made when using this ProxyConfig. 50 // being made when using this ProxyConfig.
51 ProxyRules(); 51 ProxyRules();
52 ~ProxyRules(); 52 ~ProxyRules();
53 53
54 bool empty() const { 54 bool empty() const { return type == TYPE_NO_RULES; }
55 return type == TYPE_NO_RULES;
56 }
57 55
58 // Sets |result| with the proxies to use for |url| based on the current 56 // Sets |result| with the proxies to use for |url| based on the current
59 // rules. 57 // rules.
60 void Apply(const GURL& url, ProxyInfo* result) const; 58 void Apply(const GURL& url, ProxyInfo* result) const;
61 59
62 // Parses the rules from a string, indicating which proxies to use. 60 // Parses the rules from a string, indicating which proxies to use.
63 // 61 //
64 // proxy-uri = [<proxy-scheme>"://"]<proxy-host>[":"<proxy-port>] 62 // proxy-uri = [<proxy-scheme>"://"]<proxy-host>[":"<proxy-port>]
65 // 63 //
66 // proxy-uri-list = <proxy-uri>[","<proxy-uri-list>] 64 // proxy-uri-list = <proxy-uri>[","<proxy-uri-list>]
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 // Returns true if this config contains any "automatic" settings. See the 163 // Returns true if this config contains any "automatic" settings. See the
166 // class description for what that means. 164 // class description for what that means.
167 bool HasAutomaticSettings() const; 165 bool HasAutomaticSettings() const;
168 166
169 void ClearAutomaticSettings(); 167 void ClearAutomaticSettings();
170 168
171 // Creates a Value dump of this configuration. The caller is responsible for 169 // Creates a Value dump of this configuration. The caller is responsible for
172 // deleting the returned value. 170 // deleting the returned value.
173 base::DictionaryValue* ToValue() const; 171 base::DictionaryValue* ToValue() const;
174 172
175 ProxyRules& proxy_rules() { 173 ProxyRules& proxy_rules() { return proxy_rules_; }
176 return proxy_rules_;
177 }
178 174
179 const ProxyRules& proxy_rules() const { 175 const ProxyRules& proxy_rules() const { return proxy_rules_; }
180 return proxy_rules_;
181 }
182 176
183 void set_pac_url(const GURL& url) { 177 void set_pac_url(const GURL& url) { pac_url_ = url; }
184 pac_url_ = url;
185 }
186 178
187 const GURL& pac_url() const { 179 const GURL& pac_url() const { return pac_url_; }
188 return pac_url_;
189 }
190 180
191 void set_pac_mandatory(bool enable_pac_mandatory) { 181 void set_pac_mandatory(bool enable_pac_mandatory) {
192 pac_mandatory_ = enable_pac_mandatory; 182 pac_mandatory_ = enable_pac_mandatory;
193 } 183 }
194 184
195 bool pac_mandatory() const { 185 bool pac_mandatory() const { return pac_mandatory_; }
196 return pac_mandatory_;
197 }
198 186
199 bool has_pac_url() const { 187 bool has_pac_url() const { return pac_url_.is_valid(); }
200 return pac_url_.is_valid();
201 }
202 188
203 void set_auto_detect(bool enable_auto_detect) { 189 void set_auto_detect(bool enable_auto_detect) {
204 auto_detect_ = enable_auto_detect; 190 auto_detect_ = enable_auto_detect;
205 } 191 }
206 192
207 bool auto_detect() const { 193 bool auto_detect() const { return auto_detect_; }
208 return auto_detect_;
209 }
210 194
211 void set_source(ProxyConfigSource source) { 195 void set_source(ProxyConfigSource source) { source_ = source; }
212 source_ = source;
213 }
214 196
215 ProxyConfigSource source() const { 197 ProxyConfigSource source() const { return source_; }
216 return source_;
217 }
218 198
219 // Helpers to construct some common proxy configurations. 199 // Helpers to construct some common proxy configurations.
220 200
221 static ProxyConfig CreateDirect() { 201 static ProxyConfig CreateDirect() { return ProxyConfig(); }
222 return ProxyConfig();
223 }
224 202
225 static ProxyConfig CreateAutoDetect() { 203 static ProxyConfig CreateAutoDetect() {
226 ProxyConfig config; 204 ProxyConfig config;
227 config.set_auto_detect(true); 205 config.set_auto_detect(true);
228 return config; 206 return config;
229 } 207 }
230 208
231 static ProxyConfig CreateFromCustomPacURL(const GURL& pac_url) { 209 static ProxyConfig CreateFromCustomPacURL(const GURL& pac_url) {
232 ProxyConfig config; 210 ProxyConfig config;
233 config.set_pac_url(pac_url); 211 config.set_pac_url(pac_url);
(...skipping 17 matching lines...) Expand all
251 ProxyRules proxy_rules_; 229 ProxyRules proxy_rules_;
252 230
253 // Source of proxy settings. 231 // Source of proxy settings.
254 ProxyConfigSource source_; 232 ProxyConfigSource source_;
255 233
256 ID id_; 234 ID id_;
257 }; 235 };
258 236
259 } // namespace net 237 } // namespace net
260 238
261
262
263 #endif // NET_PROXY_PROXY_CONFIG_H_ 239 #endif // NET_PROXY_PROXY_CONFIG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698