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

Unified Diff: components/offline_pages/offline_page_model.cc

Issue 1741123002: Add removal filter support for Cookies, Storage, and Content Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios fix, and fixed test Created 4 years, 9 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: components/offline_pages/offline_page_model.cc
diff --git a/components/offline_pages/offline_page_model.cc b/components/offline_pages/offline_page_model.cc
index 50698ff51e6d8d5f6fe2f9a9c68202f68d80234d..4a9944727257cb3d6aa9c97e77adee04d3850934 100644
--- a/components/offline_pages/offline_page_model.cc
+++ b/components/offline_pages/offline_page_model.cc
@@ -285,6 +285,22 @@ void OfflinePageModel::ClearAll(const base::Closure& callback) {
weak_ptr_factory_.GetWeakPtr(), callback));
}
+void OfflinePageModel::ClearWithURLPredicate(
+ const base::Callback<bool(const GURL&)> predicate,
+ const base::Closure& callback) {
+ DCHECK(is_loaded_);
+
+ std::vector<int64_t> offline_ids;
+ for (const auto& id_page_pair : offline_pages_) {
+ if (predicate.Run(GURL(id_page_pair.second.url)))
+ offline_ids.push_back(id_page_pair.first);
+ }
+ DeletePagesByOfflineId(
+ offline_ids,
+ base::Bind(&OfflinePageModel::OnRemoveAllFilesDoneForClearAll,
+ weak_ptr_factory_.GetWeakPtr(), callback));
+}
+
bool OfflinePageModel::HasOfflinePages() const {
// Since offline pages feature is enabled by default,
// NetErrorTabHelper::SetHasOfflinePages might call this before the model is

Powered by Google App Engine
This is Rietveld 408576698