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 "build/build_config.h" | 24 #include "build/build_config.h" |
25 #include "net/base/net_export.h" | 25 #include "net/base/net_export.h" |
26 #include "net/base/network_delegate.h" | 26 #include "net/base/network_delegate.h" |
27 #include "net/dns/host_resolver.h" | 27 #include "net/dns/host_resolver.h" |
28 #include "net/proxy/proxy_config_service.h" | 28 #include "net/proxy/proxy_config_service.h" |
29 #include "net/proxy/proxy_service.h" | 29 #include "net/proxy/proxy_service.h" |
| 30 #include "net/quic/quic_protocol.h" |
30 #include "net/socket/next_proto.h" | 31 #include "net/socket/next_proto.h" |
31 | 32 |
32 namespace net { | 33 namespace net { |
33 | 34 |
34 class FtpTransactionFactory; | 35 class FtpTransactionFactory; |
35 class HostMappingRules; | 36 class HostMappingRules; |
36 class HttpAuthHandlerFactory; | 37 class HttpAuthHandlerFactory; |
37 class ProxyConfigService; | 38 class ProxyConfigService; |
38 class URLRequestContext; | 39 class URLRequestContext; |
39 | 40 |
(...skipping 25 matching lines...) Expand all Loading... |
65 | 66 |
66 // These fields mirror those in net::HttpNetworkSession::Params; | 67 // These fields mirror those in net::HttpNetworkSession::Params; |
67 bool ignore_certificate_errors; | 68 bool ignore_certificate_errors; |
68 HostMappingRules* host_mapping_rules; | 69 HostMappingRules* host_mapping_rules; |
69 uint16 testing_fixed_http_port; | 70 uint16 testing_fixed_http_port; |
70 uint16 testing_fixed_https_port; | 71 uint16 testing_fixed_https_port; |
71 NextProtoVector next_protos; | 72 NextProtoVector next_protos; |
72 std::string trusted_spdy_proxy; | 73 std::string trusted_spdy_proxy; |
73 bool use_alternate_protocols; | 74 bool use_alternate_protocols; |
74 bool enable_quic; | 75 bool enable_quic; |
| 76 QuicTagVector quic_connection_options; |
75 }; | 77 }; |
76 | 78 |
77 URLRequestContextBuilder(); | 79 URLRequestContextBuilder(); |
78 ~URLRequestContextBuilder(); | 80 ~URLRequestContextBuilder(); |
79 | 81 |
80 // These functions are mutually exclusive. The ProxyConfigService, if | 82 // These functions are mutually exclusive. The ProxyConfigService, if |
81 // set, will be used to construct a ProxyService. | 83 // set, will be used to construct a ProxyService. |
82 void set_proxy_config_service(ProxyConfigService* proxy_config_service) { | 84 void set_proxy_config_service(ProxyConfigService* proxy_config_service) { |
83 proxy_config_service_.reset(proxy_config_service); | 85 proxy_config_service_.reset(proxy_config_service); |
84 } | 86 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 157 |
156 void set_transport_security_persister_path( | 158 void set_transport_security_persister_path( |
157 const base::FilePath& transport_security_persister_path) { | 159 const base::FilePath& transport_security_persister_path) { |
158 transport_security_persister_path_ = transport_security_persister_path; | 160 transport_security_persister_path_ = transport_security_persister_path; |
159 } | 161 } |
160 | 162 |
161 // Adjust |http_network_session_params_.next_protos| to enable SPDY and QUIC. | 163 // Adjust |http_network_session_params_.next_protos| to enable SPDY and QUIC. |
162 void SetSpdyAndQuicEnabled(bool spdy_enabled, | 164 void SetSpdyAndQuicEnabled(bool spdy_enabled, |
163 bool quic_enabled); | 165 bool quic_enabled); |
164 | 166 |
| 167 void set_quic_connection_options( |
| 168 const QuicTagVector& quic_connection_options) { |
| 169 http_network_session_params_.quic_connection_options = |
| 170 quic_connection_options; |
| 171 } |
| 172 |
165 void set_throttling_enabled(bool throttling_enabled) { | 173 void set_throttling_enabled(bool throttling_enabled) { |
166 throttling_enabled_ = throttling_enabled; | 174 throttling_enabled_ = throttling_enabled; |
167 } | 175 } |
168 | 176 |
169 URLRequestContext* Build(); | 177 URLRequestContext* Build(); |
170 | 178 |
171 private: | 179 private: |
172 struct NET_EXPORT SchemeFactory { | 180 struct NET_EXPORT SchemeFactory { |
173 SchemeFactory(const std::string& scheme, | 181 SchemeFactory(const std::string& scheme, |
174 net::HttpAuthHandlerFactory* factory); | 182 net::HttpAuthHandlerFactory* factory); |
(...skipping 28 matching lines...) Expand all Loading... |
203 scoped_ptr<NetworkDelegate> network_delegate_; | 211 scoped_ptr<NetworkDelegate> network_delegate_; |
204 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 212 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
205 std::vector<SchemeFactory> extra_http_auth_handlers_; | 213 std::vector<SchemeFactory> extra_http_auth_handlers_; |
206 | 214 |
207 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 215 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
208 }; | 216 }; |
209 | 217 |
210 } // namespace net | 218 } // namespace net |
211 | 219 |
212 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 220 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |