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

Unified Diff: chrome/browser/browsing_data/browsing_data_remover.cc

Issue 1072413003: Add foundation for trimming the AffiliationDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/browsing_data_remover.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover.cc b/chrome/browser/browsing_data/browsing_data_remover.cc
index ed3f118627089cbf80251f2415b93add01d68fd6..bde44a12a3120ca847db9b244e24a13653f9e6a9 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -214,6 +214,7 @@ BrowsingDataRemover::BrowsingDataRemover(Profile* profile,
waiting_for_clear_nacl_cache_(false),
waiting_for_clear_network_predictor_(false),
waiting_for_clear_networking_history_(false),
+ waiting_for_clear_passwords_(false),
waiting_for_clear_platform_keys_(false),
waiting_for_clear_plugin_data_(false),
waiting_for_clear_pnacl_cache_(false),
@@ -562,8 +563,18 @@ void BrowsingDataRemover::RemoveImpl(int remove_mask,
PasswordStoreFactory::GetForProfile(
profile_, ServiceAccessType::EXPLICIT_ACCESS).get();
- if (password_store)
- password_store->RemoveLoginsCreatedBetween(delete_begin_, delete_end_);
+ if (password_store) {
+ // TrimAffiliationCache() will be called in OnClearedPasswords(), so that
+ // affiliation data corresponding to just deleted passwords can also be
+ // removed.
+ waiting_for_clear_passwords_ = true;
+ password_store->RemoveLoginsCreatedBetween(
+ delete_begin_, delete_end_,
+ base::Bind(&BrowsingDataRemover::OnClearedPasswords,
+ base::Unretained(this)));
+ }
+ } else if (remove_mask & REMOVE_CACHE) {
+ TrimAffiliationCache();
}
if (remove_mask & REMOVE_FORM_DATA) {
@@ -804,6 +815,7 @@ bool BrowsingDataRemover::AllDone() {
!waiting_for_clear_nacl_cache_ &&
!waiting_for_clear_network_predictor_ &&
!waiting_for_clear_networking_history_ &&
+ !waiting_for_clear_passwords_ &&
!waiting_for_clear_platform_keys_ &&
!waiting_for_clear_plugin_data_ &&
!waiting_for_clear_pnacl_cache_ &&
@@ -1003,6 +1015,19 @@ void BrowsingDataRemover::OnClearPlatformKeys(
}
#endif
+
+void BrowsingDataRemover::OnClearedPasswords() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ waiting_for_clear_passwords_ = false;
+ TrimAffiliationCache();
Mike West 2015/05/13 15:20:06 Ideally, we'd wait on this as well.
+ NotifyAndDeleteIfDone();
+}
+
+void BrowsingDataRemover::TrimAffiliationCache() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ PasswordStoreFactory::TrimOrDeleteAffiliationCache(profile_);
Mike West 2015/05/13 15:20:06 Ideally, we'd have tests showing that this method
+}
+
void BrowsingDataRemover::OnClearedCookies(int num_deleted) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(

Powered by Google App Engine
This is Rietveld 408576698