OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SERVICE_H_ | 5 #ifndef NET_PROXY_PROXY_SERVICE_H_ |
6 #define NET_PROXY_PROXY_SERVICE_H_ | 6 #define NET_PROXY_PROXY_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 // the caller will not need to cancel the request. | 116 // the caller will not need to cancel the request. |
117 // | 117 // |
118 // We use the three possible proxy access types in the following order, | 118 // We use the three possible proxy access types in the following order, |
119 // doing fallback if one doesn't work. See "pac_script_decider.h" | 119 // doing fallback if one doesn't work. See "pac_script_decider.h" |
120 // for the specifics. | 120 // for the specifics. |
121 // 1. WPAD auto-detection | 121 // 1. WPAD auto-detection |
122 // 2. PAC URL | 122 // 2. PAC URL |
123 // 3. named proxy | 123 // 3. named proxy |
124 // | 124 // |
125 // Profiling information for the request is saved to |net_log| if non-NULL. | 125 // Profiling information for the request is saved to |net_log| if non-NULL. |
126 int ResolveProxy(const GURL& url, | 126 // This method is virtual for unit testing. |
127 int load_flags, | 127 virtual int ResolveProxy(const GURL& url, |
128 ProxyInfo* results, | 128 int load_flags, |
129 const net::CompletionCallback& callback, | 129 ProxyInfo* results, |
130 PacRequest** pac_request, | 130 const net::CompletionCallback& callback, |
131 NetworkDelegate* network_delegate, | 131 PacRequest** pac_request, |
132 const BoundNetLog& net_log); | 132 NetworkDelegate* network_delegate, |
| 133 const BoundNetLog& net_log); |
133 | 134 |
134 // This method is called after a failure to connect or resolve a host name. | 135 // This method is called after a failure to connect or resolve a host name. |
135 // It gives the proxy service an opportunity to reconsider the proxy to use. | 136 // It gives the proxy service an opportunity to reconsider the proxy to use. |
136 // The |results| parameter contains the results returned by an earlier call | 137 // The |results| parameter contains the results returned by an earlier call |
137 // to ResolveProxy. The |net_error| parameter contains the network error | 138 // to ResolveProxy. The |net_error| parameter contains the network error |
138 // code associated with the failure. See "net/base/net_error_list.h" for a | 139 // code associated with the failure. See "net/base/net_error_list.h" for a |
139 // list of possible values. The semantics of this call are otherwise | 140 // list of possible values. The semantics of this call are otherwise |
140 // similar to ResolveProxy. | 141 // similar to ResolveProxy. |
141 // | 142 // |
142 // NULL can be passed for |pac_request| if the caller will not need to | 143 // NULL can be passed for |pac_request| if the caller will not need to |
(...skipping 27 matching lines...) Expand all Loading... |
170 const BoundNetLog& net_log); | 171 const BoundNetLog& net_log); |
171 | 172 |
172 // Called to report that the last proxy connection succeeded. If |proxy_info| | 173 // Called to report that the last proxy connection succeeded. If |proxy_info| |
173 // has a non empty proxy_retry_info map, the proxies that have been tried (and | 174 // has a non empty proxy_retry_info map, the proxies that have been tried (and |
174 // failed) for this request will be marked as bad. |network_delegate| will | 175 // failed) for this request will be marked as bad. |network_delegate| will |
175 // be notified of any proxy fallbacks. | 176 // be notified of any proxy fallbacks. |
176 void ReportSuccess(const ProxyInfo& proxy_info, | 177 void ReportSuccess(const ProxyInfo& proxy_info, |
177 NetworkDelegate* network_delegate); | 178 NetworkDelegate* network_delegate); |
178 | 179 |
179 // Call this method with a non-null |pac_request| to cancel the PAC request. | 180 // Call this method with a non-null |pac_request| to cancel the PAC request. |
180 void CancelPacRequest(PacRequest* pac_request); | 181 // This method is virtual for unit testing. |
| 182 virtual void CancelPacRequest(PacRequest* pac_request); |
181 | 183 |
182 // Returns the LoadState for this |pac_request| which must be non-NULL. | 184 // Returns the LoadState for this |pac_request| which must be non-NULL. |
183 LoadState GetLoadState(const PacRequest* pac_request) const; | 185 LoadState GetLoadState(const PacRequest* pac_request) const; |
184 | 186 |
185 // Sets the ProxyScriptFetcher and DhcpProxyScriptFetcher dependencies. This | 187 // Sets the ProxyScriptFetcher and DhcpProxyScriptFetcher dependencies. This |
186 // is needed if the ProxyResolver is of type ProxyResolverWithoutFetch. | 188 // is needed if the ProxyResolver is of type ProxyResolverWithoutFetch. |
187 // ProxyService takes ownership of both objects. | 189 // ProxyService takes ownership of both objects. |
188 void SetProxyScriptFetchers( | 190 void SetProxyScriptFetchers( |
189 ProxyScriptFetcher* proxy_script_fetcher, | 191 ProxyScriptFetcher* proxy_script_fetcher, |
190 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher); | 192 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 431 |
430 // Whether child ProxyScriptDeciders should use QuickCheck | 432 // Whether child ProxyScriptDeciders should use QuickCheck |
431 bool quick_check_enabled_; | 433 bool quick_check_enabled_; |
432 | 434 |
433 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 435 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
434 }; | 436 }; |
435 | 437 |
436 } // namespace net | 438 } // namespace net |
437 | 439 |
438 #endif // NET_PROXY_PROXY_SERVICE_H_ | 440 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |