| 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 <stddef.h> | |
| 8 #include <string> | 7 #include <string> |
| 9 #include <utility> | 8 #include <utility> |
| 10 | 9 |
| 11 #include "base/bind.h" | 10 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 13 #include "base/callback.h" | 12 #include "base/callback.h" |
| 14 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 16 #include "base/debug/alias.h" | 15 #include "base/debug/alias.h" |
| 17 #include "base/logging.h" | 16 #include "base/logging.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "chrome/browser/profiles/profile_manager.h" | 48 #include "chrome/browser/profiles/profile_manager.h" |
| 50 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" | 49 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" |
| 51 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | 50 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
| 52 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" | 51 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" |
| 53 #include "chrome/common/chrome_paths.h" | 52 #include "chrome/common/chrome_paths.h" |
| 54 #include "chrome/common/chrome_switches.h" | 53 #include "chrome/common/chrome_switches.h" |
| 55 #include "chrome/common/features.h" | 54 #include "chrome/common/features.h" |
| 56 #include "chrome/common/pref_names.h" | 55 #include "chrome/common/pref_names.h" |
| 57 #include "chrome/common/url_constants.h" | 56 #include "chrome/common/url_constants.h" |
| 58 #include "components/about_handler/about_protocol_handler.h" | 57 #include "components/about_handler/about_protocol_handler.h" |
| 58 #include "components/certificate_transparency/tree_state_tracker.h" |
| 59 #include "components/content_settings/core/browser/content_settings_provider.h" | 59 #include "components/content_settings/core/browser/content_settings_provider.h" |
| 60 #include "components/content_settings/core/browser/cookie_settings.h" | 60 #include "components/content_settings/core/browser/cookie_settings.h" |
| 61 #include "components/content_settings/core/browser/host_content_settings_map.h" | 61 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 62 #include "components/cookie_config/cookie_store_util.h" | 62 #include "components/cookie_config/cookie_store_util.h" |
| 63 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 63 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 64 #include "components/dom_distiller/core/url_constants.h" | 64 #include "components/dom_distiller/core/url_constants.h" |
| 65 #include "components/metrics/metrics_pref_names.h" | 65 #include "components/metrics/metrics_pref_names.h" |
| 66 #include "components/net_log/chrome_net_log.h" | 66 #include "components/net_log/chrome_net_log.h" |
| 67 #include "components/policy/core/browser/url_blacklist_manager.h" | 67 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 68 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 68 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| (...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 // Install the New Tab Page Interceptor. | 1126 // Install the New Tab Page Interceptor. |
| 1127 if (profile_params_->new_tab_page_interceptor.get()) { | 1127 if (profile_params_->new_tab_page_interceptor.get()) { |
| 1128 request_interceptors.push_back( | 1128 request_interceptors.push_back( |
| 1129 profile_params_->new_tab_page_interceptor.release()); | 1129 profile_params_->new_tab_page_interceptor.release()); |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 scoped_ptr<net::MultiLogCTVerifier> ct_verifier( | 1132 scoped_ptr<net::MultiLogCTVerifier> ct_verifier( |
| 1133 new net::MultiLogCTVerifier()); | 1133 new net::MultiLogCTVerifier()); |
| 1134 ct_verifier->AddLogs(io_thread_globals->ct_logs); | 1134 ct_verifier->AddLogs(io_thread_globals->ct_logs); |
| 1135 main_request_context_->set_cert_transparency_verifier(ct_verifier.get()); | 1135 main_request_context_->set_cert_transparency_verifier(ct_verifier.get()); |
| 1136 |
| 1137 VLOG(1) << "Creating TreeStateTracker observer on ProfileIOData."; |
| 1138 |
| 1139 /* |
| 1140 if (!IsOffTheRecord()) { |
| 1141 VLOG(1) << "New Disk-based TreeStateStorage in " |
| 1142 << profile_params_->path.AsUTF8Unsafe(); |
| 1143 tree_storage.reset(new certificate_transparency::DiskTreeStateStorage( |
| 1144 profile_params_->path.Append("CertificateTransparency"))); |
| 1145 } else { |
| 1146 VLOG(1) << "New Memory-based TreeStateStorage."; |
| 1147 tree_storage.reset(new certificate_transparency::MemoryTreeStateStorage()); |
| 1148 } |
| 1149 */ |
| 1150 |
| 1151 scoped_ptr<certificate_transparency::TreeStateTracker> scts_observer( |
| 1152 new certificate_transparency::TreeStateTracker( |
| 1153 io_thread_globals->ct_logs)); |
| 1154 ct_verifier->SetObserver(scts_observer.get()); |
| 1136 cert_transparency_verifier_ = std::move(ct_verifier); | 1155 cert_transparency_verifier_ = std::move(ct_verifier); |
| 1156 cert_transparency_observer_ = std::move(scts_observer); |
| 1157 VLOG(1) << "XXX Registering observer to the STHReporter."; |
| 1158 |
| 1159 io_thread_globals->sth_observers_registrar.SignUpForRegistration( |
| 1160 cert_transparency_observer_.get()); |
| 1161 cert_transparency_observer_unregistration_ = base::Bind( |
| 1162 &net::ct::STHReporterRegistrar::UnregisterObserver, |
| 1163 base::Unretained(&(io_thread_globals->sth_observers_registrar)), |
| 1164 cert_transparency_observer_.get()); |
| 1165 |
| 1166 VLOG(1) << "TreeStateTracker observer on ProfileIOData created."; |
| 1137 | 1167 |
| 1138 InitializeInternal(std::move(network_delegate), profile_params_.get(), | 1168 InitializeInternal(std::move(network_delegate), profile_params_.get(), |
| 1139 protocol_handlers, std::move(request_interceptors)); | 1169 protocol_handlers, std::move(request_interceptors)); |
| 1140 | 1170 |
| 1141 profile_params_.reset(); | 1171 profile_params_.reset(); |
| 1142 initialized_ = true; | 1172 initialized_ = true; |
| 1143 } | 1173 } |
| 1144 | 1174 |
| 1145 void ProfileIOData::ApplyProfileParamsToContext( | 1175 void ProfileIOData::ApplyProfileParamsToContext( |
| 1146 net::URLRequestContext* context) const { | 1176 net::URLRequestContext* context) const { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 delete this; | 1303 delete this; |
| 1274 } | 1304 } |
| 1275 | 1305 |
| 1276 void ProfileIOData::set_channel_id_service( | 1306 void ProfileIOData::set_channel_id_service( |
| 1277 net::ChannelIDService* channel_id_service) const { | 1307 net::ChannelIDService* channel_id_service) const { |
| 1278 channel_id_service_.reset(channel_id_service); | 1308 channel_id_service_.reset(channel_id_service); |
| 1279 } | 1309 } |
| 1280 | 1310 |
| 1281 void ProfileIOData::DestroyResourceContext() { | 1311 void ProfileIOData::DestroyResourceContext() { |
| 1282 resource_context_.reset(); | 1312 resource_context_.reset(); |
| 1313 // Stop any new URLRequests from being made by the cert_transparency_observer_ |
| 1314 // by stopping notifications to it from the CTVerifier. |
| 1315 cert_transparency_verifier_->SetObserver(nullptr); |
| 1316 cert_transparency_observer_unregistration_.Run(); |
| 1317 |
| 1318 VLOG(1) << "XXX: ProfileIOData::DestroyResourceContext"; |
| 1283 } | 1319 } |
| 1284 | 1320 |
| 1285 scoped_ptr<net::HttpNetworkSession> ProfileIOData::CreateHttpNetworkSession( | 1321 scoped_ptr<net::HttpNetworkSession> ProfileIOData::CreateHttpNetworkSession( |
| 1286 const ProfileParams& profile_params) const { | 1322 const ProfileParams& profile_params) const { |
| 1287 net::HttpNetworkSession::Params params; | 1323 net::HttpNetworkSession::Params params; |
| 1288 net::URLRequestContext* context = main_request_context(); | 1324 net::URLRequestContext* context = main_request_context(); |
| 1289 | 1325 |
| 1290 IOThread* const io_thread = profile_params.io_thread; | 1326 IOThread* const io_thread = profile_params.io_thread; |
| 1291 | 1327 |
| 1292 io_thread->InitializeNetworkSessionParams(¶ms); | 1328 io_thread->InitializeNetworkSessionParams(¶ms); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1319 make_scoped_ptr(new DevToolsNetworkTransactionFactory( | 1355 make_scoped_ptr(new DevToolsNetworkTransactionFactory( |
| 1320 network_controller_handle_.GetController(), shared_session)), | 1356 network_controller_handle_.GetController(), shared_session)), |
| 1321 std::move(backend), true /* set_up_quic_server_info */)); | 1357 std::move(backend), true /* set_up_quic_server_info */)); |
| 1322 } | 1358 } |
| 1323 | 1359 |
| 1324 void ProfileIOData::SetCookieSettingsForTesting( | 1360 void ProfileIOData::SetCookieSettingsForTesting( |
| 1325 content_settings::CookieSettings* cookie_settings) { | 1361 content_settings::CookieSettings* cookie_settings) { |
| 1326 DCHECK(!cookie_settings_.get()); | 1362 DCHECK(!cookie_settings_.get()); |
| 1327 cookie_settings_ = cookie_settings; | 1363 cookie_settings_ = cookie_settings; |
| 1328 } | 1364 } |
| OLD | NEW |