Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ | 5 #ifndef COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ |
| 6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ | 6 #define COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
| 13 #include "components/subresource_filter/core/common/proto/rules.pb.h" | 13 #include "components/subresource_filter/core/common/proto/rules.pb.h" |
| 14 | 14 |
| 15 namespace subresource_filter { | 15 namespace subresource_filter { |
| 16 namespace testing { | 16 namespace testing { |
| 17 | 17 |
| 18 // Creates a simple blacklist URL rule from a |pattern| of a certain |type|. The | |
|
engedy
2017/04/05 10:55:11
This is used only by a single call site to create
pkalinnikov
2017/04/05 13:29:21
SGTM. However, such a rule would be considered uns
engedy
2017/04/05 13:41:33
Sounds good.
| |
| 19 // anchors of the rule's pattern are set to ANCHOR_TYPE_NONE, and the rule | |
| 20 // targets all element types. | |
| 21 proto::UrlRule CreateUrlRule(base::StringPiece pattern, | |
| 22 proto::UrlPatternType pattern_type); | |
| 23 | |
| 24 // Creates a blacklist URL rule which targets subresources of any type such that | |
|
engedy
2017/04/05 10:55:10
nit: ... such that the resource URL ends with |suf
pkalinnikov
2017/04/05 13:29:21
Done.
| |
| 25 // their URLs end with |suffix|. | |
| 18 proto::UrlRule CreateSuffixRule(base::StringPiece suffix); | 26 proto::UrlRule CreateSuffixRule(base::StringPiece suffix); |
| 19 | 27 |
| 28 // Same as CreateUrlRule(pattern, proto::URL_PATTERN_TYPE_WILDCARDED), but the | |
| 29 // rule applies to the specified |activation_types|, and to no element types. | |
| 30 // Additionally, it is restricted to a set of |domains| (if provided). | |
| 20 proto::UrlRule CreateWhitelistRuleForDocument( | 31 proto::UrlRule CreateWhitelistRuleForDocument( |
| 21 base::StringPiece pattern, | 32 base::StringPiece pattern, |
| 22 int32_t activation_types = proto::ACTIVATION_TYPE_DOCUMENT, | 33 int32_t activation_types = proto::ACTIVATION_TYPE_DOCUMENT, |
| 23 std::vector<std::string> domains = std::vector<std::string>()); | 34 std::vector<std::string> domains = std::vector<std::string>()); |
| 24 | 35 |
| 25 } // namespace testing | 36 } // namespace testing |
| 26 } // namespace subresource_filter | 37 } // namespace subresource_filter |
| 27 | 38 |
| 28 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ | 39 #endif // COMPONENTS_SUBRESOURCE_FILTER_CORE_COMMON_TEST_RULESET_UTILS_H_ |
| OLD | NEW |