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 10 matching lines...) Expand all Loading... |
21 #include <string> | 21 #include <string> |
22 #include <unordered_map> | 22 #include <unordered_map> |
23 #include <utility> | 23 #include <utility> |
24 #include <vector> | 24 #include <vector> |
25 | 25 |
26 #include "base/files/file_path.h" | 26 #include "base/files/file_path.h" |
27 #include "base/macros.h" | 27 #include "base/macros.h" |
28 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
29 #include "base/task_scheduler/task_traits.h" | 29 #include "base/task_scheduler/task_traits.h" |
30 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 31 #include "build/buildflag.h" |
31 #include "net/base/net_export.h" | 32 #include "net/base/net_export.h" |
32 #include "net/base/network_delegate.h" | 33 #include "net/base/network_delegate.h" |
33 #include "net/base/proxy_delegate.h" | 34 #include "net/base/proxy_delegate.h" |
34 #include "net/dns/host_resolver.h" | 35 #include "net/dns/host_resolver.h" |
35 #include "net/http/http_network_session.h" | 36 #include "net/http/http_network_session.h" |
36 #include "net/net_features.h" | 37 #include "net/net_features.h" |
37 #include "net/proxy/proxy_config_service.h" | 38 #include "net/proxy/proxy_config_service.h" |
38 #include "net/proxy/proxy_service.h" | 39 #include "net/proxy/proxy_service.h" |
39 #include "net/quic/core/quic_packets.h" | 40 #include "net/quic/core/quic_packets.h" |
40 #include "net/socket/next_proto.h" | 41 #include "net/socket/next_proto.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 301 } |
301 | 302 |
302 void set_throttling_enabled(bool throttling_enabled) { | 303 void set_throttling_enabled(bool throttling_enabled) { |
303 throttling_enabled_ = throttling_enabled; | 304 throttling_enabled_ = throttling_enabled; |
304 } | 305 } |
305 | 306 |
306 void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); | 307 void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); |
307 | 308 |
308 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); | 309 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); |
309 | 310 |
310 // Sets the reporting policy of the created request context. If not set, or | 311 #if BUILDFLAG(ENABLE_REPORTING) |
311 // set to nullptr, reporting is disabled. | |
312 void set_reporting_policy( | 312 void set_reporting_policy( |
313 std::unique_ptr<net::ReportingPolicy> reporting_policy); | 313 std::unique_ptr<net::ReportingPolicy> reporting_policy); |
| 314 #endif // BUILDFLAG(ENABLE_REPORTING) |
314 | 315 |
315 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> | 316 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> |
316 url_request_interceptors); | 317 url_request_interceptors); |
317 | 318 |
318 // Override the default in-memory cookie store and channel id service. | 319 // Override the default in-memory cookie store and channel id service. |
319 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and | 320 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and |
320 // ChannelIDService will be disabled for this context. | 321 // ChannelIDService will be disabled for this context. |
321 // If |cookie_store| is not NULL and |channel_id_service| is NULL, | 322 // If |cookie_store| is not NULL and |channel_id_service| is NULL, |
322 // only ChannelIdService is disabled for this context. | 323 // only ChannelIdService is disabled for this context. |
323 // Note that a persistent cookie store should not be used with an in-memory | 324 // Note that a persistent cookie store should not be used with an in-memory |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 bool pac_quick_check_enabled_; | 405 bool pac_quick_check_enabled_; |
405 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; | 406 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; |
406 std::unique_ptr<ProxyService> proxy_service_; | 407 std::unique_ptr<ProxyService> proxy_service_; |
407 scoped_refptr<net::SSLConfigService> ssl_config_service_; | 408 scoped_refptr<net::SSLConfigService> ssl_config_service_; |
408 std::unique_ptr<NetworkDelegate> network_delegate_; | 409 std::unique_ptr<NetworkDelegate> network_delegate_; |
409 std::unique_ptr<ProxyDelegate> proxy_delegate_; | 410 std::unique_ptr<ProxyDelegate> proxy_delegate_; |
410 std::unique_ptr<CookieStore> cookie_store_; | 411 std::unique_ptr<CookieStore> cookie_store_; |
411 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 412 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
412 std::unique_ptr<CertVerifier> cert_verifier_; | 413 std::unique_ptr<CertVerifier> cert_verifier_; |
413 std::unique_ptr<CTVerifier> ct_verifier_; | 414 std::unique_ptr<CTVerifier> ct_verifier_; |
| 415 #if BUILDFLAG(ENABLE_REPORTING) |
414 std::unique_ptr<net::ReportingPolicy> reporting_policy_; | 416 std::unique_ptr<net::ReportingPolicy> reporting_policy_; |
| 417 #endif // BUILDFLAG(ENABLE_REPORTING) |
415 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; | 418 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; |
416 std::unique_ptr<HttpServerProperties> http_server_properties_; | 419 std::unique_ptr<HttpServerProperties> http_server_properties_; |
417 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 420 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
418 protocol_handlers_; | 421 protocol_handlers_; |
419 | 422 |
420 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 423 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
421 }; | 424 }; |
422 | 425 |
423 } // namespace net | 426 } // namespace net |
424 | 427 |
425 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 428 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |