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