| Index: components/subresource_filter/core/common/indexed_ruleset.cc
|
| diff --git a/components/subresource_filter/core/common/indexed_ruleset.cc b/components/subresource_filter/core/common/indexed_ruleset.cc
|
| index edbbee88c9d1283af1ac0e1bf198c0d279d39ebc..5f991dc80ea8aa3f72ab6a99586e6564faa1f057 100644
|
| --- a/components/subresource_filter/core/common/indexed_ruleset.cc
|
| +++ b/components/subresource_filter/core/common/indexed_ruleset.cc
|
| @@ -1,3 +1,4 @@
|
| +
|
| // Copyright 2016 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.
|
| @@ -61,10 +62,17 @@ bool IndexedRulesetMatcher::Verify(const uint8_t* buffer, size_t size) {
|
| }
|
|
|
| IndexedRulesetMatcher::IndexedRulesetMatcher(const uint8_t* buffer, size_t size)
|
| + : IndexedRulesetMatcher(buffer, size, nullptr) {}
|
| +
|
| +IndexedRulesetMatcher::IndexedRulesetMatcher(
|
| + const uint8_t* buffer,
|
| + size_t size,
|
| + std::unique_ptr<RuleRecorder> recorder)
|
| : root_(flat::GetIndexedRuleset(buffer)),
|
| blacklist_(root_->blacklist_index()),
|
| whitelist_(root_->whitelist_index()),
|
| - deactivation_(root_->deactivation_index()) {}
|
| + deactivation_(root_->deactivation_index()),
|
| + recorder_(std::move(recorder)) {}
|
|
|
| bool IndexedRulesetMatcher::ShouldDisableFilteringForDocument(
|
| const GURL& document_url,
|
| @@ -74,7 +82,7 @@ bool IndexedRulesetMatcher::ShouldDisableFilteringForDocument(
|
| document_url, parent_document_origin, proto::ELEMENT_TYPE_UNSPECIFIED,
|
| activation_type,
|
| FirstPartyOrigin::IsThirdParty(document_url, parent_document_origin),
|
| - false);
|
| + false, nullptr);
|
| }
|
|
|
| bool IndexedRulesetMatcher::ShouldDisallowResourceLoad(
|
| @@ -85,10 +93,12 @@ bool IndexedRulesetMatcher::ShouldDisallowResourceLoad(
|
| const bool is_third_party = first_party.IsThirdParty(url);
|
| return !!blacklist_.FindMatch(url, first_party.origin(), element_type,
|
| proto::ACTIVATION_TYPE_UNSPECIFIED,
|
| - is_third_party, disable_generic_rules) &&
|
| + is_third_party, disable_generic_rules,
|
| + recorder_.get()) &&
|
| !whitelist_.FindMatch(url, first_party.origin(), element_type,
|
| proto::ACTIVATION_TYPE_UNSPECIFIED,
|
| - is_third_party, disable_generic_rules);
|
| + is_third_party, disable_generic_rules,
|
| + recorder_.get());
|
| }
|
|
|
| } // namespace subresource_filter
|
|
|