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