| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This class represents contextual information (cookies, cache, etc.) | 5 // This class represents contextual information (cookies, cache, etc.) |
| 6 // that's useful when processing resource requests. | 6 // that's useful when processing resource requests. |
| 7 // The class is reference-counted so that it can be cleaned up after any | 7 // The class is reference-counted so that it can be cleaned up after any |
| 8 // requests that are using it have been completed. | 8 // requests that are using it have been completed. |
| 9 | 9 |
| 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 10 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 class URLRequestContext | 40 class URLRequestContext |
| 41 : public base::RefCountedThreadSafe<URLRequestContext>, | 41 : public base::RefCountedThreadSafe<URLRequestContext>, |
| 42 public NonThreadSafe { | 42 public NonThreadSafe { |
| 43 public: | 43 public: |
| 44 URLRequestContext(); | 44 URLRequestContext(); |
| 45 | 45 |
| 46 net::NetLog* net_log() const { | 46 net::NetLog* net_log() const { |
| 47 return net_log_; | 47 return net_log_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void set_net_log(net::NetLog* net_log) { |
| 51 net_log_ = net_log; |
| 52 } |
| 53 |
| 50 net::HostResolver* host_resolver() const { | 54 net::HostResolver* host_resolver() const { |
| 51 return host_resolver_; | 55 return host_resolver_; |
| 52 } | 56 } |
| 53 | 57 |
| 58 void set_host_resolver(net::HostResolver* host_resolver) { |
| 59 host_resolver_ = host_resolver; |
| 60 } |
| 61 |
| 54 net::CertVerifier* cert_verifier() const { | 62 net::CertVerifier* cert_verifier() const { |
| 55 return cert_verifier_; | 63 return cert_verifier_; |
| 56 } | 64 } |
| 57 | 65 |
| 66 void set_cert_verifier(net::CertVerifier* cert_verifier) { |
| 67 cert_verifier_ = cert_verifier; |
| 68 } |
| 69 |
| 58 net::DnsRRResolver* dnsrr_resolver() const { | 70 net::DnsRRResolver* dnsrr_resolver() const { |
| 59 return dnsrr_resolver_; | 71 return dnsrr_resolver_; |
| 60 } | 72 } |
| 61 | 73 |
| 74 void set_dnsrr_resolver(net::DnsRRResolver* dnsrr_resolver) { |
| 75 dnsrr_resolver_ = dnsrr_resolver; |
| 76 } |
| 77 |
| 62 net::DnsCertProvenanceChecker* dns_cert_checker() const { | 78 net::DnsCertProvenanceChecker* dns_cert_checker() const { |
| 63 return dns_cert_checker_.get(); | 79 return dns_cert_checker_.get(); |
| 64 } | 80 } |
| 65 | 81 |
| 66 // Get the proxy service for this context. | 82 // Get the proxy service for this context. |
| 67 net::ProxyService* proxy_service() const { | 83 net::ProxyService* proxy_service() const { |
| 68 return proxy_service_; | 84 return proxy_service_; |
| 69 } | 85 } |
| 70 | 86 |
| 87 void set_proxy_service(net::ProxyService* proxy_service) { |
| 88 proxy_service_ = proxy_service; |
| 89 } |
| 90 |
| 71 // Get the ssl config service for this context. | 91 // Get the ssl config service for this context. |
| 72 net::SSLConfigService* ssl_config_service() const { | 92 net::SSLConfigService* ssl_config_service() const { |
| 73 return ssl_config_service_; | 93 return ssl_config_service_; |
| 74 } | 94 } |
| 75 | 95 |
| 96 // Gets the HTTP Authentication Handler Factory for this context. |
| 97 // The factory is only valid for the lifetime of this URLRequestContext |
| 98 net::HttpAuthHandlerFactory* http_auth_handler_factory() { |
| 99 return http_auth_handler_factory_; |
| 100 } |
| 101 void set_http_auth_handler_factory(net::HttpAuthHandlerFactory* factory) { |
| 102 http_auth_handler_factory_ = factory; |
| 103 } |
| 104 |
| 76 // Gets the http transaction factory for this context. | 105 // Gets the http transaction factory for this context. |
| 77 net::HttpTransactionFactory* http_transaction_factory() const { | 106 net::HttpTransactionFactory* http_transaction_factory() const { |
| 78 return http_transaction_factory_; | 107 return http_transaction_factory_; |
| 79 } | 108 } |
| 80 | 109 |
| 110 void set_http_transaction_factory(net::HttpTransactionFactory* factory) { |
| 111 http_transaction_factory_ = factory; |
| 112 } |
| 113 |
| 81 // Gets the ftp transaction factory for this context. | 114 // Gets the ftp transaction factory for this context. |
| 82 net::FtpTransactionFactory* ftp_transaction_factory() { | 115 net::FtpTransactionFactory* ftp_transaction_factory() { |
| 83 return ftp_transaction_factory_; | 116 return ftp_transaction_factory_; |
| 84 } | 117 } |
| 85 | 118 |
| 86 // Gets the cookie store for this context (may be null, in which case | 119 // Gets the cookie store for this context (may be null, in which case |
| 87 // cookies are not stored). | 120 // cookies are not stored). |
| 88 net::CookieStore* cookie_store() { return cookie_store_.get(); } | 121 net::CookieStore* cookie_store() { return cookie_store_.get(); } |
| 89 | 122 |
| 123 void set_cookie_store(net::CookieStore* cookie_store); |
| 124 |
| 90 // Gets the cookie policy for this context (may be null, in which case | 125 // Gets the cookie policy for this context (may be null, in which case |
| 91 // cookies are allowed). | 126 // cookies are allowed). |
| 92 net::CookiePolicy* cookie_policy() { return cookie_policy_; } | 127 net::CookiePolicy* cookie_policy() { return cookie_policy_; } |
| 93 | 128 |
| 94 net::TransportSecurityState* transport_security_state() { | 129 net::TransportSecurityState* transport_security_state() { |
| 95 return transport_security_state_; } | 130 return transport_security_state_; } |
| 96 | 131 |
| 97 // Gets the FTP authentication cache for this context. | 132 // Gets the FTP authentication cache for this context. |
| 98 net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } | 133 net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; } |
| 99 | 134 |
| 100 // Gets the HTTP Authentication Handler Factory for this context. | |
| 101 // The factory is only valid for the lifetime of this URLRequestContext | |
| 102 net::HttpAuthHandlerFactory* http_auth_handler_factory() { | |
| 103 return http_auth_handler_factory_; | |
| 104 } | |
| 105 | |
| 106 // Gets the value of 'Accept-Charset' header field. | 135 // Gets the value of 'Accept-Charset' header field. |
| 107 const std::string& accept_charset() const { return accept_charset_; } | 136 const std::string& accept_charset() const { return accept_charset_; } |
| 108 | 137 |
| 109 // Gets the value of 'Accept-Language' header field. | 138 // Gets the value of 'Accept-Language' header field. |
| 110 const std::string& accept_language() const { return accept_language_; } | 139 const std::string& accept_language() const { return accept_language_; } |
| 111 | 140 |
| 112 // Gets the UA string to use for the given URL. Pass an invalid URL (such as | 141 // Gets the UA string to use for the given URL. Pass an invalid URL (such as |
| 113 // GURL()) to get the default UA string. Subclasses should override this | 142 // GURL()) to get the default UA string. Subclasses should override this |
| 114 // method to provide a UA string. | 143 // method to provide a UA string. |
| 115 virtual const std::string& GetUserAgent(const GURL& url) const; | 144 virtual const std::string& GetUserAgent(const GURL& url) const; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 std::string referrer_charset_; | 185 std::string referrer_charset_; |
| 157 | 186 |
| 158 private: | 187 private: |
| 159 // Indicates whether or not this is the main URLRequestContext. | 188 // Indicates whether or not this is the main URLRequestContext. |
| 160 bool is_main_; | 189 bool is_main_; |
| 161 | 190 |
| 162 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); | 191 DISALLOW_COPY_AND_ASSIGN(URLRequestContext); |
| 163 }; | 192 }; |
| 164 | 193 |
| 165 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ | 194 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_ |
| OLD | NEW |