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