| OLD | NEW |
| 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 33 void SetSingleProxyServer(const ProxyServer& proxy_server); | 33 void SetSingleProxyServer(const ProxyServer& proxy_server); |
| 34 | 34 |
| 35 // De-prioritizes the proxies that we have cached as not working, by moving | 35 // De-prioritizes the proxies that we have cached as not working, by moving |
| 36 // them to the end of the fallback list. | 36 // them to the end of the fallback list. |
| 37 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); | 37 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); |
| 38 | 38 |
| 39 // Delete any entry which doesn't have one of the specified proxy schemes. | 39 // Delete any entry which doesn't have one of the specified proxy schemes. |
| 40 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. | 40 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. |
| 41 void RemoveProxiesWithoutScheme(int scheme_bit_field); | 41 void RemoveProxiesWithoutScheme(int scheme_bit_field); |
| 42 | 42 |
| 43 // Clear the proxy list. |
| 44 void Clear(); |
| 45 |
| 43 // Returns true if there is nothing left in the ProxyList. | 46 // Returns true if there is nothing left in the ProxyList. |
| 44 bool IsEmpty() const; | 47 bool IsEmpty() const; |
| 45 | 48 |
| 49 // Returns the number of proxy servers in this list. |
| 50 size_t size() const; |
| 51 |
| 46 // Returns the first proxy server in the list. It is only valid to call | 52 // Returns the first proxy server in the list. It is only valid to call |
| 47 // this if !IsEmpty(). | 53 // this if !IsEmpty(). |
| 48 const ProxyServer& Get() const; | 54 const ProxyServer& Get() const; |
| 49 | 55 |
| 50 // Sets the list by parsing the pac result |pac_string|. | 56 // Sets the list by parsing the pac result |pac_string|. |
| 51 // Some examples for |pac_string|: | 57 // Some examples for |pac_string|: |
| 52 // "DIRECT" | 58 // "DIRECT" |
| 53 // "PROXY foopy1" | 59 // "PROXY foopy1" |
| 54 // "PROXY foopy1; SOCKS4 foopy2:1188" | 60 // "PROXY foopy1; SOCKS4 foopy2:1188" |
| 55 // Does a best-effort parse, and silently discards any errors. | 61 // Does a best-effort parse, and silently discards any errors. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 66 const BoundNetLog& net_log); | 72 const BoundNetLog& net_log); |
| 67 | 73 |
| 68 private: | 74 private: |
| 69 // List of proxies. | 75 // List of proxies. |
| 70 std::vector<ProxyServer> proxies_; | 76 std::vector<ProxyServer> proxies_; |
| 71 }; | 77 }; |
| 72 | 78 |
| 73 } // namespace net | 79 } // namespace net |
| 74 | 80 |
| 75 #endif // NET_PROXY_PROXY_LIST_H_ | 81 #endif // NET_PROXY_PROXY_LIST_H_ |
| OLD | NEW |