| 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 "build/build_config.h" | 25 #include "build/build_config.h" |
| 25 #include "net/base/net_export.h" | 26 #include "net/base/net_export.h" |
| 26 #include "net/base/network_delegate.h" | 27 #include "net/base/network_delegate.h" |
| 27 #include "net/dns/host_resolver.h" | 28 #include "net/dns/host_resolver.h" |
| 28 #include "net/proxy/proxy_config_service.h" | 29 #include "net/proxy/proxy_config_service.h" |
| 29 #include "net/proxy/proxy_service.h" | 30 #include "net/proxy/proxy_service.h" |
| 30 #include "net/quic/quic_protocol.h" | 31 #include "net/quic/quic_protocol.h" |
| 31 #include "net/socket/next_proto.h" | 32 #include "net/socket/next_proto.h" |
| 32 | 33 |
| 33 namespace base { | 34 namespace base { |
| 34 class SingleThreadTaskRunner; | 35 class SingleThreadTaskRunner; |
| 35 } | 36 } |
| 36 | 37 |
| 37 namespace net { | 38 namespace net { |
| 38 | 39 |
| 39 class ChannelIDService; | 40 class ChannelIDService; |
| 40 class CookieStore; | 41 class CookieStore; |
| 41 class FtpTransactionFactory; | 42 class FtpTransactionFactory; |
| 42 class HostMappingRules; | 43 class HostMappingRules; |
| 43 class HttpAuthHandlerFactory; | 44 class HttpAuthHandlerFactory; |
| 44 class ProxyConfigService; | 45 class ProxyConfigService; |
| 45 class URLRequestContext; | 46 class URLRequestContext; |
| 47 class URLRequestInterceptor; |
| 46 | 48 |
| 47 class NET_EXPORT URLRequestContextBuilder { | 49 class NET_EXPORT URLRequestContextBuilder { |
| 48 public: | 50 public: |
| 49 struct NET_EXPORT HttpCacheParams { | 51 struct NET_EXPORT HttpCacheParams { |
| 50 enum Type { | 52 enum Type { |
| 51 IN_MEMORY, | 53 IN_MEMORY, |
| 52 DISK, | 54 DISK, |
| 53 }; | 55 }; |
| 54 | 56 |
| 55 HttpCacheParams(); | 57 HttpCacheParams(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 void set_quic_connection_options( | 174 void set_quic_connection_options( |
| 173 const QuicTagVector& quic_connection_options) { | 175 const QuicTagVector& quic_connection_options) { |
| 174 http_network_session_params_.quic_connection_options = | 176 http_network_session_params_.quic_connection_options = |
| 175 quic_connection_options; | 177 quic_connection_options; |
| 176 } | 178 } |
| 177 | 179 |
| 178 void set_throttling_enabled(bool throttling_enabled) { | 180 void set_throttling_enabled(bool throttling_enabled) { |
| 179 throttling_enabled_ = throttling_enabled; | 181 throttling_enabled_ = throttling_enabled; |
| 180 } | 182 } |
| 181 | 183 |
| 184 void SetInterceptors( |
| 185 ScopedVector<URLRequestInterceptor> url_request_interceptors); |
| 186 |
| 182 // Override the default in-memory cookie store and channel id service. | 187 // Override the default in-memory cookie store and channel id service. |
| 183 // |cookie_store| must not be NULL. |channel_id_service| may be NULL to | 188 // |cookie_store| must not be NULL. |channel_id_service| may be NULL to |
| 184 // disable channel id for this context. | 189 // disable channel id for this context. |
| 185 // Note that a persistent cookie store should not be used with an in-memory | 190 // Note that a persistent cookie store should not be used with an in-memory |
| 186 // channel id service, and one cookie store should not be shared between | 191 // channel id service, and one cookie store should not be shared between |
| 187 // multiple channel-id stores (or used both with and without a channel id | 192 // multiple channel-id stores (or used both with and without a channel id |
| 188 // store). | 193 // store). |
| 189 void SetCookieAndChannelIdStores( | 194 void SetCookieAndChannelIdStores( |
| 190 const scoped_refptr<CookieStore>& cookie_store, | 195 const scoped_refptr<CookieStore>& cookie_store, |
| 191 scoped_ptr<ChannelIDService> channel_id_service); | 196 scoped_ptr<ChannelIDService> channel_id_service); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 base::FilePath transport_security_persister_path_; | 240 base::FilePath transport_security_persister_path_; |
| 236 scoped_ptr<NetLog> net_log_; | 241 scoped_ptr<NetLog> net_log_; |
| 237 scoped_ptr<HostResolver> host_resolver_; | 242 scoped_ptr<HostResolver> host_resolver_; |
| 238 scoped_ptr<ChannelIDService> channel_id_service_; | 243 scoped_ptr<ChannelIDService> channel_id_service_; |
| 239 scoped_ptr<ProxyConfigService> proxy_config_service_; | 244 scoped_ptr<ProxyConfigService> proxy_config_service_; |
| 240 scoped_ptr<ProxyService> proxy_service_; | 245 scoped_ptr<ProxyService> proxy_service_; |
| 241 scoped_ptr<NetworkDelegate> network_delegate_; | 246 scoped_ptr<NetworkDelegate> network_delegate_; |
| 242 scoped_refptr<CookieStore> cookie_store_; | 247 scoped_refptr<CookieStore> cookie_store_; |
| 243 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 248 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
| 244 std::vector<SchemeFactory> extra_http_auth_handlers_; | 249 std::vector<SchemeFactory> extra_http_auth_handlers_; |
| 250 ScopedVector<URLRequestInterceptor> url_request_interceptors_; |
| 245 | 251 |
| 246 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 252 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 247 }; | 253 }; |
| 248 | 254 |
| 249 } // namespace net | 255 } // namespace net |
| 250 | 256 |
| 251 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 257 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |