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

Unified Diff: extensions/common/api/declarative_net_request/constants.h

Issue 2881453002: DNR Prototype: With flatbuffers
Patch Set: -- Created 3 years, 6 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: extensions/common/api/declarative_net_request/constants.h
diff --git a/extensions/common/api/declarative_net_request/constants.h b/extensions/common/api/declarative_net_request/constants.h
new file mode 100644
index 0000000000000000000000000000000000000000..69d3a22a6a698ef9af77ffa9896a4fa03328831b
--- /dev/null
+++ b/extensions/common/api/declarative_net_request/constants.h
@@ -0,0 +1,64 @@
+// Copyright 2017 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.
+
+#ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_NET_REQUEST_CONSTANTS_H_
+#define EXTENSIONS_BROWSER_API_DECLARATIVE_NET_REQUEST_CONSTANTS_H_
+
+#include "components/subresource_filter/core/common/flat/url_pattern_index_generated.h"
+#include "extensions/common/api/declarative_net_request.h"
+
+namespace extensions {
+namespace declarative_net_request {
+
+enum class ParseResult {
+ SUCCESS,
+ ERROR_LIST_NOT_PASSED,
+ ERROR_DUPLICATE_IDS,
+ ERROR_RESOURCE_TYPE_DUPLICATED,
+ ERROR_PERSISTING_RULESET,
+ ERROR_EMPTY_REDIRECT_RULE_PRIORITY,
+ ERROR_EMPTY_REDIRECT_URL,
+ ERROR_INVALID_RULE_ID,
+ ERROR_INVALID_REDIRECT_RULE_PRIORITY,
+ ERROR_JSON_PARSE,
+};
+
+using Rule = extensions::api::declarative_net_request::Rule;
+
+using UrlPatternType = subresource_filter::flat::UrlPatternType;
+
+using AnchorType = subresource_filter::flat::AnchorType;
+
+using ActivationType = subresource_filter::flat::ActivationType;
+
+// URL rule matching options. These correspond to multiple fields of
+// subresource_filter::proto::UrlRule, but here, they are represented as flags
+// of the same bitmask to allow for compact storage.
+using OptionFlag = subresource_filter::flat::OptionFlag;
+
+using ElementType = subresource_filter::flat::ElementType;
+
+// JSON keys for the API.
+constexpr char kActionTypeKey[] = "type";
+constexpr char kRedirectUrlKey[] = "redirectUrl";
+constexpr char kURLFilterKey[] = "urlFilter";
+constexpr char kURLFilterIsCaseSensitiveKey[] = "urlFilterIsCaseSensitive";
+constexpr char kDomainsKey[] = "domains";
+constexpr char kExcludedDomainsKey[] = "excludedDomains";
+constexpr char kResourceTypesKey[] = "resourceTypes";
+constexpr char kExcludeResourceTypesKey[] = "excludeResourceTypes";
+constexpr char kDomainTypeKey[] = "domainType";
+constexpr char kRuleIDKey[] = "id";
+constexpr char kRulePriorityKey[] = "priority";
+constexpr char kRuleConditionKey[] = "condition";
+constexpr char kRuleActionKey[] = "action";
+constexpr char kAPIName[] = "declarativeNetRequest";
+constexpr int kMinValidID = 0;
+constexpr int kMinValidPriority = 0;
+constexpr int kDefaultPriority = 0;
+
+} // namespace declarative_net_request
+} // namespace extension
+
+#endif // EXTENSIONS_BROWSER_API_DECLARATIVE_NET_REQUEST_CONSTANTS_H_
« no previous file with comments | « extensions/common/api/declarative_net_request/DEPS ('k') | extensions/common/api/declarative_net_request/indexed_rule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698