| 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..c0c6a068691ba6e885f5c6ee5b9d1561a3a28f51 100644
|
| --- a/chrome/browser/browsing_data/origin_filter_builder.h
|
| +++ b/chrome/browser/browsing_data/origin_filter_builder.h
|
| @@ -10,15 +10,20 @@
|
| #include <vector>
|
|
|
| #include "base/callback.h"
|
| +#include "net/cookies/canonical_cookie.h"
|
| #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 +38,28 @@ 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;
|
| +
|
| + // Since cookies don't have a scheme (they are a superset of origins, and all
|
| + // origins with the cookie's domain can see the cookie), we check to see if
|
| + // any of the origins have the same domain as the cookie.
|
| + // * If we're a blacklist, we will return true (to delete) if NONE of the
|
| + // constructed GURLs are in the origin list.
|
| + // * If we're a whitelist, we will return true (to delete) if ANY of the
|
| + // constructed GURLS are in the origin list.
|
| + base::Callback<bool(const net::CanonicalCookie& pattern)>
|
| + BuildDomainCookieFilter() 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 +75,21 @@ 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 none of the scheme + cookie.domain patterns are in the origins and
|
| + // we're a blacklist, or any of them are in the origins and we're a whitelist.
|
| + // The whitelist or blacklist is represented as |origins| and |mode|.
|
| + static bool MatchesCookieWithAllSchemes(std::set<url::Origin>* origins,
|
| + Mode mode,
|
| + const net::CanonicalCookie& cookie);
|
| +
|
| // 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
|
|
|