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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 namespace net { | 46 namespace net { |
47 | 47 |
48 class CertVerifier; | 48 class CertVerifier; |
49 class ChannelIDService; | 49 class ChannelIDService; |
50 class CookieStore; | 50 class CookieStore; |
51 class CTVerifier; | 51 class CTVerifier; |
52 class HttpAuthHandlerFactory; | 52 class HttpAuthHandlerFactory; |
53 class HttpServerProperties; | 53 class HttpServerProperties; |
54 class NetworkQualityEstimator; | 54 class NetworkQualityEstimator; |
55 class ProxyConfigService; | 55 class ProxyConfigService; |
| 56 struct ReportingPolicy; |
56 class URLRequestContext; | 57 class URLRequestContext; |
57 class URLRequestInterceptor; | 58 class URLRequestInterceptor; |
58 | 59 |
59 class NET_EXPORT URLRequestContextBuilder { | 60 class NET_EXPORT URLRequestContextBuilder { |
60 public: | 61 public: |
61 struct NET_EXPORT HttpCacheParams { | 62 struct NET_EXPORT HttpCacheParams { |
62 enum Type { | 63 enum Type { |
63 // In-memory cache. | 64 // In-memory cache. |
64 IN_MEMORY, | 65 IN_MEMORY, |
65 // Disk cache using "default" backend. | 66 // Disk cache using "default" backend. |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } | 275 } |
275 | 276 |
276 void set_throttling_enabled(bool throttling_enabled) { | 277 void set_throttling_enabled(bool throttling_enabled) { |
277 throttling_enabled_ = throttling_enabled; | 278 throttling_enabled_ = throttling_enabled; |
278 } | 279 } |
279 | 280 |
280 void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); | 281 void set_ct_verifier(std::unique_ptr<CTVerifier> ct_verifier); |
281 | 282 |
282 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); | 283 void SetCertVerifier(std::unique_ptr<CertVerifier> cert_verifier); |
283 | 284 |
| 285 // Sets the reporting policy of the created request context. If not set, or |
| 286 // set to nullptr, reporting is disabled. |
| 287 void set_reporting_policy( |
| 288 std::unique_ptr<net::ReportingPolicy> reporting_policy); |
| 289 |
284 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> | 290 void SetInterceptors(std::vector<std::unique_ptr<URLRequestInterceptor>> |
285 url_request_interceptors); | 291 url_request_interceptors); |
286 | 292 |
287 // Override the default in-memory cookie store and channel id service. | 293 // Override the default in-memory cookie store and channel id service. |
288 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and | 294 // If both |cookie_store| and |channel_id_service| are NULL, CookieStore and |
289 // ChannelIDService will be disabled for this context. | 295 // ChannelIDService will be disabled for this context. |
290 // If |cookie_store| is not NULL and |channel_id_service| is NULL, | 296 // If |cookie_store| is not NULL and |channel_id_service| is NULL, |
291 // only ChannelIdService is disabled for this context. | 297 // only ChannelIdService is disabled for this context. |
292 // Note that a persistent cookie store should not be used with an in-memory | 298 // Note that a persistent cookie store should not be used with an in-memory |
293 // channel id service, and one cookie store should not be shared between | 299 // channel id service, and one cookie store should not be shared between |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 std::unique_ptr<ProxyConfigService> proxy_config_service_; | 365 std::unique_ptr<ProxyConfigService> proxy_config_service_; |
360 bool pac_quick_check_enabled_; | 366 bool pac_quick_check_enabled_; |
361 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; | 367 ProxyService::SanitizeUrlPolicy pac_sanitize_url_policy_; |
362 std::unique_ptr<ProxyService> proxy_service_; | 368 std::unique_ptr<ProxyService> proxy_service_; |
363 std::unique_ptr<NetworkDelegate> network_delegate_; | 369 std::unique_ptr<NetworkDelegate> network_delegate_; |
364 std::unique_ptr<ProxyDelegate> proxy_delegate_; | 370 std::unique_ptr<ProxyDelegate> proxy_delegate_; |
365 std::unique_ptr<CookieStore> cookie_store_; | 371 std::unique_ptr<CookieStore> cookie_store_; |
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::unique_ptr<CTVerifier> ct_verifier_; | 374 std::unique_ptr<CTVerifier> ct_verifier_; |
| 375 std::unique_ptr<net::ReportingPolicy> reporting_policy_; |
369 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; | 376 std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; |
370 std::unique_ptr<HttpServerProperties> http_server_properties_; | 377 std::unique_ptr<HttpServerProperties> http_server_properties_; |
371 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> | 378 std::map<std::string, std::unique_ptr<URLRequestJobFactory::ProtocolHandler>> |
372 protocol_handlers_; | 379 protocol_handlers_; |
373 | 380 |
374 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); | 381 DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder); |
375 }; | 382 }; |
376 | 383 |
377 } // namespace net | 384 } // namespace net |
378 | 385 |
379 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ | 386 #endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_BUILDER_H_ |
OLD | NEW |