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 |
11 #include "net/proxy/proxy_retry_info.h" | 11 #include "net/proxy/proxy_retry_info.h" |
12 #include "net/proxy/proxy_server.h" | 12 #include "net/proxy/proxy_server.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 // This class is used to hold a list of proxies returned by GetProxyForUrl or | 16 // This class is used to hold a list of proxies returned by GetProxyForUrl or |
17 // manually configured. It handles proxy fallback if multiple servers are | 17 // manually configured. It handles proxy fallback if multiple servers are |
18 // specified. | 18 // specified. |
19 class ProxyList { | 19 class ProxyList { |
20 public: | 20 public: |
21 // Initializes the proxy list to a string containing one or more proxy servers | 21 // Initializes the proxy list to a string containing one or more proxy servers |
22 // delimited by a semicolon. | 22 // delimited by a semicolon. |
23 void Set(const std::string& proxy_uri_list); | 23 void Set(const std::string& proxy_uri_list); |
24 | 24 |
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 // De-prioritizes the proxies that we have cached as not working, by moving |
29 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info); | 29 // them to the end of the fallback list. |
| 30 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); |
30 | 31 |
31 // Delete any entry which doesn't have one of the specified proxy schemes. | 32 // 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. | 33 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. |
33 void RemoveProxiesWithoutScheme(int scheme_bit_field); | 34 void RemoveProxiesWithoutScheme(int scheme_bit_field); |
34 | 35 |
35 // Returns true if there is nothing left in the ProxyList. | 36 // Returns true if there is nothing left in the ProxyList. |
36 bool IsEmpty() const; | 37 bool IsEmpty() const; |
37 | 38 |
38 // Returns the first proxy server in the list. It is only valid to call | 39 // Returns the first proxy server in the list. It is only valid to call |
39 // this if !IsEmpty(). | 40 // this if !IsEmpty(). |
(...skipping 16 matching lines...) Expand all Loading... |
56 bool Fallback(ProxyRetryInfoMap* proxy_retry_info); | 57 bool Fallback(ProxyRetryInfoMap* proxy_retry_info); |
57 | 58 |
58 private: | 59 private: |
59 // List of proxies. | 60 // List of proxies. |
60 std::vector<ProxyServer> proxies_; | 61 std::vector<ProxyServer> proxies_; |
61 }; | 62 }; |
62 | 63 |
63 } // namespace net | 64 } // namespace net |
64 | 65 |
65 #endif // NET_PROXY_PROXY_LIST_H_ | 66 #endif // NET_PROXY_PROXY_LIST_H_ |
OLD | NEW |