| OLD | NEW |
| 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" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // they should be specified using SetPacScriptByUrl(). | 52 // they should be specified using SetPacScriptByUrl(). |
| 53 bool expects_pac_bytes() const { return expects_pac_bytes_; } | 53 bool expects_pac_bytes() const { return expects_pac_bytes_; } |
| 54 | 54 |
| 55 // Sets the PAC script backend to use for this proxy resolver (by URL). | 55 // Sets the PAC script backend to use for this proxy resolver (by URL). |
| 56 int SetPacScriptByUrl(const GURL& url, CompletionCallback* callback) { | 56 int SetPacScriptByUrl(const GURL& url, CompletionCallback* callback) { |
| 57 DCHECK(!expects_pac_bytes()); | 57 DCHECK(!expects_pac_bytes()); |
| 58 return SetPacScript(url, std::string(), callback); | 58 return SetPacScript(url, std::string(), callback); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Sets the PAC script backend to use for this proxy resolver (by contents). | 61 // Sets the PAC script backend to use for this proxy resolver (by contents). |
| 62 int SetPacScriptByData(const std::string& bytes, | 62 int SetPacScriptByData(const std::string& bytes_utf8, |
| 63 CompletionCallback* callback) { | 63 CompletionCallback* callback) { |
| 64 DCHECK(expects_pac_bytes()); | 64 DCHECK(expects_pac_bytes()); |
| 65 return SetPacScript(GURL(), bytes, callback); | 65 return SetPacScript(GURL(), bytes_utf8, callback); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // TODO(eroman): Make this =0. | 68 // TODO(eroman): Make this =0. |
| 69 virtual void CancelSetPacScript() { | 69 virtual void CancelSetPacScript() { |
| 70 NOTREACHED(); | 70 NOTREACHED(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 // Called to set the PAC script backend to use. If |pac_url| is invalid, | 74 // Called to set the PAC script backend to use. If |pac_url| is invalid, |
| 75 // this is a request to use WPAD (auto detect). |bytes| may be empty if the | 75 // this is a request to use WPAD (auto detect). |bytes_utf8| may be empty if |
| 76 // fetch failed, or if the fetch returned no content. | 76 // the fetch failed, or if the fetch returned no content. |
| 77 // Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies | 77 // Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies |
| 78 // the result through |callback|. | 78 // the result through |callback|. |
| 79 virtual int SetPacScript(const GURL& pac_url, | 79 virtual int SetPacScript(const GURL& pac_url, |
| 80 const std::string& bytes, | 80 const std::string& bytes_utf8, |
| 81 CompletionCallback* callback) = 0; | 81 CompletionCallback* callback) = 0; |
| 82 | 82 |
| 83 const bool expects_pac_bytes_; | 83 const bool expects_pac_bytes_; |
| 84 | 84 |
| 85 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); | 85 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 } // namespace net | 88 } // namespace net |
| 89 | 89 |
| 90 #endif // NET_PROXY_PROXY_RESOLVER_H_ | 90 #endif // NET_PROXY_PROXY_RESOLVER_H_ |
| OLD | NEW |