| 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 #include <utility> | 10 #include <utility> |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 precache_manager->ClearHistory(); | 692 precache_manager->ClearHistory(); |
| 693 // The above calls are done on the UI thread but do their work on the DB | 693 // The above calls are done on the UI thread but do their work on the DB |
| 694 // thread. So wait for it. | 694 // thread. So wait for it. |
| 695 BrowserThread::PostTaskAndReply( | 695 BrowserThread::PostTaskAndReply( |
| 696 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | 696 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), |
| 697 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, | 697 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, |
| 698 weak_ptr_factory_.GetWeakPtr())); | 698 weak_ptr_factory_.GetWeakPtr())); |
| 699 } | 699 } |
| 700 | 700 |
| 701 // Clear the history information (last launch time and origin URL) of any | 701 // Clear the history information (last launch time and origin URL) of any |
| 702 // registered webapps. | 702 // registered webapps. The webapp_registry makes a JNI call into a Java-side |
| 703 webapp_registry_->ClearWebappHistoryForUrls(filter); | 703 // AsyncTask, so don't wait for the reply. |
| 704 waiting_for_clear_webapp_history_ = true; |
| 705 webapp_registry_->ClearWebappHistoryForUrls( |
| 706 filter, |
| 707 base::Bind(&BrowsingDataRemover::OnClearedWebappHistory, |
| 708 weak_ptr_factory_.GetWeakPtr())); |
| 704 #endif | 709 #endif |
| 705 | 710 |
| 706 data_reduction_proxy::DataReductionProxySettings* | 711 data_reduction_proxy::DataReductionProxySettings* |
| 707 data_reduction_proxy_settings = | 712 data_reduction_proxy_settings = |
| 708 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 713 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 709 profile_); | 714 profile_); |
| 710 // |data_reduction_proxy_settings| is null if |profile_| is off the record. | 715 // |data_reduction_proxy_settings| is null if |profile_| is off the record. |
| 711 if (data_reduction_proxy_settings) { | 716 if (data_reduction_proxy_settings) { |
| 712 data_reduction_proxy::DataReductionProxyService* | 717 data_reduction_proxy::DataReductionProxyService* |
| 713 data_reduction_proxy_service = | 718 data_reduction_proxy_service = |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 waiting_for_clear_domain_reliability_monitor_ = true; | 1135 waiting_for_clear_domain_reliability_monitor_ = true; |
| 1131 service->ClearBrowsingData( | 1136 service->ClearBrowsingData( |
| 1132 mode, | 1137 mode, |
| 1133 filter, | 1138 filter, |
| 1134 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | 1139 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
| 1135 weak_ptr_factory_.GetWeakPtr())); | 1140 weak_ptr_factory_.GetWeakPtr())); |
| 1136 } | 1141 } |
| 1137 } | 1142 } |
| 1138 | 1143 |
| 1139 #if BUILDFLAG(ANDROID_JAVA_UI) | 1144 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1140 // Clear all data associated with registered webapps. | 1145 if (remove_mask & REMOVE_WEBAPP_DATA) { |
| 1141 if (remove_mask & REMOVE_WEBAPP_DATA) | 1146 // Clear all data associated with registered webapps. The webapp_registry |
| 1142 webapp_registry_->UnregisterWebappsForUrls(filter); | 1147 // makes a JNI call into a Java-side AsyncTask, so don't wait for the reply. |
| 1148 waiting_for_clear_webapp_data_ = true; |
| 1149 webapp_registry_->UnregisterWebappsForUrls( |
| 1150 filter, |
| 1151 base::Bind(&BrowsingDataRemover::OnClearedWebappData, |
| 1152 weak_ptr_factory_.GetWeakPtr())); |
| 1153 } |
| 1143 | 1154 |
| 1144 // For now we're considering offline pages as cache, so if we're removing | 1155 // For now we're considering offline pages as cache, so if we're removing |
| 1145 // cache we should remove offline pages as well. | 1156 // cache we should remove offline pages as well. |
| 1146 if ((remove_mask & REMOVE_CACHE)) { | 1157 if ((remove_mask & REMOVE_CACHE)) { |
| 1147 waiting_for_clear_offline_page_data_ = true; | 1158 waiting_for_clear_offline_page_data_ = true; |
| 1148 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) | 1159 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) |
| 1149 ->DeleteCachedPagesByURLPredicate( | 1160 ->DeleteCachedPagesByURLPredicate( |
| 1150 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, | 1161 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, |
| 1151 weak_ptr_factory_.GetWeakPtr())); | 1162 weak_ptr_factory_.GetWeakPtr())); |
| 1152 } | 1163 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1240 !waiting_for_clear_http_auth_cache_ && | 1251 !waiting_for_clear_http_auth_cache_ && |
| 1241 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && | 1252 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && |
| 1242 !waiting_for_clear_network_predictor_ && | 1253 !waiting_for_clear_network_predictor_ && |
| 1243 !waiting_for_clear_networking_history_ && | 1254 !waiting_for_clear_networking_history_ && |
| 1244 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && | 1255 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && |
| 1245 !waiting_for_clear_platform_keys_ && | 1256 !waiting_for_clear_platform_keys_ && |
| 1246 !waiting_for_clear_plugin_data_count_ && | 1257 !waiting_for_clear_plugin_data_count_ && |
| 1247 !waiting_for_clear_pnacl_cache_ && | 1258 !waiting_for_clear_pnacl_cache_ && |
| 1248 #if BUILDFLAG(ANDROID_JAVA_UI) | 1259 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1249 !waiting_for_clear_precache_history_ && | 1260 !waiting_for_clear_precache_history_ && |
| 1261 !waiting_for_clear_webapp_data_ && |
| 1262 !waiting_for_clear_webapp_history_ && |
| 1250 !waiting_for_clear_offline_page_data_ && | 1263 !waiting_for_clear_offline_page_data_ && |
| 1251 #endif | 1264 #endif |
| 1252 #if defined(ENABLE_WEBRTC) | 1265 #if defined(ENABLE_WEBRTC) |
| 1253 !waiting_for_clear_webrtc_logs_ && | 1266 !waiting_for_clear_webrtc_logs_ && |
| 1254 #endif | 1267 #endif |
| 1255 !waiting_for_clear_storage_partition_data_ && | 1268 !waiting_for_clear_storage_partition_data_ && |
| 1256 !waiting_for_clear_auto_sign_in_; | 1269 !waiting_for_clear_auto_sign_in_; |
| 1257 } | 1270 } |
| 1258 | 1271 |
| 1259 void BrowsingDataRemover::OnKeywordsLoaded( | 1272 void BrowsingDataRemover::OnKeywordsLoaded( |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 } | 1511 } |
| 1499 #endif | 1512 #endif |
| 1500 | 1513 |
| 1501 #if BUILDFLAG(ANDROID_JAVA_UI) | 1514 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1502 void BrowsingDataRemover::OnClearedPrecacheHistory() { | 1515 void BrowsingDataRemover::OnClearedPrecacheHistory() { |
| 1503 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1516 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1504 waiting_for_clear_precache_history_ = false; | 1517 waiting_for_clear_precache_history_ = false; |
| 1505 NotifyIfDone(); | 1518 NotifyIfDone(); |
| 1506 } | 1519 } |
| 1507 | 1520 |
| 1521 void BrowsingDataRemover::OnClearedWebappData() { |
| 1522 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1523 waiting_for_clear_webapp_data_ = false; |
| 1524 NotifyIfDone(); |
| 1525 } |
| 1526 |
| 1527 void BrowsingDataRemover::OnClearedWebappHistory() { |
| 1528 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1529 waiting_for_clear_webapp_history_ = false; |
| 1530 NotifyIfDone(); |
| 1531 } |
| 1532 |
| 1508 void BrowsingDataRemover::OnClearedOfflinePageData( | 1533 void BrowsingDataRemover::OnClearedOfflinePageData( |
| 1509 offline_pages::OfflinePageModel::DeletePageResult result) { | 1534 offline_pages::OfflinePageModel::DeletePageResult result) { |
| 1510 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1535 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1511 waiting_for_clear_offline_page_data_ = false; | 1536 waiting_for_clear_offline_page_data_ = false; |
| 1512 NotifyIfDone(); | 1537 NotifyIfDone(); |
| 1513 } | 1538 } |
| 1514 #endif | 1539 #endif |
| 1515 | 1540 |
| 1516 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1541 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1517 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1542 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1518 waiting_for_clear_domain_reliability_monitor_ = false; | 1543 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1519 NotifyIfDone(); | 1544 NotifyIfDone(); |
| 1520 } | 1545 } |
| OLD | NEW |