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__ | |
battre
2012/02/08 09:15:20
Should this go to chrome/common?
calamity
2012/02/09 00:56:52
Sorry, I'm not sure what you mean? The file is gen
battre
2012/02/09 09:00:47
I was wondering whether chrome/browser/extensions/
| |
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; | |
battre
2012/02/08 09:15:20
I think the style guide prohibits "bleeding using
calamity
2012/02/09 00:56:52
Moved to the .cc file.
| |
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. | |
battre
2012/02/08 09:15:20
nit: space after "Passes"
calamity
2012/02/09 00:56:52
Done.
| |
56 DictionaryValue* ToValue() const; | |
battre
2012/02/08 09:15:20
should this return a scoped_ptr?
calamity
2012/02/09 00:56:52
Done.
| |
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. | |
battre
2012/02/08 09:15:20
Why is the "Name of the event this function affect
calamity
2012/02/09 00:56:52
Done.
| |
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 ~Params(); | |
79 | |
80 static scoped_ptr<Params> Create(const ListValue& args); | |
81 | |
82 private: | |
83 Params(); | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(Params); | |
86 }; | |
87 | |
88 class Result { | |
89 public: | |
90 // Rules that were registered, the optional parameters are filled with | |
91 // values. | |
92 static Value* Create(const std::vector<linked_ptr<Rule> > rules); | |
93 | |
94 private: | |
95 Result() {}; | |
96 DISALLOW_COPY_AND_ASSIGN(Result); | |
97 }; | |
98 | |
99 }; | |
100 | |
101 namespace RemoveRules { | |
102 struct Params { | |
103 // Name of the event this function affects. | |
104 // If non-empty, only rules with identifiers contained in this array are | |
105 // unregistered. | |
106 // Name of the event this function affects. | |
107 std::string event; | |
108 | |
109 // If non-empty, only rules with identifiers contained in this array are | |
110 // unregistered. | |
111 std::vector<std::string> rule_identifiers; | |
112 | |
113 ~Params(); | |
114 | |
115 static scoped_ptr<Params> Create(const ListValue& args); | |
116 | |
117 private: | |
118 Params(); | |
119 | |
120 DISALLOW_COPY_AND_ASSIGN(Params); | |
121 }; | |
122 | |
123 class Result { | |
124 public: | |
125 static Value* Create(); | |
126 | |
127 private: | |
128 Result() {}; | |
129 DISALLOW_COPY_AND_ASSIGN(Result); | |
130 }; | |
131 | |
132 }; | |
133 | |
134 namespace AddRules { | |
135 struct Params { | |
136 // Name of the event this function affects. | |
137 // Rules to be registered. These do not replace previously registered rules. | |
138 // Name of the event this function affects. | |
139 std::string event; | |
140 | |
141 // Rules to be registered. These do not replace previously registered rules. | |
142 std::vector<linked_ptr<Rule> > rules; | |
143 | |
144 ~Params(); | |
145 | |
146 static scoped_ptr<Params> Create(const ListValue& args); | |
147 | |
148 private: | |
149 Params(); | |
150 | |
151 DISALLOW_COPY_AND_ASSIGN(Params); | |
152 }; | |
153 | |
154 class Result { | |
155 public: | |
156 // Rules that were registered, the optional parameters are filled with | |
157 // values. | |
158 static Value* Create(const std::vector<linked_ptr<Rule> > rules); | |
159 | |
160 private: | |
161 Result() {}; | |
162 DISALLOW_COPY_AND_ASSIGN(Result); | |
163 }; | |
164 | |
165 }; | |
166 | |
167 | |
168 } // experimental_declarative | |
169 } // api | |
170 } // extensions | |
171 | |
172 #endif // CHROME_COMMON_EXTENSIONS_API_EXPERIMENTAL_DECLARATIVE_H__ | |
OLD | NEW |