OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/shell_url_request_context_getter.h" | 5 #include "content/shell/browser/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/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
13 #include "base/threading/worker_pool.h" | 13 #include "base/threading/worker_pool.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/cookie_store_factory.h" | 15 #include "content/public/browser/cookie_store_factory.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "content/public/common/url_constants.h" | |
18 #include "content/shell/browser/shell_network_delegate.h" | 17 #include "content/shell/browser/shell_network_delegate.h" |
19 #include "content/shell/common/shell_switches.h" | 18 #include "content/shell/common/shell_switches.h" |
20 #include "net/base/cache_type.h" | 19 #include "net/base/cache_type.h" |
21 #include "net/cert/cert_verifier.h" | 20 #include "net/cert/cert_verifier.h" |
22 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
23 #include "net/dns/host_resolver.h" | 22 #include "net/dns/host_resolver.h" |
24 #include "net/dns/mapped_host_resolver.h" | 23 #include "net/dns/mapped_host_resolver.h" |
25 #include "net/http/http_auth_handler_factory.h" | 24 #include "net/http/http_auth_handler_factory.h" |
26 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
27 #include "net/http/http_network_session.h" | 26 #include "net/http/http_network_session.h" |
28 #include "net/http/http_server_properties_impl.h" | 27 #include "net/http/http_server_properties_impl.h" |
29 #include "net/http/transport_security_state.h" | 28 #include "net/http/transport_security_state.h" |
30 #include "net/proxy/proxy_service.h" | 29 #include "net/proxy/proxy_service.h" |
31 #include "net/ssl/default_server_bound_cert_store.h" | 30 #include "net/ssl/default_server_bound_cert_store.h" |
32 #include "net/ssl/server_bound_cert_service.h" | 31 #include "net/ssl/server_bound_cert_service.h" |
33 #include "net/ssl/ssl_config_service_defaults.h" | 32 #include "net/ssl/ssl_config_service_defaults.h" |
34 #include "net/url_request/data_protocol_handler.h" | 33 #include "net/url_request/data_protocol_handler.h" |
35 #include "net/url_request/file_protocol_handler.h" | 34 #include "net/url_request/file_protocol_handler.h" |
36 #include "net/url_request/protocol_intercept_job_factory.h" | 35 #include "net/url_request/protocol_intercept_job_factory.h" |
37 #include "net/url_request/static_http_user_agent_settings.h" | 36 #include "net/url_request/static_http_user_agent_settings.h" |
38 #include "net/url_request/url_request_context.h" | 37 #include "net/url_request/url_request_context.h" |
39 #include "net/url_request/url_request_context_storage.h" | 38 #include "net/url_request/url_request_context_storage.h" |
40 #include "net/url_request/url_request_job_factory_impl.h" | 39 #include "net/url_request/url_request_job_factory_impl.h" |
| 40 #include "url/url_constants.h" |
41 | 41 |
42 namespace content { | 42 namespace content { |
43 | 43 |
44 namespace { | 44 namespace { |
45 | 45 |
46 void InstallProtocolHandlers(net::URLRequestJobFactoryImpl* job_factory, | 46 void InstallProtocolHandlers(net::URLRequestJobFactoryImpl* job_factory, |
47 ProtocolHandlerMap* protocol_handlers) { | 47 ProtocolHandlerMap* protocol_handlers) { |
48 for (ProtocolHandlerMap::iterator it = | 48 for (ProtocolHandlerMap::iterator it = |
49 protocol_handlers->begin(); | 49 protocol_handlers->begin(); |
50 it != protocol_handlers->end(); | 50 it != protocol_handlers->end(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 net::HttpCache* main_cache = new net::HttpCache( | 200 net::HttpCache* main_cache = new net::HttpCache( |
201 network_session_params, main_backend); | 201 network_session_params, main_backend); |
202 storage_->set_http_transaction_factory(main_cache); | 202 storage_->set_http_transaction_factory(main_cache); |
203 | 203 |
204 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | 204 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( |
205 new net::URLRequestJobFactoryImpl()); | 205 new net::URLRequestJobFactoryImpl()); |
206 // Keep ProtocolHandlers added in sync with | 206 // Keep ProtocolHandlers added in sync with |
207 // ShellContentBrowserClient::IsHandledURL(). | 207 // ShellContentBrowserClient::IsHandledURL(). |
208 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); | 208 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); |
209 bool set_protocol = job_factory->SetProtocolHandler( | 209 bool set_protocol = job_factory->SetProtocolHandler( |
210 kDataScheme, new net::DataProtocolHandler); | 210 url::kDataScheme, new net::DataProtocolHandler); |
211 DCHECK(set_protocol); | 211 DCHECK(set_protocol); |
212 set_protocol = job_factory->SetProtocolHandler( | 212 set_protocol = job_factory->SetProtocolHandler( |
213 kFileScheme, | 213 url::kFileScheme, |
214 new net::FileProtocolHandler( | 214 new net::FileProtocolHandler( |
215 content::BrowserThread::GetBlockingPool()-> | 215 content::BrowserThread::GetBlockingPool()-> |
216 GetTaskRunnerWithShutdownBehavior( | 216 GetTaskRunnerWithShutdownBehavior( |
217 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); | 217 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); |
218 DCHECK(set_protocol); | 218 DCHECK(set_protocol); |
219 | 219 |
220 // Set up interceptors in the reverse order. | 220 // Set up interceptors in the reverse order. |
221 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 221 scoped_ptr<net::URLRequestJobFactory> top_job_factory = |
222 job_factory.PassAs<net::URLRequestJobFactory>(); | 222 job_factory.PassAs<net::URLRequestJobFactory>(); |
223 for (ProtocolHandlerScopedVector::reverse_iterator i = | 223 for (ProtocolHandlerScopedVector::reverse_iterator i = |
(...skipping 14 matching lines...) Expand all Loading... |
238 scoped_refptr<base::SingleThreadTaskRunner> | 238 scoped_refptr<base::SingleThreadTaskRunner> |
239 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 239 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
240 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 240 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
241 } | 241 } |
242 | 242 |
243 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { | 243 net::HostResolver* ShellURLRequestContextGetter::host_resolver() { |
244 return url_request_context_->host_resolver(); | 244 return url_request_context_->host_resolver(); |
245 } | 245 } |
246 | 246 |
247 } // namespace content | 247 } // namespace content |
OLD | NEW |