Upstream changes for NetworkQualityProvider
[chromium-blink-merge.git] / net / url_request / url_request_context_storage.cc
blobe1452be9b351d78f9f50ccfd29c13e261a6c5d4e
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/fraudulent_certificate_reporter.h"
21 #include "net/url_request/http_user_agent_settings.h"
22 #include "net/url_request/url_request_backoff_manager.h"
23 #include "net/url_request/url_request_context.h"
24 #include "net/url_request/url_request_job_factory.h"
25 #include "net/url_request/url_request_throttler_manager.h"
27 namespace net {
29 URLRequestContextStorage::URLRequestContextStorage(URLRequestContext* context)
30 : context_(context) {
31 DCHECK(context);
34 URLRequestContextStorage::~URLRequestContextStorage() {}
36 void URLRequestContextStorage::set_net_log(NetLog* net_log) {
37 context_->set_net_log(net_log);
38 net_log_.reset(net_log);
41 void URLRequestContextStorage::set_host_resolver(
42 scoped_ptr<HostResolver> host_resolver) {
43 context_->set_host_resolver(host_resolver.get());
44 host_resolver_ = host_resolver.Pass();
47 void URLRequestContextStorage::set_cert_verifier(CertVerifier* cert_verifier) {
48 context_->set_cert_verifier(cert_verifier);
49 cert_verifier_.reset(cert_verifier);
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_fraudulent_certificate_reporter(
59 FraudulentCertificateReporter* fraudulent_certificate_reporter) {
60 context_->set_fraudulent_certificate_reporter(
61 fraudulent_certificate_reporter);
62 fraudulent_certificate_reporter_.reset(fraudulent_certificate_reporter);
65 void URLRequestContextStorage::set_http_auth_handler_factory(
66 HttpAuthHandlerFactory* http_auth_handler_factory) {
67 context_->set_http_auth_handler_factory(http_auth_handler_factory);
68 http_auth_handler_factory_.reset(http_auth_handler_factory);
71 void URLRequestContextStorage::set_proxy_service(ProxyService* proxy_service) {
72 context_->set_proxy_service(proxy_service);
73 proxy_service_.reset(proxy_service);
76 void URLRequestContextStorage::set_ssl_config_service(
77 SSLConfigService* ssl_config_service) {
78 context_->set_ssl_config_service(ssl_config_service);
79 ssl_config_service_ = ssl_config_service;
82 void URLRequestContextStorage::set_network_delegate(
83 NetworkDelegate* network_delegate) {
84 context_->set_network_delegate(network_delegate);
85 network_delegate_.reset(network_delegate);
88 void URLRequestContextStorage::set_http_server_properties(
89 scoped_ptr<HttpServerProperties> http_server_properties) {
90 http_server_properties_ = http_server_properties.Pass();
91 context_->set_http_server_properties(http_server_properties_->GetWeakPtr());
94 void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) {
95 context_->set_cookie_store(cookie_store);
96 cookie_store_ = cookie_store;
99 void URLRequestContextStorage::set_transport_security_state(
100 TransportSecurityState* transport_security_state) {
101 context_->set_transport_security_state(transport_security_state);
102 transport_security_state_.reset(transport_security_state);
105 void URLRequestContextStorage::set_http_transaction_factory(
106 HttpTransactionFactory* http_transaction_factory) {
107 context_->set_http_transaction_factory(http_transaction_factory);
108 http_transaction_factory_.reset(http_transaction_factory);
111 void URLRequestContextStorage::set_job_factory(
112 URLRequestJobFactory* job_factory) {
113 context_->set_job_factory(job_factory);
114 job_factory_.reset(job_factory);
117 void URLRequestContextStorage::set_throttler_manager(
118 URLRequestThrottlerManager* throttler_manager) {
119 context_->set_throttler_manager(throttler_manager);
120 throttler_manager_.reset(throttler_manager);
123 void URLRequestContextStorage::set_backoff_manager(
124 URLRequestBackoffManager* backoff_manager) {
125 context_->set_backoff_manager(backoff_manager);
126 backoff_manager_.reset(backoff_manager);
129 void URLRequestContextStorage::set_http_user_agent_settings(
130 HttpUserAgentSettings* http_user_agent_settings) {
131 context_->set_http_user_agent_settings(http_user_agent_settings);
132 http_user_agent_settings_.reset(http_user_agent_settings);
135 void URLRequestContextStorage::set_sdch_manager(
136 scoped_ptr<SdchManager> sdch_manager) {
137 context_->set_sdch_manager(sdch_manager.get());
138 sdch_manager_ = sdch_manager.Pass();
141 } // namespace net