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 [ | |
6 { | |
7 "namespace": "declarative", | |
8 "internal": true, | |
9 "documentation_permissions_required": ["declarative"], | |
10 "types": [ | |
11 { | |
12 "id": "Rule", | |
13 "type": "object", | |
14 "description": "Description of a declarative rule for handling events.", | |
15 "properties": { | |
16 "id": { | |
17 "type": "string", | |
18 "optional": true, | |
19 "description": "Optional identifier that allows referencing this rul
e." | |
20 }, | |
21 "conditions": { | |
22 "type": "array", | |
23 "items": {"type": "any"}, | |
24 "description": "List of conditions that can trigger the actions." | |
25 }, | |
26 "actions": { | |
27 "type": "array", | |
28 "items": {"type": "any"}, | |
29 "description": "List of actions that are triggered if one of the con
dtions is fulfilled." | |
30 }, | |
31 "priority": { | |
32 "type": "integer", | |
33 "optional": true, | |
34 "description": "Optional priority of this rule. Defaults to 100." | |
35 } | |
36 } | |
37 }, | |
38 { | |
39 "id": "UrlFilter", | |
40 "type": "object", | |
41 "description": "Filters URLs for various criteria", | |
42 "nocompile": true, | |
43 "properties": { | |
44 "hostContains": { | |
45 "type": "string", | |
46 "description": "Matches if the host name of the URL contains a speci
fied string.", | |
47 "optional": true | |
48 }, | |
49 "hostEquals": { | |
50 "type": "string", | |
51 "description": "Matches if the host name of the URL is equal to a sp
ecified string.", | |
52 "optional": true | |
53 }, | |
54 "hostPrefix": { | |
55 "type": "string", | |
56 "description": "Matches if the host name of the URL starts with a sp
ecified string.", | |
57 "optional": true | |
58 }, | |
59 "hostSuffix": { | |
60 "type": "string", | |
61 "description": "Matches if the host name of the URL ends with a spec
ified string.", | |
62 "optional": true | |
63 }, | |
64 "pathContains": { | |
65 "type": "string", | |
66 "description": "Matches if the path segment of the URL contains a sp
ecified string.", | |
67 "optional": true | |
68 }, | |
69 "pathEquals": { | |
70 "type": "string", | |
71 "description": "Matches if the path segment of the URL is equal to a
specified string.", | |
72 "optional": true | |
73 }, | |
74 "pathPrefix": { | |
75 "type": "string", | |
76 "description": "Matches if the path segment of the URL starts with a
specified string.", | |
77 "optional": true | |
78 }, | |
79 "pathSuffix": { | |
80 "type": "string", | |
81 "description": "Matches if the path segment of the URL ends with a s
pecified string.", | |
82 "optional": true | |
83 }, | |
84 "queryEquals": { | |
85 "type": "string", | |
86 "description": "Matches if the query segment of the URL is equal to
a specified string.", | |
87 "optional": true | |
88 }, | |
89 "queryPrefix": { | |
90 "type": "string", | |
91 "description": "Matches if the query segment of the URL starts with
a specified string.", | |
92 "optional": true | |
93 }, | |
94 "querySuffix": { | |
95 "type": "string", | |
96 "description": "Matches if the query segment of the URL ends with a
specified string.", | |
97 "optional": true | |
98 }, | |
99 "urlSuffix": { | |
100 "type": "string", | |
101 "description": "Matches if the URL ends with a specified string.", | |
102 "optional": true | |
103 }, | |
104 "urlEquals": { | |
105 "type": "string", | |
106 "description": "Matches if the URL is equal to a specified string.", | |
107 "optional": true | |
108 }, | |
109 "urlPrefix": { | |
110 "type": "string", | |
111 "description": "Matches if the URL starts with a specified string.", | |
112 "optional": true | |
113 }, | |
114 "urlSuffix": { | |
115 "type": "string", | |
116 "description": "Matches if the URL ends with a specified string.", | |
117 "optional": true | |
118 }, | |
119 "schemes": { | |
120 "type": "array", | |
121 "description": "Matches if the scheme of the URL is equal to any of
the schemes specified in the array.", | |
122 "optional": true, | |
123 "items": { "type": "string" } | |
124 }, | |
125 "ports": { | |
126 "type": "array", | |
127 "description": "Matches if the port of the URL is contained in any o
f the specified port lists. For example <code>[80, 443, [1000, 1200]]</code> mat
ches all requests on port 80, 443 and in the range 1000-1200.", | |
128 "optional": true, | |
129 "items": { | |
130 "choices": [ | |
131 {"type": "integer", "description": "A specific port."}, | |
132 {"type": "array", "items": {"type": "integer"}, "description": "
A pair of integers identiying the start and end (both inclusive) of a port range
."} | |
133 ] | |
134 } | |
135 } | |
136 } | |
137 } | |
138 ], | |
139 "functions": [ | |
140 { | |
141 "name": "addRules", | |
142 "type": "function", | |
143 "description": "Registers rules to handle events. Note that you cannot c
all this function as <code>chrome.declarative.addRules(...)</code>. Instead a fu
nction of this signature is provided for event objects supporting the declarativ
e API such as <code>chrome.declarativeWebRequest.onRequest</code>.", | |
144 "parameters": [ | |
145 { | |
146 "nodoc": "true", | |
147 "name": "eventName", | |
148 "type": "string", | |
149 "description": "Name of the event this function affects." | |
150 }, | |
151 { | |
152 "name": "rules", | |
153 "type": "array", | |
154 "items": {"$ref": "Rule"}, | |
155 "description": "Rules to be registered. These do not replace previou
sly registered rules." | |
156 }, | |
157 { | |
158 "name": "callback", | |
159 "optional": true, | |
160 "type": "function", | |
161 "parameters": [ | |
162 { | |
163 "name": "rules", | |
164 "type": "array", | |
165 "items": {"$ref": "Rule"}, | |
166 "description": "Rules that were registered, the optional paramet
ers are filled with values." | |
167 } | |
168 ], | |
169 "description": "Called with registered rules." | |
170 } | |
171 ] | |
172 }, | |
173 { | |
174 "name": "getRules", | |
175 "type": "function", | |
176 "description": "Returns currently registered rules. Note that you cannot
call this function as <code>chrome.declarative.getRules(...)</code>. Instead a
function of this signature is provided for event objects supporting the declarat
ive API such as <code>chrome.declarativeWebRequest.onRequest</code>.", | |
177 "parameters": [ | |
178 { | |
179 "nodoc": "true", | |
180 "name": "eventName", | |
181 "type": "string", | |
182 "description": "Name of the event this function affects." | |
183 }, | |
184 { | |
185 "name": "ruleIdentifiers", | |
186 "optional": "true", | |
187 "type": "array", | |
188 "items": {"type": "string"}, | |
189 "description": "If an array is passed, only rules with identifiers c
ontained in this array are returned." | |
190 }, | |
191 { | |
192 "name": "callback", | |
193 "type": "function", | |
194 "parameters": [ | |
195 { | |
196 "name": "rules", | |
197 "type": "array", | |
198 "items": {"$ref": "Rule"}, | |
199 "description": "Rules that were registered, the optional paramet
ers are filled with values." | |
200 } | |
201 ], | |
202 "description": "Called with registered rules." | |
203 } | |
204 ] | |
205 }, | |
206 { | |
207 "name": "removeRules", | |
208 "type": "function", | |
209 "description": "Unregisters currently registered rules. Note that you ca
nnot call this function as <code>chrome.declarative.removeRules(...)</code>. Ins
tead a function of this signature is provided for event objects supporting the d
eclarative API such as <code>chrome.declarativeWebRequest.onRequest</code>.", | |
210 "parameters": [ | |
211 { | |
212 "nodoc": "true", | |
213 "name": "eventName", | |
214 "type": "string", | |
215 "description": "Name of the event this function affects." | |
216 }, | |
217 { | |
218 "name": "ruleIdentifiers", | |
219 "optional": "true", | |
220 "type": "array", | |
221 "items": {"type": "string"}, | |
222 "description": "If an array is passed, only rules with identifiers c
ontained in this array are unregistered." | |
223 }, | |
224 { | |
225 "name": "callback", | |
226 "optional": true, | |
227 "type": "function", | |
228 "parameters": [], | |
229 "description": "Called when rules were unregistered." | |
230 } | |
231 ] | |
232 } | |
233 ] | |
234 } | |
235 ] | |
236 | |
OLD | NEW |