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

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

Issue 2876463007: Revert of Make ProfileIOData's ProxyService fetch PACs with the main URLRequestContext (Closed)
Patch Set: Created 3 years, 7 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_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 transport_security_state_->SetExpectCTReporter(nullptr); 667 transport_security_state_->SetExpectCTReporter(nullptr);
668 expect_ct_reporter_.reset(); 668 expect_ct_reporter_.reset();
669 669
670 if (transport_security_state_) 670 if (transport_security_state_)
671 transport_security_state_->SetRequireCTDelegate(nullptr); 671 transport_security_state_->SetRequireCTDelegate(nullptr);
672 672
673 // And the same for the ReportingService. 673 // And the same for the ReportingService.
674 main_request_context_storage()->set_reporting_service( 674 main_request_context_storage()->set_reporting_service(
675 std::unique_ptr<net::ReportingService>()); 675 std::unique_ptr<net::ReportingService>());
676 676
677 // This should be shut down last, as any other requests may initiate more
678 // activity when the ProxyService aborts lookups.
679 if (proxy_service_)
680 proxy_service_->OnShutdown();
681
682 // TODO(ajwong): These AssertNoURLRequests() calls are unnecessary since they 677 // TODO(ajwong): These AssertNoURLRequests() calls are unnecessary since they
683 // are already done in the URLRequestContext destructor. 678 // are already done in the URLRequestContext destructor.
684 if (main_request_context_) 679 if (main_request_context_)
685 main_request_context_->AssertNoURLRequests(); 680 main_request_context_->AssertNoURLRequests();
686 if (extensions_request_context_) 681 if (extensions_request_context_)
687 extensions_request_context_->AssertNoURLRequests(); 682 extensions_request_context_->AssertNoURLRequests();
688 683
689 current_context = 0; 684 current_context = 0;
690 for (URLRequestContextMap::iterator it = app_request_context_map_.begin(); 685 for (URLRequestContextMap::iterator it = app_request_context_map_.begin();
691 it != app_request_context_map_.end(); ++it) { 686 it != app_request_context_map_.end(); ++it) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 // Create the common request contexts. 984 // Create the common request contexts.
990 main_request_context_.reset(new net::URLRequestContext()); 985 main_request_context_.reset(new net::URLRequestContext());
991 main_request_context_storage_.reset( 986 main_request_context_storage_.reset(
992 new net::URLRequestContextStorage(main_request_context_.get())); 987 new net::URLRequestContextStorage(main_request_context_.get()));
993 extensions_request_context_.reset(new net::URLRequestContext()); 988 extensions_request_context_.reset(new net::URLRequestContext());
994 main_request_context_->set_name("main"); 989 main_request_context_->set_name("main");
995 extensions_request_context_->set_name("extensions"); 990 extensions_request_context_->set_name("extensions");
996 991
997 main_request_context_->set_enable_brotli(io_thread_globals->enable_brotli); 992 main_request_context_->set_enable_brotli(io_thread_globals->enable_brotli);
998 993
999 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate( 994 std::unique_ptr<ChromeNetworkDelegate> network_delegate(
1000 new ChromeNetworkDelegate( 995 new ChromeNetworkDelegate(
1001 #if BUILDFLAG(ENABLE_EXTENSIONS) 996 #if BUILDFLAG(ENABLE_EXTENSIONS)
1002 io_thread_globals->extension_event_router_forwarder.get(), 997 io_thread_globals->extension_event_router_forwarder.get(),
1003 #else 998 #else
1004 NULL, 999 NULL,
1005 #endif 1000 #endif
1006 &enable_referrers_)); 1001 &enable_referrers_));
1007 #if BUILDFLAG(ENABLE_EXTENSIONS) 1002 #if BUILDFLAG(ENABLE_EXTENSIONS)
1008 chrome_network_delegate->set_extension_info_map( 1003 network_delegate->set_extension_info_map(
1009 profile_params_->extension_info_map.get()); 1004 profile_params_->extension_info_map.get());
1010 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) { 1005 if (!command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling)) {
1011 extension_throttle_manager_.reset( 1006 extension_throttle_manager_.reset(
1012 new extensions::ExtensionThrottleManager()); 1007 new extensions::ExtensionThrottleManager());
1013 } 1008 }
1014 #endif 1009 #endif
1015 1010
1016 chrome_network_delegate->set_url_blacklist_manager( 1011 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get());
1017 url_blacklist_manager_.get()); 1012 network_delegate->set_profile(profile_params_->profile);
1018 chrome_network_delegate->set_profile(profile_params_->profile); 1013 network_delegate->set_profile_path(profile_params_->path);
1019 chrome_network_delegate->set_profile_path(profile_params_->path); 1014 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get());
1020 chrome_network_delegate->set_cookie_settings( 1015 network_delegate->set_enable_do_not_track(&enable_do_not_track_);
1021 profile_params_->cookie_settings.get()); 1016 network_delegate->set_force_google_safe_search(&force_google_safesearch_);
1022 chrome_network_delegate->set_enable_do_not_track(&enable_do_not_track_); 1017 network_delegate->set_force_youtube_restrict(&force_youtube_restrict_);
1023 chrome_network_delegate->set_force_google_safe_search( 1018 network_delegate->set_allowed_domains_for_apps(&allowed_domains_for_apps_);
1024 &force_google_safesearch_); 1019 network_delegate->set_data_use_aggregator(
1025 chrome_network_delegate->set_force_youtube_restrict(&force_youtube_restrict_);
1026 chrome_network_delegate->set_allowed_domains_for_apps(
1027 &allowed_domains_for_apps_);
1028 chrome_network_delegate->set_data_use_aggregator(
1029 io_thread_globals->data_use_aggregator.get(), IsOffTheRecord()); 1020 io_thread_globals->data_use_aggregator.get(), IsOffTheRecord());
1030 1021
1031 std::unique_ptr<net::NetworkDelegate> network_delegate =
1032 ConfigureNetworkDelegate(profile_params_->io_thread,
1033 std::move(chrome_network_delegate));
1034
1035 main_request_context_->set_host_resolver(
1036 io_thread_globals->host_resolver.get());
1037
1038 // NOTE: Proxy service uses the default io thread network delegate, not the 1022 // NOTE: Proxy service uses the default io thread network delegate, not the
1039 // delegate just created. 1023 // delegate just created.
1040 proxy_service_ = ProxyServiceFactory::CreateProxyService( 1024 proxy_service_ = ProxyServiceFactory::CreateProxyService(
1041 io_thread->net_log(), main_request_context_.get(), network_delegate.get(), 1025 io_thread->net_log(),
1026 io_thread_globals->proxy_script_fetcher_context.get(),
1027 io_thread_globals->system_network_delegate.get(),
1042 std::move(profile_params_->proxy_config_service), command_line, 1028 std::move(profile_params_->proxy_config_service), command_line,
1043 io_thread->WpadQuickCheckEnabled(), 1029 io_thread->WpadQuickCheckEnabled(),
1044 io_thread->PacHttpsUrlStrippingEnabled()); 1030 io_thread->PacHttpsUrlStrippingEnabled());
1045
1046 main_request_context_storage_->set_network_delegate(
1047 std::move(network_delegate));
1048
1049 transport_security_state_.reset(new net::TransportSecurityState()); 1031 transport_security_state_.reset(new net::TransportSecurityState());
1050 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); 1032 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool();
1051 transport_security_persister_.reset( 1033 transport_security_persister_.reset(
1052 new net::TransportSecurityPersister( 1034 new net::TransportSecurityPersister(
1053 transport_security_state_.get(), 1035 transport_security_state_.get(),
1054 profile_params_->path, 1036 profile_params_->path,
1055 pool->GetSequencedTaskRunnerWithShutdownBehavior( 1037 pool->GetSequencedTaskRunnerWithShutdownBehavior(
1056 pool->GetSequenceToken(), 1038 pool->GetSequenceToken(),
1057 base::SequencedWorkerPool::BLOCK_SHUTDOWN), 1039 base::SequencedWorkerPool::BLOCK_SHUTDOWN),
1058 IsOffTheRecord())); 1040 IsOffTheRecord()));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 ct_tree_tracker_.reset(new certificate_transparency::TreeStateTracker( 1112 ct_tree_tracker_.reset(new certificate_transparency::TreeStateTracker(
1131 io_thread_globals->ct_logs, io_thread->net_log())); 1113 io_thread_globals->ct_logs, io_thread->net_log()));
1132 ct_verifier->SetObserver(ct_tree_tracker_.get()); 1114 ct_verifier->SetObserver(ct_tree_tracker_.get());
1133 1115
1134 cert_transparency_verifier_ = std::move(ct_verifier); 1116 cert_transparency_verifier_ = std::move(ct_verifier);
1135 io_thread->RegisterSTHObserver(ct_tree_tracker_.get()); 1117 io_thread->RegisterSTHObserver(ct_tree_tracker_.get());
1136 ct_tree_tracker_unregistration_ = 1118 ct_tree_tracker_unregistration_ =
1137 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread), 1119 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread),
1138 ct_tree_tracker_.get()); 1120 ct_tree_tracker_.get());
1139 1121
1140 InitializeInternal(profile_params_.get(), protocol_handlers, 1122 InitializeInternal(std::move(network_delegate), profile_params_.get(),
1141 std::move(request_interceptors)); 1123 protocol_handlers, std::move(request_interceptors));
1142 1124
1143 profile_params_.reset(); 1125 profile_params_.reset();
1144 initialized_ = true; 1126 initialized_ = true;
1145 } 1127 }
1146 1128
1147 void ProfileIOData::ApplyProfileParamsToContext( 1129 void ProfileIOData::ApplyProfileParamsToContext(
1148 net::URLRequestContext* context) const { 1130 net::URLRequestContext* context) const {
1149 context->set_http_user_agent_settings( 1131 context->set_http_user_agent_settings(
1150 chrome_http_user_agent_settings_.get()); 1132 chrome_http_user_agent_settings_.get());
1151 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); 1133 context->set_ssl_config_service(profile_params_->ssl_config_service.get());
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 net::HttpTransactionFactory* main_http_factory, 1303 net::HttpTransactionFactory* main_http_factory,
1322 std::unique_ptr<net::HttpCache::BackendFactory> backend) const { 1304 std::unique_ptr<net::HttpCache::BackendFactory> backend) const {
1323 DCHECK(main_http_factory); 1305 DCHECK(main_http_factory);
1324 net::HttpNetworkSession* shared_session = main_http_factory->GetSession(); 1306 net::HttpNetworkSession* shared_session = main_http_factory->GetSession();
1325 return base::MakeUnique<net::HttpCache>( 1307 return base::MakeUnique<net::HttpCache>(
1326 base::WrapUnique(new DevToolsNetworkTransactionFactory( 1308 base::WrapUnique(new DevToolsNetworkTransactionFactory(
1327 network_controller_handle_.GetController(), shared_session)), 1309 network_controller_handle_.GetController(), shared_session)),
1328 std::move(backend), false /* is_main_cache */); 1310 std::move(backend), false /* is_main_cache */);
1329 } 1311 }
1330 1312
1331 std::unique_ptr<net::NetworkDelegate> ProfileIOData::ConfigureNetworkDelegate(
1332 IOThread* io_thread,
1333 std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const {
1334 return base::WrapUnique<net::NetworkDelegate>(
1335 chrome_network_delegate.release());
1336 }
1337
1338 void ProfileIOData::SetCookieSettingsForTesting( 1313 void ProfileIOData::SetCookieSettingsForTesting(
1339 content_settings::CookieSettings* cookie_settings) { 1314 content_settings::CookieSettings* cookie_settings) {
1340 DCHECK(!cookie_settings_.get()); 1315 DCHECK(!cookie_settings_.get());
1341 cookie_settings_ = cookie_settings; 1316 cookie_settings_ = cookie_settings;
1342 } 1317 }
1343 1318
1344 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( 1319 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState(
1345 const GURL& url) const { 1320 const GURL& url) const {
1346 return url_blacklist_manager_->GetURLBlacklistState(url); 1321 return url_blacklist_manager_->GetURLBlacklistState(url);
1347 } 1322 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_io_data.h ('k') | net/test/embedded_test_server/embedded_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698