OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_LIST_H_ | 5 #ifndef NET_PROXY_PROXY_LIST_H_ |
6 #define NET_PROXY_PROXY_LIST_H_ | 6 #define NET_PROXY_PROXY_LIST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 // Set the proxy list to a single entry, |proxy_server|. | 25 // Set the proxy list to a single entry, |proxy_server|. |
26 void SetSingleProxyServer(const ProxyServer& proxy_server); | 26 void SetSingleProxyServer(const ProxyServer& proxy_server); |
27 | 27 |
28 // Remove all proxies known to be bad from the proxy list. | 28 // Remove all proxies known to be bad from the proxy list. |
29 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info); | 29 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info); |
30 | 30 |
31 // Delete any entry which doesn't have one of the specified proxy schemes. | 31 // Delete any entry which doesn't have one of the specified proxy schemes. |
32 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. | 32 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. |
33 void RemoveProxiesWithoutScheme(int scheme_bit_field); | 33 void RemoveProxiesWithoutScheme(int scheme_bit_field); |
34 | 34 |
35 // Returns the first valid proxy server in the list. | 35 // Returns true if there is nothing left in the ProxyList. |
36 ProxyServer Get() const; | 36 bool IsEmpty() const; |
| 37 |
| 38 // Returns the first proxy server in the list. It is only valid to call |
| 39 // this if !IsEmpty(). |
| 40 const ProxyServer& Get() const; |
37 | 41 |
38 // Set the list by parsing the pac result |pac_string|. | 42 // Set the list by parsing the pac result |pac_string|. |
39 // Some examples for |pac_string|: | 43 // Some examples for |pac_string|: |
40 // "DIRECT" | 44 // "DIRECT" |
41 // "PROXY foopy1" | 45 // "PROXY foopy1" |
42 // "PROXY foopy1; SOCKS4 foopy2:1188" | 46 // "PROXY foopy1; SOCKS4 foopy2:1188" |
43 void SetFromPacString(const std::string& pac_string); | 47 void SetFromPacString(const std::string& pac_string); |
44 | 48 |
45 // Returns a PAC-style semicolon-separated list of valid proxy servers. | 49 // Returns a PAC-style semicolon-separated list of valid proxy servers. |
46 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". | 50 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". |
47 std::string ToPacString() const; | 51 std::string ToPacString() const; |
48 | 52 |
49 // Marks the current proxy server as bad and deletes it from the list. The | 53 // Marks the current proxy server as bad and deletes it from the list. The |
50 // list of known bad proxies is given by proxy_retry_info. Returns true if | 54 // list of known bad proxies is given by proxy_retry_info. Returns true if |
51 // there is another server available in the list. | 55 // there is another server available in the list. |
52 bool Fallback(ProxyRetryInfoMap* proxy_retry_info); | 56 bool Fallback(ProxyRetryInfoMap* proxy_retry_info); |
53 | 57 |
54 private: | 58 private: |
55 // List of proxies. | 59 // List of proxies. |
56 std::vector<ProxyServer> proxies_; | 60 std::vector<ProxyServer> proxies_; |
57 }; | 61 }; |
58 | 62 |
59 } // namespace net | 63 } // namespace net |
60 | 64 |
61 #endif // NET_PROXY_PROXY_LIST_H_ | 65 #endif // NET_PROXY_PROXY_LIST_H_ |
OLD | NEW |