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/network_delegate.h"
9 #include "net/base/sdch_manager.h"
10 #include "net/cert/cert_verifier.h"
11 #include "net/cookies/cookie_store.h"
12 #include "net/dns/host_resolver.h"
13 #include "net/ftp/ftp_transaction_factory.h"
14 #include "net/http/http_auth_handler_factory.h"
15 #include "net/http/http_server_properties.h"
16 #include "net/http/http_transaction_factory.h"
17 #include "net/log/net_log.h"
18 #include "net/proxy/proxy_service.h"
19 #include "net/ssl/channel_id_service.h"
20 #include "net/url_request/http_user_agent_settings.h"
21 #include "net/url_request/url_request_backoff_manager.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_http_auth_handler_factory(
58 HttpAuthHandlerFactory
* http_auth_handler_factory
) {
59 context_
->set_http_auth_handler_factory(http_auth_handler_factory
);
60 http_auth_handler_factory_
.reset(http_auth_handler_factory
);
63 void URLRequestContextStorage::set_proxy_service(ProxyService
* proxy_service
) {
64 context_
->set_proxy_service(proxy_service
);
65 proxy_service_
.reset(proxy_service
);
68 void URLRequestContextStorage::set_ssl_config_service(
69 SSLConfigService
* ssl_config_service
) {
70 context_
->set_ssl_config_service(ssl_config_service
);
71 ssl_config_service_
= ssl_config_service
;
74 void URLRequestContextStorage::set_network_delegate(
75 NetworkDelegate
* network_delegate
) {
76 context_
->set_network_delegate(network_delegate
);
77 network_delegate_
.reset(network_delegate
);
80 void URLRequestContextStorage::set_http_server_properties(
81 scoped_ptr
<HttpServerProperties
> http_server_properties
) {
82 http_server_properties_
= http_server_properties
.Pass();
83 context_
->set_http_server_properties(http_server_properties_
->GetWeakPtr());
86 void URLRequestContextStorage::set_cookie_store(CookieStore
* cookie_store
) {
87 context_
->set_cookie_store(cookie_store
);
88 cookie_store_
= cookie_store
;
91 void URLRequestContextStorage::set_transport_security_state(
92 TransportSecurityState
* transport_security_state
) {
93 context_
->set_transport_security_state(transport_security_state
);
94 transport_security_state_
.reset(transport_security_state
);
97 void URLRequestContextStorage::set_http_transaction_factory(
98 HttpTransactionFactory
* http_transaction_factory
) {
99 context_
->set_http_transaction_factory(http_transaction_factory
);
100 http_transaction_factory_
.reset(http_transaction_factory
);
103 void URLRequestContextStorage::set_job_factory(
104 URLRequestJobFactory
* job_factory
) {
105 context_
->set_job_factory(job_factory
);
106 job_factory_
.reset(job_factory
);
109 void URLRequestContextStorage::set_throttler_manager(
110 URLRequestThrottlerManager
* throttler_manager
) {
111 context_
->set_throttler_manager(throttler_manager
);
112 throttler_manager_
.reset(throttler_manager
);
115 void URLRequestContextStorage::set_backoff_manager(
116 URLRequestBackoffManager
* backoff_manager
) {
117 context_
->set_backoff_manager(backoff_manager
);
118 backoff_manager_
.reset(backoff_manager
);
121 void URLRequestContextStorage::set_http_user_agent_settings(
122 HttpUserAgentSettings
* http_user_agent_settings
) {
123 context_
->set_http_user_agent_settings(http_user_agent_settings
);
124 http_user_agent_settings_
.reset(http_user_agent_settings
);
127 void URLRequestContextStorage::set_sdch_manager(
128 scoped_ptr
<SdchManager
> sdch_manager
) {
129 context_
->set_sdch_manager(sdch_manager
.get());
130 sdch_manager_
= sdch_manager
.Pass();