OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 // The <code>chrome.declarativeNetRequest</code> API is used to intercept and |
| 6 // perform actions on a network request by specifying declarative rules. |
| 7 namespace declarativeNetRequest { |
| 8 enum ResourceType { |
| 9 // TODO add main frame, csp. |
| 10 sub_frame, |
| 11 stylesheet, |
| 12 script, |
| 13 image, |
| 14 font, |
| 15 object, |
| 16 xmlhttprequest, |
| 17 ping, |
| 18 media, |
| 19 websocket, |
| 20 other |
| 21 }; |
| 22 |
| 23 enum DomainType { |
| 24 first_party, |
| 25 third_party, |
| 26 any |
| 27 }; |
| 28 |
| 29 enum RuleActionType { |
| 30 // TODO add whitelist_recursive. |
| 31 block, |
| 32 redirect, |
| 33 whitelist |
| 34 }; |
| 35 |
| 36 // TODO ensure meaningful. (All fields are optional.) |
| 37 dictionary RuleCondition { |
| 38 DOMString? urlFilter; |
| 39 // It seems we dont support default values. |
| 40 boolean? urlFilterIsCaseSensitive; |
| 41 DOMString[]? domains; |
| 42 DOMString[]? excludedDomains; |
| 43 ResourceType[]? resourceTypes; |
| 44 // TODO change to excluded |
| 45 ResourceType[]? excludeResourceTypes; |
| 46 DomainType? domainType; |
| 47 }; |
| 48 |
| 49 dictionary RuleAction { |
| 50 RuleActionType type; |
| 51 DOMString? redirectUrl; |
| 52 }; |
| 53 |
| 54 dictionary Rule { |
| 55 // Default is required actually. |
| 56 // Unsigned don't seem to be supported. |
| 57 // TODO ensure unsigned. |
| 58 long id; |
| 59 // TODO ensure provided for redirect rules. |
| 60 long? priority; |
| 61 RuleCondition condition; |
| 62 RuleAction action; |
| 63 }; |
| 64 }; |
OLD | NEW |