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 "base/memory/weak_ptr.h" | |
pauljensen
2015/07/01 18:42:22
unneeded?
xunjieli
2015/07/06 14:58:02
Done.
| |
25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
26 #include "net/base/net_export.h" | 27 #include "net/base/net_export.h" |
27 #include "net/base/network_delegate.h" | 28 #include "net/base/network_delegate.h" |
28 #include "net/dns/host_resolver.h" | 29 #include "net/dns/host_resolver.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 { |
39 | 40 |
40 class ChannelIDService; | 41 class ChannelIDService; |
41 class CookieStore; | 42 class CookieStore; |
42 class FtpTransactionFactory; | 43 class FtpTransactionFactory; |
43 class HostMappingRules; | 44 class HostMappingRules; |
44 class HttpAuthHandlerFactory; | 45 class HttpAuthHandlerFactory; |
46 class HttpServerProperties; | |
pauljensen
2015/07/01 18:42:22
unneeded?
xunjieli
2015/07/06 14:58:02
Done.
| |
47 class HttpServerPropertiesManager; | |
45 class ProxyConfigService; | 48 class ProxyConfigService; |
46 class URLRequestContext; | 49 class URLRequestContext; |
47 class URLRequestInterceptor; | 50 class URLRequestInterceptor; |
48 | 51 |
49 class NET_EXPORT URLRequestContextBuilder { | 52 class NET_EXPORT URLRequestContextBuilder { |
50 public: | 53 public: |
51 struct NET_EXPORT HttpCacheParams { | 54 struct NET_EXPORT HttpCacheParams { |
52 enum Type { | 55 enum Type { |
53 IN_MEMORY, | 56 IN_MEMORY, |
54 DISK, | 57 DISK, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 void SetFileTaskRunner( | 203 void SetFileTaskRunner( |
201 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 204 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
202 | 205 |
203 // Note that if SDCH is enabled without a policy object observing | 206 // Note that if SDCH is enabled without a policy object observing |
204 // the SDCH manager and handling at least Get-Dictionary events, the | 207 // the SDCH manager and handling at least Get-Dictionary events, the |
205 // result will be "Content-Encoding: sdch" advertisements, but no | 208 // result will be "Content-Encoding: sdch" advertisements, but no |
206 // dictionaries fetches and no specific dictionaries advertised. | 209 // dictionaries fetches and no specific dictionaries advertised. |
207 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. | 210 // SdchOwner in net/sdch/sdch_owner.h is a simple policy object. |
208 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } | 211 void set_sdch_enabled(bool enable) { sdch_enabled_ = enable; } |
209 | 212 |
213 // Sets a specific HttpServerPropertiesManager for use in the | |
214 // URLRequestContext rather than creating a HttpServerPropertiesImpl by | |
215 // default. Note that the ownership of |http_server_properties_manager| will | |
216 // be passed to the URLRequestContext. | |
217 void SetHttpServerPropertiesManager( | |
218 scoped_ptr<HttpServerPropertiesManager> http_server_properties_manager); | |
219 | |
210 URLRequestContext* Build(); | 220 URLRequestContext* Build(); |
211 | 221 |
212 private: | 222 private: |
213 struct NET_EXPORT SchemeFactory { | 223 struct NET_EXPORT SchemeFactory { |
214 SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory); | 224 SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory); |
215 ~SchemeFactory(); | 225 ~SchemeFactory(); |
216 | 226 |
217 std::string scheme; | 227 std::string scheme; |
218 HttpAuthHandlerFactory* factory; | 228 HttpAuthHandlerFactory* factory; |
219 }; | 229 }; |
(...skipping 21 matching lines...) Expand all Loading... | |
241 scoped_ptr<NetLog> net_log_; | 251 scoped_ptr<NetLog> net_log_; |
242 scoped_ptr<HostResolver> host_resolver_; | 252 scoped_ptr<HostResolver> host_resolver_; |
243 scoped_ptr<ChannelIDService> channel_id_service_; | 253 scoped_ptr<ChannelIDService> channel_id_service_; |
244 scoped_ptr<ProxyConfigService> proxy_config_service_; | 254 scoped_ptr<ProxyConfigService> proxy_config_service_; |
245 scoped_ptr<ProxyService> proxy_service_; | 255 scoped_ptr<ProxyService> proxy_service_; |
246 scoped_ptr<NetworkDelegate> network_delegate_; | 256 scoped_ptr<NetworkDelegate> network_delegate_; |
247 scoped_refptr<CookieStore> cookie_store_; | 257 scoped_refptr<CookieStore> cookie_store_; |
248 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 258 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
249 std::vector<SchemeFactory> extra_http_auth_handlers_; | 259 std::vector<SchemeFactory> extra_http_auth_handlers_; |
250 ScopedVector<URLRequestInterceptor> url_request_interceptors_; | 260 ScopedVector<URLRequestInterceptor> url_request_interceptors_; |
261 scoped_ptr<HttpServerPropertiesManager> http_server_properties_manager_; | |
251 | 262 |
252 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 263 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
253 }; | 264 }; |
254 | 265 |
255 } // namespace net | 266 } // namespace net |
256 | 267 |
257 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 268 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |