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// Note: Native renderer implementation: extensions/renderer/content_setting.*. 6[ 7 { 8 "namespace": "contentSettings", 9 "description": "Use the <code>chrome.contentSettings</code> API to change settings that control whether websites can use features such as cookies, JavaScript, and plugins. More generally speaking, content settings allow you to customize Chrome's behavior on a per-site basis instead of globally.", 10 "compiler_options": { "generate_type_functions": true }, 11 "types": [ 12 { 13 "id": "ResourceIdentifier", 14 "type": "object", 15 "properties": { 16 "id": { 17 "type": "string", 18 "description": "The resource identifier for the given content type." 19 }, 20 "description": { 21 "type": "string", 22 "optional": true, 23 "description": "A human readable description of the resource." 24 } 25 }, 26 "description": "The only content type using resource identifiers is $(ref:contentSettings.plugins). For more information, see <a href=\"contentSettings#resource-identifiers\">Resource Identifiers</a>." 27 }, 28 { 29 "id": "Scope", 30 "type": "string", 31 "enum": ["regular", "incognito_session_only"], 32 "description": "The scope of the ContentSetting. 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)." 33 }, 34 { 35 "id": "ContentSetting", 36 "js_module": "ContentSetting", 37 "type": "object", 38 "functions": [ 39 { 40 "name": "clear", 41 "type": "function", 42 "description": "Clear all content setting rules set by this extension.", 43 "parameters": [ 44 { 45 "name": "details", 46 "type": "object", 47 "properties": { 48 "scope": { 49 "$ref": "Scope", 50 "optional": true, 51 "description": "Where to clear the setting (default: regular)." 52 } 53 } 54 }, 55 { 56 "type": "function", 57 "name": "callback", 58 "optional": true, 59 "parameters": [] 60 } 61 ] 62 }, 63 { 64 "name": "get", 65 "type": "function", 66 "description": "Gets the current content setting for a given pair of URLs.", 67 "parameters": [ 68 { 69 "name": "details", 70 "type": "object", 71 "properties": { 72 "primaryUrl": { 73 "type": "string", 74 "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." 75 }, 76 "secondaryUrl": { 77 "type": "string", 78 "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.", 79 "optional": true 80 }, 81 "resourceIdentifier": { 82 "$ref": "ResourceIdentifier", 83 "optional": true, 84 "description": "A more specific identifier of the type of content for which the settings should be retrieved." 85 }, 86 "incognito": { 87 "type": "boolean", 88 "optional": true, 89 "description": "Whether to check the content settings for an incognito session. (default false)" 90 } 91 } 92 }, 93 { 94 "type": "function", 95 "name": "callback", 96 "parameters": [ 97 { 98 "name": "details", 99 "type": "object", 100 "properties": { 101 "setting": { 102 "type": "any", 103 "description": "The content setting. See the description of the individual ContentSetting objects for the possible values." 104 } 105 } 106 } 107 ] 108 } 109 ] 110 }, 111 { 112 "name": "set", 113 "type": "function", 114 "description": "Applies a new content setting rule.", 115 "parameters": [ 116 { 117 "name": "details", 118 "type": "object", 119 "properties": { 120 "primaryPattern": { 121 "type": "string", 122 "description": "The pattern for the primary URL. For details on the format of a pattern, see <a href='contentSettings#patterns'>Content Setting Patterns</a>." 123 }, 124 "secondaryPattern": { 125 "type": "string", 126 "description": "The pattern for the secondary URL. Defaults to matching all URLs. For details on the format of a pattern, see <a href='contentSettings#patterns'>Content Setting Patterns</a>.", 127 "optional": true 128 }, 129 "resourceIdentifier": { 130 "$ref": "ResourceIdentifier", 131 "optional": true, 132 "description": "The resource identifier for the content type." 133 }, 134 "setting": { 135 "type": "any", 136 "description": "The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values." 137 }, 138 "scope": { 139 "$ref": "Scope", 140 "optional": true, 141 "description": "Where to set the setting (default: regular)." 142 } 143 } 144 }, 145 { 146 "type": "function", 147 "name": "callback", 148 "optional": true, 149 "parameters": [] 150 } 151 ] 152 }, 153 { 154 "name": "getResourceIdentifiers", 155 "type": "function", 156 "description": "", 157 "parameters": [ 158 { 159 "name": "callback", 160 "type": "function", 161 "parameters": [ 162 { 163 "name": "resourceIdentifiers", 164 "type": "array", 165 "description": "A list of resource identifiers for this content type, or <var>undefined</var> if this content type does not use resource identifiers.", 166 "optional": true, 167 "items": { 168 "$ref": "ResourceIdentifier" 169 } 170 } 171 ] 172 } 173 ] 174 } 175 ] 176 }, 177 { 178 "id": "CookiesContentSetting", 179 "type": "string", 180 "enum": ["allow", "block", "session_only"] 181 }, 182 { 183 "id": "ImagesContentSetting", 184 "type": "string", 185 "enum": ["allow", "block"] 186 }, 187 { 188 "id": "JavascriptContentSetting", 189 "type": "string", 190 "enum": ["allow", "block"] 191 }, 192 { 193 "id": "LocationContentSetting", 194 "type": "string", 195 "enum": ["allow", "block", "ask"] 196 }, 197 { 198 "id": "PluginsContentSetting", 199 "type": "string", 200 "enum": ["allow", "block", "detect_important_content"] 201 }, 202 { 203 "id": "PopupsContentSetting", 204 "type": "string", 205 "enum": ["allow", "block"] 206 }, 207 { 208 "id": "NotificationsContentSetting", 209 "type": "string", 210 "enum": ["allow", "block", "ask"] 211 }, 212 { 213 "id": "FullscreenContentSetting", 214 "type": "string", 215 "enum": ["allow"] 216 }, 217 { 218 "id": "MouselockContentSetting", 219 "type": "string", 220 "enum": ["allow"] 221 }, 222 { 223 "id": "MicrophoneContentSetting", 224 "type": "string", 225 "enum": ["allow", "block", "ask"] 226 }, 227 { 228 "id": "CameraContentSetting", 229 "type": "string", 230 "enum": ["allow", "block", "ask"] 231 }, 232 { 233 "id": "PpapiBrokerContentSetting", 234 "type": "string", 235 "enum": ["allow", "block", "ask"] 236 }, 237 { 238 "id": "MultipleAutomaticDownloadsContentSetting", 239 "type": "string", 240 "enum": ["allow", "block", "ask"] 241 } 242 ], 243 "properties": { 244 "cookies": { 245 "$ref": "ContentSetting", 246 "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.", 247 "value": [ 248 "cookies", 249 {"$ref":"CookiesContentSetting"} 250 ] 251 }, 252 "images": { 253 "$ref": "ContentSetting", 254 "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 URL of the top-level frame. The secondary URL is the URL of the image.", 255 "value": [ 256 "images", 257 {"$ref":"ImagesContentSetting"} 258 ] 259 }, 260 "javascript": { 261 "$ref": "ContentSetting", 262 "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 URL of the top-level frame. The secondary URL is not used.", 263 "value": [ 264 "javascript", 265 {"$ref":"JavascriptContentSetting"} 266 ] 267 }, 268 "location": { 269 "$ref": "ContentSetting", 270 "description": "Whether to allow Geolocation. One of <br><var>allow</var>: Allow sites to track your physical location,<br><var>block</var>: Don't allow sites to track your physical location,<br><var>ask</var>: Ask before allowing sites to track your physical location. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the document which requested location data. The secondary URL is the URL of the top-level frame (which may or may not differ from the requesting URL).", 271 "value": [ 272 "geolocation", 273 {"$ref":"LocationContentSetting"} 274 ] 275 }, 276 "plugins": { 277 "$ref": "ContentSetting", 278 "description": "Whether to run plugins. One of<br><var>allow</var>: Run plugins automatically,<br><var>block</var>: Don't run plugins automatically,<br><var>detect_important_content</var>: Only run automatically those plugins that are detected as the website's main content.<br>The primary URL is the URL of the top-level frame. The secondary URL is not used.", 279 "value": [ 280 "plugins", 281 {"$ref":"PluginsContentSetting"} 282 ] 283 }, 284 "popups": { 285 "$ref": "ContentSetting", 286 "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 URL of the top-level frame. The secondary URL is not used.", 287 "value": [ 288 "popups", 289 {"$ref":"PopupsContentSetting"} 290 ] 291 }, 292 "notifications": { 293 "$ref": "ContentSetting", 294 "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 URL of the document which wants to show the notification. The secondary URL is not used.", 295 "value": [ 296 "notifications", 297 {"$ref":"NotificationsContentSetting"} 298 ] 299 }, 300 "fullscreen": { 301 "$ref": "ContentSetting", 302 "description": "<i>Deprecated.</i> No longer has any effect. Fullscreen permission is now automatically granted for all sites. Value is always <var>allow</var>.", 303 "value": [ 304 "fullscreen", 305 {"$ref":"FullscreenContentSetting"} 306 ] 307 }, 308 "mouselock": { 309 "$ref": "ContentSetting", 310 "description": "<i>Deprecated.</i> No longer has any effect. Mouse lock permission is now automatically granted for all sites. Value is always <var>allow</var>.", 311 "value": [ 312 "mouselock", 313 {"$ref":"MouselockContentSetting"} 314 ] 315 }, 316 "microphone": { 317 "$ref": "ContentSetting", 318 "description": "Whether to allow sites to access the microphone. One of <br><var>allow</var>: Allow sites to access the microphone,<br><var>block</var>: Don't allow sites to access the microphone,<br><var>ask</var>: Ask when a site wants to access the microphone. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the document which requested microphone access. The secondary URL is not used.<br>NOTE: The 'allow' setting is not valid if both patterns are '<all_urls>'.", 319 "value": [ 320 "media-stream-mic", 321 {"$ref":"MicrophoneContentSetting"} 322 ] 323 }, 324 "camera": { 325 "$ref": "ContentSetting", 326 "description": "Whether to allow sites to access the camera. One of <br><var>allow</var>: Allow sites to access the camera,<br><var>block</var>: Don't allow sites to access the camera,<br><var>ask</var>: Ask when a site wants to access the camera. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the document which requested camera access. The secondary URL is not used.<br>NOTE: The 'allow' setting is not valid if both patterns are '<all_urls>'.", 327 "value": [ 328 "media-stream-camera", 329 {"$ref":"CameraContentSetting"} 330 ] 331 }, 332 "unsandboxedPlugins": { 333 "$ref": "ContentSetting", 334 "description": "Whether to allow sites to run plugins unsandboxed. One of <br><var>allow</var>: Allow sites to run plugins unsandboxed,<br><var>block</var>: Don't allow sites to run plugins unsandboxed,<br><var>ask</var>: Ask when a site wants to run a plugin unsandboxed. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the top-level frame. The secondary URL is not used.", 335 "value": [ 336 "ppapi-broker", 337 {"$ref":"PpapiBrokerContentSetting"} 338 ] 339 }, 340 "automaticDownloads": { 341 "$ref": "ContentSetting", 342 "description": "Whether to allow sites to download multiple files automatically. One of <br><var>allow</var>: Allow sites to download multiple files automatically,<br><var>block</var>: Don't allow sites to download multiple files automatically,<br><var>ask</var>: Ask when a site wants to download files automatically after the first file. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the top-level frame. The secondary URL is not used.", 343 "value": [ 344 "automatic-downloads", 345 {"$ref":"MultipleAutomaticDownloadsContentSetting"} 346 ] 347 } 348 } 349 } 350] 351