Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(918)

Side by Side Diff: net/proxy/proxy_list.h

Issue 12315019: Change ProxyRules to handle ProxyLists rather than just single ProxyServer instances. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 13 matching lines...) Expand all
24 ProxyList(); 24 ProxyList();
25 ~ProxyList(); 25 ~ProxyList();
26 26
27 // Initializes the proxy list to a string containing one or more proxy servers 27 // Initializes the proxy list to a string containing one or more proxy servers
28 // delimited by a semicolon. 28 // delimited by a semicolon.
29 void Set(const std::string& proxy_uri_list); 29 void Set(const std::string& proxy_uri_list);
30 30
31 // Set the proxy list to a single entry, |proxy_server|. 31 // Set the proxy list to a single entry, |proxy_server|.
32 void SetSingleProxyServer(const ProxyServer& proxy_server); 32 void SetSingleProxyServer(const ProxyServer& proxy_server);
33 33
34 // Append a single proxy server to the end of the proxy list.
35 void AddProxyServer(const ProxyServer& proxy_server);
36
34 // De-prioritizes the proxies that we have cached as not working, by moving 37 // De-prioritizes the proxies that we have cached as not working, by moving
35 // them to the end of the fallback list. 38 // them to the end of the fallback list.
36 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info); 39 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info);
37 40
38 // Returns true if this proxy list contains at least one proxy that is 41 // Returns true if this proxy list contains at least one proxy that is
39 // not currently present in |proxy_retry_info|. 42 // not currently present in |proxy_retry_info|.
40 bool HasUntriedProxies(const ProxyRetryInfoMap& proxy_retry_info) const; 43 bool HasUntriedProxies(const ProxyRetryInfoMap& proxy_retry_info) const;
41 44
42 // Delete any entry which doesn't have one of the specified proxy schemes. 45 // Delete any entry which doesn't have one of the specified proxy schemes.
43 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. 46 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together.
44 void RemoveProxiesWithoutScheme(int scheme_bit_field); 47 void RemoveProxiesWithoutScheme(int scheme_bit_field);
45 48
46 // Clear the proxy list. 49 // Clear the proxy list.
47 void Clear(); 50 void Clear();
48 51
49 // Returns true if there is nothing left in the ProxyList. 52 // Returns true if there is nothing left in the ProxyList.
50 bool IsEmpty() const; 53 bool IsEmpty() const;
51 54
52 // Returns the number of proxy servers in this list. 55 // Returns the number of proxy servers in this list.
53 size_t size() const; 56 size_t size() const;
54 57
58 // Returns true if |*this| lists the same proxies as |other|.
59 bool Equals(const ProxyList& other) const;
60
55 // Returns the first proxy server in the list. It is only valid to call 61 // Returns the first proxy server in the list. It is only valid to call
56 // this if !IsEmpty(). 62 // this if !IsEmpty().
57 const ProxyServer& Get() const; 63 const ProxyServer& Get() const;
58 64
59 // Sets the list by parsing the pac result |pac_string|. 65 // Sets the list by parsing the pac result |pac_string|.
60 // Some examples for |pac_string|: 66 // Some examples for |pac_string|:
61 // "DIRECT" 67 // "DIRECT"
62 // "PROXY foopy1" 68 // "PROXY foopy1"
63 // "PROXY foopy1; SOCKS4 foopy2:1188" 69 // "PROXY foopy1; SOCKS4 foopy2:1188"
64 // Does a best-effort parse, and silently discards any errors. 70 // Does a best-effort parse, and silently discards any errors.
(...skipping 16 matching lines...) Expand all
81 const BoundNetLog& net_log) const; 87 const BoundNetLog& net_log) const;
82 88
83 private: 89 private:
84 // List of proxies. 90 // List of proxies.
85 std::vector<ProxyServer> proxies_; 91 std::vector<ProxyServer> proxies_;
86 }; 92 };
87 93
88 } // namespace net 94 } // namespace net
89 95
90 #endif // NET_PROXY_PROXY_LIST_H_ 96 #endif // NET_PROXY_PROXY_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698