| 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 precache_manager->ClearHistory(); | 695 precache_manager->ClearHistory(); |
| 696 // The above calls are done on the UI thread but do their work on the DB | 696 // The above calls are done on the UI thread but do their work on the DB |
| 697 // thread. So wait for it. | 697 // thread. So wait for it. |
| 698 BrowserThread::PostTaskAndReply( | 698 BrowserThread::PostTaskAndReply( |
| 699 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | 699 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), |
| 700 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, | 700 base::Bind(&BrowsingDataRemover::OnClearedPrecacheHistory, |
| 701 weak_ptr_factory_.GetWeakPtr())); | 701 weak_ptr_factory_.GetWeakPtr())); |
| 702 } | 702 } |
| 703 | 703 |
| 704 // Clear the history information (last launch time and origin URL) of any | 704 // Clear the history information (last launch time and origin URL) of any |
| 705 // registered webapps. The webapp_registry makes a JNI call into a Java-side | 705 // registered webapps. |
| 706 // AsyncTask, so don't wait for the reply. | 706 webapp_registry_->ClearWebappHistoryForUrls(filter); |
| 707 waiting_for_clear_webapp_history_ = true; | |
| 708 webapp_registry_->ClearWebappHistoryForUrls( | |
| 709 filter, | |
| 710 base::Bind(&BrowsingDataRemover::OnClearedWebappHistory, | |
| 711 weak_ptr_factory_.GetWeakPtr())); | |
| 712 #endif | 707 #endif |
| 713 | 708 |
| 714 data_reduction_proxy::DataReductionProxySettings* | 709 data_reduction_proxy::DataReductionProxySettings* |
| 715 data_reduction_proxy_settings = | 710 data_reduction_proxy_settings = |
| 716 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 711 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 717 profile_); | 712 profile_); |
| 718 // |data_reduction_proxy_settings| is null if |profile_| is off the record. | 713 // |data_reduction_proxy_settings| is null if |profile_| is off the record. |
| 719 if (data_reduction_proxy_settings) { | 714 if (data_reduction_proxy_settings) { |
| 720 data_reduction_proxy::DataReductionProxyService* | 715 data_reduction_proxy::DataReductionProxyService* |
| 721 data_reduction_proxy_service = | 716 data_reduction_proxy_service = |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1153 waiting_for_clear_domain_reliability_monitor_ = true; | 1148 waiting_for_clear_domain_reliability_monitor_ = true; |
| 1154 service->ClearBrowsingData( | 1149 service->ClearBrowsingData( |
| 1155 mode, | 1150 mode, |
| 1156 filter, | 1151 filter, |
| 1157 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, | 1152 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, |
| 1158 weak_ptr_factory_.GetWeakPtr())); | 1153 weak_ptr_factory_.GetWeakPtr())); |
| 1159 } | 1154 } |
| 1160 } | 1155 } |
| 1161 | 1156 |
| 1162 #if BUILDFLAG(ANDROID_JAVA_UI) | 1157 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1163 if (remove_mask & REMOVE_WEBAPP_DATA) { | 1158 // Clear all data associated with registered webapps. |
| 1164 // Clear all data associated with registered webapps. The webapp_registry | 1159 if (remove_mask & REMOVE_WEBAPP_DATA) |
| 1165 // makes a JNI call into a Java-side AsyncTask, so don't wait for the reply. | 1160 webapp_registry_->UnregisterWebappsForUrls(filter); |
| 1166 waiting_for_clear_webapp_data_ = true; | |
| 1167 webapp_registry_->UnregisterWebappsForUrls( | |
| 1168 filter, | |
| 1169 base::Bind(&BrowsingDataRemover::OnClearedWebappData, | |
| 1170 weak_ptr_factory_.GetWeakPtr())); | |
| 1171 } | |
| 1172 | 1161 |
| 1173 // For now we're considering offline pages as cache, so if we're removing | 1162 // For now we're considering offline pages as cache, so if we're removing |
| 1174 // cache we should remove offline pages as well. | 1163 // cache we should remove offline pages as well. |
| 1175 if ((remove_mask & REMOVE_CACHE)) { | 1164 if ((remove_mask & REMOVE_CACHE)) { |
| 1176 waiting_for_clear_offline_page_data_ = true; | 1165 waiting_for_clear_offline_page_data_ = true; |
| 1177 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) | 1166 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) |
| 1178 ->DeleteCachedPagesByURLPredicate( | 1167 ->DeleteCachedPagesByURLPredicate( |
| 1179 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, | 1168 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, |
| 1180 weak_ptr_factory_.GetWeakPtr())); | 1169 weak_ptr_factory_.GetWeakPtr())); |
| 1181 } | 1170 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1269 !waiting_for_clear_http_auth_cache_ && | 1258 !waiting_for_clear_http_auth_cache_ && |
| 1270 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && | 1259 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && |
| 1271 !waiting_for_clear_network_predictor_ && | 1260 !waiting_for_clear_network_predictor_ && |
| 1272 !waiting_for_clear_networking_history_ && | 1261 !waiting_for_clear_networking_history_ && |
| 1273 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && | 1262 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && |
| 1274 !waiting_for_clear_platform_keys_ && | 1263 !waiting_for_clear_platform_keys_ && |
| 1275 !waiting_for_clear_plugin_data_count_ && | 1264 !waiting_for_clear_plugin_data_count_ && |
| 1276 !waiting_for_clear_pnacl_cache_ && | 1265 !waiting_for_clear_pnacl_cache_ && |
| 1277 #if BUILDFLAG(ANDROID_JAVA_UI) | 1266 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1278 !waiting_for_clear_precache_history_ && | 1267 !waiting_for_clear_precache_history_ && |
| 1279 !waiting_for_clear_webapp_data_ && | |
| 1280 !waiting_for_clear_webapp_history_ && | |
| 1281 !waiting_for_clear_offline_page_data_ && | 1268 !waiting_for_clear_offline_page_data_ && |
| 1282 #endif | 1269 #endif |
| 1283 #if defined(ENABLE_WEBRTC) | 1270 #if defined(ENABLE_WEBRTC) |
| 1284 !waiting_for_clear_webrtc_logs_ && | 1271 !waiting_for_clear_webrtc_logs_ && |
| 1285 #endif | 1272 #endif |
| 1286 !waiting_for_clear_storage_partition_data_ && | 1273 !waiting_for_clear_storage_partition_data_ && |
| 1287 !waiting_for_clear_auto_sign_in_; | 1274 !waiting_for_clear_auto_sign_in_; |
| 1288 } | 1275 } |
| 1289 | 1276 |
| 1290 void BrowsingDataRemover::OnKeywordsLoaded( | 1277 void BrowsingDataRemover::OnKeywordsLoaded( |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 } | 1516 } |
| 1530 #endif | 1517 #endif |
| 1531 | 1518 |
| 1532 #if BUILDFLAG(ANDROID_JAVA_UI) | 1519 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 1533 void BrowsingDataRemover::OnClearedPrecacheHistory() { | 1520 void BrowsingDataRemover::OnClearedPrecacheHistory() { |
| 1534 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1521 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1535 waiting_for_clear_precache_history_ = false; | 1522 waiting_for_clear_precache_history_ = false; |
| 1536 NotifyIfDone(); | 1523 NotifyIfDone(); |
| 1537 } | 1524 } |
| 1538 | 1525 |
| 1539 void BrowsingDataRemover::OnClearedWebappData() { | |
| 1540 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 1541 waiting_for_clear_webapp_data_ = false; | |
| 1542 NotifyIfDone(); | |
| 1543 } | |
| 1544 | |
| 1545 void BrowsingDataRemover::OnClearedWebappHistory() { | |
| 1546 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 1547 waiting_for_clear_webapp_history_ = false; | |
| 1548 NotifyIfDone(); | |
| 1549 } | |
| 1550 | |
| 1551 void BrowsingDataRemover::OnClearedOfflinePageData( | 1526 void BrowsingDataRemover::OnClearedOfflinePageData( |
| 1552 offline_pages::OfflinePageModel::DeletePageResult result) { | 1527 offline_pages::OfflinePageModel::DeletePageResult result) { |
| 1553 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1528 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1554 waiting_for_clear_offline_page_data_ = false; | 1529 waiting_for_clear_offline_page_data_ = false; |
| 1555 NotifyIfDone(); | 1530 NotifyIfDone(); |
| 1556 } | 1531 } |
| 1557 #endif | 1532 #endif |
| 1558 | 1533 |
| 1559 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { | 1534 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { |
| 1560 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1535 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1561 waiting_for_clear_domain_reliability_monitor_ = false; | 1536 waiting_for_clear_domain_reliability_monitor_ = false; |
| 1562 NotifyIfDone(); | 1537 NotifyIfDone(); |
| 1563 } | 1538 } |
| OLD | NEW |