| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const net::CompletionCallback& callback, | 45 const net::CompletionCallback& callback, |
| 46 RequestHandle* request, | 46 RequestHandle* request, |
| 47 const BoundNetLog& net_log) = 0; | 47 const BoundNetLog& net_log) = 0; |
| 48 | 48 |
| 49 // Cancels |request|. | 49 // Cancels |request|. |
| 50 virtual void CancelRequest(RequestHandle request) = 0; | 50 virtual void CancelRequest(RequestHandle request) = 0; |
| 51 | 51 |
| 52 // Gets the LoadState for |request|. | 52 // Gets the LoadState for |request|. |
| 53 virtual LoadState GetLoadState(RequestHandle request) const = 0; | 53 virtual LoadState GetLoadState(RequestHandle request) const = 0; |
| 54 | 54 |
| 55 // Gets the LoadState for |request|. May be called from another thread. | |
| 56 virtual LoadState GetLoadStateThreadSafe(RequestHandle request) const = 0; | |
| 57 | |
| 58 // The PAC script backend can be specified to the ProxyResolver either via | 55 // The PAC script backend can be specified to the ProxyResolver either via |
| 59 // URL, or via the javascript text itself. If |expects_pac_bytes| is true, | 56 // URL, or via the javascript text itself. If |expects_pac_bytes| is true, |
| 60 // then the ProxyResolverScriptData passed to SetPacScript() should | 57 // then the ProxyResolverScriptData passed to SetPacScript() should |
| 61 // contain the actual script bytes rather than just the URL. | 58 // contain the actual script bytes rather than just the URL. |
| 62 bool expects_pac_bytes() const { return expects_pac_bytes_; } | 59 bool expects_pac_bytes() const { return expects_pac_bytes_; } |
| 63 | 60 |
| 64 virtual void CancelSetPacScript() = 0; | 61 virtual void CancelSetPacScript() = 0; |
| 65 | 62 |
| 66 // Frees any unneeded memory held by the resolver, e.g. garbage in the JS | 63 // Frees any unneeded memory held by the resolver, e.g. garbage in the JS |
| 67 // engine. Most subclasses don't need to do anything, so we provide a default | 64 // engine. Most subclasses don't need to do anything, so we provide a default |
| 68 // no-op implementation. | 65 // no-op implementation. |
| 69 virtual void PurgeMemory() {} | 66 virtual void PurgeMemory() {} |
| 70 | 67 |
| 71 // Called to set the PAC script backend to use. | 68 // Called to set the PAC script backend to use. |
| 72 // Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies | 69 // Returns ERR_IO_PENDING in the case of asynchronous completion, and notifies |
| 73 // the result through |callback|. | 70 // the result through |callback|. |
| 74 virtual int SetPacScript( | 71 virtual int SetPacScript( |
| 75 const scoped_refptr<ProxyResolverScriptData>& pac_script, | 72 const scoped_refptr<ProxyResolverScriptData>& pac_script, |
| 76 const net::CompletionCallback& callback) = 0; | 73 const net::CompletionCallback& callback) = 0; |
| 77 | 74 |
| 78 // Optional shutdown code to be run before destruction. This is only used | |
| 79 // by the multithreaded runner to signal cleanup from origin thread | |
| 80 virtual void Shutdown() {} | |
| 81 | |
| 82 private: | 75 private: |
| 83 const bool expects_pac_bytes_; | 76 const bool expects_pac_bytes_; |
| 84 | 77 |
| 85 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); | 78 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); |
| 86 }; | 79 }; |
| 87 | 80 |
| 88 } // namespace net | 81 } // namespace net |
| 89 | 82 |
| 90 #endif // NET_PROXY_PROXY_RESOLVER_H_ | 83 #endif // NET_PROXY_PROXY_RESOLVER_H_ |
| OLD | NEW |