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

Unified Diff: chrome/browser/browsing_data/origin_filter_builder.h

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: comments Created 4 years, 10 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/origin_filter_builder.h
diff --git a/chrome/browser/browsing_data/origin_filter_builder.h b/chrome/browser/browsing_data/origin_filter_builder.h
index 092ec42b161422ee8c87132d9a155c3d8e2fe4f7..945de0fb5aa36dd0c1a00f7c3efc80095c1e875a 100644
--- a/chrome/browser/browsing_data/origin_filter_builder.h
+++ b/chrome/browser/browsing_data/origin_filter_builder.h
@@ -13,12 +13,16 @@
#include "url/gurl.h"
#include "url/origin.h"
+class ContentSettingsPattern;
+
// A class that constructs URL deletion filters (represented as GURL->bool
// predicates) that match certain origins.
class OriginFilterBuilder {
public:
enum Mode {
+ // This means that only the origins given will be deleted.
WHITELIST,
+ // This means that the origins given will NOT be deleted.
BLACKLIST
};
@@ -33,10 +37,18 @@ class OriginFilterBuilder {
// Sets the |mode| of the filter.
void SetMode(Mode mode);
+ // Returns if we're an empty blacklist, where we delete everything.
+ bool IsEmptyBlacklist() const;
+
// Builds a filter that matches URLs whose origins are in the whitelist,
// or aren't in the blacklist.
base::Callback<bool(const GURL&)> BuildSameOriginFilter() const;
+ // Builds a filter that matches ContentSettingsPatterns whose origins are in
+ // the whitelist, or aren't in the blacklist.
+ base::Callback<bool(const ContentSettingsPattern& pattern)>
+ BuildSameOriginContentSettingsFilter() const;
+
// Build a filter that matches URLs whose origins, or origins obtained by
// replacing the host with any superdomain, are listed in the whitelist,
// or are not listed in the blacklist.
@@ -52,6 +64,14 @@ class OriginFilterBuilder {
static bool MatchesURL(
std::set<url::Origin>* origins, Mode mode, const GURL& url);
+ // True if the origin of pattern is in the whitelist, or isn't in the
+ // blacklist.
+ // The whitelist or blacklist is represented as |origins| and |mode|.
+ static bool MatchesContentSettingsPattern(
+ std::set<url::Origin>* origins,
+ Mode mode,
+ const ContentSettingsPattern& pattern);
+
// True if any origin [scheme, host, port], such that |url| has the same
// scheme and port, and |url|'s host is the same or a subdomain of that host,
// is in the whitelist, or isn't in the blacklist. The whitelist or blacklist

Powered by Google App Engine
This is Rietveld 408576698