| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 [ | 5 [ |
| 6 { | 6 { |
| 7 "namespace": "declarative", | 7 "namespace": "events", |
| 8 "internal": true, | 8 "internal": true, |
| 9 "documentation_permissions_required": ["declarative"], | 9 "unprivileged": true, |
| 10 "types": [ | 10 "types": [ |
| 11 { | 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 { |
| 12 "id": "Rule", | 118 "id": "Rule", |
| 13 "type": "object", | 119 "type": "object", |
| 14 "description": "Description of a declarative rule for handling events.", | 120 "description": "Description of a declarative rule for handling events.", |
| 15 "properties": { | 121 "properties": { |
| 16 "id": { | 122 "id": { |
| 17 "type": "string", | 123 "type": "string", |
| 18 "optional": true, | 124 "optional": true, |
| 19 "description": "Optional identifier that allows referencing this rul
e." | 125 "description": "Optional identifier that allows referencing this rul
e." |
| 20 }, | 126 }, |
| 21 "conditions": { | 127 "conditions": { |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 "optional": true, | 234 "optional": true, |
| 129 "items": { | 235 "items": { |
| 130 "choices": [ | 236 "choices": [ |
| 131 {"type": "integer", "description": "A specific port."}, | 237 {"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
."} | 238 {"type": "array", "items": {"type": "integer"}, "description": "
A pair of integers identiying the start and end (both inclusive) of a port range
."} |
| 133 ] | 239 ] |
| 134 } | 240 } |
| 135 } | 241 } |
| 136 } | 242 } |
| 137 } | 243 } |
| 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 ] | 244 ] |
| 234 } | 245 } |
| 235 ] | 246 ] |
| 236 | 247 |
| OLD | NEW |