| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 // Sends all the unstarted pending requests off to the resolver. | 211 // Sends all the unstarted pending requests off to the resolver. |
| 212 void ResumeAllPendingRequests(); | 212 void ResumeAllPendingRequests(); |
| 213 | 213 |
| 214 // Returns true if |pending_requests_| contains |req|. | 214 // Returns true if |pending_requests_| contains |req|. |
| 215 bool ContainsPendingRequest(PacRequest* req); | 215 bool ContainsPendingRequest(PacRequest* req); |
| 216 | 216 |
| 217 // Removes |req| from the list of pending requests. | 217 // Removes |req| from the list of pending requests. |
| 218 void RemovePendingRequest(PacRequest* req); | 218 void RemovePendingRequest(PacRequest* req); |
| 219 | 219 |
| 220 // Called to indicate that a PacRequest completed. The |config_id| parameter | 220 // Called when proxy resolution has completed (either synchronously or |
| 221 // indicates the proxy configuration that was queried. |result_code| is OK | 221 // asynchronously). Handles logging the result, and cleaning out |
| 222 // if the PAC file could be downloaded and executed. Otherwise, it is an | 222 // bad entries from the results list. |
| 223 // error code, indicating a bad proxy configuration. | 223 int DidFinishResolvingProxy(ProxyInfo* result, |
| 224 void DidCompletePacRequest(int config_id, int result_code); | 224 int result_code, |
| 225 LoadLog* load_log); |
| 225 | 226 |
| 226 // Returns true if the URL passed in should not go through the proxy server. | 227 // Returns true if the URL passed in should not go through the proxy server. |
| 227 // 1. If the proxy settings say to bypass local names, and |IsLocalName(url)|. | 228 // 1. If the proxy settings say to bypass local names, and |IsLocalName(url)|. |
| 228 // 2. The URL matches one of the entities in the proxy bypass list. | 229 // 2. The URL matches one of the entities in the proxy bypass list. |
| 229 bool ShouldBypassProxyForURL(const GURL& url); | 230 bool ShouldBypassProxyForURL(const GURL& url); |
| 230 | 231 |
| 231 // Returns true if |url| is to an intranet site (using non-FQDN as the | 232 // Returns true if |url| is to an intranet site (using non-FQDN as the |
| 232 // heuristic). | 233 // heuristic). |
| 233 static bool IsLocalName(const GURL& url); | 234 static bool IsLocalName(const GURL& url); |
| 234 | 235 |
| 235 // Helper to download the PAC script (wpad + custom) and apply fallback rules. | 236 // Helper to download the PAC script (wpad + custom) and apply fallback rules. |
| 236 scoped_ptr<InitProxyResolver> init_proxy_resolver_; | 237 scoped_ptr<InitProxyResolver> init_proxy_resolver_; |
| 237 | 238 |
| 238 // Log from the *last* time |init_proxy_resolver_.Init()| was called, or NULL. | 239 // Log from the *last* time |init_proxy_resolver_.Init()| was called, or NULL. |
| 239 scoped_refptr<LoadLog> init_proxy_resolver_log_; | 240 scoped_refptr<LoadLog> init_proxy_resolver_log_; |
| 240 | 241 |
| 241 scoped_ptr<ProxyConfigService> config_service_; | 242 scoped_ptr<ProxyConfigService> config_service_; |
| 242 scoped_ptr<ProxyResolver> resolver_; | 243 scoped_ptr<ProxyResolver> resolver_; |
| 243 | 244 |
| 244 // We store the proxy config and a counter (ID) that is incremented each time | 245 // We store the proxy config and a counter (ID) that is incremented each time |
| 245 // the config changes. | 246 // the config changes. |
| 246 ProxyConfig config_; | 247 ProxyConfig config_; |
| 247 | 248 |
| 248 // Increasing ID to give to the next ProxyConfig that we set. | 249 // Increasing ID to give to the next ProxyConfig that we set. |
| 249 int next_config_id_; | 250 int next_config_id_; |
| 250 | 251 |
| 251 // Indicates that the configuration is bad and should be ignored. | |
| 252 bool config_is_bad_; | |
| 253 | |
| 254 // Indicates whether the ProxyResolver should be sent requests. | 252 // Indicates whether the ProxyResolver should be sent requests. |
| 255 bool should_use_proxy_resolver_; | 253 bool should_use_proxy_resolver_; |
| 256 | 254 |
| 257 // The time when the proxy configuration was last read from the system. | 255 // The time when the proxy configuration was last read from the system. |
| 258 base::TimeTicks config_last_update_time_; | 256 base::TimeTicks config_last_update_time_; |
| 259 | 257 |
| 260 // Map of the known bad proxies and the information about the retry time. | 258 // Map of the known bad proxies and the information about the retry time. |
| 261 ProxyRetryInfoMap proxy_retry_info_; | 259 ProxyRetryInfoMap proxy_retry_info_; |
| 262 | 260 |
| 263 // Set of pending/inprogress requests. | 261 // Set of pending/inprogress requests. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 297 |
| 300 base::WaitableEvent event_; | 298 base::WaitableEvent event_; |
| 301 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 299 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
| 302 ProxyInfo proxy_info_; | 300 ProxyInfo proxy_info_; |
| 303 int result_; | 301 int result_; |
| 304 }; | 302 }; |
| 305 | 303 |
| 306 } // namespace net | 304 } // namespace net |
| 307 | 305 |
| 308 #endif // NET_PROXY_PROXY_SERVICE_H_ | 306 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |