| 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/browsing_data/browsing_data_remover.h" | 5 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chrome/browser/password_manager/password_store_factory.h" | 32 #include "chrome/browser/password_manager/password_store_factory.h" |
| 33 #include "chrome/browser/prerender/prerender_manager.h" | 33 #include "chrome/browser/prerender/prerender_manager.h" |
| 34 #include "chrome/browser/prerender/prerender_manager_factory.h" | 34 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| 35 #include "chrome/browser/profiles/profile.h" | 35 #include "chrome/browser/profiles/profile.h" |
| 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 36 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
| 37 #include "chrome/browser/search_engines/template_url_service_factory.h" | 37 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 38 #include "chrome/browser/sessions/session_service.h" | 38 #include "chrome/browser/sessions/session_service.h" |
| 39 #include "chrome/browser/sessions/session_service_factory.h" | 39 #include "chrome/browser/sessions/session_service_factory.h" |
| 40 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 40 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
| 41 #include "chrome/browser/web_data_service_factory.h" | 41 #include "chrome/browser/web_data_service_factory.h" |
| 42 #include "chrome/common/features.h" |
| 42 #include "chrome/common/pref_names.h" | 43 #include "chrome/common/pref_names.h" |
| 43 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
| 44 #include "components/autofill/core/browser/personal_data_manager.h" | 45 #include "components/autofill/core/browser/personal_data_manager.h" |
| 45 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" | 46 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" |
| 46 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" | 47 #include "components/browsing_data/storage_partition_http_cache_data_remover.h" |
| 47 #include "components/content_settings/core/browser/host_content_settings_map.h" | 48 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 48 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" | 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_comp
ression_stats.h" |
| 49 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" | 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_serv
ice.h" |
| 50 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 51 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
| 51 #include "components/domain_reliability/service.h" | 52 #include "components/domain_reliability/service.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 69 #include "net/base/net_errors.h" | 70 #include "net/base/net_errors.h" |
| 70 #include "net/cookies/cookie_store.h" | 71 #include "net/cookies/cookie_store.h" |
| 71 #include "net/http/transport_security_state.h" | 72 #include "net/http/transport_security_state.h" |
| 72 #include "net/ssl/channel_id_service.h" | 73 #include "net/ssl/channel_id_service.h" |
| 73 #include "net/ssl/channel_id_store.h" | 74 #include "net/ssl/channel_id_store.h" |
| 74 #include "net/url_request/url_request_context.h" | 75 #include "net/url_request/url_request_context.h" |
| 75 #include "net/url_request/url_request_context_getter.h" | 76 #include "net/url_request/url_request_context_getter.h" |
| 76 #include "storage/browser/quota/special_storage_policy.h" | 77 #include "storage/browser/quota/special_storage_policy.h" |
| 77 #include "url/origin.h" | 78 #include "url/origin.h" |
| 78 | 79 |
| 79 #if defined(OS_ANDROID) | 80 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 80 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" | 81 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" |
| 81 #include "chrome/browser/android/webapps/webapp_registry.h" | 82 #include "chrome/browser/android/webapps/webapp_registry.h" |
| 82 #include "chrome/browser/precache/precache_manager_factory.h" | 83 #include "chrome/browser/precache/precache_manager_factory.h" |
| 83 #include "components/offline_pages/offline_page_feature.h" | 84 #include "components/offline_pages/offline_page_feature.h" |
| 84 #include "components/offline_pages/offline_page_model.h" | 85 #include "components/offline_pages/offline_page_model.h" |
| 85 #include "components/precache/content/precache_manager.h" | 86 #include "components/precache/content/precache_manager.h" |
| 86 #endif | 87 #endif |
| 87 | 88 |
| 88 #if defined(OS_CHROMEOS) | 89 #if defined(OS_CHROMEOS) |
| 89 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 90 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 delete_begin_), | 423 delete_begin_), |
| 423 base::Bind(&BrowsingDataRemover::OnClearedWebRtcLogs, | 424 base::Bind(&BrowsingDataRemover::OnClearedWebRtcLogs, |
| 424 base::Unretained(this))); | 425 base::Unretained(this))); |
| 425 #endif | 426 #endif |
| 426 | 427 |
| 427 // The SSL Host State that tracks SSL interstitial "proceed" decisions may | 428 // The SSL Host State that tracks SSL interstitial "proceed" decisions may |
| 428 // include origins that the user has visited, so it must be cleared. | 429 // include origins that the user has visited, so it must be cleared. |
| 429 if (profile_->GetSSLHostStateDelegate()) | 430 if (profile_->GetSSLHostStateDelegate()) |
| 430 profile_->GetSSLHostStateDelegate()->Clear(); | 431 profile_->GetSSLHostStateDelegate()->Clear(); |
| 431 | 432 |
| 432 #if defined(OS_ANDROID) | 433 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 433 precache::PrecacheManager* precache_manager = | 434 precache::PrecacheManager* precache_manager = |
| 434 precache::PrecacheManagerFactory::GetForBrowserContext(profile_); | 435 precache::PrecacheManagerFactory::GetForBrowserContext(profile_); |
| 435 // |precache_manager| could be nullptr if the profile is off the record. | 436 // |precache_manager| could be nullptr if the profile is off the record. |
| 436 if (!precache_manager) { | 437 if (!precache_manager) { |
| 437 waiting_for_clear_precache_history_ = true; | 438 waiting_for_clear_precache_history_ = true; |
| 438 precache_manager->ClearHistory(); | 439 precache_manager->ClearHistory(); |
| 439 // The above calls are done on the UI thread but do their work on the DB | 440 // The above calls are done on the UI thread but do their work on the DB |
| 440 // thread. So wait for it. | 441 // thread. So wait for it. |
| 441 BrowserThread::PostTaskAndReply( | 442 BrowserThread::PostTaskAndReply( |
| 442 BrowserThread::DB, FROM_HERE, | 443 BrowserThread::DB, FROM_HERE, |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 mode = domain_reliability::CLEAR_BEACONS; | 795 mode = domain_reliability::CLEAR_BEACONS; |
| 795 | 796 |
| 796 waiting_for_clear_domain_reliability_monitor_ = true; | 797 waiting_for_clear_domain_reliability_monitor_ = true; |
| 797 service->ClearBrowsingData( | 798 service->ClearBrowsingData( |
| 798 mode, | 799 mode, |
| 799 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | 800 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
| 800 base::Unretained(this))); | 801 base::Unretained(this))); |
| 801 } | 802 } |
| 802 } | 803 } |
| 803 | 804 |
| 804 #if defined(OS_ANDROID) | 805 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 805 if (remove_mask & REMOVE_WEBAPP_DATA) { | 806 if (remove_mask & REMOVE_WEBAPP_DATA) { |
| 806 waiting_for_clear_webapp_data_ = true; | 807 waiting_for_clear_webapp_data_ = true; |
| 807 WebappRegistry::UnregisterWebapps( | 808 WebappRegistry::UnregisterWebapps( |
| 808 base::Bind(&BrowsingDataRemover::OnClearedWebappData, | 809 base::Bind(&BrowsingDataRemover::OnClearedWebappData, |
| 809 base::Unretained(this))); | 810 base::Unretained(this))); |
| 810 } | 811 } |
| 811 | 812 |
| 812 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && | 813 if ((remove_mask & REMOVE_OFFLINE_PAGE_DATA) && |
| 813 offline_pages::IsOfflinePagesEnabled()) { | 814 offline_pages::IsOfflinePagesEnabled()) { |
| 814 waiting_for_clear_offline_page_data_ = true; | 815 waiting_for_clear_offline_page_data_ = true; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 !waiting_for_clear_hostname_resolution_cache_ && | 891 !waiting_for_clear_hostname_resolution_cache_ && |
| 891 !waiting_for_clear_keyword_data_ && | 892 !waiting_for_clear_keyword_data_ && |
| 892 !waiting_for_clear_nacl_cache_ && | 893 !waiting_for_clear_nacl_cache_ && |
| 893 !waiting_for_clear_network_predictor_ && | 894 !waiting_for_clear_network_predictor_ && |
| 894 !waiting_for_clear_networking_history_ && | 895 !waiting_for_clear_networking_history_ && |
| 895 !waiting_for_clear_passwords_ && | 896 !waiting_for_clear_passwords_ && |
| 896 !waiting_for_clear_passwords_stats_ && | 897 !waiting_for_clear_passwords_stats_ && |
| 897 !waiting_for_clear_platform_keys_ && | 898 !waiting_for_clear_platform_keys_ && |
| 898 !waiting_for_clear_plugin_data_ && | 899 !waiting_for_clear_plugin_data_ && |
| 899 !waiting_for_clear_pnacl_cache_ && | 900 !waiting_for_clear_pnacl_cache_ && |
| 900 #if defined(OS_ANDROID) | 901 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 901 !waiting_for_clear_precache_history_ && | 902 !waiting_for_clear_precache_history_ && |
| 902 !waiting_for_clear_webapp_data_ && | 903 !waiting_for_clear_webapp_data_ && |
| 903 !waiting_for_clear_offline_page_data_ && | 904 !waiting_for_clear_offline_page_data_ && |
| 904 #endif | 905 #endif |
| 905 #if defined(ENABLE_WEBRTC) | 906 #if defined(ENABLE_WEBRTC) |
| 906 !waiting_for_clear_webrtc_logs_ && | 907 !waiting_for_clear_webrtc_logs_ && |
| 907 #endif | 908 #endif |
| 908 !waiting_for_clear_storage_partition_data_; | 909 !waiting_for_clear_storage_partition_data_; |
| 909 } | 910 } |
| 910 | 911 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 } | 1187 } |
| 1187 | 1188 |
| 1188 #if defined(ENABLE_WEBRTC) | 1189 #if defined(ENABLE_WEBRTC) |
| 1189 void BrowsingDataRemover::OnClearedWebRtcLogs() { | 1190 void BrowsingDataRemover::OnClearedWebRtcLogs() { |
| 1190 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1191 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1191 waiting_for_clear_webrtc_logs_ = false; | 1192 waiting_for_clear_webrtc_logs_ = false; |
| 1192 NotifyAndDeleteIfDone(); | 1193 NotifyAndDeleteIfDone(); |
| 1193 } | 1194 } |
| 1194 #endif | 1195 #endif |
| 1195 | 1196 |
| 1196 #if defined(OS_ANDROID) | 1197 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1197 void BrowsingDataRemover::OnClearedPrecacheHistory() { | 1198 void BrowsingDataRemover::OnClearedPrecacheHistory() { |
| 1198 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1199 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1199 waiting_for_clear_precache_history_ = false; | 1200 waiting_for_clear_precache_history_ = false; |
| 1200 NotifyAndDeleteIfDone(); | 1201 NotifyAndDeleteIfDone(); |
| 1201 } | 1202 } |
| 1202 | 1203 |
| 1203 void BrowsingDataRemover::OnClearedWebappData() { | 1204 void BrowsingDataRemover::OnClearedWebappData() { |
| 1204 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1205 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1205 waiting_for_clear_webapp_data_ = false; | 1206 waiting_for_clear_webapp_data_ = false; |
| 1206 NotifyAndDeleteIfDone(); | 1207 NotifyAndDeleteIfDone(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1218 waiting_for_clear_domain_reliability_monitor_ = false; | 1219 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1219 NotifyAndDeleteIfDone(); | 1220 NotifyAndDeleteIfDone(); |
| 1220 } | 1221 } |
| 1221 | 1222 |
| 1222 // static | 1223 // static |
| 1223 BrowsingDataRemover::CallbackSubscription | 1224 BrowsingDataRemover::CallbackSubscription |
| 1224 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( | 1225 BrowsingDataRemover::RegisterOnBrowsingDataRemovedCallback( |
| 1225 const BrowsingDataRemover::Callback& callback) { | 1226 const BrowsingDataRemover::Callback& callback) { |
| 1226 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); | 1227 return GetOnBrowsingDataRemovedCallbacks()->Add(callback); |
| 1227 } | 1228 } |
| OLD | NEW |