2bb508c28eb36036d8f466cc465c97932e1b1e37
[platform/framework/web/crosswalk.git] / src / net / url_request / url_request_context_storage.cc
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.
4
5 #include "net/url_request/url_request_context_storage.h"
6
7 #include "base/logging.h"
8 #include "net/base/net_log.h"
9 #include "net/base/network_delegate.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/proxy/proxy_service.h"
18 #include "net/ssl/server_bound_cert_service.h"
19 #include "net/url_request/fraudulent_certificate_reporter.h"
20 #include "net/url_request/http_user_agent_settings.h"
21 #include "net/url_request/url_request_context.h"
22 #include "net/url_request/url_request_job_factory.h"
23 #include "net/url_request/url_request_throttler_manager.h"
24
25 namespace net {
26
27 URLRequestContextStorage::URLRequestContextStorage(URLRequestContext* context)
28     : context_(context) {
29   DCHECK(context);
30 }
31
32 URLRequestContextStorage::~URLRequestContextStorage() {}
33
34 void URLRequestContextStorage::set_net_log(NetLog* net_log) {
35   context_->set_net_log(net_log);
36   net_log_.reset(net_log);
37 }
38
39 void URLRequestContextStorage::set_host_resolver(
40     scoped_ptr<HostResolver> host_resolver) {
41   context_->set_host_resolver(host_resolver.get());
42   host_resolver_ = host_resolver.Pass();
43 }
44
45 void URLRequestContextStorage::set_cert_verifier(CertVerifier* cert_verifier) {
46   context_->set_cert_verifier(cert_verifier);
47   cert_verifier_.reset(cert_verifier);
48 }
49
50 void URLRequestContextStorage::set_server_bound_cert_service(
51     ServerBoundCertService* server_bound_cert_service) {
52   context_->set_server_bound_cert_service(server_bound_cert_service);
53   server_bound_cert_service_.reset(server_bound_cert_service);
54 }
55
56 void URLRequestContextStorage::set_fraudulent_certificate_reporter(
57     FraudulentCertificateReporter* fraudulent_certificate_reporter) {
58   context_->set_fraudulent_certificate_reporter(
59       fraudulent_certificate_reporter);
60   fraudulent_certificate_reporter_.reset(fraudulent_certificate_reporter);
61 }
62
63 void URLRequestContextStorage::set_http_auth_handler_factory(
64     HttpAuthHandlerFactory* http_auth_handler_factory) {
65   context_->set_http_auth_handler_factory(http_auth_handler_factory);
66   http_auth_handler_factory_.reset(http_auth_handler_factory);
67 }
68
69 void URLRequestContextStorage::set_proxy_service(ProxyService* proxy_service) {
70   context_->set_proxy_service(proxy_service);
71   proxy_service_.reset(proxy_service);
72 }
73
74 void URLRequestContextStorage::set_ssl_config_service(
75     SSLConfigService* ssl_config_service) {
76   context_->set_ssl_config_service(ssl_config_service);
77   ssl_config_service_ = ssl_config_service;
78 }
79
80 void URLRequestContextStorage::set_network_delegate(
81     NetworkDelegate* network_delegate) {
82   context_->set_network_delegate(network_delegate);
83   network_delegate_.reset(network_delegate);
84 }
85
86 void URLRequestContextStorage::set_http_server_properties(
87     scoped_ptr<HttpServerProperties> http_server_properties) {
88   http_server_properties_ = http_server_properties.Pass();
89   context_->set_http_server_properties(http_server_properties_->GetWeakPtr());
90 }
91
92 void URLRequestContextStorage::set_cookie_store(CookieStore* cookie_store) {
93   context_->set_cookie_store(cookie_store);
94   cookie_store_ = cookie_store;
95 }
96
97 void URLRequestContextStorage::set_transport_security_state(
98     TransportSecurityState* transport_security_state) {
99   context_->set_transport_security_state(transport_security_state);
100   transport_security_state_.reset(transport_security_state);
101 }
102
103 void URLRequestContextStorage::set_http_transaction_factory(
104     HttpTransactionFactory* http_transaction_factory) {
105   context_->set_http_transaction_factory(http_transaction_factory);
106   http_transaction_factory_.reset(http_transaction_factory);
107 }
108
109 void URLRequestContextStorage::set_job_factory(
110     URLRequestJobFactory* job_factory) {
111   context_->set_job_factory(job_factory);
112   job_factory_.reset(job_factory);
113 }
114
115 void URLRequestContextStorage::set_throttler_manager(
116     URLRequestThrottlerManager* throttler_manager) {
117   context_->set_throttler_manager(throttler_manager);
118   throttler_manager_.reset(throttler_manager);
119 }
120
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);
125 }
126
127 }  // namespace net