OLD | NEW |
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_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 17 matching lines...) Expand all Loading... |
28 // delimited by a semicolon. | 28 // delimited by a semicolon. |
29 void Set(const std::string& proxy_uri_list); | 29 void Set(const std::string& proxy_uri_list); |
30 | 30 |
31 // Set the proxy list to a single entry, |proxy_server|. | 31 // Set the proxy list to a single entry, |proxy_server|. |
32 void SetSingleProxyServer(const ProxyServer& proxy_server); | 32 void SetSingleProxyServer(const ProxyServer& proxy_server); |
33 | 33 |
34 // De-prioritizes the proxies that we have cached as not working, by moving | 34 // De-prioritizes the proxies that we have cached as not working, by moving |
35 // them to the end of the fallback list. | 35 // them to the end of the fallback list. |
36 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); | 36 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); |
37 | 37 |
| 38 // Returns true if this proxy list contains at least one proxy that is |
| 39 // not currently present in |proxy_retry_info|. |
| 40 bool HasUntriedProxies(const ProxyRetryInfoMap& proxy_retry_info) const; |
| 41 |
38 // Delete any entry which doesn't have one of the specified proxy schemes. | 42 // Delete any entry which doesn't have one of the specified proxy schemes. |
39 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. | 43 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. |
40 void RemoveProxiesWithoutScheme(int scheme_bit_field); | 44 void RemoveProxiesWithoutScheme(int scheme_bit_field); |
41 | 45 |
42 // Clear the proxy list. | 46 // Clear the proxy list. |
43 void Clear(); | 47 void Clear(); |
44 | 48 |
45 // Returns true if there is nothing left in the ProxyList. | 49 // Returns true if there is nothing left in the ProxyList. |
46 bool IsEmpty() const; | 50 bool IsEmpty() const; |
47 | 51 |
(...skipping 15 matching lines...) Expand all Loading... |
63 // Returns a PAC-style semicolon-separated list of valid proxy servers. | 67 // Returns a PAC-style semicolon-separated list of valid proxy servers. |
64 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". | 68 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". |
65 std::string ToPacString() const; | 69 std::string ToPacString() const; |
66 | 70 |
67 // Marks the current proxy server as bad and deletes it from the list. The | 71 // Marks the current proxy server as bad and deletes it from the list. The |
68 // list of known bad proxies is given by proxy_retry_info. Returns true if | 72 // list of known bad proxies is given by proxy_retry_info. Returns true if |
69 // there is another server available in the list. | 73 // there is another server available in the list. |
70 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, | 74 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, |
71 const BoundNetLog& net_log); | 75 const BoundNetLog& net_log); |
72 | 76 |
| 77 // Updates |proxy_retry_info| to indicate that the first proxy in the list |
| 78 // is bad. This is distinct from Fallback(), above, to allow updating proxy |
| 79 // retry information without modifying a given transction's proxy list. |
| 80 void UpdateRetryInfoOnFallback(ProxyRetryInfoMap* proxy_retry_info, |
| 81 const BoundNetLog& net_log) const; |
| 82 |
73 private: | 83 private: |
74 // List of proxies. | 84 // List of proxies. |
75 std::vector<ProxyServer> proxies_; | 85 std::vector<ProxyServer> proxies_; |
76 }; | 86 }; |
77 | 87 |
78 } // namespace net | 88 } // namespace net |
79 | 89 |
80 #endif // NET_PROXY_PROXY_LIST_H_ | 90 #endif // NET_PROXY_PROXY_LIST_H_ |
OLD | NEW |