| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // DeclarativeRule<>, DeclarativeConditionSet<>, and DeclarativeActionSet<> | 5 // DeclarativeRule<>, DeclarativeConditionSet<>, and DeclarativeActionSet<> |
| 6 // templates usable with multiple different declarativeFoo systems. These are | 6 // templates usable with multiple different declarativeFoo systems. These are |
| 7 // templated on the Condition and Action types that define the behavior of a | 7 // templated on the Condition and Action types that define the behavior of a |
| 8 // particular declarative event. | 8 // particular declarative event. |
| 9 | 9 |
| 10 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_RULE_H__ | 10 #ifndef EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_RULE_H__ |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // ConditionT and ActionT. | 196 // ConditionT and ActionT. |
| 197 template<typename ConditionT, typename ActionT> | 197 template<typename ConditionT, typename ActionT> |
| 198 class DeclarativeRule { | 198 class DeclarativeRule { |
| 199 public: | 199 public: |
| 200 typedef std::string ExtensionId; | 200 typedef std::string ExtensionId; |
| 201 typedef std::string RuleId; | 201 typedef std::string RuleId; |
| 202 typedef std::pair<ExtensionId, RuleId> GlobalRuleId; | 202 typedef std::pair<ExtensionId, RuleId> GlobalRuleId; |
| 203 typedef int Priority; | 203 typedef int Priority; |
| 204 typedef DeclarativeConditionSet<ConditionT> ConditionSet; | 204 typedef DeclarativeConditionSet<ConditionT> ConditionSet; |
| 205 typedef DeclarativeActionSet<ActionT> ActionSet; | 205 typedef DeclarativeActionSet<ActionT> ActionSet; |
| 206 typedef extensions::core_api::events::Rule JsonRule; | 206 typedef extensions::api::events::Rule JsonRule; |
| 207 typedef std::vector<std::string> Tags; | 207 typedef std::vector<std::string> Tags; |
| 208 | 208 |
| 209 // Checks whether the set of |conditions| and |actions| are consistent. | 209 // Checks whether the set of |conditions| and |actions| are consistent. |
| 210 // Returns true in case of consistency and MUST set |error| otherwise. | 210 // Returns true in case of consistency and MUST set |error| otherwise. |
| 211 typedef base::Callback<bool(const ConditionSet* conditions, | 211 typedef base::Callback<bool(const ConditionSet* conditions, |
| 212 const ActionSet* actions, | 212 const ActionSet* actions, |
| 213 std::string* error)> ConsistencyChecker; | 213 std::string* error)> ConsistencyChecker; |
| 214 | 214 |
| 215 DeclarativeRule(const GlobalRuleId& id, | 215 DeclarativeRule(const GlobalRuleId& id, |
| 216 const Tags& tags, | 216 const Tags& tags, |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 } | 496 } |
| 497 | 497 |
| 498 template<typename ConditionT, typename ActionT> | 498 template<typename ConditionT, typename ActionT> |
| 499 int DeclarativeRule<ConditionT, ActionT>::GetMinimumPriority() const { | 499 int DeclarativeRule<ConditionT, ActionT>::GetMinimumPriority() const { |
| 500 return actions_->GetMinimumPriority(); | 500 return actions_->GetMinimumPriority(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace extensions | 503 } // namespace extensions |
| 504 | 504 |
| 505 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_RULE_H__ | 505 #endif // EXTENSIONS_BROWSER_API_DECLARATIVE_DECLARATIVE_RULE_H__ |
| OLD | NEW |