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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 52 class HostMappingRules; |
53 class HttpAuthHandlerFactory; | 53 class HttpAuthHandlerFactory; |
54 class HttpServerProperties; | 54 class HttpServerProperties; |
| 55 class NetworkQualityEstimator; |
55 class ProxyConfigService; | 56 class ProxyConfigService; |
56 class SocketPerformanceWatcherFactory; | 57 class SocketPerformanceWatcherFactory; |
57 class URLRequestContext; | 58 class URLRequestContext; |
58 class URLRequestInterceptor; | 59 class URLRequestInterceptor; |
59 | 60 |
60 class NET_EXPORT URLRequestContextBuilder { | 61 class NET_EXPORT URLRequestContextBuilder { |
61 public: | 62 public: |
62 struct NET_EXPORT HttpCacheParams { | 63 struct NET_EXPORT HttpCacheParams { |
63 enum Type { | 64 enum Type { |
64 // In-memory cache. | 65 // In-memory cache. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 bool quic_close_sessions_on_ip_change; | 102 bool quic_close_sessions_on_ip_change; |
102 bool quic_migrate_sessions_on_network_change; | 103 bool quic_migrate_sessions_on_network_change; |
103 bool quic_migrate_sessions_early; | 104 bool quic_migrate_sessions_early; |
104 bool quic_disable_bidirectional_streams; | 105 bool quic_disable_bidirectional_streams; |
105 bool quic_race_cert_verification; | 106 bool quic_race_cert_verification; |
106 }; | 107 }; |
107 | 108 |
108 URLRequestContextBuilder(); | 109 URLRequestContextBuilder(); |
109 ~URLRequestContextBuilder(); | 110 ~URLRequestContextBuilder(); |
110 | 111 |
| 112 // Sets a name for this URLRequestContext. Currently the name is used in |
| 113 // MemoryDumpProvier to annotate memory usage. The name does not need to be |
| 114 // unique. |
| 115 void set_name(const char* name) { name_ = name; } |
| 116 |
| 117 // Sets whether Brotli compression is enabled. Disabled by default; |
| 118 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } |
| 119 |
| 120 // Unlike most other setters, the builder does not take ownership of the |
| 121 // NetworkQualityEstimator. |
| 122 void set_network_quality_estimator( |
| 123 NetworkQualityEstimator* network_quality_estimator) { |
| 124 network_quality_estimator_ = network_quality_estimator; |
| 125 } |
| 126 |
111 // Extracts the component pointers required to construct an HttpNetworkSession | 127 // Extracts the component pointers required to construct an HttpNetworkSession |
112 // and copies them into the Params used to create the session. This function | 128 // and copies them into the Params used to create the session. This function |
113 // should be used to ensure that a context and its associated | 129 // should be used to ensure that a context and its associated |
114 // HttpNetworkSession are consistent. | 130 // HttpNetworkSession are consistent. |
115 static void SetHttpNetworkSessionComponents( | 131 static void SetHttpNetworkSessionComponents( |
116 const URLRequestContext* context, | 132 const URLRequestContext* context, |
117 HttpNetworkSession::Params* params); | 133 HttpNetworkSession::Params* params); |
118 | 134 |
119 // These functions are mutually exclusive. The ProxyConfigService, if | 135 // These functions are mutually exclusive. The ProxyConfigService, if |
120 // set, will be used to construct a ProxyService. | 136 // set, will be used to construct a ProxyService. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } | 320 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } |
305 | 321 |
306 // Sets a specific HttpServerProperties for use in the | 322 // Sets a specific HttpServerProperties for use in the |
307 // URLRequestContext rather than creating a default HttpServerPropertiesImpl. | 323 // URLRequestContext rather than creating a default HttpServerPropertiesImpl. |
308 void SetHttpServerProperties( | 324 void SetHttpServerProperties( |
309 std::unique_ptr<HttpServerProperties> http_server_properties); | 325 std::unique_ptr<HttpServerProperties> http_server_properties); |
310 | 326 |
311 std::unique_ptr<URLRequestContext> Build(); | 327 std::unique_ptr<URLRequestContext> Build(); |
312 | 328 |
313 private: | 329 private: |
| 330 const char* name_; |
| 331 bool enable_brotli_; |
| 332 NetworkQualityEstimator* network_quality_estimator_; |
| 333 |
314 std::string accept_language_; | 334 std::string accept_language_; |
315 std::string user_agent_; | 335 std::string user_agent_; |
316 // Include support for data:// requests. | 336 // Include support for data:// requests. |
317 bool data_enabled_; | 337 bool data_enabled_; |
318 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) | 338 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) |
319 // Include support for file:// requests. | 339 // Include support for file:// requests. |
320 bool file_enabled_; | 340 bool file_enabled_; |
321 #endif | 341 #endif |
322 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) | 342 #if !BUILDFLAG(DISABLE_FTP_SUPPORT) |
323 // Include support for ftp:// requests. | 343 // Include support for ftp:// requests. |
(...skipping 27 matching lines...) Expand all Loading... |
351 // Not owned by the context builder. Once it is set to a non-null value, it | 371 // Not owned by the context builder. Once it is set to a non-null value, it |
352 // is guaranteed to be non-null during the lifetime of |this|. | 372 // is guaranteed to be non-null during the lifetime of |this|. |
353 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; | 373 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
354 | 374 |
355 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 375 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
356 }; | 376 }; |
357 | 377 |
358 } // namespace net | 378 } // namespace net |
359 | 379 |
360 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 380 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |