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

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

Issue 2716333002: Implement important sites dialog for desktop. (Closed)
Patch Set: rename util file and remove pure static class Created 3 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: chrome/browser/browsing_data/browsing_data_important_sites_util.cc
diff --git a/chrome/browser/browsing_data/browsing_data_important_sites_util.cc b/chrome/browser/browsing_data/browsing_data_important_sites_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..62698827c7e1e89c9f281140ee8ab4a958404638
--- /dev/null
+++ b/chrome/browser/browsing_data/browsing_data_important_sites_util.cc
@@ -0,0 +1,52 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/browsing_data/browsing_data_important_sites_util.h"
+
+#include "content/public/browser/browsing_data_filter_builder.h"
+
+namespace browsing_data_important_sites_util {
+
+void Remove(int remove_mask,
+ int origin_mask,
+ browsing_data::TimePeriod time_period,
+ const std::vector<std::string>& excluded_domains,
+ BrowsingDataRemover* remover,
+ BrowsingDataRemover::Observer* observer) {
+ int filterable_mask =
+ remove_mask & BrowsingDataRemover::IMPORTANT_SITES_DATATYPES;
+ int nonfilterable_mask =
+ remove_mask & ~BrowsingDataRemover::IMPORTANT_SITES_DATATYPES;
+
+ std::unique_ptr<content::BrowsingDataFilterBuilder> filter_builder(
dmurph 2017/03/06 21:16:47 Unless I'm contradicting something, can you bring
dullweber 2017/03/07 12:24:34 I moved it back. I think the relevant part that sh
+ content::BrowsingDataFilterBuilder::Create(
+ content::BrowsingDataFilterBuilder::BLACKLIST));
+ for (const std::string& domain : excluded_domains) {
+ filter_builder->AddRegisterableDomain(domain);
+ }
+
+ browsing_data::RecordDeletionForPeriod(time_period);
+
+ if (filterable_mask) {
+ remover->RemoveWithFilterAndReply(
+ browsing_data::CalculateBeginDeleteTime(time_period),
+ browsing_data::CalculateEndDeleteTime(time_period), filterable_mask,
+ origin_mask, std::move(filter_builder), observer);
+ } else {
+ // Make sure |observer| doesn't wait for the filtered task.
+ observer->OnBrowsingDataRemoverDone();
+ }
+
+ if (nonfilterable_mask) {
+ remover->RemoveAndReply(
+ browsing_data::CalculateBeginDeleteTime(time_period),
+ browsing_data::CalculateEndDeleteTime(time_period), nonfilterable_mask,
+ origin_mask, observer);
+ } else {
+ // Make sure |observer| doesn't wait for the non-filtered task.
+ observer->OnBrowsingDataRemoverDone();
+ }
+}
+
+} // namespace browsing_data_important_sites_util

Powered by Google App Engine
This is Rietveld 408576698