OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_NET_REQUEST_CONSTANTS_H_ |
| 6 #define EXTENSIONS_BROWSER_API_DECLARATIVE_NET_REQUEST_CONSTANTS_H_ |
| 7 |
| 8 #include "components/subresource_filter/core/common/flat/url_pattern_index_gener
ated.h" |
| 9 #include "extensions/common/api/declarative_net_request.h" |
| 10 |
| 11 namespace extensions { |
| 12 namespace declarative_net_request { |
| 13 |
| 14 enum class ParseResult { |
| 15 SUCCESS, |
| 16 ERROR_LIST_NOT_PASSED, |
| 17 ERROR_DUPLICATE_IDS, |
| 18 ERROR_RESOURCE_TYPE_DUPLICATED, |
| 19 ERROR_PERSISTING_RULESET, |
| 20 ERROR_EMPTY_REDIRECT_RULE_PRIORITY, |
| 21 ERROR_EMPTY_REDIRECT_URL, |
| 22 ERROR_INVALID_RULE_ID, |
| 23 ERROR_INVALID_REDIRECT_RULE_PRIORITY, |
| 24 ERROR_JSON_PARSE, |
| 25 }; |
| 26 |
| 27 using Rule = extensions::api::declarative_net_request::Rule; |
| 28 |
| 29 using UrlPatternType = subresource_filter::flat::UrlPatternType; |
| 30 |
| 31 using AnchorType = subresource_filter::flat::AnchorType; |
| 32 |
| 33 using ActivationType = subresource_filter::flat::ActivationType; |
| 34 |
| 35 // URL rule matching options. These correspond to multiple fields of |
| 36 // subresource_filter::proto::UrlRule, but here, they are represented as flags |
| 37 // of the same bitmask to allow for compact storage. |
| 38 using OptionFlag = subresource_filter::flat::OptionFlag; |
| 39 |
| 40 using ElementType = subresource_filter::flat::ElementType; |
| 41 |
| 42 // JSON keys for the API. |
| 43 constexpr char kActionTypeKey[] = "type"; |
| 44 constexpr char kRedirectUrlKey[] = "redirectUrl"; |
| 45 constexpr char kURLFilterKey[] = "urlFilter"; |
| 46 constexpr char kURLFilterIsCaseSensitiveKey[] = "urlFilterIsCaseSensitive"; |
| 47 constexpr char kDomainsKey[] = "domains"; |
| 48 constexpr char kExcludedDomainsKey[] = "excludedDomains"; |
| 49 constexpr char kResourceTypesKey[] = "resourceTypes"; |
| 50 constexpr char kExcludeResourceTypesKey[] = "excludeResourceTypes"; |
| 51 constexpr char kDomainTypeKey[] = "domainType"; |
| 52 constexpr char kRuleIDKey[] = "id"; |
| 53 constexpr char kRulePriorityKey[] = "priority"; |
| 54 constexpr char kRuleConditionKey[] = "condition"; |
| 55 constexpr char kRuleActionKey[] = "action"; |
| 56 constexpr char kAPIName[] = "declarativeNetRequest"; |
| 57 constexpr int kMinValidID = 0; |
| 58 constexpr int kMinValidPriority = 0; |
| 59 constexpr int kDefaultPriority = 0; |
| 60 |
| 61 } // namespace declarative_net_request |
| 62 } // namespace extension |
| 63 |
| 64 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_NET_REQUEST_CONSTANTS_H_ |
OLD | NEW |