Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: chrome/common/extensions/api/declarative_web_request.json

Issue 595033002: Move declarative_webrequest_custom_bindings.js. and declarative_web_request.json. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/extensions/docs/server2/api_models_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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": "declarativeWebRequest",
8 "description": "<em><strong>Note:</strong> this API is currently on hold, wi thout concrete plans to move to stable.</em> Use the <code>chrome.declarativeWeb Request</code> API to intercept, block, or modify requests in-flight. It is sign ificantly faster than the <a href='webRequest'><code>chrome.webRequest</code> AP I</a> because you can register rules that are evaluated in the browser rather th an the JavaScript engine with reduces roundtrip latencies and allows higher effi ciency.",
9 "types": [
10 {
11 "id": "HeaderFilter",
12 "type": "object",
13 "description": "Filters request headers for various criteria. Multiple c riteria are evaluated as a conjunction.",
14 "properties": {
15 "namePrefix": {
16 "description" : "Matches if the header name starts with the specifie d string.",
17 "type": "string",
18 "optional": true
19 },
20 "nameSuffix": {
21 "type": "string",
22 "optional": true,
23 "description" : "Matches if the header name ends with the specified string."
24 },
25 "nameContains": {
26 "choices": [
27 {"type": "array", "items": {"type": "string"}},
28 {"type": "string"}
29 ],
30 "optional": true,
31 "description" : "Matches if the header name contains all of the spec ified strings."
32 },
33 "nameEquals": {
34 "type": "string",
35 "optional": true,
36 "description" : "Matches if the header name is equal to the specifie d string."
37 },
38 "valuePrefix": {
39 "type": "string",
40 "optional": true,
41 "description" : "Matches if the header value starts with the specifi ed string."
42 },
43 "valueSuffix": {
44 "type": "string",
45 "optional": true,
46 "description" : "Matches if the header value ends with the specified string."
47 },
48 "valueContains": {
49 "choices": [
50 {"type": "array", "items": {"type": "string"}},
51 {"type": "string"}
52 ],
53 "optional": true,
54 "description" : "Matches if the header value contains all of the spe cified strings."
55 },
56 "valueEquals": {
57 "type": "string",
58 "optional": true,
59 "description" : "Matches if the header value is equal to the specifi ed string."
60 }
61 }
62 },
63 {
64 "id": "RequestMatcher",
65 "type": "object",
66 "description": "Matches network events by various criteria.",
67 "properties": {
68 "url": {
69 "$ref": "events.UrlFilter",
70 "description": "Matches if the conditions of the UrlFilter are fulfi lled for the URL of the request.",
71 "optional": true
72 },
73 "firstPartyForCookiesUrl": {
74 "$ref": "events.UrlFilter",
75 "description": "Matches if the conditions of the UrlFilter are fulfi lled for the 'first party' URL of the request. The 'first party' URL of a reques t, when present, can be different from the request's target URL, and describes w hat is considered 'first party' for the sake of third-party checks for cookies." ,
76 "optional": true
77 },
78 "resourceType": {
79 "type": "array",
80 "optional": true,
81 "description": "Matches if the request type of a request is containe d in the list. Requests that cannot match any of the types will be filtered out. ",
82 "items": { "type": "string", "enum": ["main_frame", "sub_frame", "st ylesheet", "script", "image", "object", "xmlhttprequest", "other"] }
83 },
84 "contentType": {
85 "type": "array",
86 "optional": true,
87 "description": "Matches if the MIME media type of a response (from t he HTTP Content-Type header) is contained in the list.",
88 "items": { "type": "string" }
89 },
90 "excludeContentType": {
91 "type": "array",
92 "optional": true,
93 "description": "Matches if the MIME media type of a response (from t he HTTP Content-Type header) is <em>not</em> contained in the list.",
94 "items": { "type": "string" }
95 },
96 "requestHeaders": {
97 "type": "array",
98 "optional": true,
99 "description": "Matches if some of the request headers is matched by one of the HeaderFilters.",
100 "items": { "$ref": "HeaderFilter" }
101 },
102 "excludeRequestHeaders": {
103 "type": "array",
104 "optional": true,
105 "description": "Matches if none of the request headers is matched by any of the HeaderFilters.",
106 "items": { "$ref": "HeaderFilter" }
107 },
108 "responseHeaders": {
109 "type": "array",
110 "optional": true,
111 "description": "Matches if some of the response headers is matched b y one of the HeaderFilters.",
112 "items": { "$ref": "HeaderFilter" }
113 },
114 "excludeResponseHeaders": {
115 "type": "array",
116 "optional": true,
117 "description": "Matches if none of the response headers is matched b y any of the HeaderFilters.",
118 "items": { "$ref": "HeaderFilter" }
119 },
120 "thirdPartyForCookies": {
121 "type": "boolean",
122 "optional": true,
123 "description": "If set to true, matches requests that are subject to third-party cookie policies. If set to false, matches all other requests."
124 },
125 "stages": {
126 "type": "array",
127 "items": {
128 "type": "string",
129 "enum": ["onBeforeRequest", "onBeforeSendHeaders", "onHeadersRecei ved", "onAuthRequired"]
130 },
131 "optional": true,
132 "description": "Contains a list of strings describing stages. Allowe d values are 'onBeforeRequest', 'onBeforeSendHeaders', 'onHeadersReceived', 'onA uthRequired'. If this attribute is present, then it limits the applicable stages to those listed. Note that the whole condition is only applicable in stages com patible with all attributes."
133 },
134 "instanceType": {
135 "type": "string", "enum": ["declarativeWebRequest.RequestMatcher"],
136 "nodoc": true
137 }
138 }
139 },
140 {
141 "id": "CancelRequest",
142 "description": "Declarative event action that cancels a network request. ",
143 "type": "object",
144 "properties": {
145 "instanceType": {
146 "type": "string", "enum": ["declarativeWebRequest.CancelRequest"],
147 "nodoc": true
148 }
149 }
150 },
151 {
152 "id": "RedirectRequest",
153 "description": "Declarative event action that redirects a network reques t.",
154 "type": "object",
155 "properties": {
156 "instanceType": {
157 "type": "string", "enum": ["declarativeWebRequest.RedirectRequest"],
158 "nodoc": true
159 },
160 "redirectUrl": { "type": "string", "description": "Destination to wher e the request is redirected."}
161 }
162 },
163 {
164 "id": "declarativeWebRequest.RedirectToTransparentImage",
165 "description": "Declarative event action that redirects a network reques t to a transparent image.",
166 "type": "object",
167 "properties": {
168 "instanceType": {
169 "type": "string", "enum": ["declarativeWebRequest.RedirectToTranspar entImage"],
170 "nodoc": true
171 }
172 }
173 },
174 {
175 "id": "declarativeWebRequest.RedirectToEmptyDocument",
176 "description": "Declarative event action that redirects a network reques t to an empty document.",
177 "type": "object",
178 "properties": {
179 "instanceType": {
180 "type": "string", "enum": ["declarativeWebRequest.RedirectToEmptyDoc ument"],
181 "nodoc": true
182 }
183 }
184 },
185 {
186 "id": "declarativeWebRequest.RedirectByRegEx",
187 "description": "Redirects a request by applying a regular expression on the URL. The regular expressions use the <a href=\"http://code.google.com/p/re2/ wiki/Syntax\">RE2 syntax</a>.",
188 "type": "object",
189 "properties": {
190 "instanceType": {
191 "type": "string", "enum": ["declarativeWebRequest.RedirectByRegEx"],
192 "nodoc": true
193 },
194 "from": {
195 "type": "string",
196 "description": "A match pattern that may contain capture groups. Cap ture groups are referenced in the Perl syntax ($1, $2, ...) instead of the RE2 s yntax (\\1, \\2, ...) in order to be closer to JavaScript Regular Expressions."
197 },
198 "to": {
199 "type": "string",
200 "description": "Destination pattern."
201 }
202 }
203 },
204 {
205 "id": "declarativeWebRequest.SetRequestHeader",
206 "description": "Sets the request header of the specified name to the spe cified value. If a header with the specified name did not exist before, a new on e is created. Header name comparison is always case-insensitive. Each request he ader name occurs only once in each request.",
207 "type": "object",
208 "properties": {
209 "instanceType": {
210 "type": "string", "enum": ["declarativeWebRequest.SetRequestHeader"] ,
211 "nodoc": true
212 },
213 "name": {
214 "type": "string",
215 "description": "HTTP request header name."
216 },
217 "value": {
218 "type": "string",
219 "description": "HTTP request header value."
220 }
221 }
222 },
223 {
224 "id": "declarativeWebRequest.RemoveRequestHeader",
225 "description": "Removes the request header of the specified name. Do not use SetRequestHeader and RemoveRequestHeader with the same header name on the s ame request. Each request header name occurs only once in each request.",
226 "type": "object",
227 "properties": {
228 "instanceType": {
229 "type": "string", "enum": ["declarativeWebRequest.RemoveRequestHeade r"],
230 "nodoc": true
231 },
232 "name": {
233 "type": "string",
234 "description": "HTTP request header name (case-insensitive)."
235 }
236 }
237 },
238 {
239 "id": "declarativeWebRequest.AddResponseHeader",
240 "description": "Adds the response header to the response of this web req uest. As multiple response headers may share the same name, you need to first re move and then add a new response header in order to replace one.",
241 "type": "object",
242 "properties": {
243 "instanceType": {
244 "type": "string", "enum": ["declarativeWebRequest.AddResponseHeader" ],
245 "nodoc": true
246 },
247 "name": {
248 "type": "string",
249 "description": "HTTP response header name."
250 },
251 "value": {
252 "type": "string",
253 "description": "HTTP response header value."
254 }
255 }
256 },
257 {
258 "id": "declarativeWebRequest.RemoveResponseHeader",
259 "description": "Removes all response headers of the specified names and values.",
260 "type": "object",
261 "properties": {
262 "instanceType": {
263 "type": "string", "enum": ["declarativeWebRequest.RemoveResponseHead er"],
264 "nodoc": true
265 },
266 "name": {
267 "type": "string",
268 "description": "HTTP request header name (case-insensitive)."
269 },
270 "value": {
271 "type": "string",
272 "description": "HTTP request header value (case-insensitive).",
273 "optional": true
274 }
275 }
276 },
277 {
278 "id": "declarativeWebRequest.IgnoreRules",
279 "description": "Masks all rules that match the specified criteria.",
280 "type": "object",
281 "properties": {
282 "instanceType": {
283 "type": "string", "enum": ["declarativeWebRequest.IgnoreRules"],
284 "nodoc": true
285 },
286 "lowerPriorityThan": {
287 "type": "integer",
288 "description": "If set, rules with a lower priority than the specifi ed value are ignored. This boundary is not persisted, it affects only rules and their actions of the same network request stage.",
289 "optional": true
290 },
291 "hasTag": {
292 "type": "string",
293 "description": "If set, rules with the specified tag are ignored. Th is ignoring is not persisted, it affects only rules and their actions of the sam e network request stage. Note that rules are executed in descending order of the ir priorities. This action affects rules of lower priority than the current rule . Rules with the same priority may or may not be ignored.",
294 "optional": true
295 }
296 }
297 },
298 {
299 "id": "declarativeWebRequest.SendMessageToExtension",
300 "description": "Triggers the $(ref:declarativeWebRequest.onMessage) even t.",
301 "type": "object",
302 "properties": {
303 "instanceType": {
304 "type": "string", "enum": ["declarativeWebRequest.SendMessageToExten sion"],
305 "nodoc": true
306 },
307 "message": {
308 "type": "string",
309 "description": "The value that will be passed in the <code>message</ code> attribute of the dictionary that is passed to the event handler."
310 }
311 }
312 },
313 {
314 "id": "declarativeWebRequest.RequestCookie",
315 "description": "A filter or specification of a cookie in HTTP Requests." ,
316 "type": "object",
317 "properties": {
318 "name": {
319 "type": "string",
320 "description": "Name of a cookie.",
321 "optional": true
322 },
323 "value": {
324 "type": "string",
325 "description": "Value of a cookie, may be padded in double-quotes.",
326 "optional": true
327 }
328 }
329 },
330 {
331 "id": "declarativeWebRequest.ResponseCookie",
332 "description": "A specification of a cookie in HTTP Responses.",
333 "type": "object",
334 "properties": {
335 "name": {
336 "type": "string",
337 "description": "Name of a cookie.",
338 "optional": true
339 },
340 "value": {
341 "type": "string",
342 "description": "Value of a cookie, may be padded in double-quotes.",
343 "optional": true
344 },
345 "expires": {
346 "type": "string",
347 "description": "Value of the Expires cookie attribute.",
348 "optional": true
349 },
350 "maxAge": {
351 "type": "number",
352 "description": "Value of the Max-Age cookie attribute",
353 "optional": true
354 },
355 "domain": {
356 "type": "string",
357 "description": "Value of the Domain cookie attribute.",
358 "optional": true
359 },
360 "path": {
361 "type": "string",
362 "description": "Value of the Path cookie attribute.",
363 "optional": true
364 },
365 "secure": {
366 "type": "string",
367 "description": "Existence of the Secure cookie attribute.",
368 "optional": true
369 },
370 "httpOnly": {
371 "type": "string",
372 "description": "Existence of the HttpOnly cookie attribute.",
373 "optional": true
374 }
375 }
376 },
377 {
378 "id": "declarativeWebRequest.FilterResponseCookie",
379 "description": "A filter of a cookie in HTTP Responses.",
380 "type": "object",
381 "properties": {
382 "name": {
383 "type": "string",
384 "description": "Name of a cookie.",
385 "optional": true
386 },
387 "value": {
388 "type": "string",
389 "description": "Value of a cookie, may be padded in double-quotes.",
390 "optional": true
391 },
392 "expires": {
393 "type": "string",
394 "description": "Value of the Expires cookie attribute.",
395 "optional": true
396 },
397 "maxAge": {
398 "type": "number",
399 "description": "Value of the Max-Age cookie attribute",
400 "optional": true
401 },
402 "domain": {
403 "type": "string",
404 "description": "Value of the Domain cookie attribute.",
405 "optional": true
406 },
407 "path": {
408 "type": "string",
409 "description": "Value of the Path cookie attribute.",
410 "optional": true
411 },
412 "secure": {
413 "type": "string",
414 "description": "Existence of the Secure cookie attribute.",
415 "optional": true
416 },
417 "httpOnly": {
418 "type": "string",
419 "description": "Existence of the HttpOnly cookie attribute.",
420 "optional": true
421 },
422 "ageUpperBound": {
423 "type": "integer",
424 "description": "Inclusive upper bound on the cookie lifetime (specif ied in seconds after current time). Only cookies whose expiration date-time is i n the interval [now, now + ageUpperBound] fulfill this criterion. Session cookie s and cookies whose expiration date-time is in the past do not meet the criterio n of this filter. The cookie lifetime is calculated from either 'max-age' or 'ex pires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime.",
425 "minimum": 0,
426 "optional": true
427 },
428 "ageLowerBound": {
429 "type": "integer",
430 "description": "Inclusive lower bound on the cookie lifetime (specif ied in seconds after current time). Only cookies whose expiration date-time is s et to 'now + ageLowerBound' or later fulfill this criterion. Session cookies do not meet the criterion of this filter. The cookie lifetime is calculated from ei ther 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime.",
431 "minimum": 0,
432 "optional": true
433 },
434 "sessionCookie": {
435 "type": "boolean",
436 "description": "Filters session cookies. Session cookies have no lif etime specified in any of 'max-age' or 'expires' attributes.",
437 "optional": true
438 }
439 }
440 },
441 {
442 "id": "declarativeWebRequest.AddRequestCookie",
443 "description": "Adds a cookie to the request or overrides a cookie, in c ase another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
444 "type": "object",
445 "properties": {
446 "instanceType": {
447 "type": "string", "enum": ["declarativeWebRequest.AddRequestCookie"] ,
448 "nodoc": true
449 },
450 "cookie": {
451 "$ref": "declarativeWebRequest.RequestCookie",
452 "description": "Cookie to be added to the request. No field may be u ndefined."
453 }
454 }
455 },
456 {
457 "id": "declarativeWebRequest.AddResponseCookie",
458 "description": "Adds a cookie to the response or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred t o use the Cookies API because this is computationally less expensive.",
459 "type": "object",
460 "properties": {
461 "instanceType": {
462 "type": "string", "enum": ["declarativeWebRequest.AddResponseCookie" ],
463 "nodoc": true
464 },
465 "cookie": {
466 "$ref": "declarativeWebRequest.ResponseCookie",
467 "description": "Cookie to be added to the response. The name and val ue need to be specified."
468 }
469 }
470 },
471 {
472 "id": "declarativeWebRequest.EditRequestCookie",
473 "description": "Edits one or more cookies of request. Note that it is pr eferred to use the Cookies API because this is computationally less expensive.",
474 "type": "object",
475 "properties": {
476 "instanceType": {
477 "type": "string", "enum": ["declarativeWebRequest.EditRequestCookie" ],
478 "nodoc": true
479 },
480 "filter": {
481 "$ref": "declarativeWebRequest.RequestCookie",
482 "description": "Filter for cookies that will be modified. All empty entries are ignored."
483 },
484 "modification": {
485 "$ref": "declarativeWebRequest.RequestCookie",
486 "description": "Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed."
487 }
488 }
489 },
490 {
491 "id": "declarativeWebRequest.EditResponseCookie",
492 "description": "Edits one or more cookies of response. Note that it is p referred to use the Cookies API because this is computationally less expensive." ,
493 "type": "object",
494 "properties": {
495 "instanceType": {
496 "type": "string", "enum": ["declarativeWebRequest.EditResponseCookie "],
497 "nodoc": true
498 },
499 "filter": {
500 "$ref": "declarativeWebRequest.FilterResponseCookie",
501 "description": "Filter for cookies that will be modified. All empty entries are ignored."
502 },
503 "modification": {
504 "$ref": "declarativeWebRequest.ResponseCookie",
505 "description": "Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed."
506 }
507 }
508 },
509 {
510 "id": "declarativeWebRequest.RemoveRequestCookie",
511 "description": "Removes one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive. ",
512 "type": "object",
513 "properties": {
514 "instanceType": {
515 "type": "string", "enum": ["declarativeWebRequest.RemoveRequestCooki e"],
516 "nodoc": true
517 },
518 "filter": {
519 "$ref": "declarativeWebRequest.RequestCookie",
520 "description": "Filter for cookies that will be removed. All empty e ntries are ignored."
521 }
522 }
523 },
524 {
525 "id": "declarativeWebRequest.RemoveResponseCookie",
526 "description": "Removes one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive .",
527 "type": "object",
528 "properties": {
529 "instanceType": {
530 "type": "string", "enum": ["declarativeWebRequest.RemoveResponseCook ie"],
531 "nodoc": true
532 },
533 "filter": {
534 "$ref": "declarativeWebRequest.FilterResponseCookie",
535 "description": "Filter for cookies that will be removed. All empty e ntries are ignored."
536 }
537 }
538 }
539 ],
540 "functions": [
541 ],
542 "events": [
543 {
544 "name": "onRequest",
545 "options": {
546 "supportsListeners": false,
547 "supportsRules": true,
548 "conditions": ["declarativeWebRequest.RequestMatcher"],
549 "actions": [
550 "declarativeWebRequest.AddRequestCookie",
551 "declarativeWebRequest.AddResponseCookie",
552 "declarativeWebRequest.AddResponseHeader",
553 "declarativeWebRequest.CancelRequest",
554 "declarativeWebRequest.EditRequestCookie",
555 "declarativeWebRequest.EditResponseCookie",
556 "declarativeWebRequest.RedirectRequest",
557 "declarativeWebRequest.RedirectToTransparentImage",
558 "declarativeWebRequest.RedirectToEmptyDocument",
559 "declarativeWebRequest.RedirectByRegEx",
560 "declarativeWebRequest.RemoveRequestCookie",
561 "declarativeWebRequest.RemoveResponseCookie",
562 "declarativeWebRequest.RemoveRequestHeader",
563 "declarativeWebRequest.RemoveResponseHeader",
564 "declarativeWebRequest.SetRequestHeader",
565 "declarativeWebRequest.SendMessageToExtension",
566 "declarativeWebRequest.IgnoreRules"
567 ]
568 }
569 },
570 {
571 "name": "onMessage",
572 "type": "function",
573 "description": "Fired when a message is sent via $(ref:declarativeWebReq uest.SendMessageToExtension) from an action of the declarative web request API." ,
574 "parameters": [
575 {
576 "type": "object",
577 "name": "details",
578 "properties": {
579 "message": {"type": "string", "description": "The message sent by the calling script."},
580 "stage": {"type": "string",
581 "enum": ["onBeforeRequest", "onBeforeSendHeaders", "onHe adersReceived", "onAuthRequired"],
582 "description": "The stage of the network request during which the event was triggered."},
583 "requestId": {"type": "string", "description": "The ID of the requ est. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
584 "url": {"type": "string"},
585 "method": {"type": "string", "description": "Standard HTTP method. "},
586 "frameId": {"type": "integer", "description": "The value 0 indicat es that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>) , <code>frameId</code> indicates the ID of this frame, not the ID of the outer f rame. Frame IDs are unique within a tab."},
587 "parentFrameId": {"type": "integer", "description": "ID of frame t hat wraps the frame which sent the request. Set to -1 if no parent frame exists. "},
588 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." },
589 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "st ylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description ": "How the requested resource will be used."},
590 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}
591 }
592 }
593 ]
594 }
595 ]
596 }
597 ]
OLDNEW
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/extensions/docs/server2/api_models_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698