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/cert/cert_verifier.h" | 84 #include "net/cert/cert_verifier.h" |
| 85 #include "net/cert/ct_log_verifier.h" |
84 #include "net/cert/multi_log_ct_verifier.h" | 86 #include "net/cert/multi_log_ct_verifier.h" |
85 #include "net/cookies/canonical_cookie.h" | 87 #include "net/cookies/canonical_cookie.h" |
86 #include "net/http/http_network_session.h" | 88 #include "net/http/http_network_session.h" |
87 #include "net/http/http_transaction_factory.h" | 89 #include "net/http/http_transaction_factory.h" |
88 #include "net/http/http_util.h" | 90 #include "net/http/http_util.h" |
89 #include "net/http/transport_security_persister.h" | 91 #include "net/http/transport_security_persister.h" |
90 #include "net/nqe/network_quality_estimator.h" | 92 #include "net/nqe/network_quality_estimator.h" |
91 #include "net/proxy/proxy_config_service_fixed.h" | 93 #include "net/proxy/proxy_config_service_fixed.h" |
92 #include "net/proxy/proxy_script_fetcher_impl.h" | 94 #include "net/proxy/proxy_script_fetcher_impl.h" |
93 #include "net/proxy/proxy_service.h" | 95 #include "net/proxy/proxy_service.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1139 // Install the New Tab Page Interceptor. | 1141 // Install the New Tab Page Interceptor. |
1140 if (profile_params_->new_tab_page_interceptor.get()) { | 1142 if (profile_params_->new_tab_page_interceptor.get()) { |
1141 request_interceptors.push_back( | 1143 request_interceptors.push_back( |
1142 profile_params_->new_tab_page_interceptor.release()); | 1144 profile_params_->new_tab_page_interceptor.release()); |
1143 } | 1145 } |
1144 | 1146 |
1145 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier( | 1147 std::unique_ptr<net::MultiLogCTVerifier> ct_verifier( |
1146 new net::MultiLogCTVerifier()); | 1148 new net::MultiLogCTVerifier()); |
1147 ct_verifier->AddLogs(io_thread_globals->ct_logs); | 1149 ct_verifier->AddLogs(io_thread_globals->ct_logs); |
1148 main_request_context_->set_cert_transparency_verifier(ct_verifier.get()); | 1150 main_request_context_->set_cert_transparency_verifier(ct_verifier.get()); |
| 1151 |
| 1152 ct_tree_tracker_.reset(new certificate_transparency::TreeStateTracker( |
| 1153 io_thread_globals->ct_logs)); |
| 1154 ct_verifier->SetObserver(ct_tree_tracker_.get()); |
| 1155 |
1149 cert_transparency_verifier_ = std::move(ct_verifier); | 1156 cert_transparency_verifier_ = std::move(ct_verifier); |
| 1157 io_thread->RegisterSTHObserver(ct_tree_tracker_.get()); |
| 1158 ct_tree_tracker_unregistration_ = |
| 1159 base::Bind(&IOThread::UnregisterSTHObserver, base::Unretained(io_thread), |
| 1160 ct_tree_tracker_.get()); |
1150 | 1161 |
1151 InitializeInternal(std::move(network_delegate), profile_params_.get(), | 1162 InitializeInternal(std::move(network_delegate), profile_params_.get(), |
1152 protocol_handlers, std::move(request_interceptors)); | 1163 protocol_handlers, std::move(request_interceptors)); |
1153 | 1164 |
1154 profile_params_.reset(); | 1165 profile_params_.reset(); |
1155 initialized_ = true; | 1166 initialized_ = true; |
1156 } | 1167 } |
1157 | 1168 |
1158 void ProfileIOData::ApplyProfileParamsToContext( | 1169 void ProfileIOData::ApplyProfileParamsToContext( |
1159 net::URLRequestContext* context) const { | 1170 net::URLRequestContext* context) const { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 delete this; | 1299 delete this; |
1289 } | 1300 } |
1290 | 1301 |
1291 void ProfileIOData::set_channel_id_service( | 1302 void ProfileIOData::set_channel_id_service( |
1292 net::ChannelIDService* channel_id_service) const { | 1303 net::ChannelIDService* channel_id_service) const { |
1293 channel_id_service_.reset(channel_id_service); | 1304 channel_id_service_.reset(channel_id_service); |
1294 } | 1305 } |
1295 | 1306 |
1296 void ProfileIOData::DestroyResourceContext() { | 1307 void ProfileIOData::DestroyResourceContext() { |
1297 resource_context_.reset(); | 1308 resource_context_.reset(); |
| 1309 // Prevent the cert_transparency_observer_ from getting any more |
| 1310 // notifications by severing the link between it and the |
| 1311 // cert_transparency_verifier_ and unregistering it from new STH |
| 1312 // notifications. |
| 1313 cert_transparency_verifier_->SetObserver(nullptr); |
| 1314 ct_tree_tracker_unregistration_.Run(); |
1298 } | 1315 } |
1299 | 1316 |
1300 std::unique_ptr<net::HttpNetworkSession> | 1317 std::unique_ptr<net::HttpNetworkSession> |
1301 ProfileIOData::CreateHttpNetworkSession( | 1318 ProfileIOData::CreateHttpNetworkSession( |
1302 const ProfileParams& profile_params) const { | 1319 const ProfileParams& profile_params) const { |
1303 net::URLRequestContext* context = main_request_context(); | 1320 net::URLRequestContext* context = main_request_context(); |
1304 | 1321 |
1305 IOThread* const io_thread = profile_params.io_thread; | 1322 IOThread* const io_thread = profile_params.io_thread; |
1306 | 1323 |
1307 net::HttpNetworkSession::Params params(io_thread->NetworkSessionParams()); | 1324 net::HttpNetworkSession::Params params(io_thread->NetworkSessionParams()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1340 void ProfileIOData::SetCookieSettingsForTesting( | 1357 void ProfileIOData::SetCookieSettingsForTesting( |
1341 content_settings::CookieSettings* cookie_settings) { | 1358 content_settings::CookieSettings* cookie_settings) { |
1342 DCHECK(!cookie_settings_.get()); | 1359 DCHECK(!cookie_settings_.get()); |
1343 cookie_settings_ = cookie_settings; | 1360 cookie_settings_ = cookie_settings; |
1344 } | 1361 } |
1345 | 1362 |
1346 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1363 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
1347 const GURL& url) const { | 1364 const GURL& url) const { |
1348 return url_blacklist_manager_->GetURLBlacklistState(url); | 1365 return url_blacklist_manager_->GetURLBlacklistState(url); |
1349 } | 1366 } |
OLD | NEW |