1 // Copyright (c) 2011 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.h"
7 #include "base/compiler_specific.h"
8 #include "base/string_util.h"
9 #include "net/base/cookie_store.h"
10 #include "net/base/host_resolver.h"
11 #include "net/ftp/ftp_transaction_factory.h"
12 #include "net/http/http_transaction_factory.h"
16 URLRequestContext::URLRequestContext()
17 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
21 origin_bound_cert_service_(NULL
),
22 fraudulent_certificate_reporter_(NULL
),
23 http_auth_handler_factory_(NULL
),
25 network_delegate_(NULL
),
26 http_server_properties_(NULL
),
27 transport_security_state_(NULL
),
28 ftp_auth_cache_(new FtpAuthCache
),
29 http_transaction_factory_(NULL
),
30 ftp_transaction_factory_(NULL
),
34 void URLRequestContext::CopyFrom(URLRequestContext
* other
) {
35 // Copy URLRequestContext parameters.
36 set_net_log(other
->net_log());
37 set_host_resolver(other
->host_resolver());
38 set_cert_verifier(other
->cert_verifier());
39 set_origin_bound_cert_service(other
->origin_bound_cert_service());
40 set_fraudulent_certificate_reporter(other
->fraudulent_certificate_reporter());
41 set_http_auth_handler_factory(other
->http_auth_handler_factory());
42 set_proxy_service(other
->proxy_service());
43 set_ssl_config_service(other
->ssl_config_service());
44 set_network_delegate(other
->network_delegate());
45 set_http_server_properties(other
->http_server_properties());
46 set_cookie_store(other
->cookie_store());
47 set_transport_security_state(other
->transport_security_state());
48 // FTPAuthCache is unique per context.
49 set_accept_language(other
->accept_language());
50 set_accept_charset(other
->accept_charset());
51 set_referrer_charset(other
->referrer_charset());
52 set_http_transaction_factory(other
->http_transaction_factory());
53 set_ftp_transaction_factory(other
->ftp_transaction_factory());
54 set_job_factory(other
->job_factory());
57 void URLRequestContext::set_cookie_store(CookieStore
* cookie_store
) {
58 cookie_store_
= cookie_store
;
61 const std::string
& URLRequestContext::GetUserAgent(const GURL
& url
) const {
65 URLRequestContext::~URLRequestContext() {