Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/url_request/url_request_context_storage.h" |
| 6 | |
| 7 | #include "base/logging.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 8 | #include "net/base/net_log.h" |
| 9 | #include "net/base/network_delegate.h" |
Torne (Richard Coles) | 03b57e0 | 2014-08-28 12:05:23 +0100 | [diff] [blame] | 10 | #include "net/base/sdch_manager.h" |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 11 | #include "net/cert/cert_verifier.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 12 | #include "net/cookies/cookie_store.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 13 | #include "net/dns/host_resolver.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 14 | #include "net/ftp/ftp_transaction_factory.h" |
| 15 | #include "net/http/http_auth_handler_factory.h" |
| 16 | #include "net/http/http_server_properties.h" |
| 17 | #include "net/http/http_transaction_factory.h" |
| 18 | #include "net/proxy/proxy_service.h" |
Torne (Richard Coles) | 5f1c943 | 2014-08-12 13:47:38 +0100 | [diff] [blame] | 19 | #include "net/ssl/channel_id_service.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 20 | #include "net/url_request/fraudulent_certificate_reporter.h" |
| 21 | #include "net/url_request/http_user_agent_settings.h" |
| 22 | #include "net/url_request/url_request_context.h" |
| 23 | #include "net/url_request/url_request_job_factory.h" |
| 24 | #include "net/url_request/url_request_throttler_manager.h" |
| 25 | |
| 26 | namespace net { |
| 27 | |
| 28 | URLRequestContextStorage::URLRequestContextStorage(URLRequestContext* context) |
| 29 | : context_(context) { |
| 30 | DCHECK(context); |
| 31 | } |
| 32 | |
| 33 | URLRequestContextStorage::~URLRequestContextStorage() {} |
| 34 | |
| 35 | void URLRequestContextStorage::set_net_log(NetLog* net_log) { |
| 36 | context_->set_net_log(net_log); |
| 37 | net_log_.reset(net_log); |
| 38 | } |
| 39 | |
| 40 | void URLRequestContextStorage::set_host_resolver( |
| 41 | scoped_ptr<HostResolver> host_resolver) { |
| 42 | context_->set_host_resolver(host_resolver.get()); |
| 43 | host_resolver_ = host_resolver.Pass(); |
| 44 | } |
| 45 | |
| 46 | void URLRequestContextStorage::set_cert_verifier(CertVerifier* cert_verifier) { |
| 47 | context_->set_cert_verifier(cert_verifier); |
| 48 | cert_verifier_.reset(cert_verifier); |
| 49 | } |
| 50 | |
Torne (Richard Coles) | 5f1c943 | 2014-08-12 13:47:38 +0100 | [diff] [blame] | 51 | void URLRequestContextStorage::set_channel_id_service( |
| 52 | ChannelIDService* channel_id_service) { |
| 53 | context_->set_channel_id_service(channel_id_service); |
| 54 | channel_id_service_.reset(channel_id_service); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | void URLRequestContextStorage::set_fraudulent_certificate_reporter( |
| 58 | FraudulentCertificateReporter* fraudulent_certificate_reporter) { |
| 59 | context_->set_fraudulent_certificate_reporter( |
| 60 | fraudulent_certificate_reporter); |
| 61 | fraudulent_certificate_reporter_.reset(fraudulent_certificate_reporter); |
| 62 | } |
| 63 | |
| 64 | void URLRequestContextStorage::set_http_auth_handler_factory( |
| 65 | HttpAuthHandlerFactory* http_auth_handler_factory) { |
| 66 | context_->set_http_auth_handler_factory(http_auth_handler_factory); |
| 67 | http_auth_handler_factory_.reset(http_auth_handler_factory); |
| 68 | } |
| 69 | |
| 70 | void URLRequestContextStorage::set_proxy_service(ProxyService* proxy_service) { |
| 71 | context_->set_proxy_service(proxy_service); |
| 72 | proxy_service_.reset(proxy_service); |
| 73 | } |
| 74 | |
| 75 | void URLRequestContextStorage::set_ssl_config_service( |
| 76 | SSLConfigService* ssl_config_service) { |
| 77 | context_->set_ssl_config_service(ssl_config_service); |
| 78 | ssl_config_service_ = ssl_config_service; |
| 79 | } |
| 80 | |
| 81 | void URLRequestContextStorage::set_network_delegate( |
| 82 | NetworkDelegate* network_delegate) { |
| 83 | context_->set_network_delegate(network_delegate); |
| 84 | network_delegate_.reset(network_delegate); |
| 85 | } |
| 86 | |
| 87 | void URLRequestContextStorage::set_http_server_properties( |
Ben Murdoch | ca12bfa | 2013-07-23 11:17:05 +0100 | [diff] [blame] | 88 | scoped_ptr<HttpServerProperties> http_server_properties) { |
| 89 | http_server_properties_ = http_server_properties.Pass(); |
| 90 | context_->set_http_server_properties(http_server_properties_->GetWeakPtr()); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) { |
| 94 | context_->set_cookie_store(cookie_store); |
| 95 | cookie_store_ = cookie_store; |
| 96 | } |
| 97 | |
| 98 | void URLRequestContextStorage::set_transport_security_state( |
| 99 | TransportSecurityState* transport_security_state) { |
| 100 | context_->set_transport_security_state(transport_security_state); |
| 101 | transport_security_state_.reset(transport_security_state); |
| 102 | } |
| 103 | |
| 104 | void URLRequestContextStorage::set_http_transaction_factory( |
| 105 | HttpTransactionFactory* http_transaction_factory) { |
| 106 | context_->set_http_transaction_factory(http_transaction_factory); |
| 107 | http_transaction_factory_.reset(http_transaction_factory); |
| 108 | } |
| 109 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 110 | void URLRequestContextStorage::set_job_factory( |
| 111 | URLRequestJobFactory* job_factory) { |
| 112 | context_->set_job_factory(job_factory); |
| 113 | job_factory_.reset(job_factory); |
| 114 | } |
| 115 | |
| 116 | void URLRequestContextStorage::set_throttler_manager( |
| 117 | URLRequestThrottlerManager* throttler_manager) { |
| 118 | context_->set_throttler_manager(throttler_manager); |
| 119 | throttler_manager_.reset(throttler_manager); |
| 120 | } |
| 121 | |
| 122 | void URLRequestContextStorage::set_http_user_agent_settings( |
| 123 | HttpUserAgentSettings* http_user_agent_settings) { |
| 124 | context_->set_http_user_agent_settings(http_user_agent_settings); |
| 125 | http_user_agent_settings_.reset(http_user_agent_settings); |
| 126 | } |
| 127 | |
Torne (Richard Coles) | 03b57e0 | 2014-08-28 12:05:23 +0100 | [diff] [blame] | 128 | void URLRequestContextStorage::set_sdch_manager( |
| 129 | scoped_ptr<SdchManager> sdch_manager) { |
| 130 | context_->set_sdch_manager(sdch_manager.get()); |
| 131 | sdch_manager_ = sdch_manager.Pass(); |
| 132 | } |
| 133 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 134 | } // namespace net |