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 // This class is useful for building a simple URLRequestContext. Most creators | 5 // This class is useful for building a simple URLRequestContext. Most creators |
6 // of new URLRequestContexts should use this helper class to construct it. Call | 6 // of new URLRequestContexts should use this helper class to construct it. Call |
7 // any configuration params, and when done, invoke Build() to construct the | 7 // any configuration params, and when done, invoke Build() to construct the |
8 // URLRequestContext. This URLRequestContext will own all its own storage. | 8 // URLRequestContext. This URLRequestContext will own all its own storage. |
9 // | 9 // |
10 // URLRequestContextBuilder and its associated params classes are initially | 10 // URLRequestContextBuilder and its associated params classes are initially |
(...skipping 19 matching lines...) Expand all Loading... | |
30 #include "net/base/net_export.h" | 30 #include "net/base/net_export.h" |
31 #include "net/base/network_delegate.h" | 31 #include "net/base/network_delegate.h" |
32 #include "net/base/proxy_delegate.h" | 32 #include "net/base/proxy_delegate.h" |
33 #include "net/dns/host_resolver.h" | 33 #include "net/dns/host_resolver.h" |
34 #include "net/http/http_network_session.h" | 34 #include "net/http/http_network_session.h" |
35 #include "net/net_features.h" | 35 #include "net/net_features.h" |
36 #include "net/proxy/proxy_config_service.h" | 36 #include "net/proxy/proxy_config_service.h" |
37 #include "net/proxy/proxy_service.h" | 37 #include "net/proxy/proxy_service.h" |
38 #include "net/quic/core/quic_packets.h" | 38 #include "net/quic/core/quic_packets.h" |
39 #include "net/socket/next_proto.h" | 39 #include "net/socket/next_proto.h" |
40 #include "net/ssl/ssl_config_service.h" | |
40 #include "net/url_request/url_request_job_factory.h" | 41 #include "net/url_request/url_request_job_factory.h" |
41 | 42 |
42 namespace base { | 43 namespace base { |
43 class SingleThreadTaskRunner; | 44 class SingleThreadTaskRunner; |
44 } | 45 } |
45 | 46 |
46 namespace net { | 47 namespace net { |
47 | 48 |
48 class CertVerifier; | 49 class CertVerifier; |
49 class ChannelIDService; | 50 class ChannelIDService; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 } | 131 } |
131 | 132 |
132 // Sets the proxy service. If one is not provided, by default, uses system | 133 // Sets the proxy service. If one is not provided, by default, uses system |
133 // libraries to evaluate PAC scripts, if available (And if not, skips PAC | 134 // libraries to evaluate PAC scripts, if available (And if not, skips PAC |
134 // resolution). Subclasses may override CreateProxyService for different | 135 // resolution). Subclasses may override CreateProxyService for different |
135 // default behavior. | 136 // default behavior. |
136 void set_proxy_service(std::unique_ptr<ProxyService> proxy_service) { | 137 void set_proxy_service(std::unique_ptr<ProxyService> proxy_service) { |
137 proxy_service_ = std::move(proxy_service); | 138 proxy_service_ = std::move(proxy_service); |
138 } | 139 } |
139 | 140 |
141 void set_ssl_config_service( | |
142 scoped_refptr<net::SSLConfigService> ssl_config_service) { | |
143 ssl_config_service_ = std::move(ssl_config_service); | |
144 } | |
145 | |
140 // Call these functions to specify hard-coded Accept-Language | 146 // Call these functions to specify hard-coded Accept-Language |
141 // or User-Agent header values for all requests that don't | 147 // or User-Agent header values for all requests that don't |
142 // have the headers already set. | 148 // have the headers already set. |
143 void set_accept_language(const std::string& accept_language) { | 149 void set_accept_language(const std::string& accept_language) { |
144 accept_language_ = accept_language; | 150 accept_language_ = accept_language; |
145 } | 151 } |
146 void set_user_agent(const std::string& user_agent) { | 152 void set_user_agent(const std::string& user_agent) { |
147 user_agent_ = user_agent; | 153 user_agent_ = user_agent; |
148 } | 154 } |
149 | 155 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 // custom factory will be unset and this must be called before the next Build | 209 // custom factory will be unset and this must be called before the next Build |
204 // to set another custom one. | 210 // to set another custom one. |
205 void SetHttpAuthHandlerFactory( | 211 void SetHttpAuthHandlerFactory( |
206 std::unique_ptr<HttpAuthHandlerFactory> factory); | 212 std::unique_ptr<HttpAuthHandlerFactory> factory); |
207 | 213 |
208 // By default HttpCache is enabled with a default constructed HttpCacheParams. | 214 // By default HttpCache is enabled with a default constructed HttpCacheParams. |
209 void EnableHttpCache(const HttpCacheParams& params); | 215 void EnableHttpCache(const HttpCacheParams& params); |
210 void DisableHttpCache(); | 216 void DisableHttpCache(); |
211 | 217 |
212 // Override default HttpNetworkSession::Params settings. | 218 // Override default HttpNetworkSession::Params settings. |
213 void set_http_network_session_params( | 219 void set_http_network_session_params( |
Randy Smith (Not in Mondays)
2017/06/13 16:42:15
Not for this CL, just commenting in case it's rele
mmenke
2017/06/13 17:02:22
I agree - it's on my imaginary TODO list to fix.
| |
214 const HttpNetworkSession::Params& http_network_session_params) { | 220 const HttpNetworkSession::Params& http_network_session_params) { |
215 http_network_session_params_ = http_network_session_params; | 221 http_network_session_params_ = http_network_session_params; |
216 } | 222 } |
217 | 223 |
218 void set_transport_security_persister_path( | 224 void set_transport_security_persister_path( |
219 const base::FilePath& transport_security_persister_path) { | 225 const base::FilePath& transport_security_persister_path) { |
220 transport_security_persister_path_ = transport_security_persister_path; | 226 transport_security_persister_path_ = transport_security_persister_path; |
221 } | 227 } |
222 | 228 |
223 void SetSpdyAndQuicEnabled(bool spdy_enabled, | 229 void SetSpdyAndQuicEnabled(bool spdy_enabled, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
353 HttpCacheParams http_cache_params_; | 359 HttpCacheParams http_cache_params_; |
354 HttpNetworkSession::Params http_network_session_params_; | 360 HttpNetworkSession::Params http_network_session_params_; |
355 base::FilePath transport_security_persister_path_; | 361 base::FilePath transport_security_persister_path_; |
356 NetLog* net_log_; | 362 NetLog* net_log_; |
357 std::unique_ptr<HostResolver> host_resolver_; | 363 std::unique_ptr<HostResolver> host_resolver_; |
358 std::unique_ptr<ChannelIDService> channel_id_service_; | 364 std::unique_ptr<ChannelIDService> channel_id_service_; |
359 std::unique_ptr<ProxyConfigService> proxy_config_service_; | 365 std::unique_ptr<ProxyConfigService> proxy_config_service_; |
360 bool pac_quick_check_enabled_; | 366 bool pac_quick_check_enabled_; |
361 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; | 367 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; |
362 std::unique_ptr<ProxyService> proxy_service_; | 368 std::unique_ptr<ProxyService> proxy_service_; |
369 scoped_refptr<net::SSLConfigService> ssl_config_service_; | |
363 std::unique_ptr<NetworkDelegate> network_delegate_; | 370 std::unique_ptr<NetworkDelegate> network_delegate_; |
364 std::unique_ptr<ProxyDelegate> proxy_delegate_; | 371 std::unique_ptr<ProxyDelegate> proxy_delegate_; |
365 std::unique_ptr<CookieStore> cookie_store_; | 372 std::unique_ptr<CookieStore> cookie_store_; |
366 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 373 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
367 std::unique_ptr<CertVerifier> cert_verifier_; | 374 std::unique_ptr<CertVerifier> cert_verifier_; |
368 std::unique_ptr<CTVerifier> ct_verifier_; | 375 std::unique_ptr<CTVerifier> ct_verifier_; |
369 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; | 376 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; |
370 std::unique_ptr<HttpServerProperties> http_server_properties_; | 377 std::unique_ptr<HttpServerProperties> http_server_properties_; |
371 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 378 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
372 protocol_handlers_; | 379 protocol_handlers_; |
373 | 380 |
374 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 381 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
375 }; | 382 }; |
376 | 383 |
377 } // namespace net | 384 } // namespace net |
378 | 385 |
379 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 386 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |