OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/shell/shell_url_request_context_getter.h" | 5 #include "content/shell/shell_url_request_context_getter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
9 #include "base/threading/worker_pool.h" | 9 #include "base/threading/worker_pool.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "content/shell/shell_network_delegate.h" | 11 #include "content/shell/shell_network_delegate.h" |
12 #include "net/base/cert_verifier.h" | 12 #include "net/base/cert_verifier.h" |
13 #include "net/base/default_server_bound_cert_store.h" | 13 #include "net/base/default_server_bound_cert_store.h" |
14 #include "net/base/host_resolver.h" | 14 #include "net/base/host_resolver.h" |
15 #include "net/base/server_bound_cert_service.h" | 15 #include "net/base/server_bound_cert_service.h" |
16 #include "net/base/ssl_config_service_defaults.h" | 16 #include "net/base/ssl_config_service_defaults.h" |
17 #include "net/cookies/cookie_monster.h" | 17 #include "net/cookies/cookie_monster.h" |
18 #include "net/http/http_auth_handler_factory.h" | 18 #include "net/http/http_auth_handler_factory.h" |
19 #include "net/http/http_cache.h" | 19 #include "net/http/http_cache.h" |
| 20 #include "net/http/http_network_session.h" |
20 #include "net/http/http_server_properties_impl.h" | 21 #include "net/http/http_server_properties_impl.h" |
21 #include "net/proxy/proxy_service.h" | 22 #include "net/proxy/proxy_service.h" |
22 #include "net/url_request/url_request_context.h" | 23 #include "net/url_request/url_request_context.h" |
23 #include "net/url_request/url_request_context_storage.h" | 24 #include "net/url_request/url_request_context_storage.h" |
24 #include "net/url_request/url_request_job_factory.h" | 25 #include "net/url_request/url_request_job_factory.h" |
25 | 26 |
26 namespace content { | 27 namespace content { |
27 | 28 |
28 ShellURLRequestContextGetter::ShellURLRequestContextGetter( | 29 ShellURLRequestContextGetter::ShellURLRequestContextGetter( |
29 const FilePath& base_path, | 30 const FilePath& base_path, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 82 |
82 FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); | 83 FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); |
83 net::HttpCache::DefaultBackend* main_backend = | 84 net::HttpCache::DefaultBackend* main_backend = |
84 new net::HttpCache::DefaultBackend( | 85 new net::HttpCache::DefaultBackend( |
85 net::DISK_CACHE, | 86 net::DISK_CACHE, |
86 cache_path, | 87 cache_path, |
87 0, | 88 0, |
88 BrowserThread::GetMessageLoopProxyForThread( | 89 BrowserThread::GetMessageLoopProxyForThread( |
89 BrowserThread::CACHE)); | 90 BrowserThread::CACHE)); |
90 | 91 |
| 92 net::HttpNetworkSession::Params network_session_params; |
| 93 network_session_params.host_resolver = |
| 94 url_request_context_->host_resolver(); |
| 95 network_session_params.cert_verifier = |
| 96 url_request_context_->cert_verifier(); |
| 97 network_session_params.server_bound_cert_service = |
| 98 url_request_context_->server_bound_cert_service(); |
| 99 network_session_params.proxy_service = |
| 100 url_request_context_->proxy_service(); |
| 101 network_session_params.ssl_config_service = |
| 102 url_request_context_->ssl_config_service(); |
| 103 network_session_params.http_auth_handler_factory = |
| 104 url_request_context_->http_auth_handler_factory(); |
| 105 network_session_params.network_delegate = |
| 106 url_request_context_->network_delegate(); |
| 107 network_session_params.http_server_properties = |
| 108 url_request_context_->http_server_properties(); |
| 109 |
91 net::HttpCache* main_cache = new net::HttpCache( | 110 net::HttpCache* main_cache = new net::HttpCache( |
92 url_request_context_->host_resolver(), | 111 network_session_params, main_backend); |
93 url_request_context_->cert_verifier(), | |
94 url_request_context_->server_bound_cert_service(), | |
95 NULL, /* transport_security_state */ | |
96 url_request_context_->proxy_service(), | |
97 "", /* ssl_session_cache_shard */ | |
98 url_request_context_->ssl_config_service(), | |
99 url_request_context_->http_auth_handler_factory(), | |
100 url_request_context_->network_delegate(), | |
101 url_request_context_->http_server_properties(), | |
102 NULL, | |
103 main_backend, | |
104 "" /* trusted_spdy_proxy */ ); | |
105 storage_->set_http_transaction_factory(main_cache); | 112 storage_->set_http_transaction_factory(main_cache); |
106 | 113 |
107 storage_->set_job_factory(new net::URLRequestJobFactory); | 114 storage_->set_job_factory(new net::URLRequestJobFactory); |
108 } | 115 } |
109 | 116 |
110 return url_request_context_.get(); | 117 return url_request_context_.get(); |
111 } | 118 } |
112 | 119 |
113 scoped_refptr<base::SingleThreadTaskRunner> | 120 scoped_refptr<base::SingleThreadTaskRunner> |
114 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 121 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
115 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 122 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
116 } | 123 } |
117 | 124 |
118 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 125 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
119 return url_request_context_->host_resolver(); | 126 return url_request_context_->host_resolver(); |
120 } | 127 } |
121 | 128 |
122 } // namespace content | 129 } // namespace content |
OLD | NEW |