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/ct_policy_manager.h" |
61 #include "components/certificate_transparency/tree_state_tracker.h" | 62 #include "components/certificate_transparency/tree_state_tracker.h" |
62 #include "components/content_settings/core/browser/content_settings_provider.h" | 63 #include "components/content_settings/core/browser/content_settings_provider.h" |
63 #include "components/content_settings/core/browser/cookie_settings.h" | 64 #include "components/content_settings/core/browser/cookie_settings.h" |
64 #include "components/content_settings/core/browser/host_content_settings_map.h" | 65 #include "components/content_settings/core/browser/host_content_settings_map.h" |
65 #include "components/cookie_config/cookie_store_util.h" | 66 #include "components/cookie_config/cookie_store_util.h" |
66 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" | 67 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
67 #include "components/dom_distiller/core/url_constants.h" | 68 #include "components/dom_distiller/core/url_constants.h" |
68 #include "components/metrics/metrics_pref_names.h" | 69 #include "components/metrics/metrics_pref_names.h" |
69 #include "components/metrics/metrics_service.h" | 70 #include "components/metrics/metrics_service.h" |
70 #include "components/net_log/chrome_net_log.h" | 71 #include "components/net_log/chrome_net_log.h" |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 policy::URLBlacklist::SegmentURLCallback callback = | 523 policy::URLBlacklist::SegmentURLCallback callback = |
523 static_cast<policy::URLBlacklist::SegmentURLCallback>( | 524 static_cast<policy::URLBlacklist::SegmentURLCallback>( |
524 url_formatter::SegmentURL); | 525 url_formatter::SegmentURL); |
525 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); | 526 base::SequencedWorkerPool* pool = BrowserThread::GetBlockingPool(); |
526 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 527 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
527 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); | 528 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); |
528 url_blacklist_manager_.reset(new policy::URLBlacklistManager( | 529 url_blacklist_manager_.reset(new policy::URLBlacklistManager( |
529 pref_service, background_task_runner, io_task_runner, callback, | 530 pref_service, background_task_runner, io_task_runner, callback, |
530 base::Bind(policy::OverrideBlacklistForURL))); | 531 base::Bind(policy::OverrideBlacklistForURL))); |
531 | 532 |
| 533 // The CTPolicyManager shares the same constraints of needing to be cleaned |
| 534 // up on the UI thread. |
| 535 ct_policy_manager_.reset(new certificate_transparency::CTPolicyManager( |
| 536 pref_service, io_task_runner)); |
| 537 |
532 if (!IsOffTheRecord()) { | 538 if (!IsOffTheRecord()) { |
533 // Add policy headers for non-incognito requests. | 539 // Add policy headers for non-incognito requests. |
534 policy::PolicyHeaderService* policy_header_service = | 540 policy::PolicyHeaderService* policy_header_service = |
535 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); | 541 policy::PolicyHeaderServiceFactory::GetForBrowserContext(profile); |
536 if (policy_header_service) { | 542 if (policy_header_service) { |
537 policy_header_helper_ = | 543 policy_header_helper_ = |
538 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); | 544 policy_header_service->CreatePolicyHeaderIOHelper(io_task_runner); |
539 } | 545 } |
540 } | 546 } |
541 | 547 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // Destroy certificate_report_sender_ before main_request_context_, | 674 // Destroy certificate_report_sender_ before main_request_context_, |
669 // since the former has a reference to the latter. | 675 // since the former has a reference to the latter. |
670 if (transport_security_state_) | 676 if (transport_security_state_) |
671 transport_security_state_->SetReportSender(nullptr); | 677 transport_security_state_->SetReportSender(nullptr); |
672 certificate_report_sender_.reset(); | 678 certificate_report_sender_.reset(); |
673 | 679 |
674 if (transport_security_state_) | 680 if (transport_security_state_) |
675 transport_security_state_->SetExpectCTReporter(nullptr); | 681 transport_security_state_->SetExpectCTReporter(nullptr); |
676 expect_ct_reporter_.reset(); | 682 expect_ct_reporter_.reset(); |
677 | 683 |
| 684 if (transport_security_state_) |
| 685 transport_security_state_->SetRequireCTDelegate(nullptr); |
| 686 |
678 // TODO(ajwong): These AssertNoURLRequests() calls are unnecessary since they | 687 // TODO(ajwong): These AssertNoURLRequests() calls are unnecessary since they |
679 // are already done in the URLRequestContext destructor. | 688 // are already done in the URLRequestContext destructor. |
680 if (main_request_context_) | 689 if (main_request_context_) |
681 main_request_context_->AssertNoURLRequests(); | 690 main_request_context_->AssertNoURLRequests(); |
682 if (extensions_request_context_) | 691 if (extensions_request_context_) |
683 extensions_request_context_->AssertNoURLRequests(); | 692 extensions_request_context_->AssertNoURLRequests(); |
684 | 693 |
685 current_context = 0; | 694 current_context = 0; |
686 for (URLRequestContextMap::iterator it = app_request_context_map_.begin(); | 695 for (URLRequestContextMap::iterator it = app_request_context_map_.begin(); |
687 it != app_request_context_map_.end(); ++it) { | 696 it != app_request_context_map_.end(); ++it) { |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 IsOffTheRecord())); | 1093 IsOffTheRecord())); |
1085 | 1094 |
1086 certificate_report_sender_.reset(new net::ReportSender( | 1095 certificate_report_sender_.reset(new net::ReportSender( |
1087 main_request_context_.get(), net::ReportSender::DO_NOT_SEND_COOKIES)); | 1096 main_request_context_.get(), net::ReportSender::DO_NOT_SEND_COOKIES)); |
1088 transport_security_state_->SetReportSender(certificate_report_sender_.get()); | 1097 transport_security_state_->SetReportSender(certificate_report_sender_.get()); |
1089 | 1098 |
1090 expect_ct_reporter_.reset( | 1099 expect_ct_reporter_.reset( |
1091 new ChromeExpectCTReporter(main_request_context_.get())); | 1100 new ChromeExpectCTReporter(main_request_context_.get())); |
1092 transport_security_state_->SetExpectCTReporter(expect_ct_reporter_.get()); | 1101 transport_security_state_->SetExpectCTReporter(expect_ct_reporter_.get()); |
1093 | 1102 |
| 1103 transport_security_state_->SetRequireCTDelegate( |
| 1104 ct_policy_manager_->GetDelegate()); |
| 1105 |
1094 // Take ownership over these parameters. | 1106 // Take ownership over these parameters. |
1095 cookie_settings_ = profile_params_->cookie_settings; | 1107 cookie_settings_ = profile_params_->cookie_settings; |
1096 host_content_settings_map_ = profile_params_->host_content_settings_map; | 1108 host_content_settings_map_ = profile_params_->host_content_settings_map; |
1097 #if defined(ENABLE_EXTENSIONS) | 1109 #if defined(ENABLE_EXTENSIONS) |
1098 extension_info_map_ = profile_params_->extension_info_map; | 1110 extension_info_map_ = profile_params_->extension_info_map; |
1099 #endif | 1111 #endif |
1100 | 1112 |
1101 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); | 1113 resource_context_->host_resolver_ = io_thread_globals->host_resolver.get(); |
1102 resource_context_->request_context_ = main_request_context_.get(); | 1114 resource_context_->request_context_ = main_request_context_.get(); |
1103 | 1115 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 enable_metrics_.Destroy(); | 1290 enable_metrics_.Destroy(); |
1279 safe_browsing_enabled_.Destroy(); | 1291 safe_browsing_enabled_.Destroy(); |
1280 sync_disabled_.Destroy(); | 1292 sync_disabled_.Destroy(); |
1281 signin_allowed_.Destroy(); | 1293 signin_allowed_.Destroy(); |
1282 network_prediction_options_.Destroy(); | 1294 network_prediction_options_.Destroy(); |
1283 if (media_device_id_salt_.get()) | 1295 if (media_device_id_salt_.get()) |
1284 media_device_id_salt_->ShutdownOnUIThread(); | 1296 media_device_id_salt_->ShutdownOnUIThread(); |
1285 session_startup_pref_.Destroy(); | 1297 session_startup_pref_.Destroy(); |
1286 if (url_blacklist_manager_) | 1298 if (url_blacklist_manager_) |
1287 url_blacklist_manager_->ShutdownOnUIThread(); | 1299 url_blacklist_manager_->ShutdownOnUIThread(); |
| 1300 if (ct_policy_manager_) |
| 1301 ct_policy_manager_->Shutdown(); |
1288 if (chrome_http_user_agent_settings_) | 1302 if (chrome_http_user_agent_settings_) |
1289 chrome_http_user_agent_settings_->CleanupOnUIThread(); | 1303 chrome_http_user_agent_settings_->CleanupOnUIThread(); |
1290 incognito_availibility_pref_.Destroy(); | 1304 incognito_availibility_pref_.Destroy(); |
1291 | 1305 |
1292 if (!context_getters->empty()) { | 1306 if (!context_getters->empty()) { |
1293 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 1307 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
1294 BrowserThread::PostTask( | 1308 BrowserThread::PostTask( |
1295 BrowserThread::IO, FROM_HERE, | 1309 BrowserThread::IO, FROM_HERE, |
1296 base::Bind(&NotifyContextGettersOfShutdownOnIO, | 1310 base::Bind(&NotifyContextGettersOfShutdownOnIO, |
1297 base::Passed(&context_getters))); | 1311 base::Passed(&context_getters))); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1361 void ProfileIOData::SetCookieSettingsForTesting( | 1375 void ProfileIOData::SetCookieSettingsForTesting( |
1362 content_settings::CookieSettings* cookie_settings) { | 1376 content_settings::CookieSettings* cookie_settings) { |
1363 DCHECK(!cookie_settings_.get()); | 1377 DCHECK(!cookie_settings_.get()); |
1364 cookie_settings_ = cookie_settings; | 1378 cookie_settings_ = cookie_settings; |
1365 } | 1379 } |
1366 | 1380 |
1367 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( | 1381 policy::URLBlacklist::URLBlacklistState ProfileIOData::GetURLBlacklistState( |
1368 const GURL& url) const { | 1382 const GURL& url) const { |
1369 return url_blacklist_manager_->GetURLBlacklistState(url); | 1383 return url_blacklist_manager_->GetURLBlacklistState(url); |
1370 } | 1384 } |
OLD | NEW |