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

Side by Side Diff: components/subresource_filter/core/common/indexed_ruleset.cc

Issue 2954613002: UrlPatternIndex: Introduce ElementType and ActivationType enums to url_pattern_index schema. (Closed)
Patch Set: Address review. Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/url_pattern_index/flat/url_pattern_index.fbs » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/subresource_filter/core/common/indexed_ruleset.h" 5 #include "components/subresource_filter/core/common/indexed_ruleset.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/subresource_filter/core/common/first_party_origin.h" 8 #include "components/subresource_filter/core/common/first_party_origin.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 #include "url/origin.h" 10 #include "url/origin.h"
11 11
12 namespace subresource_filter { 12 namespace subresource_filter {
13 13
14 namespace proto = url_pattern_index::proto; 14 namespace proto = url_pattern_index::proto;
15 15
16 // RulesetIndexer -------------------------------------------------------------- 16 // RulesetIndexer --------------------------------------------------------------
17 17
18 // static 18 // static
19 const int RulesetIndexer::kIndexedFormatVersion = 17; 19 const int RulesetIndexer::kIndexedFormatVersion = 18;
20 20
21 RulesetIndexer::RulesetIndexer() 21 RulesetIndexer::RulesetIndexer()
22 : blacklist_(&builder_), whitelist_(&builder_), deactivation_(&builder_) {} 22 : blacklist_(&builder_), whitelist_(&builder_), deactivation_(&builder_) {}
23 23
24 RulesetIndexer::~RulesetIndexer() = default; 24 RulesetIndexer::~RulesetIndexer() = default;
25 25
26 bool RulesetIndexer::AddUrlRule(const proto::UrlRule& rule) { 26 bool RulesetIndexer::AddUrlRule(const proto::UrlRule& rule) {
27 const auto offset = url_pattern_index::SerializeUrlRule(rule, &builder_); 27 const auto offset = url_pattern_index::SerializeUrlRule(rule, &builder_);
28 // Note: A zero offset.o means a "nullptr" offset. It is returned when the 28 // Note: A zero offset.o means a "nullptr" offset. It is returned when the
29 // rule has not been serialized. 29 // rule has not been serialized.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const bool is_third_party = first_party.IsThirdParty(url); 87 const bool is_third_party = first_party.IsThirdParty(url);
88 return !!blacklist_.FindMatch(url, first_party.origin(), element_type, 88 return !!blacklist_.FindMatch(url, first_party.origin(), element_type,
89 proto::ACTIVATION_TYPE_UNSPECIFIED, 89 proto::ACTIVATION_TYPE_UNSPECIFIED,
90 is_third_party, disable_generic_rules) && 90 is_third_party, disable_generic_rules) &&
91 !whitelist_.FindMatch(url, first_party.origin(), element_type, 91 !whitelist_.FindMatch(url, first_party.origin(), element_type,
92 proto::ACTIVATION_TYPE_UNSPECIFIED, 92 proto::ACTIVATION_TYPE_UNSPECIFIED,
93 is_third_party, disable_generic_rules); 93 is_third_party, disable_generic_rules);
94 } 94 }
95 95
96 } // namespace subresource_filter 96 } // namespace subresource_filter
OLDNEW
« no previous file with comments | « no previous file | components/url_pattern_index/flat/url_pattern_index.fbs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698