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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 namespace base { | 42 namespace base { |
43 class SingleThreadTaskRunner; | 43 class SingleThreadTaskRunner; |
44 } | 44 } |
45 | 45 |
46 namespace net { | 46 namespace net { |
47 | 47 |
48 class CertVerifier; | 48 class CertVerifier; |
49 class ChannelIDService; | 49 class ChannelIDService; |
50 class CookieStore; | 50 class CookieStore; |
51 class CTVerifier; | 51 class CTVerifier; |
52 class HostMappingRules; | |
53 class HttpAuthHandlerFactory; | 52 class HttpAuthHandlerFactory; |
54 class HttpServerProperties; | 53 class HttpServerProperties; |
55 class NetworkQualityEstimator; | 54 class NetworkQualityEstimator; |
56 class ProxyConfigService; | 55 class ProxyConfigService; |
57 class SocketPerformanceWatcherFactory; | 56 class SocketPerformanceWatcherFactory; |
58 class URLRequestContext; | 57 class URLRequestContext; |
59 class URLRequestInterceptor; | 58 class URLRequestInterceptor; |
60 | 59 |
61 class NET_EXPORT URLRequestContextBuilder { | 60 class NET_EXPORT URLRequestContextBuilder { |
62 public: | 61 public: |
(...skipping 14 matching lines...) Expand all Loading... |
77 Type type; | 76 Type type; |
78 | 77 |
79 // The max size of the cache in bytes. Default is algorithmically determined | 78 // The max size of the cache in bytes. Default is algorithmically determined |
80 // based off available disk space. | 79 // based off available disk space. |
81 int max_size; | 80 int max_size; |
82 | 81 |
83 // The cache path (when type is DISK). | 82 // The cache path (when type is DISK). |
84 base::FilePath path; | 83 base::FilePath path; |
85 }; | 84 }; |
86 | 85 |
87 struct NET_EXPORT HttpNetworkSessionParams { | |
88 HttpNetworkSessionParams(); | |
89 ~HttpNetworkSessionParams(); | |
90 | |
91 // Configutes |params| to match the settings in |this|. | |
92 // TODO(mmenke): Temporary utility function. Once everything is using a | |
93 // URLRequestContextBuilder, can make this no longer publicly accessible. | |
94 void ConfigureSessionParams(HttpNetworkSession::Params* params) const; | |
95 | |
96 // These fields mirror those in HttpNetworkSession::Params; | |
97 HostMappingRules host_mapping_rules; | |
98 bool ignore_certificate_errors; | |
99 uint16_t testing_fixed_http_port; | |
100 uint16_t testing_fixed_https_port; | |
101 bool enable_http2; | |
102 bool enable_quic; | |
103 std::string quic_user_agent_id; | |
104 int quic_max_server_configs_stored_in_properties; | |
105 QuicTagVector quic_connection_options; | |
106 bool quic_close_sessions_on_ip_change; | |
107 int quic_idle_connection_timeout_seconds; | |
108 bool quic_migrate_sessions_on_network_change; | |
109 bool quic_migrate_sessions_early; | |
110 bool quic_disable_bidirectional_streams; | |
111 bool quic_race_cert_verification; | |
112 }; | |
113 | |
114 URLRequestContextBuilder(); | 86 URLRequestContextBuilder(); |
115 virtual ~URLRequestContextBuilder(); | 87 virtual ~URLRequestContextBuilder(); |
116 | 88 |
117 // Sets a name for this URLRequestContext. Currently the name is used in | 89 // Sets a name for this URLRequestContext. Currently the name is used in |
118 // MemoryDumpProvier to annotate memory usage. The name does not need to be | 90 // MemoryDumpProvier to annotate memory usage. The name does not need to be |
119 // unique. | 91 // unique. |
120 void set_name(const char* name) { name_ = name; } | 92 void set_name(const char* name) { name_ = name; } |
121 | 93 |
122 // Sets whether Brotli compression is enabled. Disabled by default; | 94 // Sets whether Brotli compression is enabled. Disabled by default; |
123 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } | 95 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 // to set another custom one. | 191 // to set another custom one. |
220 void SetHttpAuthHandlerFactory( | 192 void SetHttpAuthHandlerFactory( |
221 std::unique_ptr<HttpAuthHandlerFactory> factory); | 193 std::unique_ptr<HttpAuthHandlerFactory> factory); |
222 | 194 |
223 // By default HttpCache is enabled with a default constructed HttpCacheParams. | 195 // By default HttpCache is enabled with a default constructed HttpCacheParams. |
224 void EnableHttpCache(const HttpCacheParams& params); | 196 void EnableHttpCache(const HttpCacheParams& params); |
225 void DisableHttpCache(); | 197 void DisableHttpCache(); |
226 | 198 |
227 // Override default HttpNetworkSession::Params settings. | 199 // Override default HttpNetworkSession::Params settings. |
228 void set_http_network_session_params( | 200 void set_http_network_session_params( |
229 const HttpNetworkSessionParams& http_network_session_params) { | 201 const HttpNetworkSession::Params& http_network_session_params) { |
230 http_network_session_params_ = http_network_session_params; | 202 http_network_session_params_ = http_network_session_params; |
231 } | 203 } |
232 | 204 |
233 void set_transport_security_persister_path( | 205 void set_transport_security_persister_path( |
234 const base::FilePath& transport_security_persister_path) { | 206 const base::FilePath& transport_security_persister_path) { |
235 transport_security_persister_path_ = transport_security_persister_path; | 207 transport_security_persister_path_ = transport_security_persister_path; |
236 } | 208 } |
237 | 209 |
238 void SetSpdyAndQuicEnabled(bool spdy_enabled, | 210 void SetSpdyAndQuicEnabled(bool spdy_enabled, |
239 bool quic_enabled); | 211 bool quic_enabled); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 // Include support for ftp:// requests. | 336 // Include support for ftp:// requests. |
365 bool ftp_enabled_; | 337 bool ftp_enabled_; |
366 #endif | 338 #endif |
367 bool http_cache_enabled_; | 339 bool http_cache_enabled_; |
368 bool throttling_enabled_; | 340 bool throttling_enabled_; |
369 bool sdch_enabled_; | 341 bool sdch_enabled_; |
370 bool cookie_store_set_by_client_; | 342 bool cookie_store_set_by_client_; |
371 | 343 |
372 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 344 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
373 HttpCacheParams http_cache_params_; | 345 HttpCacheParams http_cache_params_; |
374 HttpNetworkSessionParams http_network_session_params_; | 346 HttpNetworkSession::Params http_network_session_params_; |
375 base::FilePath transport_security_persister_path_; | 347 base::FilePath transport_security_persister_path_; |
376 NetLog* net_log_; | 348 NetLog* net_log_; |
377 std::unique_ptr<HostResolver> host_resolver_; | 349 std::unique_ptr<HostResolver> host_resolver_; |
378 std::unique_ptr<ChannelIDService> channel_id_service_; | 350 std::unique_ptr<ChannelIDService> channel_id_service_; |
379 std::unique_ptr<ProxyConfigService> proxy_config_service_; | 351 std::unique_ptr<ProxyConfigService> proxy_config_service_; |
380 std::unique_ptr<ProxyService> proxy_service_; | 352 std::unique_ptr<ProxyService> proxy_service_; |
381 std::unique_ptr<NetworkDelegate> network_delegate_; | 353 std::unique_ptr<NetworkDelegate> network_delegate_; |
382 std::unique_ptr<ProxyDelegate> proxy_delegate_; | 354 std::unique_ptr<ProxyDelegate> proxy_delegate_; |
383 std::unique_ptr<CookieStore> cookie_store_; | 355 std::unique_ptr<CookieStore> cookie_store_; |
384 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 356 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
385 std::unique_ptr<CertVerifier> cert_verifier_; | 357 std::unique_ptr<CertVerifier> cert_verifier_; |
386 std::unique_ptr<CTVerifier> ct_verifier_; | 358 std::unique_ptr<CTVerifier> ct_verifier_; |
387 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; | 359 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; |
388 std::unique_ptr<HttpServerProperties> http_server_properties_; | 360 std::unique_ptr<HttpServerProperties> http_server_properties_; |
389 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 361 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
390 protocol_handlers_; | 362 protocol_handlers_; |
391 // SocketPerformanceWatcherFactory to be used by this context builder. | 363 // SocketPerformanceWatcherFactory to be used by this context builder. |
392 // Not owned by the context builder. Once it is set to a non-null value, it | 364 // Not owned by the context builder. Once it is set to a non-null value, it |
393 // is guaranteed to be non-null during the lifetime of |this|. | 365 // is guaranteed to be non-null during the lifetime of |this|. |
394 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; | 366 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
395 | 367 |
396 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 368 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
397 }; | 369 }; |
398 | 370 |
399 } // namespace net | 371 } // namespace net |
400 | 372 |
401 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 373 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |