| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 QuicTagVector quic_connection_options; | 105 QuicTagVector quic_connection_options; |
| 106 bool quic_close_sessions_on_ip_change; | 106 bool quic_close_sessions_on_ip_change; |
| 107 int quic_idle_connection_timeout_seconds; | 107 int quic_idle_connection_timeout_seconds; |
| 108 bool quic_migrate_sessions_on_network_change; | 108 bool quic_migrate_sessions_on_network_change; |
| 109 bool quic_migrate_sessions_early; | 109 bool quic_migrate_sessions_early; |
| 110 bool quic_disable_bidirectional_streams; | 110 bool quic_disable_bidirectional_streams; |
| 111 bool quic_race_cert_verification; | 111 bool quic_race_cert_verification; |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 URLRequestContextBuilder(); | 114 URLRequestContextBuilder(); |
| 115 ~URLRequestContextBuilder(); | 115 virtual ~URLRequestContextBuilder(); |
| 116 | 116 |
| 117 // Sets a name for this URLRequestContext. Currently the name is used in | 117 // 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 | 118 // MemoryDumpProvier to annotate memory usage. The name does not need to be |
| 119 // unique. | 119 // unique. |
| 120 void set_name(const char* name) { name_ = name; } | 120 void set_name(const char* name) { name_ = name; } |
| 121 | 121 |
| 122 // Sets whether Brotli compression is enabled. Disabled by default; | 122 // Sets whether Brotli compression is enabled. Disabled by default; |
| 123 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } | 123 void set_enable_brotli(bool enable_brotli) { enable_brotli_ = enable_brotli; } |
| 124 | 124 |
| 125 // Unlike most other setters, the builder does not take ownership of the | 125 // Unlike most other setters, the builder does not take ownership of the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 136 static void SetHttpNetworkSessionComponents( | 136 static void SetHttpNetworkSessionComponents( |
| 137 const URLRequestContext* context, | 137 const URLRequestContext* context, |
| 138 HttpNetworkSession::Params* params); | 138 HttpNetworkSession::Params* params); |
| 139 | 139 |
| 140 // These functions are mutually exclusive. The ProxyConfigService, if | 140 // These functions are mutually exclusive. The ProxyConfigService, if |
| 141 // set, will be used to construct a ProxyService. | 141 // set, will be used to construct a ProxyService. |
| 142 void set_proxy_config_service( | 142 void set_proxy_config_service( |
| 143 std::unique_ptr<ProxyConfigService> proxy_config_service) { | 143 std::unique_ptr<ProxyConfigService> proxy_config_service) { |
| 144 proxy_config_service_ = std::move(proxy_config_service); | 144 proxy_config_service_ = std::move(proxy_config_service); |
| 145 } | 145 } |
| 146 |
| 147 // Sets the proxy service. If one is not provided, by default, uses system |
| 148 // libraries to evaluate PAC scripts, if available (And if not, skips PAC |
| 149 // resolution). Subclasses may override CreateProxyService for different |
| 150 // default behavior. |
| 146 void set_proxy_service(std::unique_ptr<ProxyService> proxy_service) { | 151 void set_proxy_service(std::unique_ptr<ProxyService> proxy_service) { |
| 147 proxy_service_ = std::move(proxy_service); | 152 proxy_service_ = std::move(proxy_service); |
| 148 } | 153 } |
| 149 | 154 |
| 150 // Call these functions to specify hard-coded Accept-Language | 155 // Call these functions to specify hard-coded Accept-Language |
| 151 // or User-Agent header values for all requests that don't | 156 // or User-Agent header values for all requests that don't |
| 152 // have the headers already set. | 157 // have the headers already set. |
| 153 void set_accept_language(const std::string& accept_language) { | 158 void set_accept_language(const std::string& accept_language) { |
| 154 accept_language_ = accept_language; | 159 accept_language_ = accept_language; |
| 155 } | 160 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. | 329 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. |
| 325 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } | 330 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } |
| 326 | 331 |
| 327 // Sets a specific HttpServerProperties for use in the | 332 // Sets a specific HttpServerProperties for use in the |
| 328 // URLRequestContext rather than creating a default HttpServerPropertiesImpl. | 333 // URLRequestContext rather than creating a default HttpServerPropertiesImpl. |
| 329 void SetHttpServerProperties( | 334 void SetHttpServerProperties( |
| 330 std::unique_ptr<HttpServerProperties> http_server_properties); | 335 std::unique_ptr<HttpServerProperties> http_server_properties); |
| 331 | 336 |
| 332 std::unique_ptr<URLRequestContext> Build(); | 337 std::unique_ptr<URLRequestContext> Build(); |
| 333 | 338 |
| 339 protected: |
| 340 // Lets subclasses override ProxyService creation, using a ProxyService that |
| 341 // uses the URLRequestContext itself to get PAC scripts. When this method is |
| 342 // invoked, the URLRequestContext is not yet ready to service requests. |
| 343 virtual std::unique_ptr<ProxyService> CreateProxyService( |
| 344 std::unique_ptr<ProxyConfigService> proxy_config_service, |
| 345 URLRequestContext* url_request_context, |
| 346 HostResolver* host_resolver, |
| 347 NetworkDelegate* network_delegate, |
| 348 NetLog* net_log); |
| 349 |
| 334 private: | 350 private: |
| 335 const char* name_; | 351 const char* name_; |
| 336 bool enable_brotli_; | 352 bool enable_brotli_; |
| 337 NetworkQualityEstimator* network_quality_estimator_; | 353 NetworkQualityEstimator* network_quality_estimator_; |
| 338 | 354 |
| 339 std::string accept_language_; | 355 std::string accept_language_; |
| 340 std::string user_agent_; | 356 std::string user_agent_; |
| 341 // Include support for data:// requests. | 357 // Include support for data:// requests. |
| 342 bool data_enabled_; | 358 bool data_enabled_; |
| 343 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) | 359 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 // Not owned by the context builder. Once it is set to a non-null value, it | 392 // Not owned by the context builder. Once it is set to a non-null value, it |
| 377 // is guaranteed to be non-null during the lifetime of |this|. | 393 // is guaranteed to be non-null during the lifetime of |this|. |
| 378 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; | 394 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
| 379 | 395 |
| 380 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 396 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 381 }; | 397 }; |
| 382 | 398 |
| 383 } // namespace net | 399 } // namespace net |
| 384 | 400 |
| 385 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 401 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |