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.
5 #include "net/url_request/url_request_context_storage.h"
7 #include "base/logging.h"
8 #include "net/base/net_log.h"
9 #include "net/base/network_delegate.h"
10 #include "net/base/sdch_manager.h"
11 #include "net/cert/cert_verifier.h"
12 #include "net/cookies/cookie_store.h"
13 #include "net/dns/host_resolver.h"
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"
19 #include "net/ssl/channel_id_service.h"
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"
28 URLRequestContextStorage::URLRequestContextStorage(URLRequestContext
* context
)
33 URLRequestContextStorage::~URLRequestContextStorage() {}
35 void URLRequestContextStorage::set_net_log(NetLog
* net_log
) {
36 context_
->set_net_log(net_log
);
37 net_log_
.reset(net_log
);
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();
46 void URLRequestContextStorage::set_cert_verifier(CertVerifier
* cert_verifier
) {
47 context_
->set_cert_verifier(cert_verifier
);
48 cert_verifier_
.reset(cert_verifier
);
51 void URLRequestContextStorage::set_channel_id_service(
52 scoped_ptr
<ChannelIDService
> channel_id_service
) {
53 context_
->set_channel_id_service(channel_id_service
.get());
54 channel_id_service_
= channel_id_service
.Pass();
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
);
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
);
70 void URLRequestContextStorage::set_proxy_service(ProxyService
* proxy_service
) {
71 context_
->set_proxy_service(proxy_service
);
72 proxy_service_
.reset(proxy_service
);
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
;
81 void URLRequestContextStorage::set_network_delegate(
82 NetworkDelegate
* network_delegate
) {
83 context_
->set_network_delegate(network_delegate
);
84 network_delegate_
.reset(network_delegate
);
87 void URLRequestContextStorage::set_http_server_properties(
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());
93 void URLRequestContextStorage::set_cookie_store(CookieStore
* cookie_store
) {
94 context_
->set_cookie_store(cookie_store
);
95 cookie_store_
= cookie_store
;
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
);
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
);
110 void URLRequestContextStorage::set_job_factory(
111 URLRequestJobFactory
* job_factory
) {
112 context_
->set_job_factory(job_factory
);
113 job_factory_
.reset(job_factory
);
116 void URLRequestContextStorage::set_throttler_manager(
117 URLRequestThrottlerManager
* throttler_manager
) {
118 context_
->set_throttler_manager(throttler_manager
);
119 throttler_manager_
.reset(throttler_manager
);
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
);
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();