Reland r74842

Merged correctly this time.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6523067

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75165 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 18315dc..45240d7 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -75,21 +75,22 @@
   }
 
   DnsCertProvenanceChecker* dns_cert_checker() const {
-    return dns_cert_checker_.get();
+    return dns_cert_checker_;
+  }
+  void set_dns_cert_checker(net::DnsCertProvenanceChecker* dns_cert_checker) {
+    dns_cert_checker_ = dns_cert_checker;
   }
 
   // Get the proxy service for this context.
-  ProxyService* proxy_service() const {
-    return proxy_service_;
-  }
-
+  ProxyService* proxy_service() const { return proxy_service_; }
   void set_proxy_service(ProxyService* proxy_service) {
     proxy_service_ = proxy_service;
   }
 
   // Get the ssl config service for this context.
-  SSLConfigService* ssl_config_service() const {
-    return ssl_config_service_;
+  SSLConfigService* ssl_config_service() const { return ssl_config_service_; }
+  void set_ssl_config_service(net::SSLConfigService* service) {
+    ssl_config_service_ = service;
   }
 
   // Gets the HTTP Authentication Handler Factory for this context.
@@ -105,7 +106,6 @@
   HttpTransactionFactory* http_transaction_factory() const {
     return http_transaction_factory_;
   }
-
   void set_http_transaction_factory(HttpTransactionFactory* factory) {
     http_transaction_factory_ = factory;
   }
@@ -114,33 +114,49 @@
   FtpTransactionFactory* ftp_transaction_factory() {
     return ftp_transaction_factory_;
   }
+  void set_ftp_transaction_factory(net::FtpTransactionFactory* factory) {
+    ftp_transaction_factory_ = factory;
+  }
 
   void set_network_delegate(HttpNetworkDelegate* network_delegate) {
     network_delegate_ = network_delegate;
   }
-  HttpNetworkDelegate* network_delegate() { return network_delegate_; }
+  HttpNetworkDelegate* network_delegate() const { return network_delegate_; }
 
   // Gets the cookie store for this context (may be null, in which case
   // cookies are not stored).
-  CookieStore* cookie_store() { return cookie_store_.get(); }
-
+  CookieStore* cookie_store() const { return cookie_store_.get(); }
   void set_cookie_store(CookieStore* cookie_store);
 
   // Gets the cookie policy for this context (may be null, in which case
   // cookies are allowed).
-  CookiePolicy* cookie_policy() { return cookie_policy_; }
+  CookiePolicy* cookie_policy() const { return cookie_policy_; }
+  void set_cookie_policy(CookiePolicy* cookie_policy) {
+    cookie_policy_ = cookie_policy;
+  }
 
-  TransportSecurityState* transport_security_state() {
-      return transport_security_state_; }
+  TransportSecurityState* transport_security_state() const {
+      return transport_security_state_;
+  }
+  void set_transport_security_state(
+      net::TransportSecurityState* state) {
+    transport_security_state_ = state;
+  }
 
   // Gets the FTP authentication cache for this context.
   FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
 
   // Gets the value of 'Accept-Charset' header field.
   const std::string& accept_charset() const { return accept_charset_; }
+  void set_accept_charset(const std::string& accept_charset) {
+    accept_charset_ = accept_charset;
+  }
 
   // Gets the value of 'Accept-Language' header field.
   const std::string& accept_language() const { return accept_language_; }
+  void set_accept_language(const std::string& accept_language) {
+    accept_language_ = accept_language;
+  }
 
   // Gets the UA string to use for the given URL.  Pass an invalid URL (such as
   // GURL()) to get the default UA string.  Subclasses should override this
@@ -164,18 +180,20 @@
 
   virtual ~URLRequestContext();
 
-  // The following members are expected to be initialized and owned by
-  // subclasses.
+ private:
+  // Indicates whether or not this is the main URLRequestContext.
+  bool is_main_;
+
+  // Ownership for these members are not defined here. Clients should either
+  // provide storage elsewhere or have a subclass take ownership.
   NetLog* net_log_;
   HostResolver* host_resolver_;
   CertVerifier* cert_verifier_;
   DnsRRResolver* dnsrr_resolver_;
-  scoped_ptr<DnsCertProvenanceChecker> dns_cert_checker_;
+  DnsCertProvenanceChecker* dns_cert_checker_;
+  HttpAuthHandlerFactory* http_auth_handler_factory_;
   scoped_refptr<ProxyService> proxy_service_;
   scoped_refptr<SSLConfigService> ssl_config_service_;
-  HttpTransactionFactory* http_transaction_factory_;
-  FtpTransactionFactory* ftp_transaction_factory_;
-  HttpAuthHandlerFactory* http_auth_handler_factory_;
   HttpNetworkDelegate* network_delegate_;
   scoped_refptr<CookieStore> cookie_store_;
   CookiePolicy* cookie_policy_;
@@ -188,9 +206,8 @@
   // filename for file download.
   std::string referrer_charset_;
 
- private:
-  // Indicates whether or not this is the main URLRequestContext.
-  bool is_main_;
+  HttpTransactionFactory* http_transaction_factory_;
+  FtpTransactionFactory* ftp_transaction_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
 };