| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 #include "net/proxy/proxy_script_fetcher_impl.h" | 72 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 73 #include "net/proxy/proxy_service.h" | 73 #include "net/proxy/proxy_service.h" |
| 74 #include "net/ssl/channel_id_service.h" | 74 #include "net/ssl/channel_id_service.h" |
| 75 #include "net/ssl/client_cert_store.h" | 75 #include "net/ssl/client_cert_store.h" |
| 76 #include "net/url_request/certificate_report_sender.h" | 76 #include "net/url_request/certificate_report_sender.h" |
| 77 #include "net/url_request/data_protocol_handler.h" | 77 #include "net/url_request/data_protocol_handler.h" |
| 78 #include "net/url_request/file_protocol_handler.h" | 78 #include "net/url_request/file_protocol_handler.h" |
| 79 #include "net/url_request/ftp_protocol_handler.h" | 79 #include "net/url_request/ftp_protocol_handler.h" |
| 80 #include "net/url_request/url_request.h" | 80 #include "net/url_request/url_request.h" |
| 81 #include "net/url_request/url_request_context.h" | 81 #include "net/url_request/url_request_context.h" |
| 82 #include "net/url_request/url_request_context_builder.h" |
| 82 #include "net/url_request/url_request_file_job.h" | 83 #include "net/url_request/url_request_file_job.h" |
| 83 #include "net/url_request/url_request_intercepting_job_factory.h" | 84 #include "net/url_request/url_request_intercepting_job_factory.h" |
| 84 #include "net/url_request/url_request_interceptor.h" | 85 #include "net/url_request/url_request_interceptor.h" |
| 85 #include "net/url_request/url_request_job_factory_impl.h" | 86 #include "net/url_request/url_request_job_factory_impl.h" |
| 86 | 87 |
| 87 #if defined(ENABLE_CONFIGURATION_POLICY) | 88 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 88 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" | 89 #include "chrome/browser/policy/cloud/policy_header_service_factory.h" |
| 89 #include "chrome/browser/policy/policy_helpers.h" | 90 #include "chrome/browser/policy/policy_helpers.h" |
| 90 #include "components/policy/core/browser/url_blacklist_manager.h" | 91 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 91 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 92 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 // for cert trust purposes anyway. | 1118 // for cert trust purposes anyway. |
| 1118 scoped_refptr<net::CertVerifyProc> verify_proc( | 1119 scoped_refptr<net::CertVerifyProc> verify_proc( |
| 1119 new chromeos::CertVerifyProcChromeOS(public_slot.Pass())); | 1120 new chromeos::CertVerifyProcChromeOS(public_slot.Pass())); |
| 1120 if (policy_cert_verifier_) { | 1121 if (policy_cert_verifier_) { |
| 1121 DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get()); | 1122 DCHECK_EQ(policy_cert_verifier_, cert_verifier_.get()); |
| 1122 policy_cert_verifier_->InitializeOnIOThread(verify_proc); | 1123 policy_cert_verifier_->InitializeOnIOThread(verify_proc); |
| 1123 } else { | 1124 } else { |
| 1124 cert_verifier_.reset( | 1125 cert_verifier_.reset( |
| 1125 new net::MultiThreadedCertVerifier(verify_proc.get())); | 1126 new net::MultiThreadedCertVerifier(verify_proc.get())); |
| 1126 } | 1127 } |
| 1127 main_request_context_->set_cert_verifier(cert_verifier_.get()); | 1128 main_request_context_->set_cert_verifier(cert_verifier_.get()); // WJM |
| 1128 #else | 1129 #else |
| 1129 main_request_context_->set_cert_verifier( | 1130 main_request_context_->set_cert_verifier( |
| 1130 io_thread_globals->cert_verifier.get()); | 1131 io_thread_globals->cert_verifier.get()); // WJM |
| 1131 #endif | 1132 #endif |
| 1132 } | 1133 } |
| 1133 | 1134 |
| 1134 // Install the New Tab Page Interceptor. | 1135 // Install the New Tab Page Interceptor. |
| 1135 if (profile_params_->new_tab_page_interceptor.get()) { | 1136 if (profile_params_->new_tab_page_interceptor.get()) { |
| 1136 request_interceptors.push_back( | 1137 request_interceptors.push_back( |
| 1137 profile_params_->new_tab_page_interceptor.release()); | 1138 profile_params_->new_tab_page_interceptor.release()); |
| 1138 } | 1139 } |
| 1139 | 1140 |
| 1140 InitializeInternal( | 1141 InitializeInternal( |
| 1141 network_delegate.Pass(), profile_params_.get(), | 1142 network_delegate.Pass(), profile_params_.get(), |
| 1142 protocol_handlers, request_interceptors.Pass()); | 1143 protocol_handlers, request_interceptors.Pass()); |
| 1143 | 1144 |
| 1144 profile_params_.reset(); | 1145 profile_params_.reset(); |
| 1145 initialized_ = true; | 1146 initialized_ = true; |
| 1146 } | 1147 } |
| 1147 | 1148 |
| 1148 void ProfileIOData::ApplyProfileParamsToContext( | 1149 void ProfileIOData::ApplyProfileParamsToContext( |
| 1149 net::URLRequestContext* context) const { | 1150 net::URLRequestContext* context) const { |
| 1150 context->set_http_user_agent_settings( | 1151 context->set_http_user_agent_settings( |
| 1151 chrome_http_user_agent_settings_.get()); | 1152 chrome_http_user_agent_settings_.get()); |
| 1152 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); | 1153 context->set_ssl_config_service(profile_params_->ssl_config_service.get()); //
WJM |
| 1153 } | 1154 } |
| 1154 | 1155 |
| 1155 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( | 1156 scoped_ptr<net::URLRequestJobFactory> ProfileIOData::SetUpJobFactoryDefaults( |
| 1156 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, | 1157 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory, |
| 1157 content::URLRequestInterceptorScopedVector request_interceptors, | 1158 content::URLRequestInterceptorScopedVector request_interceptors, |
| 1158 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> | 1159 scoped_ptr<ProtocolHandlerRegistry::JobInterceptorFactory> |
| 1159 protocol_handler_interceptor, | 1160 protocol_handler_interceptor, |
| 1160 net::NetworkDelegate* network_delegate, | 1161 net::NetworkDelegate* network_delegate, |
| 1161 net::FtpTransactionFactory* ftp_transaction_factory) const { | 1162 net::FtpTransactionFactory* ftp_transaction_factory) const { |
| 1162 // NOTE(willchan): Keep these protocol handlers in sync with | 1163 // NOTE(willchan): Keep these protocol handlers in sync with |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 | 1289 |
| 1289 scoped_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory( | 1290 scoped_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory( |
| 1290 const ProfileParams* profile_params, | 1291 const ProfileParams* profile_params, |
| 1291 net::HttpCache::BackendFactory* main_backend) const { | 1292 net::HttpCache::BackendFactory* main_backend) const { |
| 1292 net::HttpNetworkSession::Params params; | 1293 net::HttpNetworkSession::Params params; |
| 1293 net::URLRequestContext* context = main_request_context(); | 1294 net::URLRequestContext* context = main_request_context(); |
| 1294 | 1295 |
| 1295 IOThread* const io_thread = profile_params->io_thread; | 1296 IOThread* const io_thread = profile_params->io_thread; |
| 1296 | 1297 |
| 1297 io_thread->InitializeNetworkSessionParams(¶ms); | 1298 io_thread->InitializeNetworkSessionParams(¶ms); |
| 1299 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(¶ms, |
| 1300 context); |
| 1298 | 1301 |
| 1299 params.host_resolver = context->host_resolver(); | 1302 // TODO(wjmaclean): should this move into the function call above? |
| 1300 params.cert_verifier = context->cert_verifier(); | |
| 1301 params.channel_id_service = context->channel_id_service(); | |
| 1302 params.transport_security_state = context->transport_security_state(); | |
| 1303 params.cert_transparency_verifier = context->cert_transparency_verifier(); | |
| 1304 params.proxy_service = context->proxy_service(); | |
| 1305 params.ssl_session_cache_shard = GetSSLSessionCacheShard(); | 1303 params.ssl_session_cache_shard = GetSSLSessionCacheShard(); |
| 1306 params.ssl_config_service = context->ssl_config_service(); | |
| 1307 params.http_auth_handler_factory = context->http_auth_handler_factory(); | |
| 1308 params.network_delegate = context->network_delegate(); | |
| 1309 params.http_server_properties = context->http_server_properties(); | |
| 1310 params.net_log = context->net_log(); | |
| 1311 if (data_reduction_proxy_io_data_.get()) | 1304 if (data_reduction_proxy_io_data_.get()) |
| 1312 params.proxy_delegate = data_reduction_proxy_io_data_->proxy_delegate(); | 1305 params.proxy_delegate = data_reduction_proxy_io_data_->proxy_delegate(); |
| 1313 | 1306 |
| 1314 net::HttpNetworkSession* session = new net::HttpNetworkSession(params); | 1307 net::HttpNetworkSession* session = new net::HttpNetworkSession(params); |
| 1315 return scoped_ptr<net::HttpCache>(new net::HttpCache( | 1308 return scoped_ptr<net::HttpCache>(new net::HttpCache( |
| 1316 new DevToolsNetworkTransactionFactory( | 1309 new DevToolsNetworkTransactionFactory( |
| 1317 network_controller_handle_.GetController(), session), | 1310 network_controller_handle_.GetController(), session), |
| 1318 context->net_log(), main_backend)); | 1311 context->net_log(), main_backend)); |
| 1319 } | 1312 } |
| 1320 | 1313 |
| 1321 scoped_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory( | 1314 scoped_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory( |
| 1322 net::HttpNetworkSession* shared_session, | 1315 net::HttpNetworkSession* shared_session, |
| 1323 net::HttpCache::BackendFactory* backend) const { | 1316 net::HttpCache::BackendFactory* backend) const { |
| 1324 return scoped_ptr<net::HttpCache>(new net::HttpCache( | 1317 return scoped_ptr<net::HttpCache>(new net::HttpCache( |
| 1325 new DevToolsNetworkTransactionFactory( | 1318 new DevToolsNetworkTransactionFactory( |
| 1326 network_controller_handle_.GetController(), shared_session), | 1319 network_controller_handle_.GetController(), shared_session), |
| 1327 shared_session->net_log(), backend)); | 1320 shared_session->net_log(), backend)); |
| 1328 } | 1321 } |
| 1329 | 1322 |
| 1330 void ProfileIOData::SetCookieSettingsForTesting( | 1323 void ProfileIOData::SetCookieSettingsForTesting( |
| 1331 content_settings::CookieSettings* cookie_settings) { | 1324 content_settings::CookieSettings* cookie_settings) { |
| 1332 DCHECK(!cookie_settings_.get()); | 1325 DCHECK(!cookie_settings_.get()); |
| 1333 cookie_settings_ = cookie_settings; | 1326 cookie_settings_ = cookie_settings; |
| 1334 } | 1327 } |
| OLD | NEW |