Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: net/url_request/url_request_context_builder.h

Issue 1239393003: Refactor main URLRequestContext creation to use URLRequestContextBuilder Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_context.cc ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_context_builder.h
diff --git a/net/url_request/url_request_context_builder.h b/net/url_request/url_request_context_builder.h
index a104c4386550a0d43363b6d9f159c48c4866ffb6..c4e42e9389f40614d386d8b258c002d474a38dec 100644
--- a/net/url_request/url_request_context_builder.h
+++ b/net/url_request/url_request_context_builder.h
@@ -18,6 +18,7 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
@@ -37,14 +38,53 @@ class SingleThreadTaskRunner;
namespace net {
+class CertVerifier;
class ChannelIDService;
class CookieStore;
+class CTVerifier;
+class FraudulentCertificateReporter;
class FtpTransactionFactory;
class HostMappingRules;
class HttpAuthHandlerFactory;
+class HttpServerProperties;
+class HttpTransactionFactory;
+class HttpUserAgentSettings;
+class NetworkQualityEstimator;
class ProxyConfigService;
+class SSLConfigService;
+class SdchManager;
+class TransportSecurityState;
class URLRequestContext;
class URLRequestInterceptor;
+class URLRequestJobFactory;
+
+// The next threee classes are interfaces to allow callbacks during the
+// construction of a main context.
+// TODO(wjmaclean): Should these be combined into a single Delegate class,
+// to be implemented by the creator of the main context?
+class FraudulentCertificateReporterFactory {
+ public:
+ FraudulentCertificateReporterFactory() {}
+
+ virtual FraudulentCertificateReporter* Create(
+ URLRequestContext* context) const = 0;
+};
+
+class HttpTransactionFactoryFactory {
+ public:
+ HttpTransactionFactoryFactory() {}
+ virtual ~HttpTransactionFactoryFactory() {}
+
+ virtual HttpTransactionFactory* Create(URLRequestContext* context) = 0;
+};
+
+class CertVerifierDelegate {
+ public:
+ CertVerifierDelegate() {}
+ virtual ~CertVerifierDelegate() {}
+
+ virtual CertVerifier* Get(URLRequestContext* context) = 0;
+};
class NET_EXPORT URLRequestContextBuilder {
public:
@@ -95,6 +135,13 @@ class NET_EXPORT URLRequestContextBuilder {
void set_proxy_service(ProxyService* proxy_service) {
proxy_service_.reset(proxy_service);
}
+ void set_proxy_service_unowned(ProxyService* proxy_service) {
+ proxy_service_unowned_ = proxy_service;
+ }
+
+ void set_ssl_config_service(SSLConfigService* service) {
+ ssl_config_service_ = service;
+ }
// Call these functions to specify hard-coded Accept-Language
// or User-Agent header values for all requests that don't
@@ -209,6 +256,62 @@ class NET_EXPORT URLRequestContextBuilder {
URLRequestContext* Build();
+ // Functions specific to building a main context.
+ void set_fraudulent_certificate_reporter_factory(
+ const FraudulentCertificateReporterFactory* factory) {
+ fraudulent_certificate_reporter_factory_ = factory;
+ }
+
+ void set_net_log_unowned(NetLog* net_log) {
+ net_log_unowned_= net_log;
+ }
+
+ void set_transport_security_state(TransportSecurityState* state){
+ transport_security_state_.reset(state);
+ }
+
+ void set_http_user_agent_settings_unowned(HttpUserAgentSettings* settings) {
+ http_user_agent_settings_unowned_ = settings;
+ }
+
+ void set_http_transaction_factory_factory(
+ HttpTransactionFactoryFactory* factory) {
+ http_transaction_factory_factory_.reset(factory);
+ }
+
+ void set_cert_verifier_delegate(CertVerifierDelegate* cert_verifier_delegate) {
+ cert_verifier_delegate_.reset(cert_verifier_delegate);
+ }
+
+ void set_host_resolver_unowned(HostResolver* host_resolver) {
+ host_resolver_unowned_ = host_resolver;
+ }
+
+ void set_cert_transparency_verifier_unowned(CTVerifier* ct_verifier) {
+ cert_transparency_verifier_unowned_ = ct_verifier;
+ }
+
+ void set_http_server_properties(
+ const base::WeakPtr<HttpServerProperties>& http_server_properties) {
+ http_server_properties_ = http_server_properties;
+ }
+
+ void set_http_auth_handler_factory_unowned(
+ HttpAuthHandlerFactory* http_auth_handler_factory) {
+ http_auth_handler_factory_unowned_ = http_auth_handler_factory;
+ }
+
+ void set_sdch_manager(SdchManager* manager);
+
+ void set_job_factory(scoped_ptr<URLRequestJobFactory> factory);
+
+ void set_network_quality_estimator_unowned(
+ NetworkQualityEstimator* network_quality_estimator) {
+ network_quality_estimator_unowned_ = network_quality_estimator;
+ }
+
+ URLRequestContext* BuildMainContext();
+
private:
struct NET_EXPORT SchemeFactory {
SchemeFactory(const std::string& scheme, HttpAuthHandlerFactory* factory);
@@ -249,6 +352,27 @@ class NET_EXPORT URLRequestContextBuilder {
std::vector<SchemeFactory> extra_http_auth_handlers_;
ScopedVector<URLRequestInterceptor> url_request_interceptors_;
+ // Member variables specific to building a main context.
+ // Names ending in 'unowned' indicate variables that will not be owned by
+ // the main context, If this ownership status changes, then the variable
+ // in question should be renamed.
+ const FraudulentCertificateReporterFactory*
+ fraudulent_certificate_reporter_factory_;
+ NetLog* net_log_unowned_;
+ scoped_ptr<TransportSecurityState> transport_security_state_;
+ HttpUserAgentSettings* http_user_agent_settings_unowned_;
+ scoped_ptr<HttpTransactionFactoryFactory> http_transaction_factory_factory_;
+ scoped_ptr<CertVerifierDelegate> cert_verifier_delegate_;
+ HostResolver* host_resolver_unowned_;
+ CTVerifier* cert_transparency_verifier_unowned_;
+ base::WeakPtr<HttpServerProperties> http_server_properties_;
+ HttpAuthHandlerFactory* http_auth_handler_factory_unowned_;
+ scoped_ptr<SdchManager> sdch_manager_;
+ scoped_ptr<URLRequestJobFactory> job_factory_;
+ NetworkQualityEstimator* network_quality_estimator_unowned_;
+ scoped_refptr<SSLConfigService> ssl_config_service_;
+ ProxyService* proxy_service_unowned_;
+
DISALLOW_COPY_AND_ASSIGN(URLRequestContextBuilder);
};
« no previous file with comments | « net/url_request/url_request_context.cc ('k') | net/url_request/url_request_context_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698