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_H__ |
| 10 #define CHROME_COMMON_EXTENSIONS_API_EXPERIMENTAL_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 namespace extensions { |
| 22 namespace api { |
| 23 namespace experimental { |
| 24 |
| 25 // |
| 26 // Types |
| 27 // |
| 28 |
| 29 // Description of a declarative rule for handling events. |
| 30 struct Rule { |
| 31 ~Rule(); |
| 32 Rule(); |
| 33 |
| 34 // Optional priority of this rule. Defaults to 100. |
| 35 scoped_ptr<int> priority; |
| 36 |
| 37 // List of conditions that can trigger the actions. |
| 38 std::vector<linked_ptr<DictionaryValue> > conditions; |
| 39 |
| 40 // Optional identifier that allows referencing this rule. |
| 41 scoped_ptr<std::string> id; |
| 42 |
| 43 // List of actions that are triggered if one of the condtions is fulfilled. |
| 44 std::vector<linked_ptr<DictionaryValue> > actions; |
| 45 |
| 46 // Populates a Rule object from a Value. Returns whether |out| was |
| 47 // successfully populated. |
| 48 static bool Populate(const Value& value, Rule* out); |
| 49 |
| 50 // Returns a new DictionaryValue representing the serialized form of this |
| 51 // Rule object. Passes ownership to caller. |
| 52 scoped_ptr<DictionaryValue> ToValue() const; |
| 53 |
| 54 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(Rule); |
| 56 }; |
| 57 |
| 58 // |
| 59 // Functions |
| 60 // |
| 61 |
| 62 namespace GetRules { |
| 63 struct Params { |
| 64 // Name of the event this function affects. |
| 65 std::string event; |
| 66 |
| 67 // If an array is passed, only rules with identifiers contained in this arra
y |
| 68 // are returned. |
| 69 scoped_ptr<std::vector<std::string> > rule_identifiers; |
| 70 |
| 71 ~Params(); |
| 72 |
| 73 static scoped_ptr<Params> Create(const ListValue& args); |
| 74 |
| 75 private: |
| 76 Params(); |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(Params); |
| 79 }; |
| 80 |
| 81 namespace Result { |
| 82 // Rules that were registered, the optional parameters are filled with |
| 83 // values. |
| 84 Value* Create(const std::vector<linked_ptr<Rule> >& rules); |
| 85 }; |
| 86 |
| 87 }; |
| 88 |
| 89 namespace RemoveRules { |
| 90 struct Params { |
| 91 // Name of the event this function affects. |
| 92 std::string event; |
| 93 |
| 94 // If an array is passed, only rules with identifiers contained in this arra
y |
| 95 // are unregistered. |
| 96 scoped_ptr<std::vector<std::string> > rule_identifiers; |
| 97 |
| 98 ~Params(); |
| 99 |
| 100 static scoped_ptr<Params> Create(const ListValue& args); |
| 101 |
| 102 private: |
| 103 Params(); |
| 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(Params); |
| 106 }; |
| 107 |
| 108 namespace Result { |
| 109 Value* Create(); |
| 110 }; |
| 111 |
| 112 }; |
| 113 |
| 114 namespace AddRules { |
| 115 struct Params { |
| 116 // Name of the event this function affects. |
| 117 std::string event; |
| 118 |
| 119 // Rules to be registered. These do not replace previously registered rules. |
| 120 std::vector<linked_ptr<Rule> > rules; |
| 121 |
| 122 ~Params(); |
| 123 |
| 124 static scoped_ptr<Params> Create(const ListValue& args); |
| 125 |
| 126 private: |
| 127 Params(); |
| 128 |
| 129 DISALLOW_COPY_AND_ASSIGN(Params); |
| 130 }; |
| 131 |
| 132 namespace Result { |
| 133 // Rules that were registered, the optional parameters are filled with |
| 134 // values. |
| 135 Value* Create(const std::vector<linked_ptr<Rule> >& rules); |
| 136 }; |
| 137 |
| 138 }; |
| 139 |
| 140 |
| 141 } // experimental |
| 142 } // api |
| 143 } // extensions |
| 144 |
| 145 #endif // CHROME_COMMON_EXTENSIONS_API_EXPERIMENTAL_H__ |
OLD | NEW |