| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/base/load_states.h" |
| 14 #include "net/base/net_export.h" | 15 #include "net/base/net_export.h" |
| 15 #include "net/proxy/proxy_resolver_script_data.h" | 16 #include "net/proxy/proxy_resolver_script_data.h" |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 class BoundNetLog; | 20 class BoundNetLog; |
| 20 class ProxyInfo; | 21 class ProxyInfo; |
| 21 | 22 |
| 22 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies | 23 // Interface for "proxy resolvers". A ProxyResolver fills in a list of proxies |
| 23 // to use for a particular URL. Generally the backend for a ProxyResolver is | 24 // to use for a particular URL. Generally the backend for a ProxyResolver is |
| (...skipping 18 matching lines...) Expand all Loading... |
| 42 // |*request| is written to, and can be passed to CancelRequest(). | 43 // |*request| is written to, and can be passed to CancelRequest(). |
| 43 virtual int GetProxyForURL(const GURL& url, | 44 virtual int GetProxyForURL(const GURL& url, |
| 44 ProxyInfo* results, | 45 ProxyInfo* results, |
| 45 OldCompletionCallback* callback, | 46 OldCompletionCallback* callback, |
| 46 RequestHandle* request, | 47 RequestHandle* request, |
| 47 const BoundNetLog& net_log) = 0; | 48 const BoundNetLog& net_log) = 0; |
| 48 | 49 |
| 49 // Cancels |request|. | 50 // Cancels |request|. |
| 50 virtual void CancelRequest(RequestHandle request) = 0; | 51 virtual void CancelRequest(RequestHandle request) = 0; |
| 51 | 52 |
| 53 // Gets the LoadState for |request|. |
| 54 virtual LoadState GetLoadState(RequestHandle request) const = 0; |
| 55 |
| 56 // Gets the LoadState for |request|. May be called from another thread. |
| 57 virtual LoadState GetLoadStateThreadSafe(RequestHandle request) const = 0; |
| 58 |
| 52 // The PAC script backend can be specified to the ProxyResolver either via | 59 // The PAC script backend can be specified to the ProxyResolver either via |
| 53 // URL, or via the javascript text itself. If |expects_pac_bytes| is true, | 60 // URL, or via the javascript text itself. If |expects_pac_bytes| is true, |
| 54 // then the ProxyResolverScriptData passed to SetPacScript() should | 61 // then the ProxyResolverScriptData passed to SetPacScript() should |
| 55 // contain the actual script bytes rather than just the URL. | 62 // contain the actual script bytes rather than just the URL. |
| 56 bool expects_pac_bytes() const { return expects_pac_bytes_; } | 63 bool expects_pac_bytes() const { return expects_pac_bytes_; } |
| 57 | 64 |
| 58 virtual void CancelSetPacScript() = 0; | 65 virtual void CancelSetPacScript() = 0; |
| 59 | 66 |
| 60 // Frees any unneeded memory held by the resolver, e.g. garbage in the JS | 67 // Frees any unneeded memory held by the resolver, e.g. garbage in the JS |
| 61 // engine. Most subclasses don't need to do anything, so we provide a default | 68 // engine. Most subclasses don't need to do anything, so we provide a default |
| (...skipping 13 matching lines...) Expand all Loading... |
| 75 | 82 |
| 76 private: | 83 private: |
| 77 const bool expects_pac_bytes_; | 84 const bool expects_pac_bytes_; |
| 78 | 85 |
| 79 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); | 86 DISALLOW_COPY_AND_ASSIGN(ProxyResolver); |
| 80 }; | 87 }; |
| 81 | 88 |
| 82 } // namespace net | 89 } // namespace net |
| 83 | 90 |
| 84 #endif // NET_PROXY_PROXY_RESOLVER_H_ | 91 #endif // NET_PROXY_PROXY_RESOLVER_H_ |
| OLD | NEW |