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 // 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 |
| 11 // populated with "sane" default values. Read through the comments to figure out | 11 // populated with "sane" default values. Read through the comments to figure out |
| 12 // what these are. | 12 // what these are. |
| 13 | 13 |
| 14 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 14 #ifndef NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| 15 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 15 #define NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| 16 | 16 |
| 17 #include <stdint.h> | 17 #include <stdint.h> |
| 18 | 18 |
| 19 #include <map> | 19 #include <map> |
| 20 #include <memory> | 20 #include <memory> |
| 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 "build/build_config.h" | 29 #include "build/build_config.h" |
|
pauljensen
2017/06/28 13:54:22
#include "build/buildflag.h"
mmenke
2017/06/28 17:58:48
Done.
| |
| 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" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 } | 297 } |
| 298 | 298 |
| 299 void set_throttling_enabled(bool throttling_enabled) { | 299 void set_throttling_enabled(bool throttling_enabled) { |
| 300 throttling_enabled_ = throttling_enabled; | 300 throttling_enabled_ = throttling_enabled; |
| 301 } | 301 } |
| 302 | 302 |
| 303 void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); | 303 void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); |
| 304 | 304 |
| 305 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); | 305 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); |
| 306 | 306 |
| 307 // Sets the reporting policy of the created request context. If not set, or | 307 #if BUILDFLAG(ENABLE_REPORTING) |
| 308 // set to nullptr, reporting is disabled. | |
| 309 void set_reporting_policy( | 308 void set_reporting_policy( |
| 310 std::unique_ptr<net::ReportingPolicy> reporting_policy); | 309 std::unique_ptr<net::ReportingPolicy> reporting_policy); |
| 310 #endif // BUILDFLAG(ENABLE_REPORTING) | |
| 311 | 311 |
| 312 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> | 312 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> |
| 313 url_request_interceptors); | 313 url_request_interceptors); |
| 314 | 314 |
| 315 // Override the default in-memory cookie store and channel id service. | 315 // Override the default in-memory cookie store and channel id service. |
| 316 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and | 316 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and |
| 317 // ChannelIDService will be disabled for this context. | 317 // ChannelIDService will be disabled for this context. |
| 318 // If |cookie_store| is not NULL and |channel_id_service| is NULL, | 318 // If |cookie_store| is not NULL and |channel_id_service| is NULL, |
| 319 // only ChannelIdService is disabled for this context. | 319 // only ChannelIdService is disabled for this context. |
| 320 // Note that a persistent cookie store should not be used with an in-memory | 320 // Note that a persistent cookie store should not be used with an in-memory |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 bool pac_quick_check_enabled_; | 391 bool pac_quick_check_enabled_; |
| 392 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; | 392 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; |
| 393 std::unique_ptr<ProxyService> proxy_service_; | 393 std::unique_ptr<ProxyService> proxy_service_; |
| 394 scoped_refptr<net::SSLConfigService> ssl_config_service_; | 394 scoped_refptr<net::SSLConfigService> ssl_config_service_; |
| 395 std::unique_ptr<NetworkDelegate> network_delegate_; | 395 std::unique_ptr<NetworkDelegate> network_delegate_; |
| 396 std::unique_ptr<ProxyDelegate> proxy_delegate_; | 396 std::unique_ptr<ProxyDelegate> proxy_delegate_; |
| 397 std::unique_ptr<CookieStore> cookie_store_; | 397 std::unique_ptr<CookieStore> cookie_store_; |
| 398 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 398 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
| 399 std::unique_ptr<CertVerifier> cert_verifier_; | 399 std::unique_ptr<CertVerifier> cert_verifier_; |
| 400 std::unique_ptr<CTVerifier> ct_verifier_; | 400 std::unique_ptr<CTVerifier> ct_verifier_; |
| 401 #if BUILDFLAG(ENABLE_REPORTING) | |
| 401 std::unique_ptr<net::ReportingPolicy> reporting_policy_; | 402 std::unique_ptr<net::ReportingPolicy> reporting_policy_; |
| 403 #endif // BUILDFLAG(ENABLE_REPORTING) | |
| 402 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; | 404 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; |
| 403 std::unique_ptr<HttpServerProperties> http_server_properties_; | 405 std::unique_ptr<HttpServerProperties> http_server_properties_; |
| 404 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 406 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
| 405 protocol_handlers_; | 407 protocol_handlers_; |
| 406 | 408 |
| 407 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 409 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 408 }; | 410 }; |
| 409 | 411 |
| 410 } // namespace net | 412 } // namespace net |
| 411 | 413 |
| 412 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 414 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |