diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 23:52:57 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-23 23:52:57 +0000 |
commit | 2fb62920c987513f7b5f041c99be5a8ed09888ec (patch) | |
tree | 7c0355bb9fb4ecae13aeecc572a8261e94d89436 /net | |
parent | 24d5cc6bb1328948d7a0658a7fa3acf6de5b91f8 (diff) | |
download | chromium_src-2fb62920c987513f7b5f041c99be5a8ed09888ec.zip chromium_src-2fb62920c987513f7b5f041c99be5a8ed09888ec.tar.gz chromium_src-2fb62920c987513f7b5f041c99be5a8ed09888ec.tar.bz2 |
Create a URLRequestContext for PAC fetching.
Originally I was going to create a single "system" URLRequestContext. I realized that was wrong, I need one for proxy script fetching that uses a direct ProxyService. This way, we don't have the circular dependencies for URLRequestContext(A)=>ProxyService=>ProxyScriptFetcherImpl=>URLRequestContext(A). Instead, we have URLRequestContext(A)=>ProxyService=>ProxyScriptFetcherImpl=>URLRequestContext(special one for proxy).
This also exposes some setters in URLRequestContext that were in ChromeURLRequestContext. I guess this makes URLRequestContext a bit more "dangerous" since it could be mutated during runtime, but really we should probably pass around a const URLRequestContext within the network stack. I've filed http://crbug.com/67597 to track this.
BUG=67232
TEST=none
Review URL: http://codereview.chromium.org/5961005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70116 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/proxy/proxy_service.cc | 6 | ||||
-rw-r--r-- | net/proxy/proxy_service.h | 2 | ||||
-rw-r--r-- | net/url_request/url_request_context.cc | 4 | ||||
-rw-r--r-- | net/url_request/url_request_context.h | 41 |
4 files changed, 46 insertions, 7 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index f321ef03..13d049e 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -468,9 +468,13 @@ ProxyService* ProxyService::CreateFixed(const std::string& proxy) { // static ProxyService* ProxyService::CreateDirect() { + return CreateDirectWithNetLog(NULL); +} + +ProxyService* ProxyService::CreateDirectWithNetLog(NetLog* net_log) { // Use direct connections. return new ProxyService(new ProxyConfigServiceDirect, new ProxyResolverNull, - NULL); + net_log); } // static diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index 8a161ea..ba56f4d6 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h @@ -193,6 +193,8 @@ class ProxyService : public base::RefCountedThreadSafe<ProxyService>, // Creates a proxy service that uses a DIRECT connection for all requests. static ProxyService* CreateDirect(); + // |net_log|'s lifetime must exceed ProxyService. + static ProxyService* CreateDirectWithNetLog(NetLog* net_log); // This method is used by tests to create a ProxyService that returns a // hardcoded proxy fallback list (|pac_string|) for every URL. diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc index 04f0da0..3bc7da6 100644 --- a/net/url_request/url_request_context.cc +++ b/net/url_request/url_request_context.cc @@ -29,3 +29,7 @@ const std::string& URLRequestContext::GetUserAgent(const GURL& url) const { URLRequestContext::~URLRequestContext() { } + +void URLRequestContext::set_cookie_store(net::CookieStore* cookie_store) { + cookie_store_ = cookie_store; +} diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h index d3ba85f..307da44 100644 --- a/net/url_request/url_request_context.h +++ b/net/url_request/url_request_context.h @@ -47,18 +47,34 @@ class URLRequestContext return net_log_; } + void set_net_log(net::NetLog* net_log) { + net_log_ = net_log; + } + net::HostResolver* host_resolver() const { return host_resolver_; } + void set_host_resolver(net::HostResolver* host_resolver) { + host_resolver_ = host_resolver; + } + net::CertVerifier* cert_verifier() const { return cert_verifier_; } + void set_cert_verifier(net::CertVerifier* cert_verifier) { + cert_verifier_ = cert_verifier; + } + net::DnsRRResolver* dnsrr_resolver() const { return dnsrr_resolver_; } + void set_dnsrr_resolver(net::DnsRRResolver* dnsrr_resolver) { + dnsrr_resolver_ = dnsrr_resolver; + } + net::DnsCertProvenanceChecker* dns_cert_checker() const { return dns_cert_checker_.get(); } @@ -68,16 +84,33 @@ class URLRequestContext return proxy_service_; } + void set_proxy_service(net::ProxyService* proxy_service) { + proxy_service_ = proxy_service; + } + // Get the ssl config service for this context. net::SSLConfigService* ssl_config_service() const { return ssl_config_service_; } + // Gets the HTTP Authentication Handler Factory for this context. + // The factory is only valid for the lifetime of this URLRequestContext + net::HttpAuthHandlerFactory* http_auth_handler_factory() { + return http_auth_handler_factory_; + } + void set_http_auth_handler_factory(net::HttpAuthHandlerFactory* factory) { + http_auth_handler_factory_ = factory; + } + // Gets the http transaction factory for this context. net::HttpTransactionFactory* http_transaction_factory() const { return http_transaction_factory_; } + void set_http_transaction_factory(net::HttpTransactionFactory* factory) { + http_transaction_factory_ = factory; + } + // Gets the ftp transaction factory for this context. net::FtpTransactionFactory* ftp_transaction_factory() { return ftp_transaction_factory_; @@ -87,6 +120,8 @@ class URLRequestContext // cookies are not stored). net::CookieStore* cookie_store() { return cookie_store_.get(); } + void set_cookie_store(net::CookieStore* cookie_store); + // Gets the cookie policy for this context (may be null, in which case // cookies are allowed). net::CookiePolicy* cookie_policy() { return cookie_policy_; } @@ -97,12 +132,6 @@ class URLRequestContext // Gets the FTP authentication cache for this context. net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } - // Gets the HTTP Authentication Handler Factory for this context. - // The factory is only valid for the lifetime of this URLRequestContext - net::HttpAuthHandlerFactory* http_auth_handler_factory() { - return http_auth_handler_factory_; - } - // Gets the value of 'Accept-Charset' header field. const std::string& accept_charset() const { return accept_charset_; } |