| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 45 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
| 46 #include "chrome/browser/profiles/profile.h" | 46 #include "chrome/browser/profiles/profile.h" |
| 47 #include "chrome/browser/profiles/profile_manager.h" | 47 #include "chrome/browser/profiles/profile_manager.h" |
| 48 #include "chrome/browser/ssl/chrome_fraudulent_certificate_reporter.h" | 48 #include "chrome/browser/ssl/chrome_fraudulent_certificate_reporter.h" |
| 49 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | 49 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
| 50 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" | 50 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" |
| 51 #include "chrome/common/chrome_paths.h" | 51 #include "chrome/common/chrome_paths.h" |
| 52 #include "chrome/common/chrome_switches.h" | 52 #include "chrome/common/chrome_switches.h" |
| 53 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
| 54 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
| 55 #include "components/certificate_transparency/log_proof_fetcher.h" |
| 56 #include "components/certificate_transparency/tree_state_tracker.h" |
| 55 #include "components/content_settings/core/browser/content_settings_provider.h" | 57 #include "components/content_settings/core/browser/content_settings_provider.h" |
| 56 #include "components/content_settings/core/browser/cookie_settings.h" | 58 #include "components/content_settings/core/browser/cookie_settings.h" |
| 57 #include "components/content_settings/core/browser/host_content_settings_map.h" | 59 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 58 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 60 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 59 #include "components/dom_distiller/core/url_constants.h" | 61 #include "components/dom_distiller/core/url_constants.h" |
| 60 #include "components/sync_driver/pref_names.h" | 62 #include "components/sync_driver/pref_names.h" |
| 61 #include "components/url_fixer/url_fixer.h" | 63 #include "components/url_fixer/url_fixer.h" |
| 62 #include "content/public/browser/browser_thread.h" | 64 #include "content/public/browser/browser_thread.h" |
| 63 #include "content/public/browser/host_zoom_map.h" | 65 #include "content/public/browser/host_zoom_map.h" |
| 64 #include "content/public/browser/notification_service.h" | 66 #include "content/public/browser/notification_service.h" |
| 65 #include "content/public/browser/resource_context.h" | 67 #include "content/public/browser/resource_context.h" |
| 66 #include "net/base/keygen_handler.h" | 68 #include "net/base/keygen_handler.h" |
| 67 #include "net/cert/cert_verifier.h" | 69 #include "net/cert/cert_verifier.h" |
| 70 #include "net/cert/multi_log_ct_verifier.h" |
| 68 #include "net/cookies/canonical_cookie.h" | 71 #include "net/cookies/canonical_cookie.h" |
| 69 #include "net/http/http_transaction_factory.h" | 72 #include "net/http/http_transaction_factory.h" |
| 70 #include "net/http/http_util.h" | 73 #include "net/http/http_util.h" |
| 71 #include "net/http/transport_security_persister.h" | 74 #include "net/http/transport_security_persister.h" |
| 72 #include "net/proxy/proxy_config_service_fixed.h" | 75 #include "net/proxy/proxy_config_service_fixed.h" |
| 73 #include "net/proxy/proxy_script_fetcher_impl.h" | 76 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 74 #include "net/proxy/proxy_service.h" | 77 #include "net/proxy/proxy_service.h" |
| 75 #include "net/ssl/channel_id_service.h" | 78 #include "net/ssl/channel_id_service.h" |
| 76 #include "net/ssl/client_cert_store.h" | 79 #include "net/ssl/client_cert_store.h" |
| 77 #include "net/url_request/certificate_report_sender.h" | 80 #include "net/url_request/certificate_report_sender.h" |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 io_thread_globals->cert_verifier.get()); | 1136 io_thread_globals->cert_verifier.get()); |
| 1134 #endif | 1137 #endif |
| 1135 } | 1138 } |
| 1136 | 1139 |
| 1137 // Install the New Tab Page Interceptor. | 1140 // Install the New Tab Page Interceptor. |
| 1138 if (profile_params_->new_tab_page_interceptor.get()) { | 1141 if (profile_params_->new_tab_page_interceptor.get()) { |
| 1139 request_interceptors.push_back( | 1142 request_interceptors.push_back( |
| 1140 profile_params_->new_tab_page_interceptor.release()); | 1143 profile_params_->new_tab_page_interceptor.release()); |
| 1141 } | 1144 } |
| 1142 | 1145 |
| 1146 net::MultiLogCTVerifier* ct_verifier = new net::MultiLogCTVerifier(); |
| 1147 ct_verifier->AddLogs(io_thread_globals->ct_logs); |
| 1148 main_request_context_->set_cert_transparency_verifier(ct_verifier); |
| 1149 |
| 1150 VLOG(1) << "Creating TreeStateTracker observer on ProfileIOData."; |
| 1151 certificate_transparency::TreeStateTracker* scts_observer( |
| 1152 new certificate_transparency::TreeStateTracker( |
| 1153 scoped_ptr<certificate_transparency::LogProofFetcher>( |
| 1154 new certificate_transparency::LogProofFetcher( |
| 1155 main_request_context_.get())) |
| 1156 .Pass(), |
| 1157 io_thread_globals->ct_logs)); |
| 1158 ct_verifier->SetObserver(scts_observer); |
| 1159 |
| 1160 cert_transparency_verifier_.reset(ct_verifier); |
| 1161 cert_transparency_observer_.reset(scts_observer); |
| 1162 VLOG(1) << "TreeStateTracker observer on ProfileIOData created."; |
| 1163 |
| 1143 InitializeInternal( | 1164 InitializeInternal( |
| 1144 network_delegate.Pass(), profile_params_.get(), | 1165 network_delegate.Pass(), profile_params_.get(), |
| 1145 protocol_handlers, request_interceptors.Pass()); | 1166 protocol_handlers, request_interceptors.Pass()); |
| 1146 | 1167 |
| 1147 profile_params_.reset(); | 1168 profile_params_.reset(); |
| 1148 initialized_ = true; | 1169 initialized_ = true; |
| 1149 } | 1170 } |
| 1150 | 1171 |
| 1151 void ProfileIOData::ApplyProfileParamsToContext( | 1172 void ProfileIOData::ApplyProfileParamsToContext( |
| 1152 net::URLRequestContext* context) const { | 1173 net::URLRequestContext* context) const { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 delete this; | 1301 delete this; |
| 1281 } | 1302 } |
| 1282 | 1303 |
| 1283 void ProfileIOData::set_channel_id_service( | 1304 void ProfileIOData::set_channel_id_service( |
| 1284 net::ChannelIDService* channel_id_service) const { | 1305 net::ChannelIDService* channel_id_service) const { |
| 1285 channel_id_service_.reset(channel_id_service); | 1306 channel_id_service_.reset(channel_id_service); |
| 1286 } | 1307 } |
| 1287 | 1308 |
| 1288 void ProfileIOData::DestroyResourceContext() { | 1309 void ProfileIOData::DestroyResourceContext() { |
| 1289 resource_context_.reset(); | 1310 resource_context_.reset(); |
| 1311 // Stop any new URLRequests from being made by the cert_transparency_observer_ |
| 1312 // by stopping notifications to it from the CTVerifier. |
| 1313 cert_transparency_verifier_->SetObserver(nullptr); |
| 1290 } | 1314 } |
| 1291 | 1315 |
| 1292 scoped_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory( | 1316 scoped_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory( |
| 1293 const ProfileParams* profile_params, | 1317 const ProfileParams* profile_params, |
| 1294 net::HttpCache::BackendFactory* main_backend) const { | 1318 net::HttpCache::BackendFactory* main_backend) const { |
| 1295 net::HttpNetworkSession::Params params; | 1319 net::HttpNetworkSession::Params params; |
| 1296 net::URLRequestContext* context = main_request_context(); | 1320 net::URLRequestContext* context = main_request_context(); |
| 1297 | 1321 |
| 1298 IOThread* const io_thread = profile_params->io_thread; | 1322 IOThread* const io_thread = profile_params->io_thread; |
| 1299 | 1323 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1329 new DevToolsNetworkTransactionFactory( | 1353 new DevToolsNetworkTransactionFactory( |
| 1330 network_controller_.get(), shared_session), | 1354 network_controller_.get(), shared_session), |
| 1331 shared_session->net_log(), backend)); | 1355 shared_session->net_log(), backend)); |
| 1332 } | 1356 } |
| 1333 | 1357 |
| 1334 void ProfileIOData::SetCookieSettingsForTesting( | 1358 void ProfileIOData::SetCookieSettingsForTesting( |
| 1335 content_settings::CookieSettings* cookie_settings) { | 1359 content_settings::CookieSettings* cookie_settings) { |
| 1336 DCHECK(!cookie_settings_.get()); | 1360 DCHECK(!cookie_settings_.get()); |
| 1337 cookie_settings_ = cookie_settings; | 1361 cookie_settings_ = cookie_settings; |
| 1338 } | 1362 } |
| OLD | NEW |