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

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

Issue 160510: Better match IE's proxy settings.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix merge conflict Created 11 years, 4 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/init_proxy_resolver_unittest.cc ('k') | net/proxy/proxy_resolver_mac.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_RESOLVER_H_ 5 #ifndef NET_PROXY_PROXY_RESOLVER_H_
6 #define NET_PROXY_PROXY_RESOLVER_H_ 6 #define NET_PROXY_PROXY_RESOLVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "googleurl/src/gurl.h"
11 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
12 13
13 class GURL;
14
15 namespace net { 14 namespace net {
16 15
17 class ProxyInfo; 16 class ProxyInfo;
18 17
19 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies 18 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies
20 // to use for a particular URL. Generally the backend for a ProxyResolver is 19 // to use for a particular URL. Generally the backend for a ProxyResolver is
21 // a PAC script, but it doesn't need to be. ProxyResolver can service multiple 20 // a PAC script, but it doesn't need to be. ProxyResolver can service multiple
22 // requests at a time. 21 // requests at a time.
23 class ProxyResolver { 22 class ProxyResolver {
24 public: 23 public:
(...skipping 20 matching lines...) Expand all
45 // Cancels |request|. 44 // Cancels |request|.
46 virtual void CancelRequest(RequestHandle request) = 0; 45 virtual void CancelRequest(RequestHandle request) = 0;
47 46
48 // The PAC script backend can be specified to the ProxyResolver either via 47 // The PAC script backend can be specified to the ProxyResolver either via
49 // URL, or via the javascript text itself. If |expects_pac_bytes| is true, 48 // URL, or via the javascript text itself. If |expects_pac_bytes| is true,
50 // then PAC scripts should be specified using SetPacScriptByData(). Otherwise 49 // then PAC scripts should be specified using SetPacScriptByData(). Otherwise
51 // they should be specified using SetPacScriptByUrl(). 50 // they should be specified using SetPacScriptByUrl().
52 bool expects_pac_bytes() const { return expects_pac_bytes_; } 51 bool expects_pac_bytes() const { return expects_pac_bytes_; }
53 52
54 // Sets the PAC script backend to use for this proxy resolver (by URL). 53 // Sets the PAC script backend to use for this proxy resolver (by URL).
55 void SetPacScriptByUrl(const GURL& pac_url) { 54 int SetPacScriptByUrl(const GURL& url, CompletionCallback* callback) {
56 DCHECK(!expects_pac_bytes()); 55 DCHECK(!expects_pac_bytes());
57 SetPacScriptByUrlInternal(pac_url); 56 return SetPacScript(url, std::string(), callback);
58 } 57 }
59 58
60 // Sets the PAC script backend to use for this proxy resolver (by contents). 59 // Sets the PAC script backend to use for this proxy resolver (by contents).
61 void SetPacScriptByData(const std::string& bytes) { 60 int SetPacScriptByData(const std::string& bytes,
61 CompletionCallback* callback) {
62 DCHECK(expects_pac_bytes()); 62 DCHECK(expects_pac_bytes());
63 SetPacScriptByDataInternal(bytes); 63 return SetPacScript(GURL(), bytes, callback);
64 }
65
66 // TODO(eroman): Make this =0.
67 virtual void CancelSetPacScript() {
68 NOTREACHED();
64 } 69 }
65 70
66 private: 71 private:
67 // Called to set the PAC script backend to use. If |pac_url| is invalid, 72 // Called to set the PAC script backend to use. If |pac_url| is invalid,
68 // this is a request to use WPAD (auto detect). 73 // this is a request to use WPAD (auto detect). |bytes| may be empty if the
69 virtual void SetPacScriptByUrlInternal(const GURL& pac_url) {
70 NOTREACHED();
71 }
72
73 // Called to set the PAC script backend to use. |bytes| may be empty if the
74 // fetch failed, or if the fetch returned no content. 74 // fetch failed, or if the fetch returned no content.
75 virtual void SetPacScriptByDataInternal(const std::string& bytes) { 75 // Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies
76 NOTREACHED(); 76 // the result through |callback|.
77 } 77 virtual int SetPacScript(const GURL& pac_url,
78 const std::string& bytes,
79 CompletionCallback* callback) = 0;
78 80
79 const bool expects_pac_bytes_; 81 const bool expects_pac_bytes_;
80 82
81 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); 83 DISALLOW_COPY_AND_ASSIGN(ProxyResolver);
82 }; 84 };
83 85
84 } // namespace net 86 } // namespace net
85 87
86 #endif // NET_PROXY_PROXY_RESOLVER_H_ 88 #endif // NET_PROXY_PROXY_RESOLVER_H_
OLDNEW
« no previous file with comments | « net/proxy/init_proxy_resolver_unittest.cc ('k') | net/proxy/proxy_resolver_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698