OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromecast/browser/url_request_context_factory.h" | 5 #include "chromecast/browser/url_request_context_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 222 } |
223 | 223 |
224 void URLRequestContextFactory::InitializeMainContextDependencies( | 224 void URLRequestContextFactory::InitializeMainContextDependencies( |
225 net::HttpTransactionFactory* transaction_factory, | 225 net::HttpTransactionFactory* transaction_factory, |
226 content::ProtocolHandlerMap* protocol_handlers, | 226 content::ProtocolHandlerMap* protocol_handlers, |
227 content::URLRequestInterceptorScopedVector request_interceptors) { | 227 content::URLRequestInterceptorScopedVector request_interceptors) { |
228 if (main_dependencies_initialized_) | 228 if (main_dependencies_initialized_) |
229 return; | 229 return; |
230 | 230 |
231 main_transaction_factory_.reset(transaction_factory); | 231 main_transaction_factory_.reset(transaction_factory); |
232 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 232 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
233 new net::URLRequestJobFactoryImpl()); | 233 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers(); |
234 // Keep ProtocolHandlers added in sync with | 234 // Keep ProtocolHandlers added in sync with |
235 // CastContentBrowserClient::IsHandledURL(). | 235 // CastContentBrowserClient::IsHandledURL(). |
236 bool set_protocol = false; | 236 bool set_protocol = false; |
237 for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); | 237 for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); |
238 it != protocol_handlers->end(); | 238 it != protocol_handlers->end(); |
239 ++it) { | 239 ++it) { |
240 set_protocol = job_factory->SetProtocolHandler( | 240 set_protocol = job_factory->SetProtocolHandler( |
241 it->first, base::WrapUnique(it->second.release())); | 241 it->first, base::WrapUnique(it->second.release())); |
242 DCHECK(set_protocol); | 242 DCHECK(set_protocol); |
243 } | 243 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 params->proxy_service = proxy_service_.get(); | 298 params->proxy_service = proxy_service_.get(); |
299 } | 299 } |
300 | 300 |
301 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { | 301 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { |
302 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 302 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
303 InitializeSystemContextDependencies(); | 303 InitializeSystemContextDependencies(); |
304 net::HttpNetworkSession::Params system_params; | 304 net::HttpNetworkSession::Params system_params; |
305 PopulateNetworkSessionParams(false, &system_params); | 305 PopulateNetworkSessionParams(false, &system_params); |
306 system_transaction_factory_.reset(new net::HttpNetworkLayer( | 306 system_transaction_factory_.reset(new net::HttpNetworkLayer( |
307 new net::HttpNetworkSession(system_params))); | 307 new net::HttpNetworkSession(system_params))); |
308 system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); | 308 system_job_factory_ = |
| 309 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers(); |
309 system_cookie_store_ = | 310 system_cookie_store_ = |
310 content::CreateCookieStore(content::CookieStoreConfig()); | 311 content::CreateCookieStore(content::CookieStoreConfig()); |
311 | 312 |
312 net::URLRequestContext* system_context = new net::URLRequestContext(); | 313 net::URLRequestContext* system_context = new net::URLRequestContext(); |
313 system_context->set_host_resolver(host_resolver_.get()); | 314 system_context->set_host_resolver(host_resolver_.get()); |
314 system_context->set_channel_id_service(channel_id_service_.get()); | 315 system_context->set_channel_id_service(channel_id_service_.get()); |
315 system_context->set_cert_verifier(cert_verifier_.get()); | 316 system_context->set_cert_verifier(cert_verifier_.get()); |
316 system_context->set_proxy_service(proxy_service_.get()); | 317 system_context->set_proxy_service(proxy_service_.get()); |
317 system_context->set_ssl_config_service(ssl_config_service_.get()); | 318 system_context->set_ssl_config_service(ssl_config_service_.get()); |
318 system_context->set_transport_security_state( | 319 system_context->set_transport_security_state( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 401 |
401 void URLRequestContextFactory::InitializeNetworkDelegates() { | 402 void URLRequestContextFactory::InitializeNetworkDelegates() { |
402 app_network_delegate_->Initialize(false); | 403 app_network_delegate_->Initialize(false); |
403 LOG(INFO) << "Initialized app network delegate."; | 404 LOG(INFO) << "Initialized app network delegate."; |
404 system_network_delegate_->Initialize(false); | 405 system_network_delegate_->Initialize(false); |
405 LOG(INFO) << "Initialized system network delegate."; | 406 LOG(INFO) << "Initialized system network delegate."; |
406 } | 407 } |
407 | 408 |
408 } // namespace shell | 409 } // namespace shell |
409 } // namespace chromecast | 410 } // namespace chromecast |
OLD | NEW |