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

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

Issue 2221143003: Formalize the restrictions of BrowsingDataRemover::RemoveWithFilter() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Explicit task count. Created 4 years, 4 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 cf73ad4c134a14fae4fa4b4093eef0c4b7799baa..cd5df4ebf7bc89c53330fa9f12bb7934b578cfe0 100644
--- a/chrome/browser/browsing_data/browsing_data_remover.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover.cc
@@ -350,6 +350,7 @@ void BrowsingDataRemover::RemoveWithFilter(
int remove_mask,
int origin_type_mask,
std::unique_ptr<BrowsingDataFilterBuilder> filter_builder) {
+ DCHECK_EQ(0, remove_mask & ~FILTERABLE_DATATYPES);
DCHECK(filter_builder);
RemoveInternal(time_range, remove_mask, origin_type_mask,
std::move(filter_builder), nullptr);
@@ -361,6 +362,7 @@ void BrowsingDataRemover::RemoveWithFilterAndReply(
int origin_type_mask,
std::unique_ptr<BrowsingDataFilterBuilder> filter_builder,
Observer* observer) {
+ DCHECK_EQ(0, remove_mask & ~FILTERABLE_DATATYPES);
DCHECK(filter_builder);
DCHECK(observer);
RemoveInternal(time_range, remove_mask, origin_type_mask,
@@ -416,6 +418,16 @@ void BrowsingDataRemover::RemoveImpl(
int remove_mask,
const BrowsingDataFilterBuilder& filter_builder,
int origin_type_mask) {
+ // =============== README before adding more storage backends ===============
+ //
+ // If you're adding a data storage backend that is included among
+ // RemoveDataMask::FILTERABLE_DATATYPES, you must do one of the following:
+ // 1. Support one of the filters generated by |filter_builder|.
+ // 2. Add a comment explaining why is it acceptable in your case to delete all
+ // data without filtering URLs / origins / domains.
+ // 3. Do not support partial deletion, i.e. only delete your data if
+ // |filter_builder.IsEmptyBlacklist()|. Add a comment explaining why this
+ // is acceptable.
DCHECK_CURRENTLY_ON(BrowserThread::UI);
waiting_for_synchronous_clear_operations_ = true;
@@ -1022,7 +1034,9 @@ void BrowsingDataRemover::RemoveImpl(
#endif // defined(ENABLE_PLUGINS)
}
- // Remove omnibox zero-suggest cache results.
+ // Remove omnibox zero-suggest cache results. Filtering is not supported.
+ // This is not a problem, as deleting more data than necessary will just cause
+ // another server round-trip; no data is actually lost.
if ((remove_mask & (REMOVE_CACHE | REMOVE_COOKIES)))
prefs->SetString(omnibox::kZeroSuggestCachedResults, std::string());

Powered by Google App Engine
This is Rietveld 408576698