| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". | 75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". |
| 76 std::string ToPacString() const; | 76 std::string ToPacString() const; |
| 77 | 77 |
| 78 // Returns a serialized value for the list. The caller takes ownership of it. | 78 // Returns a serialized value for the list. The caller takes ownership of it. |
| 79 base::ListValue* ToValue() const; | 79 base::ListValue* ToValue() const; |
| 80 | 80 |
| 81 // Marks the current proxy server as bad and deletes it from the list. The | 81 // Marks the current proxy server as bad and deletes it from the list. The |
| 82 // list of known bad proxies is given by proxy_retry_info. Returns true if | 82 // list of known bad proxies is given by proxy_retry_info. Returns true if |
| 83 // there is another server available in the list. | 83 // there is another server available in the list. |
| 84 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, | 84 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, |
| 85 const int net_error, |
| 85 const BoundNetLog& net_log); | 86 const BoundNetLog& net_log); |
| 86 | 87 |
| 87 // Updates |proxy_retry_info| to indicate that the first proxy in the list | 88 // Updates |proxy_retry_info| to indicate that the first proxy in the list |
| 88 // is bad. This is distinct from Fallback(), above, to allow updating proxy | 89 // is bad. This is distinct from Fallback(), above, to allow updating proxy |
| 89 // retry information without modifying a given transction's proxy list. Will | 90 // retry information without modifying a given transction's proxy list. Will |
| 90 // retry after |retry_delay| if positive, and will use the default proxy retry | 91 // retry after |retry_delay| if positive, and will use the default proxy retry |
| 91 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| | 92 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| |
| 92 // is true. Additionally updates |proxy_retry_info| with | 93 // is true. Additionally updates |proxy_retry_info| with |
| 93 // |another_proxy_to_bypass| if non-empty. | 94 // |another_proxy_to_bypass| if non-empty. |
| 94 void UpdateRetryInfoOnFallback( | 95 void UpdateRetryInfoOnFallback( |
| 95 ProxyRetryInfoMap* proxy_retry_info, | 96 ProxyRetryInfoMap* proxy_retry_info, |
| 96 base::TimeDelta retry_delay, | 97 base::TimeDelta retry_delay, |
| 97 bool reconsider, | 98 bool reconsider, |
| 98 const ProxyServer& another_proxy_to_bypass, | 99 const ProxyServer& another_proxy_to_bypass, |
| 100 const int net_error, |
| 99 const BoundNetLog& net_log) const; | 101 const BoundNetLog& net_log) const; |
| 100 | 102 |
| 101 private: | 103 private: |
| 102 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in | 104 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in |
| 103 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if | 105 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if |
| 104 // |try_while_bad| is true. | 106 // |try_while_bad| is true. |
| 105 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, | 107 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, |
| 106 base::TimeDelta retry_delay, | 108 base::TimeDelta retry_delay, |
| 107 bool try_while_bad, | 109 bool try_while_bad, |
| 108 const ProxyServer& proxy_to_retry, | 110 const ProxyServer& proxy_to_retry, |
| 111 const int net_error, |
| 109 const BoundNetLog& net_log) const; | 112 const BoundNetLog& net_log) const; |
| 110 | 113 |
| 111 // List of proxies. | 114 // List of proxies. |
| 112 std::vector<ProxyServer> proxies_; | 115 std::vector<ProxyServer> proxies_; |
| 113 }; | 116 }; |
| 114 | 117 |
| 115 } // namespace net | 118 } // namespace net |
| 116 | 119 |
| 117 #endif // NET_PROXY_PROXY_LIST_H_ | 120 #endif // NET_PROXY_PROXY_LIST_H_ |
| OLD | NEW |