Chromium Code Reviews| 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 net { | 34 namespace net { |
| 34 | 35 |
| 35 class ChannelIDService; | 36 class ChannelIDService; |
| 36 class CookieStore; | 37 class CookieStore; |
| 37 class FtpTransactionFactory; | 38 class FtpTransactionFactory; |
| 38 class HostMappingRules; | 39 class HostMappingRules; |
| 39 class HttpAuthHandlerFactory; | 40 class HttpAuthHandlerFactory; |
| 40 class ProxyConfigService; | 41 class ProxyConfigService; |
| 41 class URLRequestContext; | 42 class URLRequestContext; |
| 43 class URLRequestInterceptor; | |
| 42 | 44 |
| 43 class NET_EXPORT URLRequestContextBuilder { | 45 class NET_EXPORT URLRequestContextBuilder { |
| 44 public: | 46 public: |
| 47 typedef ScopedVector<URLRequestInterceptor> URLRequestInterceptors; | |
|
mmenke
2015/03/13 18:16:48
Optional: Suggest just inlining ScopedVector<URLR
bengr
2015/03/19 01:03:51
Done.
| |
| 48 | |
| 45 struct NET_EXPORT HttpCacheParams { | 49 struct NET_EXPORT HttpCacheParams { |
| 46 enum Type { | 50 enum Type { |
| 47 IN_MEMORY, | 51 IN_MEMORY, |
| 48 DISK, | 52 DISK, |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 HttpCacheParams(); | 55 HttpCacheParams(); |
| 52 ~HttpCacheParams(); | 56 ~HttpCacheParams(); |
| 53 | 57 |
| 54 // The type of HTTP cache. Default is IN_MEMORY. | 58 // The type of HTTP cache. Default is IN_MEMORY. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 void set_quic_connection_options( | 173 void set_quic_connection_options( |
| 170 const QuicTagVector& quic_connection_options) { | 174 const QuicTagVector& quic_connection_options) { |
| 171 http_network_session_params_.quic_connection_options = | 175 http_network_session_params_.quic_connection_options = |
| 172 quic_connection_options; | 176 quic_connection_options; |
| 173 } | 177 } |
| 174 | 178 |
| 175 void set_throttling_enabled(bool throttling_enabled) { | 179 void set_throttling_enabled(bool throttling_enabled) { |
| 176 throttling_enabled_ = throttling_enabled; | 180 throttling_enabled_ = throttling_enabled; |
| 177 } | 181 } |
| 178 | 182 |
| 183 void SetInterceptors(URLRequestInterceptors url_request_interceptors); | |
| 184 | |
| 179 // Override the default in-memory cookie store and channel id service. | 185 // Override the default in-memory cookie store and channel id service. |
| 180 // |cookie_store| must not be NULL. |channel_id_service| may be NULL to | 186 // |cookie_store| must not be NULL. |channel_id_service| may be NULL to |
| 181 // disable channel id for this context. | 187 // disable channel id for this context. |
| 182 // Note that a persistent cookie store should not be used with an in-memory | 188 // Note that a persistent cookie store should not be used with an in-memory |
| 183 // channel id service, and one cookie store should not be shared between | 189 // channel id service, and one cookie store should not be shared between |
| 184 // multiple channel-id stores (or used both with and without a channel id | 190 // multiple channel-id stores (or used both with and without a channel id |
| 185 // store). | 191 // store). |
| 186 void SetCookieAndChannelIdStores( | 192 void SetCookieAndChannelIdStores( |
| 187 const scoped_refptr<CookieStore>& cookie_store, | 193 const scoped_refptr<CookieStore>& cookie_store, |
| 188 scoped_ptr<ChannelIDService> channel_id_service); | 194 scoped_ptr<ChannelIDService> channel_id_service); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 219 base::FilePath transport_security_persister_path_; | 225 base::FilePath transport_security_persister_path_; |
| 220 scoped_ptr<NetLog> net_log_; | 226 scoped_ptr<NetLog> net_log_; |
| 221 scoped_ptr<HostResolver> host_resolver_; | 227 scoped_ptr<HostResolver> host_resolver_; |
| 222 scoped_ptr<ChannelIDService> channel_id_service_; | 228 scoped_ptr<ChannelIDService> channel_id_service_; |
| 223 scoped_ptr<ProxyConfigService> proxy_config_service_; | 229 scoped_ptr<ProxyConfigService> proxy_config_service_; |
| 224 scoped_ptr<ProxyService> proxy_service_; | 230 scoped_ptr<ProxyService> proxy_service_; |
| 225 scoped_ptr<NetworkDelegate> network_delegate_; | 231 scoped_ptr<NetworkDelegate> network_delegate_; |
| 226 scoped_refptr<CookieStore> cookie_store_; | 232 scoped_refptr<CookieStore> cookie_store_; |
| 227 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 233 scoped_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
| 228 std::vector<SchemeFactory> extra_http_auth_handlers_; | 234 std::vector<SchemeFactory> extra_http_auth_handlers_; |
| 235 URLRequestInterceptors url_request_interceptors_; | |
| 229 | 236 |
| 230 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 237 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
| 231 }; | 238 }; |
| 232 | 239 |
| 233 } // namespace net | 240 } // namespace net |
| 234 | 241 |
| 235 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 242 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
| OLD | NEW |