blob: ea10c7e6cc6bf6fa0902a304a2aa2d93da55211a [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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)58218062012-11-14 11:43:16 +00008#include "net/base/net_log.h"
9#include "net/base/network_delegate.h"
Torne (Richard Coles)03b57e02014-08-28 12:05:23 +010010#include "net/base/sdch_manager.h"
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010011#include "net/cert/cert_verifier.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000012#include "net/cookies/cookie_store.h"
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000013#include "net/dns/host_resolver.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000014#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)5f1c9432014-08-12 13:47:38 +010019#include "net/ssl/channel_id_service.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000020#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
26namespace net {
27
28URLRequestContextStorage::URLRequestContextStorage(URLRequestContext* context)
29 : context_(context) {
30 DCHECK(context);
31}
32
33URLRequestContextStorage::~URLRequestContextStorage() {}
34
35void URLRequestContextStorage::set_net_log(NetLog* net_log) {
36 context_->set_net_log(net_log);
37 net_log_.reset(net_log);
38}
39
40void 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
46void 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)5f1c9432014-08-12 13:47:38 +010051void 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)58218062012-11-14 11:43:16 +000055}
56
57void 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
64void 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
70void URLRequestContextStorage::set_proxy_service(ProxyService* proxy_service) {
71 context_->set_proxy_service(proxy_service);
72 proxy_service_.reset(proxy_service);
73}
74
75void 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
81void URLRequestContextStorage::set_network_delegate(
82 NetworkDelegate* network_delegate) {
83 context_->set_network_delegate(network_delegate);
84 network_delegate_.reset(network_delegate);
85}
86
87void URLRequestContextStorage::set_http_server_properties(
Ben Murdochca12bfa2013-07-23 11:17:05 +010088 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)58218062012-11-14 11:43:16 +000091}
92
93void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) {
94 context_->set_cookie_store(cookie_store);
95 cookie_store_ = cookie_store;
96}
97
98void 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
104void 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)58218062012-11-14 11:43:16 +0000110void URLRequestContextStorage::set_job_factory(
111 URLRequestJobFactory* job_factory) {
112 context_->set_job_factory(job_factory);
113 job_factory_.reset(job_factory);
114}
115
116void URLRequestContextStorage::set_throttler_manager(
117 URLRequestThrottlerManager* throttler_manager) {
118 context_->set_throttler_manager(throttler_manager);
119 throttler_manager_.reset(throttler_manager);
120}
121
122void 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)03b57e02014-08-28 12:05:23 +0100128void 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)58218062012-11-14 11:43:16 +0000134} // namespace net