| 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 #include <string> | 18 #include <string> |
| 19 #include <unordered_map> |
| 19 #include <utility> | 20 #include <utility> |
| 20 | 21 |
| 21 #include "base/files/file_path.h" | 22 #include "base/files/file_path.h" |
| 22 #include "base/macros.h" | 23 #include "base/macros.h" |
| 23 #include "base/memory/ref_counted.h" | 24 #include "base/memory/ref_counted.h" |
| 24 #include "base/memory/scoped_ptr.h" | 25 #include "base/memory/scoped_ptr.h" |
| 25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 26 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" |
| 27 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" |
| 28 #include "net/dns/host_resolver.h" | 29 #include "net/dns/host_resolver.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 HostMappingRules* host_mapping_rules; | 84 HostMappingRules* host_mapping_rules; |
| 84 uint16_t testing_fixed_http_port; | 85 uint16_t testing_fixed_http_port; |
| 85 uint16_t testing_fixed_https_port; | 86 uint16_t testing_fixed_https_port; |
| 86 NextProtoVector next_protos; | 87 NextProtoVector next_protos; |
| 87 std::string trusted_spdy_proxy; | 88 std::string trusted_spdy_proxy; |
| 88 bool use_alternative_services; | 89 bool use_alternative_services; |
| 89 bool enable_quic; | 90 bool enable_quic; |
| 90 bool quic_store_server_configs_in_properties; | 91 bool quic_store_server_configs_in_properties; |
| 91 bool quic_delay_tcp_race; | 92 bool quic_delay_tcp_race; |
| 92 int quic_max_number_of_lossy_connections; | 93 int quic_max_number_of_lossy_connections; |
| 94 std::unordered_set<std::string> quic_host_whitelist; |
| 93 float quic_packet_loss_threshold; | 95 float quic_packet_loss_threshold; |
| 94 int quic_idle_connection_timeout_seconds; | 96 int quic_idle_connection_timeout_seconds; |
| 95 QuicTagVector quic_connection_options; | 97 QuicTagVector quic_connection_options; |
| 96 }; | 98 }; |
| 97 | 99 |
| 98 URLRequestContextBuilder(); | 100 URLRequestContextBuilder(); |
| 99 ~URLRequestContextBuilder(); | 101 ~URLRequestContextBuilder(); |
| 100 | 102 |
| 101 // Extracts the component pointers required to construct an HttpNetworkSession | 103 // Extracts the component pointers required to construct an HttpNetworkSession |
| 102 // and copies them into the Params used to create the session. This function | 104 // and copies them into the Params used to create the session. This function |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 http_network_session_params_.quic_packet_loss_threshold = | 218 http_network_session_params_.quic_packet_loss_threshold = |
| 217 quic_packet_loss_threshold; | 219 quic_packet_loss_threshold; |
| 218 } | 220 } |
| 219 | 221 |
| 220 void set_quic_idle_connection_timeout_seconds( | 222 void set_quic_idle_connection_timeout_seconds( |
| 221 int quic_idle_connection_timeout_seconds) { | 223 int quic_idle_connection_timeout_seconds) { |
| 222 http_network_session_params_.quic_idle_connection_timeout_seconds = | 224 http_network_session_params_.quic_idle_connection_timeout_seconds = |
| 223 quic_idle_connection_timeout_seconds; | 225 quic_idle_connection_timeout_seconds; |
| 224 } | 226 } |
| 225 | 227 |
| 228 void set_quic_host_whitelist( |
| 229 const std::unordered_set<std::string>& quic_host_whitelist) { |
| 230 http_network_session_params_.quic_host_whitelist = quic_host_whitelist; |
| 231 } |
| 232 |
| 226 void set_throttling_enabled(bool throttling_enabled) { | 233 void set_throttling_enabled(bool throttling_enabled) { |
| 227 throttling_enabled_ = throttling_enabled; | 234 throttling_enabled_ = throttling_enabled; |
| 228 } | 235 } |
| 229 | 236 |
| 230 void set_backoff_enabled(bool backoff_enabled) { | 237 void set_backoff_enabled(bool backoff_enabled) { |
| 231 backoff_enabled_ = backoff_enabled; | 238 backoff_enabled_ = backoff_enabled; |
| 232 } | 239 } |
| 233 | 240 |
| 234 void SetCertVerifier(scoped_ptr<CertVerifier> cert_verifier); | 241 void SetCertVerifier(scoped_ptr<CertVerifier> cert_verifier); |
| 235 | 242 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 scoped_ptr<CertVerifier> cert_verifier_; | 307 scoped_ptr<CertVerifier> cert_verifier_; |
| 301 std::vector<scoped_ptr<URLRequestInterceptor>> url_request_interceptors_; | 308 std::vector<scoped_ptr<URLRequestInterceptor>> url_request_interceptors_; |
| 302 scoped_ptr<HttpServerProperties> http_server_properties_; | 309 scoped_ptr<HttpServerProperties> http_server_properties_; |
| 303 | 310 |
| 304 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 311 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 305 }; | 312 }; |
| 306 | 313 |
| 307 } // namespace net | 314 } // namespace net |
| 308 | 315 |
| 309 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 316 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |