diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-04 22:43:12 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-04 22:43:12 +0000 |
commit | 620f57148c311c4dc2cf680a4a5861fbdcd29993 (patch) | |
tree | 93408ed35ebbaccd8f45734c7267392c81d71ca9 /net/proxy/proxy_resolver.h | |
parent | 289fdf862c649d17ddb2e08295304efb98f641f6 (diff) | |
download | chromium_src-620f57148c311c4dc2cf680a4a5861fbdcd29993.zip chromium_src-620f57148c311c4dc2cf680a4a5861fbdcd29993.tar.gz chromium_src-620f57148c311c4dc2cf680a4a5861fbdcd29993.tar.bz2 |
Better match IE's proxy settings.
* When BOTH autodetect and custom PAC script are given, try both.
* Use successful PAC parsing as the heuristic for determining when a script is valid (rather than first-request).
* Only apply the proxy bypass list when using non-PAC.
The high level explanation on how this works:
http://sites.google.com/a/chromium.org/dev/developers/design-documents/proxy-settings-fallback
BUG= http://crbug.com/18271, http://crbug.com/9985
TEST=unit tests.
Review URL: http://codereview.chromium.org/160510
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_resolver.h')
-rw-r--r-- | net/proxy/proxy_resolver.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/net/proxy/proxy_resolver.h b/net/proxy/proxy_resolver.h index ce0e81d..89fffb1 100644 --- a/net/proxy/proxy_resolver.h +++ b/net/proxy/proxy_resolver.h @@ -8,10 +8,9 @@ #include <string> #include "base/logging.h" +#include "googleurl/src/gurl.h" #include "net/base/completion_callback.h" -class GURL; - namespace net { class ProxyInfo; @@ -52,29 +51,32 @@ class ProxyResolver { bool expects_pac_bytes() const { return expects_pac_bytes_; } // Sets the PAC script backend to use for this proxy resolver (by URL). - void SetPacScriptByUrl(const GURL& pac_url) { + int SetPacScriptByUrl(const GURL& url, CompletionCallback* callback) { DCHECK(!expects_pac_bytes()); - SetPacScriptByUrlInternal(pac_url); + return SetPacScript(url, std::string(), callback); } // Sets the PAC script backend to use for this proxy resolver (by contents). - void SetPacScriptByData(const std::string& bytes) { + int SetPacScriptByData(const std::string& bytes, + CompletionCallback* callback) { DCHECK(expects_pac_bytes()); - SetPacScriptByDataInternal(bytes); + return SetPacScript(GURL(), bytes, callback); } - private: - // Called to set the PAC script backend to use. If |pac_url| is invalid, - // this is a request to use WPAD (auto detect). - virtual void SetPacScriptByUrlInternal(const GURL& pac_url) { + // TODO(eroman): Make this =0. + virtual void CancelSetPacScript() { NOTREACHED(); } - // Called to set the PAC script backend to use. |bytes| may be empty if the + private: + // Called to set the PAC script backend to use. If |pac_url| is invalid, + // this is a request to use WPAD (auto detect). |bytes| may be empty if the // fetch failed, or if the fetch returned no content. - virtual void SetPacScriptByDataInternal(const std::string& bytes) { - NOTREACHED(); - } + // Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies + // the result through |callback|. + virtual int SetPacScript(const GURL& pac_url, + const std::string& bytes, + CompletionCallback* callback) = 0; const bool expects_pac_bytes_; |