OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_INFO_H_ | 5 #ifndef NET_PROXY_PROXY_INFO_H_ |
6 #define NET_PROXY_PROXY_INFO_H_ | 6 #define NET_PROXY_PROXY_INFO_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
| 12 #include "net/base/net_log.h" |
12 #include "net/proxy/proxy_config.h" | 13 #include "net/proxy/proxy_config.h" |
13 #include "net/proxy/proxy_list.h" | 14 #include "net/proxy/proxy_list.h" |
14 #include "net/proxy/proxy_retry_info.h" | 15 #include "net/proxy/proxy_retry_info.h" |
15 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 // This object holds proxy information returned by ResolveProxy. | 20 // This object holds proxy information returned by ResolveProxy. |
20 class NET_EXPORT ProxyInfo { | 21 class NET_EXPORT ProxyInfo { |
21 public: | 22 public: |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 80 |
80 // Returns the first valid proxy server. is_empty() must be false to be able | 81 // Returns the first valid proxy server. is_empty() must be false to be able |
81 // to call this function. | 82 // to call this function. |
82 const ProxyServer& proxy_server() const { return proxy_list_.Get(); } | 83 const ProxyServer& proxy_server() const { return proxy_list_.Get(); } |
83 | 84 |
84 // See description in ProxyList::ToPacString(). | 85 // See description in ProxyList::ToPacString(). |
85 std::string ToPacString() const; | 86 std::string ToPacString() const; |
86 | 87 |
87 // Marks the current proxy as bad. Returns true if there is another proxy | 88 // Marks the current proxy as bad. Returns true if there is another proxy |
88 // available to try in proxy list_. | 89 // available to try in proxy list_. |
89 bool Fallback(ProxyRetryInfoMap* proxy_retry_info); | 90 bool Fallback(const BoundNetLog& net_log); |
90 | 91 |
91 // De-prioritizes the proxies that we have cached as not working, by moving | 92 // De-prioritizes the proxies that we have cached as not working, by moving |
92 // them to the end of the proxy list. | 93 // them to the end of the proxy list. |
93 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); | 94 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); |
94 | 95 |
95 // Deletes any entry which doesn't have one of the specified proxy schemes. | 96 // Deletes any entry which doesn't have one of the specified proxy schemes. |
96 void RemoveProxiesWithoutScheme(int scheme_bit_field); | 97 void RemoveProxiesWithoutScheme(int scheme_bit_field); |
97 | 98 |
98 private: | 99 private: |
99 friend class ProxyService; | 100 friend class ProxyService; |
100 | 101 |
| 102 const ProxyRetryInfoMap& proxy_retry_info() const { |
| 103 return proxy_retry_info_; |
| 104 } |
| 105 |
101 // The ordered list of proxy servers (including DIRECT attempts) remaining to | 106 // The ordered list of proxy servers (including DIRECT attempts) remaining to |
102 // try. If proxy_list_ is empty, then there is nothing left to fall back to. | 107 // try. If proxy_list_ is empty, then there is nothing left to fall back to. |
103 ProxyList proxy_list_; | 108 ProxyList proxy_list_; |
104 | 109 |
| 110 // List of proxies that have been tried already. |
| 111 ProxyRetryInfoMap proxy_retry_info_; |
| 112 |
105 // This value identifies the proxy config used to initialize this object. | 113 // This value identifies the proxy config used to initialize this object. |
106 ProxyConfig::ID config_id_; | 114 ProxyConfig::ID config_id_; |
107 }; | 115 }; |
108 | 116 |
109 } // namespace net | 117 } // namespace net |
110 | 118 |
111 #endif // NET_PROXY_PROXY_INFO_H_ | 119 #endif // NET_PROXY_PROXY_INFO_H_ |
OLD | NEW |