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

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: Renamed class, comments Created 4 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: 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 af089d4d4edbb6a5e2a5c35af14898c8b31d5842..8f933fc993490a940f3f08824bf9919f87ffed28 100644
--- a/components/offline_pages/offline_page_model.cc
+++ b/components/offline_pages/offline_page_model.cc
@@ -288,6 +288,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_);
fgorski 2016/04/07 17:02:49 You can push back to delayed tasks here if you wan
dmurph 2016/04/08 23:33:45 Done.
+
+ std::vector<int64_t> offline_ids;
+ for (const auto& id_page_pair : offline_pages_) {
+ if (predicate.Run(GURL(id_page_pair.second.url)))
fgorski 2016/04/07 17:02:49 id_page_pair.second.url is already a GURL. Anothe
dmurph 2016/04/08 23:33:45 Done.
+ offline_ids.push_back(id_page_pair.first);
+ }
+ DeletePagesByOfflineId(
+ offline_ids,
+ base::Bind(&OfflinePageModel::OnRemoveAllFilesDoneForClearAll,
fgorski 2016/04/07 17:02:49 No this will not do, as this wipes the whole store
dmurph 2016/04/08 23:33:45 Whoops, thanks.
+ 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