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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/threading/worker_pool.h" | 12 #include "base/threading/worker_pool.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
16 #include "content/shell/common/shell_switches.h" | 16 #include "content/shell/common/shell_switches.h" |
17 #include "content/shell/shell_network_delegate.h" | 17 #include "content/shell/shell_network_delegate.h" |
18 #include "net/base/cache_type.h" | 18 #include "net/base/cache_type.h" |
19 #include "net/cert/cert_verifier.h" | 19 #include "net/cert/cert_verifier.h" |
20 #include "net/cookies/cookie_monster.h" | 20 #include "net/cookies/cookie_monster.h" |
21 #include "net/dns/host_resolver.h" | 21 #include "net/dns/host_resolver.h" |
22 #include "net/dns/mapped_host_resolver.h" | 22 #include "net/dns/mapped_host_resolver.h" |
23 #include "net/http/http_auth_handler_factory.h" | 23 #include "net/http/http_auth_handler_factory.h" |
24 #include "net/http/http_cache.h" | 24 #include "net/http/http_cache.h" |
25 #include "net/http/http_network_session.h" | 25 #include "net/http/http_network_session.h" |
26 #include "net/http/http_server_properties_impl.h" | 26 #include "net/http/http_server_properties_impl.h" |
| 27 #include "net/http/transport_security_state.h" |
27 #include "net/proxy/proxy_service.h" | 28 #include "net/proxy/proxy_service.h" |
28 #include "net/ssl/default_server_bound_cert_store.h" | 29 #include "net/ssl/default_server_bound_cert_store.h" |
29 #include "net/ssl/server_bound_cert_service.h" | 30 #include "net/ssl/server_bound_cert_service.h" |
30 #include "net/ssl/ssl_config_service_defaults.h" | 31 #include "net/ssl/ssl_config_service_defaults.h" |
31 #include "net/url_request/data_protocol_handler.h" | 32 #include "net/url_request/data_protocol_handler.h" |
32 #include "net/url_request/file_protocol_handler.h" | 33 #include "net/url_request/file_protocol_handler.h" |
33 #include "net/url_request/protocol_intercept_job_factory.h" | 34 #include "net/url_request/protocol_intercept_job_factory.h" |
34 #include "net/url_request/static_http_user_agent_settings.h" | 35 #include "net/url_request/static_http_user_agent_settings.h" |
35 #include "net/url_request/url_request_context.h" | 36 #include "net/url_request/url_request_context.h" |
36 #include "net/url_request/url_request_context_storage.h" | 37 #include "net/url_request/url_request_context_storage.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( | 101 storage_->set_server_bound_cert_service(new net::ServerBoundCertService( |
101 new net::DefaultServerBoundCertStore(NULL), | 102 new net::DefaultServerBoundCertStore(NULL), |
102 base::WorkerPool::GetTaskRunner(true))); | 103 base::WorkerPool::GetTaskRunner(true))); |
103 storage_->set_http_user_agent_settings( | 104 storage_->set_http_user_agent_settings( |
104 new net::StaticHttpUserAgentSettings("en-us,en", EmptyString())); | 105 new net::StaticHttpUserAgentSettings("en-us,en", EmptyString())); |
105 | 106 |
106 scoped_ptr<net::HostResolver> host_resolver( | 107 scoped_ptr<net::HostResolver> host_resolver( |
107 net::HostResolver::CreateDefaultResolver(NULL)); | 108 net::HostResolver::CreateDefaultResolver(NULL)); |
108 | 109 |
109 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); | 110 storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); |
| 111 storage_->set_transport_security_state(new net::TransportSecurityState); |
110 if (command_line.HasSwitch(switches::kDumpRenderTree)) { | 112 if (command_line.HasSwitch(switches::kDumpRenderTree)) { |
111 storage_->set_proxy_service(net::ProxyService::CreateDirect()); | 113 storage_->set_proxy_service(net::ProxyService::CreateDirect()); |
112 } else { | 114 } else { |
113 // TODO(jam): use v8 if possible, look at chrome code. | 115 // TODO(jam): use v8 if possible, look at chrome code. |
114 storage_->set_proxy_service( | 116 storage_->set_proxy_service( |
115 net::ProxyService::CreateUsingSystemProxyResolver( | 117 net::ProxyService::CreateUsingSystemProxyResolver( |
116 proxy_config_service_.release(), | 118 proxy_config_service_.release(), |
117 0, | 119 0, |
118 NULL)); | 120 NULL)); |
119 } | 121 } |
120 storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); | 122 storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); |
121 storage_->set_http_auth_handler_factory( | 123 storage_->set_http_auth_handler_factory( |
122 net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); | 124 net::HttpAuthHandlerFactory::CreateDefault(host_resolver.get())); |
123 storage_->set_http_server_properties(new net::HttpServerPropertiesImpl); | 125 storage_->set_http_server_properties(new net::HttpServerPropertiesImpl); |
124 | 126 |
125 base::FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); | 127 base::FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); |
126 net::HttpCache::DefaultBackend* main_backend = | 128 net::HttpCache::DefaultBackend* main_backend = |
127 new net::HttpCache::DefaultBackend( | 129 new net::HttpCache::DefaultBackend( |
128 net::DISK_CACHE, | 130 net::DISK_CACHE, |
129 net::CACHE_BACKEND_DEFAULT, | 131 net::CACHE_BACKEND_DEFAULT, |
130 cache_path, | 132 cache_path, |
131 0, | 133 0, |
132 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) | 134 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) |
133 .get()); | 135 .get()); |
134 | 136 |
135 net::HttpNetworkSession::Params network_session_params; | 137 net::HttpNetworkSession::Params network_session_params; |
136 network_session_params.cert_verifier = | 138 network_session_params.cert_verifier = |
137 url_request_context_->cert_verifier(); | 139 url_request_context_->cert_verifier(); |
| 140 network_session_params.transport_security_state = |
| 141 url_request_context_->transport_security_state(); |
138 network_session_params.server_bound_cert_service = | 142 network_session_params.server_bound_cert_service = |
139 url_request_context_->server_bound_cert_service(); | 143 url_request_context_->server_bound_cert_service(); |
140 network_session_params.proxy_service = | 144 network_session_params.proxy_service = |
141 url_request_context_->proxy_service(); | 145 url_request_context_->proxy_service(); |
142 network_session_params.ssl_config_service = | 146 network_session_params.ssl_config_service = |
143 url_request_context_->ssl_config_service(); | 147 url_request_context_->ssl_config_service(); |
144 network_session_params.http_auth_handler_factory = | 148 network_session_params.http_auth_handler_factory = |
145 url_request_context_->http_auth_handler_factory(); | 149 url_request_context_->http_auth_handler_factory(); |
146 network_session_params.network_delegate = | 150 network_session_params.network_delegate = |
147 network_delegate_.get(); | 151 network_delegate_.get(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 scoped_refptr<base::SingleThreadTaskRunner> | 204 scoped_refptr<base::SingleThreadTaskRunner> |
201 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 205 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
202 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 206 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
203 } | 207 } |
204 | 208 |
205 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 209 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
206 return url_request_context_->host_resolver(); | 210 return url_request_context_->host_resolver(); |
207 } | 211 } |
208 | 212 |
209 } // namespace content | 213 } // namespace content |
OLD | NEW |