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 "chrome/browser/profiles/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 http_network_session_ = CreateHttpNetworkSession(*profile_params); | 525 http_network_session_ = CreateHttpNetworkSession(*profile_params); |
526 main_http_factory_ = CreateMainHttpFactory(http_network_session_.get(), | 526 main_http_factory_ = CreateMainHttpFactory(http_network_session_.get(), |
527 std::move(main_backend)); | 527 std::move(main_backend)); |
528 main_context->set_http_transaction_factory(main_http_factory_.get()); | 528 main_context->set_http_transaction_factory(main_http_factory_.get()); |
529 | 529 |
530 #if !defined(DISABLE_FTP_SUPPORT) | 530 #if !defined(DISABLE_FTP_SUPPORT) |
531 ftp_factory_.reset( | 531 ftp_factory_.reset( |
532 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); | 532 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); |
533 #endif // !defined(DISABLE_FTP_SUPPORT) | 533 #endif // !defined(DISABLE_FTP_SUPPORT) |
534 | 534 |
535 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( | 535 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory = |
536 new net::URLRequestJobFactoryImpl()); | 536 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
537 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); | 537 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); |
538 | 538 |
539 // The data reduction proxy interceptor should be as close to the network | 539 // The data reduction proxy interceptor should be as close to the network |
540 // as possible. | 540 // as possible. |
541 request_interceptors.insert( | 541 request_interceptors.insert( |
542 request_interceptors.begin(), | 542 request_interceptors.begin(), |
543 data_reduction_proxy_io_data()->CreateInterceptor().release()); | 543 data_reduction_proxy_io_data()->CreateInterceptor().release()); |
544 main_job_factory_ = SetUpJobFactoryDefaults( | 544 main_job_factory_ = SetUpJobFactoryDefaults( |
545 std::move(main_job_factory), std::move(request_interceptors), | 545 std::move(main_job_factory), std::move(request_interceptors), |
546 std::move(profile_params->protocol_handler_interceptor), | 546 std::move(profile_params->protocol_handler_interceptor), |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 content::CookieStoreConfig cookie_config( | 585 content::CookieStoreConfig cookie_config( |
586 lazy_params_->extensions_cookie_path, | 586 lazy_params_->extensions_cookie_path, |
587 lazy_params_->session_cookie_mode, | 587 lazy_params_->session_cookie_mode, |
588 NULL, NULL); | 588 NULL, NULL); |
589 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); | 589 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); |
590 // Enable cookies for chrome-extension URLs. | 590 // Enable cookies for chrome-extension URLs. |
591 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); | 591 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); |
592 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); | 592 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); |
593 extensions_context->set_cookie_store(extensions_cookie_store_.get()); | 593 extensions_context->set_cookie_store(extensions_cookie_store_.get()); |
594 | 594 |
595 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( | 595 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory = |
596 new net::URLRequestJobFactoryImpl()); | 596 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
597 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. | 597 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. |
598 // Without a network_delegate, this protocol handler will never | 598 // Without a network_delegate, this protocol handler will never |
599 // handle file: requests, but as a side effect it makes | 599 // handle file: requests, but as a side effect it makes |
600 // job_factory::IsHandledProtocol return true, which prevents attempts to | 600 // job_factory::IsHandledProtocol return true, which prevents attempts to |
601 // handle the protocol externally. We pass NULL in to | 601 // handle the protocol externally. We pass NULL in to |
602 // SetUpJobFactory() to get this effect. | 602 // SetUpJobFactory() to get this effect. |
603 extensions_job_factory_ = SetUpJobFactoryDefaults( | 603 extensions_job_factory_ = SetUpJobFactoryDefaults( |
604 std::move(extensions_job_factory), | 604 std::move(extensions_job_factory), |
605 content::URLRequestInterceptorScopedVector(), | 605 content::URLRequestInterceptorScopedVector(), |
606 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, | 606 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, | 655 cookie_path, content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES, |
656 nullptr, nullptr); | 656 nullptr, nullptr); |
657 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); | 657 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); |
658 cookie_store = content::CreateCookieStore(cookie_config); | 658 cookie_store = content::CreateCookieStore(cookie_config); |
659 } | 659 } |
660 | 660 |
661 // Transfer ownership of the cookies and cache to AppRequestContext. | 661 // Transfer ownership of the cookies and cache to AppRequestContext. |
662 context->SetCookieStore(std::move(cookie_store)); | 662 context->SetCookieStore(std::move(cookie_store)); |
663 context->SetHttpTransactionFactory(std::move(app_http_cache)); | 663 context->SetHttpTransactionFactory(std::move(app_http_cache)); |
664 | 664 |
665 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( | 665 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
666 new net::URLRequestJobFactoryImpl()); | 666 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
667 InstallProtocolHandlers(job_factory.get(), protocol_handlers); | 667 InstallProtocolHandlers(job_factory.get(), protocol_handlers); |
668 // The data reduction proxy interceptor should be as close to the network | 668 // The data reduction proxy interceptor should be as close to the network |
669 // as possible. | 669 // as possible. |
670 request_interceptors.insert( | 670 request_interceptors.insert( |
671 request_interceptors.begin(), | 671 request_interceptors.begin(), |
672 data_reduction_proxy_io_data()->CreateInterceptor().release()); | 672 data_reduction_proxy_io_data()->CreateInterceptor().release()); |
673 std::unique_ptr<net::URLRequestJobFactory> top_job_factory( | 673 std::unique_ptr<net::URLRequestJobFactory> top_job_factory( |
674 SetUpJobFactoryDefaults( | 674 SetUpJobFactoryDefaults( |
675 std::move(job_factory), std::move(request_interceptors), | 675 std::move(job_factory), std::move(request_interceptors), |
676 std::move(protocol_handler_interceptor), | 676 std::move(protocol_handler_interceptor), |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 const base::Closure& completion) { | 765 const base::Closure& completion) { |
766 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 766 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
767 DCHECK(initialized()); | 767 DCHECK(initialized()); |
768 | 768 |
769 DCHECK(transport_security_state()); | 769 DCHECK(transport_security_state()); |
770 // Completes synchronously. | 770 // Completes synchronously. |
771 transport_security_state()->DeleteAllDynamicDataSince(time); | 771 transport_security_state()->DeleteAllDynamicDataSince(time); |
772 DCHECK(http_server_properties_manager_); | 772 DCHECK(http_server_properties_manager_); |
773 http_server_properties_manager_->Clear(completion); | 773 http_server_properties_manager_->Clear(completion); |
774 } | 774 } |
OLD | NEW |