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 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 namespace net { | 45 namespace net { |
46 | 46 |
47 class ChannelIDService; | 47 class ChannelIDService; |
48 class CookieStore; | 48 class CookieStore; |
49 class FtpTransactionFactory; | 49 class FtpTransactionFactory; |
50 class HostMappingRules; | 50 class HostMappingRules; |
51 class HttpAuthHandlerFactory; | 51 class HttpAuthHandlerFactory; |
52 class HttpServerProperties; | 52 class HttpServerProperties; |
53 class ProxyConfigService; | 53 class ProxyConfigService; |
| 54 class SocketPerformanceWatcherFactory; |
54 class URLRequestContext; | 55 class URLRequestContext; |
55 class URLRequestInterceptor; | 56 class URLRequestInterceptor; |
56 | 57 |
57 class NET_EXPORT URLRequestContextBuilder { | 58 class NET_EXPORT URLRequestContextBuilder { |
58 public: | 59 public: |
59 struct NET_EXPORT HttpCacheParams { | 60 struct NET_EXPORT HttpCacheParams { |
60 enum Type { | 61 enum Type { |
61 // In-memory cache. | 62 // In-memory cache. |
62 IN_MEMORY, | 63 IN_MEMORY, |
63 // Disk cache using "default" backend. | 64 // Disk cache using "default" backend. |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 } | 286 } |
286 | 287 |
287 void set_throttling_enabled(bool throttling_enabled) { | 288 void set_throttling_enabled(bool throttling_enabled) { |
288 throttling_enabled_ = throttling_enabled; | 289 throttling_enabled_ = throttling_enabled; |
289 } | 290 } |
290 | 291 |
291 void set_backoff_enabled(bool backoff_enabled) { | 292 void set_backoff_enabled(bool backoff_enabled) { |
292 backoff_enabled_ = backoff_enabled; | 293 backoff_enabled_ = backoff_enabled; |
293 } | 294 } |
294 | 295 |
| 296 void set_socket_performance_watcher_factory( |
| 297 SocketPerformanceWatcherFactory* socket_performance_watcher_factory) { |
| 298 socket_performance_watcher_factory_ = socket_performance_watcher_factory; |
| 299 } |
| 300 |
295 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); | 301 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); |
296 | 302 |
297 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> | 303 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> |
298 url_request_interceptors); | 304 url_request_interceptors); |
299 | 305 |
300 // Override the default in-memory cookie store and channel id service. | 306 // Override the default in-memory cookie store and channel id service. |
301 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and | 307 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and |
302 // ChannelIDService will be disabled for this context. | 308 // ChannelIDService will be disabled for this context. |
303 // If |cookie_store| is not NULL and |channel_id_service| is NULL, | 309 // If |cookie_store| is not NULL and |channel_id_service| is NULL, |
304 // only ChannelIdService is disabled for this context. | 310 // only ChannelIdService is disabled for this context. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 std::unique_ptr<CookieStore> cookie_store_; | 368 std::unique_ptr<CookieStore> cookie_store_; |
363 #if !defined(DISABLE_FTP_SUPPORT) | 369 #if !defined(DISABLE_FTP_SUPPORT) |
364 std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory_; | 370 std::unique_ptr<FtpTransactionFactory> ftp_transaction_factory_; |
365 #endif | 371 #endif |
366 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; | 372 std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; |
367 std::unique_ptr<CertVerifier> cert_verifier_; | 373 std::unique_ptr<CertVerifier> cert_verifier_; |
368 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; | 374 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; |
369 std::unique_ptr<HttpServerProperties> http_server_properties_; | 375 std::unique_ptr<HttpServerProperties> http_server_properties_; |
370 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 376 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
371 protocol_handlers_; | 377 protocol_handlers_; |
| 378 // SocketPerformanceWatcherFactory to be used by this context builder. |
| 379 // Not owned by the context builder. Once it is set to a non-null value, it |
| 380 // is guaranteed to be non-null during the lifetime of |this|. |
| 381 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
372 | 382 |
373 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 383 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
374 }; | 384 }; |
375 | 385 |
376 } // namespace net | 386 } // namespace net |
377 | 387 |
378 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 388 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |