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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 220 } |
221 | 221 |
222 void URLRequestContextFactory::InitializeMainContextDependencies( | 222 void URLRequestContextFactory::InitializeMainContextDependencies( |
223 net::HttpTransactionFactory* transaction_factory, | 223 net::HttpTransactionFactory* transaction_factory, |
224 content::ProtocolHandlerMap* protocol_handlers, | 224 content::ProtocolHandlerMap* protocol_handlers, |
225 content::URLRequestInterceptorScopedVector request_interceptors) { | 225 content::URLRequestInterceptorScopedVector request_interceptors) { |
226 if (main_dependencies_initialized_) | 226 if (main_dependencies_initialized_) |
227 return; | 227 return; |
228 | 228 |
229 main_transaction_factory_.reset(transaction_factory); | 229 main_transaction_factory_.reset(transaction_factory); |
230 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 230 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
231 new net::URLRequestJobFactoryImpl()); | 231 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
232 // Keep ProtocolHandlers added in sync with | 232 // Keep ProtocolHandlers added in sync with |
233 // CastContentBrowserClient::IsHandledURL(). | 233 // CastContentBrowserClient::IsHandledURL(). |
234 bool set_protocol = false; | 234 bool set_protocol = false; |
235 for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); | 235 for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin(); |
236 it != protocol_handlers->end(); | 236 it != protocol_handlers->end(); |
237 ++it) { | 237 ++it) { |
238 set_protocol = job_factory->SetProtocolHandler( | 238 set_protocol = job_factory->SetProtocolHandler( |
239 it->first, base::WrapUnique(it->second.release())); | 239 it->first, base::WrapUnique(it->second.release())); |
240 DCHECK(set_protocol); | 240 DCHECK(set_protocol); |
241 } | 241 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 params->proxy_service = proxy_service_.get(); | 294 params->proxy_service = proxy_service_.get(); |
295 } | 295 } |
296 | 296 |
297 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { | 297 net::URLRequestContext* URLRequestContextFactory::CreateSystemRequestContext() { |
298 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 298 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
299 InitializeSystemContextDependencies(); | 299 InitializeSystemContextDependencies(); |
300 net::HttpNetworkSession::Params system_params; | 300 net::HttpNetworkSession::Params system_params; |
301 PopulateNetworkSessionParams(false, &system_params); | 301 PopulateNetworkSessionParams(false, &system_params); |
302 system_transaction_factory_.reset(new net::HttpNetworkLayer( | 302 system_transaction_factory_.reset(new net::HttpNetworkLayer( |
303 new net::HttpNetworkSession(system_params))); | 303 new net::HttpNetworkSession(system_params))); |
304 system_job_factory_.reset(new net::URLRequestJobFactoryImpl()); | 304 system_job_factory_ = |
| 305 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
305 system_cookie_store_ = | 306 system_cookie_store_ = |
306 content::CreateCookieStore(content::CookieStoreConfig()); | 307 content::CreateCookieStore(content::CookieStoreConfig()); |
307 | 308 |
308 net::URLRequestContext* system_context = new net::URLRequestContext(); | 309 net::URLRequestContext* system_context = new net::URLRequestContext(); |
309 system_context->set_host_resolver(host_resolver_.get()); | 310 system_context->set_host_resolver(host_resolver_.get()); |
310 system_context->set_channel_id_service(channel_id_service_.get()); | 311 system_context->set_channel_id_service(channel_id_service_.get()); |
311 system_context->set_cert_verifier(cert_verifier_.get()); | 312 system_context->set_cert_verifier(cert_verifier_.get()); |
312 system_context->set_proxy_service(proxy_service_.get()); | 313 system_context->set_proxy_service(proxy_service_.get()); |
313 system_context->set_ssl_config_service(ssl_config_service_.get()); | 314 system_context->set_ssl_config_service(ssl_config_service_.get()); |
314 system_context->set_transport_security_state( | 315 system_context->set_transport_security_state( |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 399 |
399 void URLRequestContextFactory::InitializeNetworkDelegates() { | 400 void URLRequestContextFactory::InitializeNetworkDelegates() { |
400 app_network_delegate_->Initialize(false); | 401 app_network_delegate_->Initialize(false); |
401 LOG(INFO) << "Initialized app network delegate."; | 402 LOG(INFO) << "Initialized app network delegate."; |
402 system_network_delegate_->Initialize(false); | 403 system_network_delegate_->Initialize(false); |
403 LOG(INFO) << "Initialized system network delegate."; | 404 LOG(INFO) << "Initialized system network delegate."; |
404 } | 405 } |
405 | 406 |
406 } // namespace shell | 407 } // namespace shell |
407 } // namespace chromecast | 408 } // namespace chromecast |
OLD | NEW |