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_io_data.h" | 5 #include "chrome/browser/profiles/profile_io_data.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. | 1016 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. |
1017 CHECK(initialized_on_UI_thread_); | 1017 CHECK(initialized_on_UI_thread_); |
1018 | 1018 |
1019 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. | 1019 // TODO(jhawkins): Return to DCHECK once crbug.com/102004 is fixed. |
1020 CHECK(profile_params_.get()); | 1020 CHECK(profile_params_.get()); |
1021 | 1021 |
1022 IOThread* const io_thread = profile_params_->io_thread; | 1022 IOThread* const io_thread = profile_params_->io_thread; |
1023 IOThread::Globals* const io_thread_globals = io_thread->globals(); | 1023 IOThread::Globals* const io_thread_globals = io_thread->globals(); |
1024 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 1024 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
1025 | 1025 |
| 1026 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1027 tracked_objects::ScopedTracker tracking_profile1( |
| 1028 FROM_HERE_WITH_EXPLICIT_FUNCTION("436671 ProfileIOData::Init1")); |
| 1029 |
1026 // Create the common request contexts. | 1030 // Create the common request contexts. |
1027 main_request_context_.reset(new net::URLRequestContext()); | 1031 main_request_context_.reset(new net::URLRequestContext()); |
1028 extensions_request_context_.reset(new net::URLRequestContext()); | 1032 extensions_request_context_.reset(new net::URLRequestContext()); |
1029 | 1033 |
| 1034 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1035 tracked_objects::ScopedTracker tracking_profile2( |
| 1036 FROM_HERE_WITH_EXPLICIT_FUNCTION("436671 ProfileIOData::Init2")); |
| 1037 |
1030 scoped_ptr<ChromeNetworkDelegate> network_delegate( | 1038 scoped_ptr<ChromeNetworkDelegate> network_delegate( |
1031 new ChromeNetworkDelegate( | 1039 new ChromeNetworkDelegate( |
1032 #if defined(ENABLE_EXTENSIONS) | 1040 #if defined(ENABLE_EXTENSIONS) |
1033 io_thread_globals->extension_event_router_forwarder.get(), | 1041 io_thread_globals->extension_event_router_forwarder.get(), |
1034 #else | 1042 #else |
1035 NULL, | 1043 NULL, |
1036 #endif | 1044 #endif |
1037 &enable_referrers_)); | 1045 &enable_referrers_)); |
1038 if (command_line.HasSwitch(switches::kEnableClientHints)) | 1046 if (command_line.HasSwitch(switches::kEnableClientHints)) |
1039 network_delegate->SetEnableClientHints(); | 1047 network_delegate->SetEnableClientHints(); |
1040 #if defined(ENABLE_EXTENSIONS) | 1048 #if defined(ENABLE_EXTENSIONS) |
1041 network_delegate->set_extension_info_map( | 1049 network_delegate->set_extension_info_map( |
1042 profile_params_->extension_info_map.get()); | 1050 profile_params_->extension_info_map.get()); |
1043 #endif | 1051 #endif |
1044 #if defined(ENABLE_CONFIGURATION_POLICY) | 1052 #if defined(ENABLE_CONFIGURATION_POLICY) |
1045 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); | 1053 network_delegate->set_url_blacklist_manager(url_blacklist_manager_.get()); |
1046 #endif | 1054 #endif |
1047 network_delegate->set_profile(profile_params_->profile); | 1055 network_delegate->set_profile(profile_params_->profile); |
1048 network_delegate->set_profile_path(profile_params_->path); | 1056 network_delegate->set_profile_path(profile_params_->path); |
1049 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); | 1057 network_delegate->set_cookie_settings(profile_params_->cookie_settings.get()); |
1050 network_delegate->set_enable_do_not_track(&enable_do_not_track_); | 1058 network_delegate->set_enable_do_not_track(&enable_do_not_track_); |
1051 network_delegate->set_force_safe_search(&force_safesearch_); | 1059 network_delegate->set_force_safe_search(&force_safesearch_); |
1052 network_delegate->set_force_google_safe_search(&force_google_safesearch_); | 1060 network_delegate->set_force_google_safe_search(&force_google_safesearch_); |
1053 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); | 1061 network_delegate->set_force_youtube_safety_mode(&force_youtube_safety_mode_); |
1054 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); | 1062 network_delegate->set_prerender_tracker(profile_params_->prerender_tracker); |
1055 fraudulent_certificate_reporter_.reset( | 1063 fraudulent_certificate_reporter_.reset( |
1056 new chrome_browser_net::ChromeFraudulentCertificateReporter( | 1064 new chrome_browser_net::ChromeFraudulentCertificateReporter( |
1057 main_request_context_.get())); | 1065 main_request_context_.get())); |
1058 | 1066 |
| 1067 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1068 tracked_objects::ScopedTracker tracking_profile3( |
| 1069 FROM_HERE_WITH_EXPLICIT_FUNCTION("436671 ProfileIOData::Init3")); |
| 1070 |
1059 // NOTE: Proxy service uses the default io thread network delegate, not the | 1071 // NOTE: Proxy service uses the default io thread network delegate, not the |
1060 // delegate just created. | 1072 // delegate just created. |
1061 proxy_service_.reset( | 1073 proxy_service_.reset( |
1062 ProxyServiceFactory::CreateProxyService( | 1074 ProxyServiceFactory::CreateProxyService( |
1063 io_thread->net_log(), | 1075 io_thread->net_log(), |
1064 io_thread_globals->proxy_script_fetcher_context.get(), | 1076 io_thread_globals->proxy_script_fetcher_context.get(), |
1065 io_thread_globals->system_network_delegate.get(), | 1077 io_thread_globals->system_network_delegate.get(), |
1066 profile_params_->proxy_config_service.release(), | 1078 profile_params_->proxy_config_service.release(), |
1067 command_line, | 1079 command_line, |
1068 quick_check_enabled_.GetValue())); | 1080 quick_check_enabled_.GetValue())); |
1069 transport_security_state_.reset(new net::TransportSecurityState()); | 1081 transport_security_state_.reset(new net::TransportSecurityState()); |
1070 transport_security_persister_.reset( | 1082 transport_security_persister_.reset( |
1071 new net::TransportSecurityPersister( | 1083 new net::TransportSecurityPersister( |
1072 transport_security_state_.get(), | 1084 transport_security_state_.get(), |
1073 profile_params_->path, | 1085 profile_params_->path, |
1074 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 1086 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
1075 IsOffTheRecord())); | 1087 IsOffTheRecord())); |
1076 | 1088 |
| 1089 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1090 tracked_objects::ScopedTracker tracking_profile4( |
| 1091 FROM_HERE_WITH_EXPLICIT_FUNCTION("436671 ProfileIOData::Init4")); |
| 1092 |
1077 // Take ownership over these parameters. | 1093 // Take ownership over these parameters. |
1078 cookie_settings_ = profile_params_->cookie_settings; | 1094 cookie_settings_ = profile_params_->cookie_settings; |
1079 host_content_settings_map_ = profile_params_->host_content_settings_map; | 1095 host_content_settings_map_ = profile_params_->host_content_settings_map; |
1080 #if defined(ENABLE_EXTENSIONS) | 1096 #if defined(ENABLE_EXTENSIONS) |
1081 extension_info_map_ = profile_params_->extension_info_map; | 1097 extension_info_map_ = profile_params_->extension_info_map; |
1082 #endif | 1098 #endif |
1083 | 1099 |
1084 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); | 1100 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); |
1085 resource_context_->request_context_ = main_request_context_.get(); | 1101 resource_context_->request_context_ = main_request_context_.get(); |
1086 | 1102 |
(...skipping 23 matching lines...) Expand all Loading... |
1110 policy_cert_verifier_->InitializeOnIOThread(verify_proc); | 1126 policy_cert_verifier_->InitializeOnIOThread(verify_proc); |
1111 } else { | 1127 } else { |
1112 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); | 1128 cert_verifier_.reset(new net::MultiThreadedCertVerifier(verify_proc.get())); |
1113 } | 1129 } |
1114 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 1130 main_request_context_->set_cert_verifier(cert_verifier_.get()); |
1115 #else | 1131 #else |
1116 main_request_context_->set_cert_verifier( | 1132 main_request_context_->set_cert_verifier( |
1117 io_thread_globals->cert_verifier.get()); | 1133 io_thread_globals->cert_verifier.get()); |
1118 #endif | 1134 #endif |
1119 | 1135 |
| 1136 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1137 tracked_objects::ScopedTracker tracking_profile5( |
| 1138 FROM_HERE_WITH_EXPLICIT_FUNCTION("436671 ProfileIOData::Init5")); |
| 1139 |
1120 InitializeInternal( | 1140 InitializeInternal( |
1121 network_delegate.Pass(), profile_params_.get(), | 1141 network_delegate.Pass(), profile_params_.get(), |
1122 protocol_handlers, request_interceptors.Pass()); | 1142 protocol_handlers, request_interceptors.Pass()); |
1123 | 1143 |
1124 profile_params_.reset(); | 1144 profile_params_.reset(); |
1125 initialized_ = true; | 1145 initialized_ = true; |
1126 } | 1146 } |
1127 | 1147 |
1128 void ProfileIOData::ApplyProfileParamsToContext( | 1148 void ProfileIOData::ApplyProfileParamsToContext( |
1129 net::URLRequestContext* context) const { | 1149 net::URLRequestContext* context) const { |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 void ProfileIOData::SetCookieSettingsForTesting( | 1340 void ProfileIOData::SetCookieSettingsForTesting( |
1321 CookieSettings* cookie_settings) { | 1341 CookieSettings* cookie_settings) { |
1322 DCHECK(!cookie_settings_.get()); | 1342 DCHECK(!cookie_settings_.get()); |
1323 cookie_settings_ = cookie_settings; | 1343 cookie_settings_ = cookie_settings; |
1324 } | 1344 } |
1325 | 1345 |
1326 void ProfileIOData::set_signin_names_for_testing( | 1346 void ProfileIOData::set_signin_names_for_testing( |
1327 SigninNamesOnIOThread* signin_names) { | 1347 SigninNamesOnIOThread* signin_names) { |
1328 signin_names_.reset(signin_names); | 1348 signin_names_.reset(signin_names); |
1329 } | 1349 } |
OLD | NEW |