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

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

Issue 552164: Merge 34903, 34928, 35008, 35549, 36054 to the 249s branch.... (Closed) Base URL: svn://chrome-svn/chrome/branches/249s/src/
Patch Set: Fix some other merge conflicts Created 10 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « net/proxy/proxy_info.cc ('k') | net/proxy/proxy_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/net/proxy/proxy_list.h:r34903,34928,35008,35549,36054
OLDNEW
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_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
11 #include "net/proxy/proxy_retry_info.h" 11 #include "net/proxy/proxy_retry_info.h"
12 #include "net/proxy/proxy_server.h" 12 #include "net/proxy/proxy_server.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 // This class is used to hold a list of proxies returned by GetProxyForUrl or 16 // This class is used to hold a list of proxies returned by GetProxyForUrl or
17 // manually configured. It handles proxy fallback if multiple servers are 17 // manually configured. It handles proxy fallback if multiple servers are
18 // specified. 18 // specified.
19 class ProxyList { 19 class ProxyList {
20 public: 20 public:
21 // Initializes the proxy list to a string containing one or more proxy servers 21 // Initializes the proxy list to a string containing one or more proxy servers
22 // delimited by a semicolon. 22 // delimited by a semicolon.
23 void Set(const std::string& proxy_uri_list); 23 void Set(const std::string& proxy_uri_list);
24 24
25 // Set the proxy list to a single entry, |proxy_server|. 25 // Set the proxy list to a single entry, |proxy_server|.
26 void SetSingleProxyServer(const ProxyServer& proxy_server); 26 void SetSingleProxyServer(const ProxyServer& proxy_server);
27 27
28 // Remove all proxies known to be bad from the proxy list. 28 // De-prioritizes the proxies that we have cached as not working, by moving
29 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info); 29 // them to the end of the fallback list.
30 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info);
30 31
31 // Delete any entry which doesn't have one of the specified proxy schemes. 32 // Delete any entry which doesn't have one of the specified proxy schemes.
32 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. 33 // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together.
33 void RemoveProxiesWithoutScheme(int scheme_bit_field); 34 void RemoveProxiesWithoutScheme(int scheme_bit_field);
34 35
35 // Returns the first valid proxy server in the list. 36 // Returns true if there is nothing left in the ProxyList.
36 ProxyServer Get() const; 37 bool IsEmpty() const;
38
39 // Returns the first proxy server in the list. It is only valid to call
40 // this if !IsEmpty().
41 const ProxyServer& Get() const;
37 42
38 // Set the list by parsing the pac result |pac_string|. 43 // Set the list by parsing the pac result |pac_string|.
39 // Some examples for |pac_string|: 44 // Some examples for |pac_string|:
40 // "DIRECT" 45 // "DIRECT"
41 // "PROXY foopy1" 46 // "PROXY foopy1"
42 // "PROXY foopy1; SOCKS4 foopy2:1188" 47 // "PROXY foopy1; SOCKS4 foopy2:1188"
43 void SetFromPacString(const std::string& pac_string); 48 void SetFromPacString(const std::string& pac_string);
44 49
45 // Returns a PAC-style semicolon-separated list of valid proxy servers. 50 // Returns a PAC-style semicolon-separated list of valid proxy servers.
46 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". 51 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy".
47 std::string ToPacString() const; 52 std::string ToPacString() const;
48 53
49 // Marks the current proxy server as bad and deletes it from the list. The 54 // Marks the current proxy server as bad and deletes it from the list. The
50 // list of known bad proxies is given by proxy_retry_info. Returns true if 55 // list of known bad proxies is given by proxy_retry_info. Returns true if
51 // there is another server available in the list. 56 // there is another server available in the list.
52 bool Fallback(ProxyRetryInfoMap* proxy_retry_info); 57 bool Fallback(ProxyRetryInfoMap* proxy_retry_info);
53 58
54 private: 59 private:
55 // List of proxies. 60 // List of proxies.
56 std::vector<ProxyServer> proxies_; 61 std::vector<ProxyServer> proxies_;
57 }; 62 };
58 63
59 } // namespace net 64 } // namespace net
60 65
61 #endif // NET_PROXY_PROXY_LIST_H_ 66 #endif // NET_PROXY_PROXY_LIST_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_info.cc ('k') | net/proxy/proxy_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698