| 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 "base/task_scheduler/task_traits.h" |
| 29 #include "build/build_config.h" | 30 #include "build/build_config.h" |
| 30 #include "net/base/net_export.h" | 31 #include "net/base/net_export.h" |
| 31 #include "net/base/network_delegate.h" | 32 #include "net/base/network_delegate.h" |
| 32 #include "net/base/proxy_delegate.h" | 33 #include "net/base/proxy_delegate.h" |
| 33 #include "net/dns/host_resolver.h" | 34 #include "net/dns/host_resolver.h" |
| 34 #include "net/http/http_network_session.h" | 35 #include "net/http/http_network_session.h" |
| 35 #include "net/net_features.h" | 36 #include "net/net_features.h" |
| 36 #include "net/proxy/proxy_config_service.h" | 37 #include "net/proxy/proxy_config_service.h" |
| 37 #include "net/proxy/proxy_service.h" | 38 #include "net/proxy/proxy_service.h" |
| 38 #include "net/quic/core/quic_packets.h" | 39 #include "net/quic/core/quic_packets.h" |
| 39 #include "net/socket/next_proto.h" | 40 #include "net/socket/next_proto.h" |
| 40 #include "net/ssl/ssl_config_service.h" | 41 #include "net/ssl/ssl_config_service.h" |
| 41 #include "net/url_request/url_request_job_factory.h" | 42 #include "net/url_request/url_request_job_factory.h" |
| 42 | 43 |
| 43 namespace base { | 44 namespace base { |
| 44 class SingleThreadTaskRunner; | 45 class SingleThreadTaskRunner; |
| 46 class SequencedTaskRunner; |
| 47 class TaskRunner; |
| 45 } | 48 } |
| 46 | 49 |
| 47 namespace net { | 50 namespace net { |
| 48 | 51 |
| 49 class CertVerifier; | 52 class CertVerifier; |
| 50 class ChannelIDService; | 53 class ChannelIDService; |
| 51 class CookieStore; | 54 class CookieStore; |
| 52 class CTVerifier; | 55 class CTVerifier; |
| 53 class HttpAuthHandlerFactory; | 56 class HttpAuthHandlerFactory; |
| 54 class HttpServerProperties; | 57 class HttpServerProperties; |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 // If |cookie_store| is not NULL and |channel_id_service| is NULL, | 321 // If |cookie_store| is not NULL and |channel_id_service| is NULL, |
| 319 // only ChannelIdService is disabled for this context. | 322 // only ChannelIdService is disabled for this context. |
| 320 // Note that a persistent cookie store should not be used with an in-memory | 323 // Note that a persistent cookie store should not be used with an in-memory |
| 321 // channel id service, and one cookie store should not be shared between | 324 // channel id service, and one cookie store should not be shared between |
| 322 // multiple channel-id stores (or used both with and without a channel id | 325 // multiple channel-id stores (or used both with and without a channel id |
| 323 // store). | 326 // store). |
| 324 void SetCookieAndChannelIdStores( | 327 void SetCookieAndChannelIdStores( |
| 325 std::unique_ptr<CookieStore> cookie_store, | 328 std::unique_ptr<CookieStore> cookie_store, |
| 326 std::unique_ptr<ChannelIDService> channel_id_service); | 329 std::unique_ptr<ChannelIDService> channel_id_service); |
| 327 | 330 |
| 328 // Sets the task runner used to perform file operations. If not set, one will | 331 // Sets the task runner used to perform file operations. If not set, |
| 329 // be created. | 332 // TaskSchedulers will be used instead. |
| 330 void SetFileTaskRunner( | 333 void SetFileTaskRunner( |
| 331 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 334 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| 332 | 335 |
| 333 // Note that if SDCH is enabled without a policy object observing | 336 // Note that if SDCH is enabled without a policy object observing |
| 334 // the SDCH manager and handling at least Get-Dictionary events, the | 337 // the SDCH manager and handling at least Get-Dictionary events, the |
| 335 // result will be "Content-Encoding: sdch" advertisements, but no | 338 // result will be "Content-Encoding: sdch" advertisements, but no |
| 336 // dictionaries fetches and no specific dictionaries advertised. | 339 // dictionaries fetches and no specific dictionaries advertised. |
| 337 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. | 340 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. |
| 338 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } | 341 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } |
| 339 | 342 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 351 // Lets subclasses override ProxyService creation, using a ProxyService that | 354 // Lets subclasses override ProxyService creation, using a ProxyService that |
| 352 // uses the URLRequestContext itself to get PAC scripts. When this method is | 355 // uses the URLRequestContext itself to get PAC scripts. When this method is |
| 353 // invoked, the URLRequestContext is not yet ready to service requests. | 356 // invoked, the URLRequestContext is not yet ready to service requests. |
| 354 virtual std::unique_ptr<ProxyService> CreateProxyService( | 357 virtual std::unique_ptr<ProxyService> CreateProxyService( |
| 355 std::unique_ptr<ProxyConfigService> proxy_config_service, | 358 std::unique_ptr<ProxyConfigService> proxy_config_service, |
| 356 URLRequestContext* url_request_context, | 359 URLRequestContext* url_request_context, |
| 357 HostResolver* host_resolver, | 360 HostResolver* host_resolver, |
| 358 NetworkDelegate* network_delegate, | 361 NetworkDelegate* network_delegate, |
| 359 NetLog* net_log); | 362 NetLog* net_log); |
| 360 | 363 |
| 364 // Returns a TaskRunner with the specified traits. If |file_task_runner_| is |
| 365 // non-NULL, uses that. Otherwise, uses base/task_scheduler/ and the specified |
| 366 // traits. |
| 367 scoped_refptr<base::TaskRunner> GetFileTaskRunner( |
| 368 const base::TaskTraits& traits); |
| 369 scoped_refptr<base::SequencedTaskRunner> GetFileSequencedTaskRunner( |
| 370 const base::TaskTraits& traits); |
| 371 scoped_refptr<base::SingleThreadTaskRunner> GetFileSingleThreadTaskRunner( |
| 372 const base::TaskTraits& traits); |
| 373 |
| 361 private: | 374 private: |
| 362 const char* name_; | 375 const char* name_; |
| 363 bool enable_brotli_; | 376 bool enable_brotli_; |
| 364 NetworkQualityEstimator* network_quality_estimator_; | 377 NetworkQualityEstimator* network_quality_estimator_; |
| 365 | 378 |
| 366 std::string accept_language_; | 379 std::string accept_language_; |
| 367 std::string user_agent_; | 380 std::string user_agent_; |
| 368 // Include support for data:// requests. | 381 // Include support for data:// requests. |
| 369 bool data_enabled_; | 382 bool data_enabled_; |
| 370 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) | 383 #if !BUILDFLAG(DISABLE_FILE_SUPPORT) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 std::unique_ptr<HttpServerProperties> http_server_properties_; | 416 std::unique_ptr<HttpServerProperties> http_server_properties_; |
| 404 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 417 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
| 405 protocol_handlers_; | 418 protocol_handlers_; |
| 406 | 419 |
| 407 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 420 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 408 }; | 421 }; |
| 409 | 422 |
| 410 } // namespace net | 423 } // namespace net |
| 411 | 424 |
| 412 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 425 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |