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(scoped_ptr
<NetLog
> net_log
) {
36 context_
->set_net_log(net_log
.get());
37 net_log_
= net_log
.Pass();
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(
47 scoped_ptr
<CertVerifier
> cert_verifier
) {
48 context_
->set_cert_verifier(cert_verifier
.get());
49 cert_verifier_
= cert_verifier
.Pass();
52 void URLRequestContextStorage::set_channel_id_service(
53 scoped_ptr
<ChannelIDService
> channel_id_service
) {
54 context_
->set_channel_id_service(channel_id_service
.get());
55 channel_id_service_
= channel_id_service
.Pass();
58 void URLRequestContextStorage::set_http_auth_handler_factory(
59 scoped_ptr
<HttpAuthHandlerFactory
> http_auth_handler_factory
) {
60 context_
->set_http_auth_handler_factory(http_auth_handler_factory
.get());
61 http_auth_handler_factory_
= http_auth_handler_factory
.Pass();
64 void URLRequestContextStorage::set_proxy_service(
65 scoped_ptr
<ProxyService
> proxy_service
) {
66 context_
->set_proxy_service(proxy_service
.get());
67 proxy_service_
= proxy_service
.Pass();
70 void URLRequestContextStorage::set_ssl_config_service(
71 SSLConfigService
* ssl_config_service
) {
72 context_
->set_ssl_config_service(ssl_config_service
);
73 ssl_config_service_
= ssl_config_service
;
76 void URLRequestContextStorage::set_network_delegate(
77 scoped_ptr
<NetworkDelegate
> network_delegate
) {
78 context_
->set_network_delegate(network_delegate
.get());
79 network_delegate_
= network_delegate
.Pass();
82 void URLRequestContextStorage::set_http_server_properties(
83 scoped_ptr
<HttpServerProperties
> http_server_properties
) {
84 http_server_properties_
= http_server_properties
.Pass();
85 context_
->set_http_server_properties(http_server_properties_
->GetWeakPtr());
88 void URLRequestContextStorage::set_cookie_store(CookieStore
* cookie_store
) {
89 context_
->set_cookie_store(cookie_store
);
90 cookie_store_
= cookie_store
;
93 void URLRequestContextStorage::set_transport_security_state(
94 scoped_ptr
<TransportSecurityState
> transport_security_state
) {
95 context_
->set_transport_security_state(transport_security_state
.get());
96 transport_security_state_
= transport_security_state
.Pass();
99 void URLRequestContextStorage::set_http_transaction_factory(
100 scoped_ptr
<HttpTransactionFactory
> http_transaction_factory
) {
101 context_
->set_http_transaction_factory(http_transaction_factory
.get());
102 http_transaction_factory_
= http_transaction_factory
.Pass();
105 void URLRequestContextStorage::set_job_factory(
106 scoped_ptr
<URLRequestJobFactory
> job_factory
) {
107 context_
->set_job_factory(job_factory
.get());
108 job_factory_
= job_factory
.Pass();
111 void URLRequestContextStorage::set_throttler_manager(
112 scoped_ptr
<URLRequestThrottlerManager
> throttler_manager
) {
113 context_
->set_throttler_manager(throttler_manager
.get());
114 throttler_manager_
= throttler_manager
.Pass();
117 void URLRequestContextStorage::set_backoff_manager(
118 scoped_ptr
<URLRequestBackoffManager
> backoff_manager
) {
119 context_
->set_backoff_manager(backoff_manager
.get());
120 backoff_manager_
= backoff_manager
.Pass();
123 void URLRequestContextStorage::set_http_user_agent_settings(
124 scoped_ptr
<HttpUserAgentSettings
> http_user_agent_settings
) {
125 context_
->set_http_user_agent_settings(http_user_agent_settings
.get());
126 http_user_agent_settings_
= http_user_agent_settings
.Pass();
129 void URLRequestContextStorage::set_sdch_manager(
130 scoped_ptr
<SdchManager
> sdch_manager
) {
131 context_
->set_sdch_manager(sdch_manager
.get());
132 sdch_manager_
= sdch_manager
.Pass();