| 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": "events", |
| 8 "compiler_options": { |
| 9 "implemented_in": "chrome/browser/extensions/api/declarative/declarative_a
pi.h", |
| 10 "generate_type_functions": true |
| 11 }, |
| 12 "internal": true, |
| 13 "unprivileged": true, |
| 14 "types": [ |
| 15 { |
| 16 "id": "Rule", |
| 17 "type": "object", |
| 18 "description": "Description of a declarative rule for handling events.", |
| 19 "properties": { |
| 20 "id": { |
| 21 "type": "string", |
| 22 "optional": true, |
| 23 "description": "Optional identifier that allows referencing this rul
e." |
| 24 }, |
| 25 "conditions": { |
| 26 "type": "array", |
| 27 "items": {"type": "any"}, |
| 28 "description": "List of conditions that can trigger the actions." |
| 29 }, |
| 30 "actions": { |
| 31 "type": "array", |
| 32 "items": {"type": "any"}, |
| 33 "description": "List of actions that are triggered if one of the con
dtions is fulfilled." |
| 34 }, |
| 35 "priority": { |
| 36 "type": "integer", |
| 37 "optional": true, |
| 38 "description": "Optional priority of this rule. Defaults to 100." |
| 39 } |
| 40 } |
| 41 }, |
| 42 { |
| 43 "id": "Event", |
| 44 "type": "object", |
| 45 "description": "An object which allows the addition and removal of liste
ners for a Chrome event.", |
| 46 "additionalProperties": { "type": "any"}, |
| 47 "functions": [ |
| 48 { |
| 49 "name": "addListener", |
| 50 "nocompile": true, |
| 51 "type": "function", |
| 52 "description": "Registers an event listener <em>callback</em> to an
event.", |
| 53 "parameters": [ |
| 54 { |
| 55 "name": "callback", |
| 56 "type": "function", |
| 57 "description": "Called when an event occurs. The parameters of t
his function depend on the type of event." |
| 58 } |
| 59 ] |
| 60 }, |
| 61 { |
| 62 "name": "removeListener", |
| 63 "nocompile": true, |
| 64 "type": "function", |
| 65 "description": "Deregisters an event listener <em>callback</em> from
an event.", |
| 66 "parameters": [ |
| 67 { |
| 68 "name": "callback", |
| 69 "type": "function", |
| 70 "description": "Listener that shall be unregistered." |
| 71 } |
| 72 ] |
| 73 }, |
| 74 { |
| 75 "name": "hasListener", |
| 76 "nocompile": true, |
| 77 "type": "function", |
| 78 "parameters": [ |
| 79 { |
| 80 "name": "callback", |
| 81 "type": "function", |
| 82 "description": "Listener whose registration status shall be test
ed." |
| 83 } |
| 84 ], |
| 85 "returns": { |
| 86 "type": "boolean", |
| 87 "description": "True if <em>callback</em> is registered to the eve
nt." |
| 88 } |
| 89 }, |
| 90 { |
| 91 "name": "hasListeners", |
| 92 "nocompile": true, |
| 93 "type": "function", |
| 94 "parameters": [], |
| 95 "returns": { |
| 96 "type": "boolean", |
| 97 "description": "True if any event listeners are registered to the
event." |
| 98 } |
| 99 }, |
| 100 { |
| 101 "name": "addRules", |
| 102 "type": "function", |
| 103 "description": "Registers rules to handle events.", |
| 104 "parameters": [ |
| 105 { |
| 106 "nodoc": "true", |
| 107 "name": "eventName", |
| 108 "type": "string", |
| 109 "description": "Name of the event this function affects." |
| 110 }, |
| 111 { |
| 112 "name": "rules", |
| 113 "type": "array", |
| 114 "items": {"$ref": "Rule"}, |
| 115 "description": "Rules to be registered. These do not replace pre
viously registered rules." |
| 116 }, |
| 117 { |
| 118 "name": "callback", |
| 119 "optional": true, |
| 120 "type": "function", |
| 121 "parameters": [ |
| 122 { |
| 123 "name": "rules", |
| 124 "type": "array", |
| 125 "items": {"$ref": "Rule"}, |
| 126 "description": "Rules that were registered, the optional par
ameters are filled with values." |
| 127 } |
| 128 ], |
| 129 "description": "Called with registered rules." |
| 130 } |
| 131 ] |
| 132 }, |
| 133 { |
| 134 "name": "getRules", |
| 135 "type": "function", |
| 136 "description": "Returns currently registered rules.", |
| 137 "parameters": [ |
| 138 { |
| 139 "nodoc": "true", |
| 140 "name": "eventName", |
| 141 "type": "string", |
| 142 "description": "Name of the event this function affects." |
| 143 }, |
| 144 { |
| 145 "name": "ruleIdentifiers", |
| 146 "optional": "true", |
| 147 "type": "array", |
| 148 "items": {"type": "string"}, |
| 149 "description": "If an array is passed, only rules with identifie
rs contained in this array are returned." |
| 150 }, |
| 151 { |
| 152 "name": "callback", |
| 153 "type": "function", |
| 154 "parameters": [ |
| 155 { |
| 156 "name": "rules", |
| 157 "type": "array", |
| 158 "items": {"$ref": "Rule"}, |
| 159 "description": "Rules that were registered, the optional par
ameters are filled with values." |
| 160 } |
| 161 ], |
| 162 "description": "Called with registered rules." |
| 163 } |
| 164 ] |
| 165 }, |
| 166 { |
| 167 "name": "removeRules", |
| 168 "type": "function", |
| 169 "description": "Unregisters currently registered rules.", |
| 170 "parameters": [ |
| 171 { |
| 172 "nodoc": "true", |
| 173 "name": "eventName", |
| 174 "type": "string", |
| 175 "description": "Name of the event this function affects." |
| 176 }, |
| 177 { |
| 178 "name": "ruleIdentifiers", |
| 179 "optional": "true", |
| 180 "type": "array", |
| 181 "items": {"type": "string"}, |
| 182 "description": "If an array is passed, only rules with identifie
rs contained in this array are unregistered." |
| 183 }, |
| 184 { |
| 185 "name": "callback", |
| 186 "optional": true, |
| 187 "type": "function", |
| 188 "parameters": [], |
| 189 "description": "Called when rules were unregistered." |
| 190 } |
| 191 ] |
| 192 } |
| 193 ] |
| 194 }, |
| 195 { |
| 196 "id": "UrlFilter", |
| 197 "type": "object", |
| 198 "description": "Filters URLs for various criteria. See <a href='#filtere
d'>event filtering</a>. All criteria are case sensitive.", |
| 199 "nocompile": true, |
| 200 "properties": { |
| 201 "hostContains": { |
| 202 "type": "string", |
| 203 "description": "Matches if the host name of the URL contains a speci
fied string. To test whether a host name component has a prefix 'foo', use hostC
ontains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implici
t dot is added at the beginning of the host name. Similarly, hostContains can be
used to match against component suffix ('foo.') and to exactly match against co
mponents ('.foo.'). Suffix- and exact-matching for the last components need to b
e done separately using hostSuffix, because no implicit dot is added at the end
of the host name.", |
| 204 "optional": true |
| 205 }, |
| 206 "hostEquals": { |
| 207 "type": "string", |
| 208 "description": "Matches if the host name of the URL is equal to a sp
ecified string.", |
| 209 "optional": true |
| 210 }, |
| 211 "hostPrefix": { |
| 212 "type": "string", |
| 213 "description": "Matches if the host name of the URL starts with a sp
ecified string.", |
| 214 "optional": true |
| 215 }, |
| 216 "hostSuffix": { |
| 217 "type": "string", |
| 218 "description": "Matches if the host name of the URL ends with a spec
ified string.", |
| 219 "optional": true |
| 220 }, |
| 221 "pathContains": { |
| 222 "type": "string", |
| 223 "description": "Matches if the path segment of the URL contains a sp
ecified string.", |
| 224 "optional": true |
| 225 }, |
| 226 "pathEquals": { |
| 227 "type": "string", |
| 228 "description": "Matches if the path segment of the URL is equal to a
specified string.", |
| 229 "optional": true |
| 230 }, |
| 231 "pathPrefix": { |
| 232 "type": "string", |
| 233 "description": "Matches if the path segment of the URL starts with a
specified string.", |
| 234 "optional": true |
| 235 }, |
| 236 "pathSuffix": { |
| 237 "type": "string", |
| 238 "description": "Matches if the path segment of the URL ends with a s
pecified string.", |
| 239 "optional": true |
| 240 }, |
| 241 "queryContains": { |
| 242 "type": "string", |
| 243 "description": "Matches if the query segment of the URL contains a s
pecified string.", |
| 244 "optional": true |
| 245 }, |
| 246 "queryEquals": { |
| 247 "type": "string", |
| 248 "description": "Matches if the query segment of the URL is equal to
a specified string.", |
| 249 "optional": true |
| 250 }, |
| 251 "queryPrefix": { |
| 252 "type": "string", |
| 253 "description": "Matches if the query segment of the URL starts with
a specified string.", |
| 254 "optional": true |
| 255 }, |
| 256 "querySuffix": { |
| 257 "type": "string", |
| 258 "description": "Matches if the query segment of the URL ends with a
specified string.", |
| 259 "optional": true |
| 260 }, |
| 261 "urlContains": { |
| 262 "type": "string", |
| 263 "description": "Matches if the URL (without fragment identifier) con
tains a specified string. Port numbers are stripped from the URL if they match t
he default port number.", |
| 264 "optional": true |
| 265 }, |
| 266 "urlEquals": { |
| 267 "type": "string", |
| 268 "description": "Matches if the URL (without fragment identifier) is
equal to a specified string. Port numbers are stripped from the URL if they matc
h the default port number.", |
| 269 "optional": true |
| 270 }, |
| 271 "urlMatches": { |
| 272 "type": "string", |
| 273 "description": "Matches if the URL (without fragment identifier) mat
ches a specified regular expression. Port numbers are stripped from the URL if t
hey match the default port number. The regular expressions use the <a href=\"htt
p://code.google.com/p/re2/wiki/Syntax\">RE2 syntax</a>.", |
| 274 "optional": true |
| 275 }, |
| 276 "urlPrefix": { |
| 277 "type": "string", |
| 278 "description": "Matches if the URL (without fragment identifier) sta
rts with a specified string. Port numbers are stripped from the URL if they matc
h the default port number.", |
| 279 "optional": true |
| 280 }, |
| 281 "urlSuffix": { |
| 282 "type": "string", |
| 283 "description": "Matches if the URL (without fragment identifier) end
s with a specified string. Port numbers are stripped from the URL if they match
the default port number.", |
| 284 "optional": true |
| 285 }, |
| 286 "schemes": { |
| 287 "type": "array", |
| 288 "description": "Matches if the scheme of the URL is equal to any of
the schemes specified in the array.", |
| 289 "optional": true, |
| 290 "items": { "type": "string" } |
| 291 }, |
| 292 "ports": { |
| 293 "type": "array", |
| 294 "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.", |
| 295 "optional": true, |
| 296 "items": { |
| 297 "choices": [ |
| 298 {"type": "integer", "description": "A specific port."}, |
| 299 {"type": "array", "items": {"type": "integer"}, "description": "
A pair of integers identiying the start and end (both inclusive) of a port range
."} |
| 300 ] |
| 301 } |
| 302 } |
| 303 } |
| 304 } |
| 305 ] |
| 306 } |
| 307 ] |
| 308 |
| OLD | NEW |