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_SERVICE_H_ | 5 #ifndef NET_PROXY_PROXY_SERVICE_H_ |
6 #define NET_PROXY_PROXY_SERVICE_H_ | 6 #define NET_PROXY_PROXY_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 bool Equals(const ProxyConfig& other) const; | 58 bool Equals(const ProxyConfig& other) const; |
59 | 59 |
60 private: | 60 private: |
61 static int last_id_; | 61 static int last_id_; |
62 int id_; | 62 int id_; |
63 }; | 63 }; |
64 | 64 |
65 // Contains the information about when to retry a proxy server. | 65 // Contains the information about when to retry a proxy server. |
66 struct ProxyRetryInfo { | 66 struct ProxyRetryInfo { |
67 // We should not retry until this time. | 67 // We should not retry until this time. |
68 TimeTicks bad_until; | 68 base::TimeTicks bad_until; |
69 | 69 |
70 // This is the current delay. If the proxy is still bad, we need to increase | 70 // This is the current delay. If the proxy is still bad, we need to increase |
71 // this delay. | 71 // this delay. |
72 TimeDelta current_delay; | 72 base::TimeDelta current_delay; |
73 }; | 73 }; |
74 | 74 |
75 // Map of proxy servers with the associated RetryInfo structures. | 75 // Map of proxy servers with the associated RetryInfo structures. |
76 typedef std::map<std::string, ProxyRetryInfo> ProxyRetryInfoMap; | 76 typedef std::map<std::string, ProxyRetryInfo> ProxyRetryInfoMap; |
77 | 77 |
78 // This class can be used to resolve the proxy server to use when loading a | 78 // This class can be used to resolve the proxy server to use when loading a |
79 // HTTP(S) URL. It uses to the given ProxyResolver to handle the actual proxy | 79 // HTTP(S) URL. It uses to the given ProxyResolver to handle the actual proxy |
80 // resolution. See ProxyResolverWinHttp for example. The consumer of this | 80 // resolution. See ProxyResolverWinHttp for example. The consumer of this |
81 // class is responsible for ensuring that the ProxyResolver instance remains | 81 // class is responsible for ensuring that the ProxyResolver instance remains |
82 // valid for the lifetime of the ProxyService. | 82 // valid for the lifetime of the ProxyService. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 scoped_ptr<base::Thread> pac_thread_; | 154 scoped_ptr<base::Thread> pac_thread_; |
155 | 155 |
156 // We store the IE proxy config and a counter that is incremented each time | 156 // We store the IE proxy config and a counter that is incremented each time |
157 // the config changes. | 157 // the config changes. |
158 ProxyConfig config_; | 158 ProxyConfig config_; |
159 | 159 |
160 // Indicates that the configuration is bad and should be ignored. | 160 // Indicates that the configuration is bad and should be ignored. |
161 bool config_is_bad_; | 161 bool config_is_bad_; |
162 | 162 |
163 // The time when the proxy configuration was last read from the system. | 163 // The time when the proxy configuration was last read from the system. |
164 TimeTicks config_last_update_time_; | 164 base::TimeTicks config_last_update_time_; |
165 | 165 |
166 // Map of the known bad proxies and the information about the retry time. | 166 // Map of the known bad proxies and the information about the retry time. |
167 ProxyRetryInfoMap proxy_retry_info_; | 167 ProxyRetryInfoMap proxy_retry_info_; |
168 | 168 |
169 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 169 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
170 }; | 170 }; |
171 | 171 |
172 // This class is used to hold a list of proxies returned by GetProxyForUrl or | 172 // This class is used to hold a list of proxies returned by GetProxyForUrl or |
173 // manually configured. It handles proxy fallback if multiple servers are | 173 // manually configured. It handles proxy fallback if multiple servers are |
174 // specified. | 174 // specified. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // code if otherwise. | 272 // code if otherwise. |
273 virtual int GetProxyForURL(const std::string& query_url, | 273 virtual int GetProxyForURL(const std::string& query_url, |
274 const std::string& pac_url, | 274 const std::string& pac_url, |
275 ProxyInfo* results) = 0; | 275 ProxyInfo* results) = 0; |
276 }; | 276 }; |
277 | 277 |
278 } // namespace net | 278 } // namespace net |
279 | 279 |
280 #endif // NET_PROXY_PROXY_SERVICE_H_ | 280 #endif // NET_PROXY_PROXY_SERVICE_H_ |
281 | 281 |
OLD | NEW |