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