diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-02 22:37:18 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-02 22:37:18 +0000 |
commit | 7dc52f27b89ea2ab8b82a127fc899efef70fc613 (patch) | |
tree | 7ff99224862492b729312a8847f432ea661d635e /net/proxy/proxy_list.h | |
parent | c8bab10c787854885375ac3c4d98c0d8b51a94c9 (diff) | |
download | chromium_src-7dc52f27b89ea2ab8b82a127fc899efef70fc613.zip chromium_src-7dc52f27b89ea2ab8b82a127fc899efef70fc613.tar.gz chromium_src-7dc52f27b89ea2ab8b82a127fc899efef70fc613.tar.bz2 |
split up proxy_service into several files (one per class).
Review URL: http://codereview.chromium.org/28278
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10739 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_list.h')
-rw-r--r-- | net/proxy/proxy_list.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/net/proxy/proxy_list.h b/net/proxy/proxy_list.h new file mode 100644 index 0000000..ac46671 --- /dev/null +++ b/net/proxy/proxy_list.h @@ -0,0 +1,59 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef NET_PROXY_PROXY_LIST_H_ +#define NET_PROXY_PROXY_LIST_H_ + +#include <string> +#include <vector> + +#include "net/proxy/proxy_retry_info.h" +#include "net/proxy/proxy_server.h" + +namespace net { + +// This class is used to hold a list of proxies returned by GetProxyForUrl or +// manually configured. It handles proxy fallback if multiple servers are +// specified. +class ProxyList { + public: + // Initializes the proxy list to a string containing one or more proxy servers + // delimited by a semicolon. + void Set(const std::string& proxy_uri_list); + + // Remove all proxies known to be bad from the proxy list. + void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info); + + // Delete any entry which doesn't have one of the specified proxy schemes. + // |scheme_bit_field| is a bunch of ProxyServer::Scheme bitwise ORed together. + void RemoveProxiesWithoutScheme(int scheme_bit_field); + + // Returns the first valid proxy server in the list. + ProxyServer Get() const; + + // Set the list by parsing the pac result |pac_string|. + // Some examples for |pac_string|: + // "DIRECT" + // "PROXY foopy1" + // "PROXY foopy1; SOCKS4 foopy2:1188" + void SetFromPacString(const std::string& pac_string); + + // Returns a PAC-style semicolon-separated list of valid proxy servers. + // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". + std::string ToPacString() const; + + // Marks the current proxy server as bad and deletes it from the list. The + // list of known bad proxies is given by proxy_retry_info. Returns true if + // there is another server available in the list. + bool Fallback(ProxyRetryInfoMap* proxy_retry_info); + + private: + // List of proxies. + std::vector<ProxyServer> proxies_; +}; + +} // namespace net + +#endif // NET_PROXY_PROXY_LIST_H_ + |