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 <string> | 17 #include <string> |
18 #include <vector> | 18 #include <vector> |
19 | 19 |
20 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
21 #include "base/files/file_path.h" | 21 #include "base/files/file_path.h" |
22 #include "base/memory/ref_counted.h" | 22 #include "base/memory/ref_counted.h" |
23 #include "base/memory/scoped_ptr.h" | 23 #include "base/memory/scoped_ptr.h" |
24 #include "base/memory/scoped_vector.h" | 24 #include "base/memory/scoped_vector.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "net/base/net_export.h" | 26 #include "net/base/net_export.h" |
27 #include "net/base/network_delegate.h" | 27 #include "net/base/network_delegate.h" |
28 #include "net/dns/host_resolver.h" | 28 #include "net/dns/host_resolver.h" |
| 29 #include "net/http/http_network_session.h" |
29 #include "net/proxy/proxy_config_service.h" | 30 #include "net/proxy/proxy_config_service.h" |
30 #include "net/proxy/proxy_service.h" | 31 #include "net/proxy/proxy_service.h" |
31 #include "net/quic/quic_protocol.h" | 32 #include "net/quic/quic_protocol.h" |
32 #include "net/socket/next_proto.h" | 33 #include "net/socket/next_proto.h" |
33 | 34 |
34 namespace base { | 35 namespace base { |
35 class SingleThreadTaskRunner; | 36 class SingleThreadTaskRunner; |
36 } | 37 } |
37 | 38 |
38 namespace net { | 39 namespace net { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 std::string trusted_spdy_proxy; | 83 std::string trusted_spdy_proxy; |
83 bool use_alternative_services; | 84 bool use_alternative_services; |
84 bool enable_quic; | 85 bool enable_quic; |
85 bool enable_insecure_quic; | 86 bool enable_insecure_quic; |
86 QuicTagVector quic_connection_options; | 87 QuicTagVector quic_connection_options; |
87 }; | 88 }; |
88 | 89 |
89 URLRequestContextBuilder(); | 90 URLRequestContextBuilder(); |
90 ~URLRequestContextBuilder(); | 91 ~URLRequestContextBuilder(); |
91 | 92 |
| 93 // Extracts the component pointers required to construct an HttpNetworkSession |
| 94 // and copies them into the Params used to create the session. This function |
| 95 // should be used to ensure that a context and its associated |
| 96 // HttpNetworkSession are consistent. |
| 97 static void SetHttpNetworkSessionComponents( |
| 98 const URLRequestContext* context, |
| 99 HttpNetworkSession::Params* params); |
| 100 |
92 // These functions are mutually exclusive. The ProxyConfigService, if | 101 // These functions are mutually exclusive. The ProxyConfigService, if |
93 // set, will be used to construct a ProxyService. | 102 // set, will be used to construct a ProxyService. |
94 void set_proxy_config_service(ProxyConfigService* proxy_config_service) { | 103 void set_proxy_config_service(ProxyConfigService* proxy_config_service) { |
95 proxy_config_service_.reset(proxy_config_service); | 104 proxy_config_service_.reset(proxy_config_service); |
96 } | 105 } |
97 void set_proxy_service(ProxyService* proxy_service) { | 106 void set_proxy_service(ProxyService* proxy_service) { |
98 proxy_service_.reset(proxy_service); | 107 proxy_service_.reset(proxy_service); |
99 } | 108 } |
100 | 109 |
101 // Call these functions to specify hard-coded Accept-Language | 110 // Call these functions to specify hard-coded Accept-Language |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 std::vector<SchemeFactory> extra_http_auth_handlers_; | 274 std::vector<SchemeFactory> extra_http_auth_handlers_; |
266 ScopedVector<URLRequestInterceptor> url_request_interceptors_; | 275 ScopedVector<URLRequestInterceptor> url_request_interceptors_; |
267 scoped_ptr<HttpServerProperties> http_server_properties_; | 276 scoped_ptr<HttpServerProperties> http_server_properties_; |
268 | 277 |
269 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 278 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
270 }; | 279 }; |
271 | 280 |
272 } // namespace net | 281 } // namespace net |
273 | 282 |
274 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 283 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |