| 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 scoped_ptr<certificate_transparency::TreeStateTracker> scts_observer( |
| 1140 new certificate_transparency::TreeStateTracker( |
| 1141 io_thread_globals->ct_logs)); |
| 1142 ct_verifier->SetObserver(scts_observer.get()); |
| 1136 cert_transparency_verifier_ = std::move(ct_verifier); | 1143 cert_transparency_verifier_ = std::move(ct_verifier); |
| 1144 cert_transparency_observer_ = std::move(scts_observer); |
| 1145 VLOG(1) << "XXX Registering observer to the STHReporter."; |
| 1146 |
| 1147 io_thread->RegisterSTHObserver(cert_transparency_observer_.get()); |
| 1148 |
| 1149 cert_transparency_observer_unregistration_ = |
| 1150 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread), |
| 1151 cert_transparency_observer_.get()); |
| 1152 |
| 1153 VLOG(1) << "TreeStateTracker observer on ProfileIOData created."; |
| 1137 | 1154 |
| 1138 InitializeInternal(std::move(network_delegate), profile_params_.get(), | 1155 InitializeInternal(std::move(network_delegate), profile_params_.get(), |
| 1139 protocol_handlers, std::move(request_interceptors)); | 1156 protocol_handlers, std::move(request_interceptors)); |
| 1140 | 1157 |
| 1141 profile_params_.reset(); | 1158 profile_params_.reset(); |
| 1142 initialized_ = true; | 1159 initialized_ = true; |
| 1143 } | 1160 } |
| 1144 | 1161 |
| 1145 void ProfileIOData::ApplyProfileParamsToContext( | 1162 void ProfileIOData::ApplyProfileParamsToContext( |
| 1146 net::URLRequestContext* context) const { | 1163 net::URLRequestContext* context) const { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 delete this; | 1290 delete this; |
| 1274 } | 1291 } |
| 1275 | 1292 |
| 1276 void ProfileIOData::set_channel_id_service( | 1293 void ProfileIOData::set_channel_id_service( |
| 1277 net::ChannelIDService* channel_id_service) const { | 1294 net::ChannelIDService* channel_id_service) const { |
| 1278 channel_id_service_.reset(channel_id_service); | 1295 channel_id_service_.reset(channel_id_service); |
| 1279 } | 1296 } |
| 1280 | 1297 |
| 1281 void ProfileIOData::DestroyResourceContext() { | 1298 void ProfileIOData::DestroyResourceContext() { |
| 1282 resource_context_.reset(); | 1299 resource_context_.reset(); |
| 1300 // Stop any new URLRequests from being made by the cert_transparency_observer_ |
| 1301 // by stopping notifications to it from the CTVerifier. |
| 1302 cert_transparency_verifier_->SetObserver(nullptr); |
| 1303 cert_transparency_observer_unregistration_.Run(); |
| 1304 |
| 1305 VLOG(1) << "XXX: ProfileIOData::DestroyResourceContext"; |
| 1283 } | 1306 } |
| 1284 | 1307 |
| 1285 scoped_ptr<net::HttpNetworkSession> ProfileIOData::CreateHttpNetworkSession( | 1308 scoped_ptr<net::HttpNetworkSession> ProfileIOData::CreateHttpNetworkSession( |
| 1286 const ProfileParams& profile_params) const { | 1309 const ProfileParams& profile_params) const { |
| 1287 net::HttpNetworkSession::Params params; | 1310 net::HttpNetworkSession::Params params; |
| 1288 net::URLRequestContext* context = main_request_context(); | 1311 net::URLRequestContext* context = main_request_context(); |
| 1289 | 1312 |
| 1290 IOThread* const io_thread = profile_params.io_thread; | 1313 IOThread* const io_thread = profile_params.io_thread; |
| 1291 | 1314 |
| 1292 io_thread->InitializeNetworkSessionParams(¶ms); | 1315 io_thread->InitializeNetworkSessionParams(¶ms); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1319 make_scoped_ptr(new DevToolsNetworkTransactionFactory( | 1342 make_scoped_ptr(new DevToolsNetworkTransactionFactory( |
| 1320 network_controller_handle_.GetController(), shared_session)), | 1343 network_controller_handle_.GetController(), shared_session)), |
| 1321 std::move(backend), true /* set_up_quic_server_info */)); | 1344 std::move(backend), true /* set_up_quic_server_info */)); |
| 1322 } | 1345 } |
| 1323 | 1346 |
| 1324 void ProfileIOData::SetCookieSettingsForTesting( | 1347 void ProfileIOData::SetCookieSettingsForTesting( |
| 1325 content_settings::CookieSettings* cookie_settings) { | 1348 content_settings::CookieSettings* cookie_settings) { |
| 1326 DCHECK(!cookie_settings_.get()); | 1349 DCHECK(!cookie_settings_.get()); |
| 1327 cookie_settings_ = cookie_settings; | 1350 cookie_settings_ = cookie_settings; |
| 1328 } | 1351 } |
| OLD | NEW |