| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/lib/browser/headless_url_request_context_getter.h" | 5 #include "headless/lib/browser/headless_url_request_context_getter.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 storage_->set_host_resolver(std::move(host_resolver)); | 174 storage_->set_host_resolver(std::move(host_resolver)); |
| 175 network_session_params.host_resolver = | 175 network_session_params.host_resolver = |
| 176 url_request_context_->host_resolver(); | 176 url_request_context_->host_resolver(); |
| 177 | 177 |
| 178 storage_->set_http_network_session( | 178 storage_->set_http_network_session( |
| 179 base::WrapUnique(new net::HttpNetworkSession(network_session_params))); | 179 base::WrapUnique(new net::HttpNetworkSession(network_session_params))); |
| 180 storage_->set_http_transaction_factory(base::WrapUnique(new net::HttpCache( | 180 storage_->set_http_transaction_factory(base::WrapUnique(new net::HttpCache( |
| 181 storage_->http_network_session(), std::move(main_backend), | 181 storage_->http_network_session(), std::move(main_backend), |
| 182 true /* set_up_quic_server_info */))); | 182 true /* set_up_quic_server_info */))); |
| 183 | 183 |
| 184 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 184 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
| 185 new net::URLRequestJobFactoryImpl()); | 185 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
| 186 | 186 |
| 187 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); | 187 InstallProtocolHandlers(job_factory.get(), &protocol_handlers_); |
| 188 bool set_protocol = job_factory->SetProtocolHandler( | 188 bool set_protocol = job_factory->SetProtocolHandler( |
| 189 url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler)); | 189 url::kDataScheme, base::WrapUnique(new net::DataProtocolHandler)); |
| 190 DCHECK(set_protocol); | 190 DCHECK(set_protocol); |
| 191 set_protocol = job_factory->SetProtocolHandler( | 191 set_protocol = job_factory->SetProtocolHandler( |
| 192 url::kFileScheme, | 192 url::kFileScheme, |
| 193 base::WrapUnique(new net::FileProtocolHandler( | 193 base::WrapUnique(new net::FileProtocolHandler( |
| 194 content::BrowserThread::GetBlockingPool() | 194 content::BrowserThread::GetBlockingPool() |
| 195 ->GetTaskRunnerWithShutdownBehavior( | 195 ->GetTaskRunnerWithShutdownBehavior( |
| (...skipping 21 matching lines...) Expand all Loading... |
| 217 HeadlessURLRequestContextGetter::GetNetworkTaskRunner() const { | 217 HeadlessURLRequestContextGetter::GetNetworkTaskRunner() const { |
| 218 return content::BrowserThread::GetMessageLoopProxyForThread( | 218 return content::BrowserThread::GetMessageLoopProxyForThread( |
| 219 content::BrowserThread::IO); | 219 content::BrowserThread::IO); |
| 220 } | 220 } |
| 221 | 221 |
| 222 net::HostResolver* HeadlessURLRequestContextGetter::host_resolver() const { | 222 net::HostResolver* HeadlessURLRequestContextGetter::host_resolver() const { |
| 223 return url_request_context_->host_resolver(); | 223 return url_request_context_->host_resolver(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 } // namespace headless | 226 } // namespace headless |
| OLD | NEW |