summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_resolver.h
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-02 22:37:18 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-02 22:37:18 +0000
commit7dc52f27b89ea2ab8b82a127fc899efef70fc613 (patch)
tree7ff99224862492b729312a8847f432ea661d635e /net/proxy/proxy_resolver.h
parentc8bab10c787854885375ac3c4d98c0d8b51a94c9 (diff)
downloadchromium_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_resolver.h')
-rw-r--r--net/proxy/proxy_resolver.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/net/proxy/proxy_resolver.h b/net/proxy/proxy_resolver.h
new file mode 100644
index 0000000..254b250
--- /dev/null
+++ b/net/proxy/proxy_resolver.h
@@ -0,0 +1,54 @@
+// 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_RESOLVER_H_
+#define NET_PROXY_PROXY_RESOLVER_H_
+
+#include <string>
+
+#include "base/logging.h"
+
+class GURL;
+
+namespace net {
+
+class ProxyInfo;
+
+// Synchronously resolve the proxy for a URL, using a PAC script. Called on the
+// PAC Thread.
+class ProxyResolver {
+ public:
+
+ // If a subclass sets |does_fetch| to false, then the owning ProxyResolver
+ // will download PAC scripts on our behalf, and notify changes with
+ // SetPacScript(). Otherwise the subclass is expected to fetch the
+ // PAC script internally, and SetPacScript() will go unused.
+ ProxyResolver(bool does_fetch) : does_fetch_(does_fetch) {}
+
+ virtual ~ProxyResolver() {}
+
+ // Query the proxy auto-config file (specified by |pac_url|) for the proxy to
+ // use to load the given |query_url|. Returns OK if successful or an error
+ // code otherwise.
+ virtual int GetProxyForURL(const GURL& query_url,
+ const GURL& pac_url,
+ ProxyInfo* results) = 0;
+
+ // Called whenever the PAC script has changed, with the contents of the
+ // PAC script. |bytes| may be empty string if there was a fetch error.
+ virtual void SetPacScript(const std::string& bytes) {
+ // Must override SetPacScript() if |does_fetch_ = true|.
+ NOTREACHED();
+ }
+
+ bool does_fetch() const { return does_fetch_; }
+
+ protected:
+ bool does_fetch_;
+};
+
+} // namespace net
+
+#endif // NET_PROXY_PROXY_RESOLVER_H_
+