Chromium Code Reviews| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // or OK if it completed successfully. Implementations must set | 87 // or OK if it completed successfully. Implementations must set |
| 88 // |next_delay| to a non-negative value. | 88 // |next_delay| to a non-negative value. |
| 89 virtual Mode GetNextDelay(int initial_error, | 89 virtual Mode GetNextDelay(int initial_error, |
| 90 base::TimeDelta current_delay, | 90 base::TimeDelta current_delay, |
| 91 base::TimeDelta* next_delay) const = 0; | 91 base::TimeDelta* next_delay) const = 0; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 // The instance takes ownership of |config_service| and |resolver_factory|. | 94 // The instance takes ownership of |config_service| and |resolver_factory|. |
| 95 // |net_log| is a possibly NULL destination to send log events to. It must | 95 // |net_log| is a possibly NULL destination to send log events to. It must |
| 96 // remain alive for the lifetime of this ProxyService. | 96 // remain alive for the lifetime of this ProxyService. |
| 97 ProxyService(ProxyConfigService* config_service, | 97 ProxyService(ProxyConfigService* config_service, |
|
pauljensen
2015/08/28 13:38:02
Would really be nice to make this a scoped_ptr whi
Randy Smith (Not in Mondays)
2015/09/02 23:42:19
See other comment; being done in separate CL.
| |
| 98 scoped_ptr<ProxyResolverFactory> resolver_factory, | 98 scoped_ptr<ProxyResolverFactory> resolver_factory, |
| 99 NetLog* net_log); | 99 NetLog* net_log); |
| 100 | 100 |
| 101 ~ProxyService() override; | 101 ~ProxyService() override; |
| 102 | 102 |
| 103 // Used internally to handle PAC queries. | 103 // Used internally to handle PAC queries. |
| 104 // TODO(eroman): consider naming this simply "Request". | 104 // TODO(eroman): consider naming this simply "Request". |
| 105 class PacRequest; | 105 class PacRequest; |
| 106 | 106 |
| 107 // Returns ERR_IO_PENDING if the proxy information could not be provided | 107 // Returns ERR_IO_PENDING if the proxy information could not be provided |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 227 } | 227 } |
| 228 | 228 |
| 229 // Forces refetching the proxy configuration, and applying it. | 229 // Forces refetching the proxy configuration, and applying it. |
| 230 // This re-does everything from fetching the system configuration, | 230 // This re-does everything from fetching the system configuration, |
| 231 // to downloading and testing the PAC files. | 231 // to downloading and testing the PAC files. |
| 232 void ForceReloadProxyConfig(); | 232 void ForceReloadProxyConfig(); |
| 233 | 233 |
| 234 // Same as CreateProxyServiceUsingV8ProxyResolver, except it uses system | 234 // Same as CreateProxyServiceUsingV8ProxyResolver, except it uses system |
| 235 // libraries for evaluating the PAC script if available, otherwise skips | 235 // libraries for evaluating the PAC script if available, otherwise skips |
| 236 // proxy autoconfig. | 236 // proxy autoconfig. |
| 237 static ProxyService* CreateUsingSystemProxyResolver( | 237 static scoped_ptr<ProxyService> CreateUsingSystemProxyResolver( |
| 238 ProxyConfigService* proxy_config_service, | 238 ProxyConfigService* proxy_config_service, |
| 239 size_t num_pac_threads, | 239 size_t num_pac_threads, |
| 240 NetLog* net_log); | 240 NetLog* net_log); |
| 241 | 241 |
| 242 // Creates a ProxyService without support for proxy autoconfig. | 242 // Creates a ProxyService without support for proxy autoconfig. |
| 243 static ProxyService* CreateWithoutProxyResolver( | 243 static scoped_ptr<ProxyService> CreateWithoutProxyResolver( |
| 244 ProxyConfigService* proxy_config_service, | 244 ProxyConfigService* proxy_config_service, |
| 245 NetLog* net_log); | 245 NetLog* net_log); |
| 246 | 246 |
| 247 // Convenience methods that creates a proxy service using the | 247 // Convenience methods that creates a proxy service using the |
| 248 // specified fixed settings. | 248 // specified fixed settings. |
| 249 static ProxyService* CreateFixed(const ProxyConfig& pc); | 249 static scoped_ptr<ProxyService> CreateFixed(const ProxyConfig& pc); |
| 250 static ProxyService* CreateFixed(const std::string& proxy); | 250 static scoped_ptr<ProxyService> CreateFixed(const std::string& proxy); |
| 251 | 251 |
| 252 // Creates a proxy service that uses a DIRECT connection for all requests. | 252 // Creates a proxy service that uses a DIRECT connection for all requests. |
| 253 static ProxyService* CreateDirect(); | 253 static scoped_ptr<ProxyService> CreateDirect(); |
| 254 // |net_log|'s lifetime must exceed ProxyService. | 254 // |net_log|'s lifetime must exceed ProxyService. |
| 255 static ProxyService* CreateDirectWithNetLog(NetLog* net_log); | 255 static scoped_ptr<ProxyService> CreateDirectWithNetLog(NetLog* net_log); |
| 256 | 256 |
| 257 // This method is used by tests to create a ProxyService that returns a | 257 // This method is used by tests to create a ProxyService that returns a |
| 258 // hardcoded proxy fallback list (|pac_string|) for every URL. | 258 // hardcoded proxy fallback list (|pac_string|) for every URL. |
| 259 // | 259 // |
| 260 // |pac_string| is a list of proxy servers, in the format that a PAC script | 260 // |pac_string| is a list of proxy servers, in the format that a PAC script |
| 261 // would return it. For example, "PROXY foobar:99; SOCKS fml:2; DIRECT" | 261 // would return it. For example, "PROXY foobar:99; SOCKS fml:2; DIRECT" |
| 262 static ProxyService* CreateFixedFromPacResult(const std::string& pac_string); | 262 static scoped_ptr<ProxyService> CreateFixedFromPacResult( |
| 263 const std::string& pac_string); | |
| 263 | 264 |
| 264 // Creates a config service appropriate for this platform that fetches the | 265 // Creates a config service appropriate for this platform that fetches the |
| 265 // system proxy settings. | 266 // system proxy settings. |
| 266 static ProxyConfigService* CreateSystemProxyConfigService( | 267 static ProxyConfigService* CreateSystemProxyConfigService( |
| 267 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, | 268 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner, |
| 268 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner); | 269 const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner); |
| 269 | 270 |
| 270 // This method should only be used by unit tests. | 271 // This method should only be used by unit tests. |
| 271 void set_stall_proxy_auto_config_delay(base::TimeDelta delay) { | 272 void set_stall_proxy_auto_config_delay(base::TimeDelta delay) { |
| 272 stall_proxy_auto_config_delay_ = delay; | 273 stall_proxy_auto_config_delay_ = delay; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 452 | 453 |
| 453 // Whether child ProxyScriptDeciders should use QuickCheck | 454 // Whether child ProxyScriptDeciders should use QuickCheck |
| 454 bool quick_check_enabled_; | 455 bool quick_check_enabled_; |
| 455 | 456 |
| 456 DISALLOW_COPY_AND_ASSIGN(ProxyService); | 457 DISALLOW_COPY_AND_ASSIGN(ProxyService); |
| 457 }; | 458 }; |
| 458 | 459 |
| 459 } // namespace net | 460 } // namespace net |
| 460 | 461 |
| 461 #endif // NET_PROXY_PROXY_SERVICE_H_ | 462 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |