Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 2351113005: [Reland] Refactor WebappRegistry into a singleton instance. (Closed)
Patch Set: Fix WebappModeTest Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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. The webapp_registry makes a JNI call into a Java-side 702 // registered webapps.
703 // AsyncTask, so don't wait for the reply. 703 webapp_registry_->ClearWebappHistoryForUrls(filter);
704 waiting_for_clear_webapp_history_ = true;
705 webapp_registry_->ClearWebappHistoryForUrls(
706 filter,
707 base::Bind(&BrowsingDataRemover::OnClearedWebappHistory,
708 weak_ptr_factory_.GetWeakPtr()));
709 #endif 704 #endif
710 705
711 data_reduction_proxy::DataReductionProxySettings* 706 data_reduction_proxy::DataReductionProxySettings*
712 data_reduction_proxy_settings = 707 data_reduction_proxy_settings =
713 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 708 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
714 profile_); 709 profile_);
715 // |data_reduction_proxy_settings| is null if |profile_| is off the record. 710 // |data_reduction_proxy_settings| is null if |profile_| is off the record.
716 if (data_reduction_proxy_settings) { 711 if (data_reduction_proxy_settings) {
717 data_reduction_proxy::DataReductionProxyService* 712 data_reduction_proxy::DataReductionProxyService*
718 data_reduction_proxy_service = 713 data_reduction_proxy_service =
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 waiting_for_clear_domain_reliability_monitor_ = true; 1130 waiting_for_clear_domain_reliability_monitor_ = true;
1136 service->ClearBrowsingData( 1131 service->ClearBrowsingData(
1137 mode, 1132 mode,
1138 filter, 1133 filter,
1139 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor, 1134 base::Bind(&BrowsingDataRemover::OnClearedDomainReliabilityMonitor,
1140 weak_ptr_factory_.GetWeakPtr())); 1135 weak_ptr_factory_.GetWeakPtr()));
1141 } 1136 }
1142 } 1137 }
1143 1138
1144 #if BUILDFLAG(ANDROID_JAVA_UI) 1139 #if BUILDFLAG(ANDROID_JAVA_UI)
1145 if (remove_mask & REMOVE_WEBAPP_DATA) { 1140 // Clear all data associated with registered webapps.
1146 // Clear all data associated with registered webapps. The webapp_registry 1141 if (remove_mask & REMOVE_WEBAPP_DATA)
1147 // makes a JNI call into a Java-side AsyncTask, so don't wait for the reply. 1142 webapp_registry_->UnregisterWebappsForUrls(filter);
1148 waiting_for_clear_webapp_data_ = true;
1149 webapp_registry_->UnregisterWebappsForUrls(
1150 filter,
1151 base::Bind(&BrowsingDataRemover::OnClearedWebappData,
1152 weak_ptr_factory_.GetWeakPtr()));
1153 }
1154 1143
1155 // For now we're considering offline pages as cache, so if we're removing 1144 // For now we're considering offline pages as cache, so if we're removing
1156 // cache we should remove offline pages as well. 1145 // cache we should remove offline pages as well.
1157 if ((remove_mask & REMOVE_CACHE)) { 1146 if ((remove_mask & REMOVE_CACHE)) {
1158 waiting_for_clear_offline_page_data_ = true; 1147 waiting_for_clear_offline_page_data_ = true;
1159 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_) 1148 offline_pages::OfflinePageModelFactory::GetForBrowserContext(profile_)
1160 ->DeleteCachedPagesByURLPredicate( 1149 ->DeleteCachedPagesByURLPredicate(
1161 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData, 1150 filter, base::Bind(&BrowsingDataRemover::OnClearedOfflinePageData,
1162 weak_ptr_factory_.GetWeakPtr())); 1151 weak_ptr_factory_.GetWeakPtr()));
1163 } 1152 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 !waiting_for_clear_http_auth_cache_ && 1240 !waiting_for_clear_http_auth_cache_ &&
1252 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ && 1241 !waiting_for_clear_keyword_data_ && !waiting_for_clear_nacl_cache_ &&
1253 !waiting_for_clear_network_predictor_ && 1242 !waiting_for_clear_network_predictor_ &&
1254 !waiting_for_clear_networking_history_ && 1243 !waiting_for_clear_networking_history_ &&
1255 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ && 1244 !waiting_for_clear_passwords_ && !waiting_for_clear_passwords_stats_ &&
1256 !waiting_for_clear_platform_keys_ && 1245 !waiting_for_clear_platform_keys_ &&
1257 !waiting_for_clear_plugin_data_count_ && 1246 !waiting_for_clear_plugin_data_count_ &&
1258 !waiting_for_clear_pnacl_cache_ && 1247 !waiting_for_clear_pnacl_cache_ &&
1259 #if BUILDFLAG(ANDROID_JAVA_UI) 1248 #if BUILDFLAG(ANDROID_JAVA_UI)
1260 !waiting_for_clear_precache_history_ && 1249 !waiting_for_clear_precache_history_ &&
1261 !waiting_for_clear_webapp_data_ &&
1262 !waiting_for_clear_webapp_history_ &&
1263 !waiting_for_clear_offline_page_data_ && 1250 !waiting_for_clear_offline_page_data_ &&
1264 #endif 1251 #endif
1265 #if defined(ENABLE_WEBRTC) 1252 #if defined(ENABLE_WEBRTC)
1266 !waiting_for_clear_webrtc_logs_ && 1253 !waiting_for_clear_webrtc_logs_ &&
1267 #endif 1254 #endif
1268 !waiting_for_clear_storage_partition_data_ && 1255 !waiting_for_clear_storage_partition_data_ &&
1269 !waiting_for_clear_auto_sign_in_; 1256 !waiting_for_clear_auto_sign_in_;
1270 } 1257 }
1271 1258
1272 void BrowsingDataRemover::OnKeywordsLoaded( 1259 void BrowsingDataRemover::OnKeywordsLoaded(
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 } 1498 }
1512 #endif 1499 #endif
1513 1500
1514 #if BUILDFLAG(ANDROID_JAVA_UI) 1501 #if BUILDFLAG(ANDROID_JAVA_UI)
1515 void BrowsingDataRemover::OnClearedPrecacheHistory() { 1502 void BrowsingDataRemover::OnClearedPrecacheHistory() {
1516 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1503 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1517 waiting_for_clear_precache_history_ = false; 1504 waiting_for_clear_precache_history_ = false;
1518 NotifyIfDone(); 1505 NotifyIfDone();
1519 } 1506 }
1520 1507
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
1533 void BrowsingDataRemover::OnClearedOfflinePageData( 1508 void BrowsingDataRemover::OnClearedOfflinePageData(
1534 offline_pages::OfflinePageModel::DeletePageResult result) { 1509 offline_pages::OfflinePageModel::DeletePageResult result) {
1535 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1510 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1536 waiting_for_clear_offline_page_data_ = false; 1511 waiting_for_clear_offline_page_data_ = false;
1537 NotifyIfDone(); 1512 NotifyIfDone();
1538 } 1513 }
1539 #endif 1514 #endif
1540 1515
1541 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() { 1516 void BrowsingDataRemover::OnClearedDomainReliabilityMonitor() {
1542 DCHECK_CURRENTLY_ON(BrowserThread::UI); 1517 DCHECK_CURRENTLY_ON(BrowserThread::UI);
1543 waiting_for_clear_domain_reliability_monitor_ = false; 1518 waiting_for_clear_domain_reliability_monitor_ = false;
1544 NotifyIfDone(); 1519 NotifyIfDone();
1545 } 1520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698