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

Unified Diff: components/subresource_filter/core/common/indexed_ruleset.h

Issue 2183883002: Implement deactivating SubresourceFilter for document. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@integrate_ruleset
Patch Set: Address more comments from engedy@ Created 4 years, 4 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/subresource_filter/core/common/indexed_ruleset.h
diff --git a/components/subresource_filter/core/common/indexed_ruleset.h b/components/subresource_filter/core/common/indexed_ruleset.h
index b0f8759a2880c71cdcc9db7b909b4222c278559f..f128d369fcb9533644a72bc28a120e0758ba45b8 100644
--- a/components/subresource_filter/core/common/indexed_ruleset.h
+++ b/components/subresource_filter/core/common/indexed_ruleset.h
@@ -112,12 +112,24 @@ class IndexedRulesetMatcher {
// |size|.
IndexedRulesetMatcher(const uint8_t* buffer, size_t size);
+ // Returns whether the subset of subresource filtering rules specified by the
+ // |activation_type| should be disabled for the |document| loaded from
+ // |parent_document_origin|. Always returns false if |activation_type| ==
+ // ACTIVATION_TYPE_UNSPECIFIED or the |document_url| is not valid. Unlike
+ // page-level activation, such rules can be used to have fine-grained control
+ // over the activation of filtering within (sub-)documents.
+ bool ShouldDisableFilteringForDocument(
+ const GURL& document_url,
+ const url::Origin& parent_document_origin,
+ proto::ActivationType activation_type) const;
+ // TODO(pkalinnikov): GetActivationTypesForDocument.
+
// Returns whether the network request to |url| of |element_type| initiated by
- // |initiator| is allowed to proceed. Always returns true, if the |url| is not
- // valid or |element_type| == ELEMENT_TYPE_UNSPECIFIED.
- bool IsAllowed(const GURL& url,
- const url::Origin& initiator,
- proto::ElementType element_type) const;
+ // |document_origin| is not allowed to proceed. Always returns false if the
+ // |url| is not valid or |element_type| == ELEMENT_TYPE_UNSPECIFIED.
+ bool ShouldDisallowResourceLoad(const GURL& url,
+ const url::Origin& document_origin,
+ proto::ElementType element_type) const;
private:
// Returns whether the network request matches a particular part of the index.
@@ -126,6 +138,7 @@ class IndexedRulesetMatcher {
const GURL& url,
const url::Origin& initiator,
proto::ElementType element_type,
+ proto::ActivationType activation_type,
bool is_third_party);
const flat::IndexedRuleset* root_;

Powered by Google App Engine
This is Rietveld 408576698