Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Side by Side Diff: chrome/browser/profiles/profile_impl_io_data.cc

Issue 1888963004: Add HttpProtocolHandler and convert everything to use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-supports-scheme
Patch Set: rebase (needs fixing) Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 main_context_storage->set_http_network_session( 531 main_context_storage->set_http_network_session(
532 CreateHttpNetworkSession(*profile_params)); 532 CreateHttpNetworkSession(*profile_params));
533 main_context_storage->set_http_transaction_factory(CreateMainHttpFactory( 533 main_context_storage->set_http_transaction_factory(CreateMainHttpFactory(
534 main_context_storage->http_network_session(), std::move(main_backend))); 534 main_context_storage->http_network_session(), std::move(main_backend)));
535 535
536 #if !defined(DISABLE_FTP_SUPPORT) 536 #if !defined(DISABLE_FTP_SUPPORT)
537 ftp_factory_.reset( 537 ftp_factory_.reset(
538 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get())); 538 new net::FtpNetworkLayer(io_thread_globals->host_resolver.get()));
539 #endif // !defined(DISABLE_FTP_SUPPORT) 539 #endif // !defined(DISABLE_FTP_SUPPORT)
540 540
541 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory( 541 std::unique_ptr<net::URLRequestJobFactoryImpl> main_job_factory =
542 new net::URLRequestJobFactoryImpl()); 542 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers();
543 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers); 543 InstallProtocolHandlers(main_job_factory.get(), protocol_handlers);
544 544
545 // Install the Offline Page Interceptor. 545 // Install the Offline Page Interceptor.
546 #if defined(OS_ANDROID) 546 #if defined(OS_ANDROID)
547 request_interceptors.push_back(std::unique_ptr<net::URLRequestInterceptor>( 547 request_interceptors.push_back(std::unique_ptr<net::URLRequestInterceptor>(
548 new offline_pages::OfflinePageRequestInterceptor( 548 new offline_pages::OfflinePageRequestInterceptor(
549 previews_io_data_.get()))); 549 previews_io_data_.get())));
550 #endif 550 #endif
551 551
552 // The data reduction proxy interceptor should be as close to the network 552 // The data reduction proxy interceptor should be as close to the network
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 content::CookieStoreConfig cookie_config( 599 content::CookieStoreConfig cookie_config(
600 lazy_params_->extensions_cookie_path, 600 lazy_params_->extensions_cookie_path,
601 lazy_params_->session_cookie_mode, 601 lazy_params_->session_cookie_mode,
602 NULL, NULL); 602 NULL, NULL);
603 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate(); 603 cookie_config.crypto_delegate = cookie_config::GetCookieCryptoDelegate();
604 // Enable cookies for chrome-extension URLs. 604 // Enable cookies for chrome-extension URLs.
605 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme); 605 cookie_config.cookieable_schemes.push_back(extensions::kExtensionScheme);
606 extensions_cookie_store_ = content::CreateCookieStore(cookie_config); 606 extensions_cookie_store_ = content::CreateCookieStore(cookie_config);
607 extensions_context->set_cookie_store(extensions_cookie_store_.get()); 607 extensions_context->set_cookie_store(extensions_cookie_store_.get());
608 608
609 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory( 609 std::unique_ptr<net::URLRequestJobFactoryImpl> extensions_job_factory =
610 new net::URLRequestJobFactoryImpl()); 610 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers();
611 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate. 611 // TODO(shalev): The extensions_job_factory has a NULL NetworkDelegate.
612 // Without a network_delegate, this protocol handler will never 612 // Without a network_delegate, this protocol handler will never
613 // handle file: requests, but as a side effect it makes 613 // handle file: requests, but as a side effect it makes
614 // job_factory::IsHandledProtocol return true, which prevents attempts to 614 // job_factory::IsHandledProtocol return true, which prevents attempts to
615 // handle the protocol externally. We pass NULL in to 615 // handle the protocol externally. We pass NULL in to
616 // SetUpJobFactory() to get this effect. 616 // SetUpJobFactory() to get this effect.
617 extensions_job_factory_ = SetUpJobFactoryDefaults( 617 extensions_job_factory_ = SetUpJobFactoryDefaults(
618 std::move(extensions_job_factory), 618 std::move(extensions_job_factory),
619 content::URLRequestInterceptorScopedVector(), 619 content::URLRequestInterceptorScopedVector(),
620 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL, 620 std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>(), NULL,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 693
694 // Transfer ownership of the ChannelIDStore and the HttpNetworkSession to the 694 // Transfer ownership of the ChannelIDStore and the HttpNetworkSession to the
695 // AppRequestContext. 695 // AppRequestContext.
696 context->SetChannelIDService(std::move(channel_id_service)); 696 context->SetChannelIDService(std::move(channel_id_service));
697 context->SetHttpNetworkSession(std::move(http_network_session)); 697 context->SetHttpNetworkSession(std::move(http_network_session));
698 698
699 // Transfer ownership of the cookies and cache to AppRequestContext. 699 // Transfer ownership of the cookies and cache to AppRequestContext.
700 context->SetCookieStore(std::move(cookie_store)); 700 context->SetCookieStore(std::move(cookie_store));
701 context->SetHttpTransactionFactory(std::move(app_http_cache)); 701 context->SetHttpTransactionFactory(std::move(app_http_cache));
702 702
703 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory( 703 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory =
704 new net::URLRequestJobFactoryImpl()); 704 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers();
705 InstallProtocolHandlers(job_factory.get(), protocol_handlers); 705 InstallProtocolHandlers(job_factory.get(), protocol_handlers);
706 // The data reduction proxy interceptor should be as close to the network 706 // The data reduction proxy interceptor should be as close to the network
707 // as possible. 707 // as possible.
708 request_interceptors.insert( 708 request_interceptors.insert(
709 request_interceptors.begin(), 709 request_interceptors.begin(),
710 data_reduction_proxy_io_data()->CreateInterceptor().release()); 710 data_reduction_proxy_io_data()->CreateInterceptor().release());
711 std::unique_ptr<net::URLRequestJobFactory> top_job_factory( 711 std::unique_ptr<net::URLRequestJobFactory> top_job_factory(
712 SetUpJobFactoryDefaults( 712 SetUpJobFactoryDefaults(
713 std::move(job_factory), std::move(request_interceptors), 713 std::move(job_factory), std::move(request_interceptors),
714 std::move(protocol_handler_interceptor), 714 std::move(protocol_handler_interceptor),
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 const base::Closure& completion) { 808 const base::Closure& completion) {
809 DCHECK_CURRENTLY_ON(BrowserThread::IO); 809 DCHECK_CURRENTLY_ON(BrowserThread::IO);
810 DCHECK(initialized()); 810 DCHECK(initialized());
811 811
812 DCHECK(transport_security_state()); 812 DCHECK(transport_security_state());
813 // Completes synchronously. 813 // Completes synchronously.
814 transport_security_state()->DeleteAllDynamicDataSince(time); 814 transport_security_state()->DeleteAllDynamicDataSince(time);
815 DCHECK(http_server_properties_manager_); 815 DCHECK(http_server_properties_manager_);
816 http_server_properties_manager_->Clear(completion); 816 http_server_properties_manager_->Clear(completion);
817 } 817 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_io_data.cc ('k') | chromecast/browser/url_request_context_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698