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": "contentSettings",
8    "description": "The contentSettings API.",
9    "types": [
10      {
11        "id": "ResourceIdentifier",
12        "type": "object",
13        "properties": {
14          "id": {
15            "type": "string",
16            "description": "The resource identifier for the given content type."
17          },
18          "description": {
19            "type": "string",
20            "optional": true,
21            "description": "A human readable description of the resource."
22          }
23        },
24        "description": "The only content type using resource identifiers is <a href=\"contentSettings.html#property-plugins\"><var>plugins</var></a>. For more information, see <a href=\"contentSettings.html#resource-identifiers\">Resource Identifiers</a>."
25      },
26      {
27        "id": "ContentSetting",
28        "type": "object",
29        "functions": [
30          {
31            "name": "clear",
32            "type": "function",
33            "description": "Clear all content setting rules set by this extension.",
34            "parameters": [
35              {
36                "name": "details",
37                "type": "object",
38                "properties": {
39                  "scope": {
40                    "type": "string",
41                    "enum": ["regular", "incognito_session_only"],
42                    "optional": true,
43                    "description": "Where to set the setting (default: regular). One of<br><var>regular</var>: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),<br><var>incognito_session_only</var>: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings)."
44                  }
45                }
46              },
47              {
48                "type": "function",
49                "name": "callback",
50                "optional": true,
51                "parameters": []
52              }
53            ]
54          },
55          {
56            "name": "get",
57            "type": "function",
58            "description": "Gets the current content setting for a given pair of URLs.",
59            "parameters": [
60              {
61                "name": "details",
62                "type": "object",
63                "properties": {
64                  "primaryUrl": {
65                    "type": "string",
66                    "description": "The primary URL for which the content setting should be retrieved. Note that the meaning of a primary URL depends on the content type."
67                  },
68                  "secondaryUrl": {
69                    "type": "string",
70                    "description": "The secondary URL for which the content setting should be retrieved. Defaults to the primary URL. Note that the meaning of a secondary URL depends on the content type, and not all content types use secondary URLs.",
71                    "optional": true
72                  },
73                  "resourceIdentifier": {
74                    "$ref": "ResourceIdentifier",
75                    "optional": true,
76                    "description": "A more specific identifier of the type of content for which the settings should be retrieved."
77                  },
78                  "incognito": {
79                    "type": "boolean",
80                    "optional": true,
81                    "description": "Whether to check the content settings for an incognito session. (default false)"
82                  }
83                }
84              },
85              {
86                "type": "function",
87                "name": "callback",
88                "parameters": [
89                  {
90                    "name": "details",
91                    "type": "object",
92                    "properties": {
93                      "setting": {
94                        "type": "any",
95                        "description": "The content setting. See the description of the individual ContentSetting objects for the possible values."
96                      }
97                    }
98                  }
99                ]
100              }
101            ]
102          },
103          {
104            "name": "set",
105            "type": "function",
106            "description": "Applies a new content setting rule.",
107            "parameters": [
108              {
109                "name": "details",
110                "type": "object",
111                "properties": {
112                  "primaryPattern": {
113                    "type": "string",
114                    "description": "The pattern for the primary URL. For details on the format of a pattern, see <a href='contentSettings.html#patterns'>Content Setting Patterns</a>."
115                  },
116                  "secondaryPattern": {
117                    "type": "string",
118                    "description": "The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see <a href='contentSettings.html#patterns'>Content Setting Patterns</a>.",
119                    "optional": true
120                  },
121                  "resourceIdentifier": {
122                    "$ref": "ResourceIdentifier",
123                    "optional": true,
124                    "description": "The resource identifier for the content type."
125                  },
126                  "setting": {
127                    "type": "any",
128                    "description": "The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values."
129                  },
130                  "scope": {
131                    "type": "string",
132                    "enum": ["regular", "incognito_session_only"],
133                    "optional": true,
134                    "description": "Where to clear the setting (default: regular). One of<br><var>regular</var>: setting for regular profile (which is inherited by the incognito profile if not overridden elsewhere),<br><var>incognito_session_only</var>: setting for incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular settings)."
135                  }
136                }
137              },
138              {
139                "type": "function",
140                "name": "callback",
141                "optional": true,
142                "parameters": []
143              }
144            ]
145          },
146          {
147            "name": "getResourceIdentifiers",
148            "type": "function",
149            "description": "",
150            "parameters": [
151              {
152                "name": "callback",
153                "type": "function",
154                "parameters": [
155                  {
156                    "name": "resourceIdentifiers",
157                    "type": "array",
158                    "description": "A list of resource identifiers for this content type, or <var>undefined</var> if this content type does not use resource identifiers.",
159                    "optional": true,
160                    "items": {
161                      "$ref": "ResourceIdentifier"
162                    }
163                  }
164                ]
165              }
166            ]
167          }
168        ]
169      }
170    ],
171    "properties": {
172      "cookies": {
173        "$ref": "ContentSetting",
174        "description": "Whether to allow cookies and other local data to be set by websites. One of<br><var>allow</var>: Accept cookies,<br><var>block</var>: Block cookies,<br><var>session_only</var>: Accept cookies only for the current session. <br>Default is <var>allow</var>.<br>The primary URL is the URL representing the cookie origin. The secondary URL is the URL of the top-level frame.",
175        "value": [
176          "cookies",
177          {"type":"string", "enum": ["allow", "block", "session_only"]}
178        ]
179      },
180      "images": {
181        "$ref": "ContentSetting",
182        "description": "Whether to show images. One of<br><var>allow</var>: Show images,<br><var>block</var>: Don't show images. <br>Default is <var>allow</var>.<br>The primary URL is the main-frame URL. The secondary URL is the URL of the image.",
183        "value": [
184          "images",
185          {"type":"string", "enum": ["allow", "block"]}
186        ]
187      },
188      "javascript": {
189        "$ref": "ContentSetting",
190        "description": "Whether to run JavaScript. One of<br><var>allow</var>: Run JavaScript,<br><var>block</var>: Don't run JavaScript. <br>Default is <var>allow</var>.<br>The primary URL is the main-frame URL. The secondary URL is not used.",
191        "value": [
192          "javascript",
193          {"type":"string", "enum": ["allow", "block"]}
194        ]
195      },
196      "plugins": {
197        "$ref": "ContentSetting",
198        "description": "Whether to run plug-ins. One of<br><var>allow</var>: Run plug-ins automatically,<br><var>block</var>: Don't run plug-ins automatically. <br>Default is <var>allow</var>.<br>The primary URL is the main-frame URL. The secondary URL is not used.",
199        "value": [
200          "plugins",
201          {"type":"string", "enum": ["allow", "block"]}
202        ]
203      },
204      "popups": {
205        "$ref": "ContentSetting",
206        "description": "Whether to allow sites to show pop-ups. One of<br><var>allow</var>: Allow sites to show pop-ups,<br><var>block</var>: Don't allow sites to show pop-ups. <br>Default is <var>block</var>.<br>The primary URL is the main-frame URL. The secondary URL is not used.",
207        "value": [
208          "popups",
209          {"type":"string", "enum": ["allow", "block"]}
210        ]
211      },
212      "notifications": {
213        "$ref": "ContentSetting",
214        "description": "Whether to allow sites to show desktop notifications. One of<br><var>allow</var>: Allow sites to show desktop notifications,<br><var>block</var>: Don't allow sites to show desktop notifications,<br><var>ask</var>: Ask when a site wants to show desktop notifications. <br>Default is <var>ask</var>.<br>The primary URL is the main-frame URL. The secondary URL is not used.",
215        "value": [
216          "notifications",
217          {"type":"string", "enum": ["allow", "block", "ask"]}
218        ]
219      }
220    }
221  }
222]
223