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