| 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> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #include "chrome/browser/profiles/profile_manager.h" | 51 #include "chrome/browser/profiles/profile_manager.h" |
| 52 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" | 52 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h" |
| 53 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" | 53 #include "chrome/browser/ui/search/new_tab_page_interceptor_service.h" |
| 54 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" | 54 #include "chrome/browser/ui/search/new_tab_page_interceptor_service_factory.h" |
| 55 #include "chrome/common/chrome_paths.h" | 55 #include "chrome/common/chrome_paths.h" |
| 56 #include "chrome/common/chrome_switches.h" | 56 #include "chrome/common/chrome_switches.h" |
| 57 #include "chrome/common/features.h" | 57 #include "chrome/common/features.h" |
| 58 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
| 59 #include "chrome/common/url_constants.h" | 59 #include "chrome/common/url_constants.h" |
| 60 #include "components/about_handler/about_protocol_handler.h" | 60 #include "components/about_handler/about_protocol_handler.h" |
| 61 #include "components/certificate_transparency/tree_state_tracker.h" |
| 61 #include "components/content_settings/core/browser/content_settings_provider.h" | 62 #include "components/content_settings/core/browser/content_settings_provider.h" |
| 62 #include "components/content_settings/core/browser/cookie_settings.h" | 63 #include "components/content_settings/core/browser/cookie_settings.h" |
| 63 #include "components/content_settings/core/browser/host_content_settings_map.h" | 64 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 64 #include "components/cookie_config/cookie_store_util.h" | 65 #include "components/cookie_config/cookie_store_util.h" |
| 65 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 66 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 66 #include "components/dom_distiller/core/url_constants.h" | 67 #include "components/dom_distiller/core/url_constants.h" |
| 67 #include "components/metrics/metrics_pref_names.h" | 68 #include "components/metrics/metrics_pref_names.h" |
| 68 #include "components/metrics/metrics_service.h" | 69 #include "components/metrics/metrics_service.h" |
| 69 #include "components/net_log/chrome_net_log.h" | 70 #include "components/net_log/chrome_net_log.h" |
| 70 #include "components/policy/core/browser/url_blacklist_manager.h" | 71 #include "components/policy/core/browser/url_blacklist_manager.h" |
| 71 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 72 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
| 72 #include "components/policy/core/common/cloud/policy_header_service.h" | 73 #include "components/policy/core/common/cloud/policy_header_service.h" |
| 73 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 74 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 74 #include "components/prefs/pref_service.h" | 75 #include "components/prefs/pref_service.h" |
| 75 #include "components/signin/core/common/signin_pref_names.h" | 76 #include "components/signin/core/common/signin_pref_names.h" |
| 76 #include "components/sync_driver/pref_names.h" | 77 #include "components/sync_driver/pref_names.h" |
| 77 #include "components/url_formatter/url_fixer.h" | 78 #include "components/url_formatter/url_fixer.h" |
| 78 #include "content/public/browser/browser_thread.h" | 79 #include "content/public/browser/browser_thread.h" |
| 79 #include "content/public/browser/host_zoom_map.h" | 80 #include "content/public/browser/host_zoom_map.h" |
| 80 #include "content/public/browser/notification_service.h" | 81 #include "content/public/browser/notification_service.h" |
| 81 #include "content/public/browser/resource_context.h" | 82 #include "content/public/browser/resource_context.h" |
| 82 #include "net/base/keygen_handler.h" | 83 #include "net/base/keygen_handler.h" |
| 83 #include "net/base/network_quality_estimator.h" | 84 #include "net/base/network_quality_estimator.h" |
| 84 #include "net/cert/cert_verifier.h" | 85 #include "net/cert/cert_verifier.h" |
| 86 #include "net/cert/ct_log_verifier.h" |
| 87 #include "net/cert/ct_observer.h" |
| 85 #include "net/cert/multi_log_ct_verifier.h" | 88 #include "net/cert/multi_log_ct_verifier.h" |
| 86 #include "net/cookies/canonical_cookie.h" | 89 #include "net/cookies/canonical_cookie.h" |
| 87 #include "net/http/http_network_session.h" | 90 #include "net/http/http_network_session.h" |
| 88 #include "net/http/http_transaction_factory.h" | 91 #include "net/http/http_transaction_factory.h" |
| 89 #include "net/http/http_util.h" | 92 #include "net/http/http_util.h" |
| 90 #include "net/http/transport_security_persister.h" | 93 #include "net/http/transport_security_persister.h" |
| 91 #include "net/proxy/proxy_config_service_fixed.h" | 94 #include "net/proxy/proxy_config_service_fixed.h" |
| 92 #include "net/proxy/proxy_script_fetcher_impl.h" | 95 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 93 #include "net/proxy/proxy_service.h" | 96 #include "net/proxy/proxy_service.h" |
| 94 #include "net/ssl/channel_id_service.h" | 97 #include "net/ssl/channel_id_service.h" |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 // Install the New Tab Page Interceptor. | 1135 // Install the New Tab Page Interceptor. |
| 1133 if (profile_params_->new_tab_page_interceptor.get()) { | 1136 if (profile_params_->new_tab_page_interceptor.get()) { |
| 1134 request_interceptors.push_back( | 1137 request_interceptors.push_back( |
| 1135 profile_params_->new_tab_page_interceptor.release()); | 1138 profile_params_->new_tab_page_interceptor.release()); |
| 1136 } | 1139 } |
| 1137 | 1140 |
| 1138 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier( | 1141 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier( |
| 1139 new net::MultiLogCTVerifier()); | 1142 new net::MultiLogCTVerifier()); |
| 1140 ct_verifier->AddLogs(io_thread_globals->ct_logs); | 1143 ct_verifier->AddLogs(io_thread_globals->ct_logs); |
| 1141 main_request_context_->set_cert_transparency_verifier(ct_verifier.get()); | 1144 main_request_context_->set_cert_transparency_verifier(ct_verifier.get()); |
| 1145 |
| 1146 cert_transparency_observer_.reset( |
| 1147 new certificate_transparency::TreeStateTracker( |
| 1148 io_thread_globals->ct_logs)); |
| 1149 ct_verifier->SetObserver(cert_transparency_observer_.get()); |
| 1142 cert_transparency_verifier_ = std::move(ct_verifier); | 1150 cert_transparency_verifier_ = std::move(ct_verifier); |
| 1143 | 1151 |
| 1152 io_thread->RegisterSTHObserver(cert_transparency_observer_.get()); |
| 1153 |
| 1154 cert_transparency_observer_unregistration_ = |
| 1155 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread), |
| 1156 cert_transparency_observer_.get()); |
| 1157 |
| 1144 InitializeInternal(std::move(network_delegate), profile_params_.get(), | 1158 InitializeInternal(std::move(network_delegate), profile_params_.get(), |
| 1145 protocol_handlers, std::move(request_interceptors)); | 1159 protocol_handlers, std::move(request_interceptors)); |
| 1146 | 1160 |
| 1147 profile_params_.reset(); | 1161 profile_params_.reset(); |
| 1148 initialized_ = true; | 1162 initialized_ = true; |
| 1149 } | 1163 } |
| 1150 | 1164 |
| 1151 void ProfileIOData::ApplyProfileParamsToContext( | 1165 void ProfileIOData::ApplyProfileParamsToContext( |
| 1152 net::URLRequestContext* context) const { | 1166 net::URLRequestContext* context) const { |
| 1153 context->set_http_user_agent_settings( | 1167 context->set_http_user_agent_settings( |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1280 delete this; | 1294 delete this; |
| 1281 } | 1295 } |
| 1282 | 1296 |
| 1283 void ProfileIOData::set_channel_id_service( | 1297 void ProfileIOData::set_channel_id_service( |
| 1284 net::ChannelIDService* channel_id_service) const { | 1298 net::ChannelIDService* channel_id_service) const { |
| 1285 channel_id_service_.reset(channel_id_service); | 1299 channel_id_service_.reset(channel_id_service); |
| 1286 } | 1300 } |
| 1287 | 1301 |
| 1288 void ProfileIOData::DestroyResourceContext() { | 1302 void ProfileIOData::DestroyResourceContext() { |
| 1289 resource_context_.reset(); | 1303 resource_context_.reset(); |
| 1304 // Prevent the cert_transparency_observer_ from getting any more |
| 1305 // notifications by severing the link between it and the |
| 1306 // cert_transparency_verifier_ and unregistering it from new STH |
| 1307 // notifications. |
| 1308 cert_transparency_verifier_->SetObserver(nullptr); |
| 1309 cert_transparency_observer_unregistration_.Run(); |
| 1290 } | 1310 } |
| 1291 | 1311 |
| 1292 std::unique_ptr<net::HttpNetworkSession> | 1312 std::unique_ptr<net::HttpNetworkSession> |
| 1293 ProfileIOData::CreateHttpNetworkSession( | 1313 ProfileIOData::CreateHttpNetworkSession( |
| 1294 const ProfileParams& profile_params) const { | 1314 const ProfileParams& profile_params) const { |
| 1295 net::URLRequestContext* context = main_request_context(); | 1315 net::URLRequestContext* context = main_request_context(); |
| 1296 | 1316 |
| 1297 IOThread* const io_thread = profile_params.io_thread; | 1317 IOThread* const io_thread = profile_params.io_thread; |
| 1298 | 1318 |
| 1299 net::HttpNetworkSession::Params params(io_thread->NetworkSessionParams()); | 1319 net::HttpNetworkSession::Params params(io_thread->NetworkSessionParams()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1327 base::WrapUnique(new DevToolsNetworkTransactionFactory( | 1347 base::WrapUnique(new DevToolsNetworkTransactionFactory( |
| 1328 network_controller_handle_.GetController(), shared_session)), | 1348 network_controller_handle_.GetController(), shared_session)), |
| 1329 std::move(backend), true /* set_up_quic_server_info */)); | 1349 std::move(backend), true /* set_up_quic_server_info */)); |
| 1330 } | 1350 } |
| 1331 | 1351 |
| 1332 void ProfileIOData::SetCookieSettingsForTesting( | 1352 void ProfileIOData::SetCookieSettingsForTesting( |
| 1333 content_settings::CookieSettings* cookie_settings) { | 1353 content_settings::CookieSettings* cookie_settings) { |
| 1334 DCHECK(!cookie_settings_.get()); | 1354 DCHECK(!cookie_settings_.get()); |
| 1335 cookie_settings_ = cookie_settings; | 1355 cookie_settings_ = cookie_settings; |
| 1336 } | 1356 } |
| OLD | NEW |