OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 // GENERATED FROM THE API DEFINITION IN |
| 6 // chrome/common/extensions/api/experimental.declarative.json |
| 7 // DO NOT EDIT. |
| 8 |
| 9 #ifndef CHROME_COMMON_EXTENSIONS_API_EXPERIMENTAL_DECLARATIVE_H__ |
| 10 #define CHROME_COMMON_EXTENSIONS_API_EXPERIMENTAL_DECLARATIVE_H__ |
| 11 #pragma once |
| 12 |
| 13 #include <string> |
| 14 #include <vector> |
| 15 |
| 16 #include "base/basictypes.h" |
| 17 #include "base/memory/linked_ptr.h" |
| 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/values.h" |
| 20 |
| 21 using base::Value; |
| 22 using base::DictionaryValue; |
| 23 using base::ListValue; |
| 24 |
| 25 namespace extensions { |
| 26 namespace api { |
| 27 namespace experimental_declarative { |
| 28 |
| 29 // |
| 30 // Types |
| 31 // |
| 32 |
| 33 // Description of a declarative rule for handling events. |
| 34 struct Rule { |
| 35 ~Rule(); |
| 36 Rule(); |
| 37 |
| 38 // Optional priority of this rule. Defaults to 100. |
| 39 scoped_ptr<int> priority; |
| 40 |
| 41 // List of conditions that can trigger the actions. |
| 42 std::vector<linked_ptr<DictionaryValue> > conditions; |
| 43 |
| 44 // Optional identifier that allows referencing this rule. |
| 45 scoped_ptr<std::string> id; |
| 46 |
| 47 // List of actions that are triggered if one of the condtions is fulfilled. |
| 48 std::vector<linked_ptr<DictionaryValue> > actions; |
| 49 |
| 50 // Populates a Rule object from a Value. Returns whether |out| was |
| 51 // successfully populated. |
| 52 static bool Populate(const Value& value, Rule* out); |
| 53 |
| 54 // Returns a new DictionaryValue representing the serialized form of this |
| 55 // Rule object. Passesownership to caller. |
| 56 DictionaryValue* ToValue() const; |
| 57 |
| 58 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(Rule); |
| 60 }; |
| 61 |
| 62 // |
| 63 // Functions |
| 64 // |
| 65 |
| 66 namespace GetRules { |
| 67 struct Params { |
| 68 // Name of the event this function affects. |
| 69 // If non-empty, only rules with identifiers contained in this array are |
| 70 // returned. |
| 71 // Name of the event this function affects. |
| 72 std::string event; |
| 73 |
| 74 // If non-empty, only rules with identifiers contained in this array are |
| 75 // returned. |
| 76 std::vector<std::string> rule_identifiers; |
| 77 |
| 78 |
| 79 ~Params(); |
| 80 |
| 81 static scoped_ptr<Params> Create(const ListValue& args); |
| 82 |
| 83 private: |
| 84 Params(); |
| 85 |
| 86 DISALLOW_COPY_AND_ASSIGN(Params); |
| 87 }; |
| 88 |
| 89 class Result { |
| 90 public: |
| 91 // Rules that were registered, the optional parameters are filled with |
| 92 // values. |
| 93 static Value* Create(const std::vector<linked_ptr<Rule> > rules); |
| 94 |
| 95 private: |
| 96 Result() {}; |
| 97 DISALLOW_COPY_AND_ASSIGN(Result); |
| 98 }; |
| 99 |
| 100 }; |
| 101 |
| 102 namespace RemoveRules { |
| 103 struct Params { |
| 104 // Name of the event this function affects. |
| 105 // If non-empty, only rules with identifiers contained in this array are |
| 106 // unregistered. |
| 107 // Name of the event this function affects. |
| 108 std::string event; |
| 109 |
| 110 // If non-empty, only rules with identifiers contained in this array are |
| 111 // unregistered. |
| 112 std::vector<std::string> rule_identifiers; |
| 113 |
| 114 |
| 115 ~Params(); |
| 116 |
| 117 static scoped_ptr<Params> Create(const ListValue& args); |
| 118 |
| 119 private: |
| 120 Params(); |
| 121 |
| 122 DISALLOW_COPY_AND_ASSIGN(Params); |
| 123 }; |
| 124 |
| 125 class Result { |
| 126 public: |
| 127 static Value* Create(); |
| 128 |
| 129 private: |
| 130 Result() {}; |
| 131 DISALLOW_COPY_AND_ASSIGN(Result); |
| 132 }; |
| 133 |
| 134 }; |
| 135 |
| 136 namespace AddRules { |
| 137 struct Params { |
| 138 // Name of the event this function affects. |
| 139 // Rules to be registered. These do not replace previously registered rules. |
| 140 // Name of the event this function affects. |
| 141 std::string event; |
| 142 |
| 143 // Rules to be registered. These do not replace previously registered rules. |
| 144 std::vector<linked_ptr<Rule> > rules; |
| 145 |
| 146 |
| 147 ~Params(); |
| 148 |
| 149 static scoped_ptr<Params> Create(const ListValue& args); |
| 150 |
| 151 private: |
| 152 Params(); |
| 153 |
| 154 DISALLOW_COPY_AND_ASSIGN(Params); |
| 155 }; |
| 156 |
| 157 class Result { |
| 158 public: |
| 159 // Rules that were registered, the optional parameters are filled with |
| 160 // values. |
| 161 static Value* Create(const std::vector<linked_ptr<Rule> > rules); |
| 162 |
| 163 private: |
| 164 Result() {}; |
| 165 DISALLOW_COPY_AND_ASSIGN(Result); |
| 166 }; |
| 167 |
| 168 }; |
| 169 |
| 170 |
| 171 } // experimental_declarative |
| 172 } // api |
| 173 } // extensions |
| 174 |
| 175 #endif // CHROME_COMMON_EXTENSIONS_API_EXPERIMENTAL_DECLARATIVE_H__ |
OLD | NEW |