// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Note: Native renderer implementation: extensions/renderer/content_setting.*.
[
{
"namespace": "contentSettings",
"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.",
"compiler_options": {
"generate_type_functions": true
},
"types": [
{
"id": "ResourceIdentifier",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The resource identifier for the given content type."
},
"description": {
"type": "string",
"optional": true,
"description": "A human readable description of the resource."
}
},
"description": "The only content type using resource identifiers is $(ref:contentSettings.plugins). For more information, see <a href=\"contentSettings#resource-identifiers\">Resource Identifiers</a>."
},
{
"id": "Scope",
"type": "string",
"enum": ["regular", "incognito_session_only"],
"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)."
},
{
"id": "ContentSetting",
"js_module": "ContentSetting",
"type": "object",
"functions": [
{
"name": "clear",
"type": "function",
"description": "Clear all content setting rules set by this extension.",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"scope": {
"$ref": "Scope",
"optional": true,
"description": "Where to clear the setting (default: regular)."
}
}
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
},
{
"name": "get",
"type": "function",
"description": "Gets the current content setting for a given pair of URLs.",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"primaryUrl": {
"type": "string",
"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."
},
"secondaryUrl": {
"type": "string",
"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.",
"optional": true
},
"resourceIdentifier": {
"$ref": "ResourceIdentifier",
"optional": true,
"description": "A more specific identifier of the type of content for which the settings should be retrieved."
},
"incognito": {
"type": "boolean",
"optional": true,
"description": "Whether to check the content settings for an incognito session. (default false)"
}
}
}
],
"returns_async": {
"name": "callback",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"setting": {
"type": "any",
"description": "The content setting. See the description of the individual ContentSetting objects for the possible values."
}
}
}
]
}
},
{
"name": "set",
"type": "function",
"description": "Applies a new content setting rule.",
"parameters": [
{
"name": "details",
"type": "object",
"properties": {
"primaryPattern": {
"type": "string",
"description": "The pattern for the primary URL. For details on the format of a pattern, see <a href='contentSettings#patterns'>Content Setting Patterns</a>."
},
"secondaryPattern": {
"type": "string",
"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>.",
"optional": true
},
"resourceIdentifier": {
"$ref": "ResourceIdentifier",
"optional": true,
"description": "The resource identifier for the content type."
},
"setting": {
"type": "any",
"description": "The setting applied by this rule. See the description of the individual ContentSetting objects for the possible values."
},
"scope": {
"$ref": "Scope",
"optional": true,
"description": "Where to set the setting (default: regular)."
}
}
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
},
{
"name": "getResourceIdentifiers",
"type": "function",
"description": "",
"parameters": [],
"returns_async": {
"name": "callback",
"parameters": [
{
"name": "resourceIdentifiers",
"type": "array",
"description": "A list of resource identifiers for this content type, or <var>undefined</var> if this content type does not use resource identifiers.",
"optional": true,
"items": {
"$ref": "ResourceIdentifier"
}
}
]
}
}
]
},
{
"id": "AutoVerifyContentSetting",
"type": "string",
"enum": ["allow", "block"]
},
{
"id": "ClipboardContentSetting",
"type": "string",
"enum": ["allow", "block", "ask"]
},
{
"id": "CookiesContentSetting",
"type": "string",
"enum": ["allow", "block", "session_only"]
},
{
"id": "ImagesContentSetting",
"type": "string",
"enum": ["allow", "block"]
},
{
"id": "JavascriptContentSetting",
"type": "string",
"enum": ["allow", "block"]
},
{
"id": "LocationContentSetting",
"type": "string",
"enum": ["allow", "block", "ask"]
},
{
"id": "PluginsContentSetting",
"type": "string",
"enum": ["block"]
},
{
"id": "PopupsContentSetting",
"type": "string",
"enum": ["allow", "block"]
},
{
"id": "NotificationsContentSetting",
"type": "string",
"enum": ["allow", "block", "ask"]
},
{
"id": "FullscreenContentSetting",
"type": "string",
"enum": ["allow"]
},
{
"id": "MouselockContentSetting",
"type": "string",
"enum": ["allow"]
},
{
"id": "MicrophoneContentSetting",
"type": "string",
"enum": ["allow", "block", "ask"]
},
{
"id": "CameraContentSetting",
"type": "string",
"enum": ["allow", "block", "ask"]
},
{
"id": "PpapiBrokerContentSetting",
"type": "string",
"enum": ["block"]
},
{
"id": "MultipleAutomaticDownloadsContentSetting",
"type": "string",
"enum": ["allow", "block", "ask"]
}
],
"properties": {
"autoVerify": {
"$ref": "ContentSetting",
"description": "Whether to allow sites to use the <a href='https://developer.chrome.com/docs/privacy-sandbox/trust-tokens/'>Private State Tokens API</a>. One of <br><var>allow</var>: Allow sites to use the Private State Tokens API, <br><var>block</var>: Block sites from using the Private State Tokens API. <br>Default is <var>allow</var>.<br> The primary URL is the URL of the top-level frame. The secondary URL is not used. NOTE: When calling <code>set()</code>, the primary pattern must be <code><all_urls></code>.",
"value": [
"anti-abuse",
{"$ref":"AutoVerifyContentSetting"}
]
},
"cookies": {
"$ref": "ContentSetting",
"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.",
"value": [
"cookies",
{"$ref":"CookiesContentSetting"}
]
},
"images": {
"$ref": "ContentSetting",
"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.",
"value": [
"images",
{"$ref":"ImagesContentSetting"}
]
},
"javascript": {
"$ref": "ContentSetting",
"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.",
"value": [
"javascript",
{"$ref":"JavascriptContentSetting"}
]
},
"location": {
"$ref": "ContentSetting",
"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).",
"value": [
"geolocation",
{"$ref":"LocationContentSetting"}
]
},
"plugins": {
"$ref": "ContentSetting",
"description": "<i>Deprecated.</i> With Flash support removed in Chrome 88, this permission no longer has any effect. Value is always <var>block</var>. Calls to <code>set()</code> and <code>clear()</code> will be ignored.",
"value": [
"plugins",
{"$ref":"PluginsContentSetting"}
]
},
"popups": {
"$ref": "ContentSetting",
"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.",
"value": [
"popups",
{"$ref":"PopupsContentSetting"}
]
},
"notifications": {
"$ref": "ContentSetting",
"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.",
"value": [
"notifications",
{"$ref":"NotificationsContentSetting"}
]
},
"fullscreen": {
"$ref": "ContentSetting",
"description": "<i>Deprecated.</i> No longer has any effect. Fullscreen permission is now automatically granted for all sites. Value is always <var>allow</var>.",
"value": [
"fullscreen",
{"$ref":"FullscreenContentSetting"}
]
},
"mouselock": {
"$ref": "ContentSetting",
"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>.",
"value": [
"mouselock",
{"$ref":"MouselockContentSetting"}
]
},
"microphone": {
"$ref": "ContentSetting",
"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>'.",
"value": [
"media-stream-mic",
{"$ref":"MicrophoneContentSetting"}
]
},
"clipboard": {
"$ref": "ContentSetting",
"description": "Whether to allow sites to access the clipboard via advanced capabilities of the Async Clipboard API. \"Advanced\" capabilities include anything besides writing built-in formats after a user gesture, i.e. the ability to read, the ability to write custom formats, and the ability to write without a user gesture. One of <br><var>allow</var>: Allow sites to use advanced clipboard capabilities,<br><var>block</var>: Don't allow sites to use advanced clipboard capabilties,<br><var>ask</var>: Ask when a site wants to use advanced clipboard capabilities. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the document which requested clipboard access. The secondary URL is not used.",
"value": [
"clipboard",
{"$ref":"ClipboardContentSetting"}
]
},
"camera": {
"$ref": "ContentSetting",
"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>'.",
"value": [
"media-stream-camera",
{"$ref":"CameraContentSetting"}
]
},
"unsandboxedPlugins": {
"$ref": "ContentSetting",
"description": "<i>Deprecated.</i> Previously, controlled whether to allow sites to run plugins unsandboxed, however, with the Flash broker process removed in Chrome 88, this permission no longer has any effect. Value is always <var>block</var>. Calls to <code>set()</code> and <code>clear()</code> will be ignored.",
"value": [
"ppapi-broker",
{"$ref":"PpapiBrokerContentSetting"}
]
},
"automaticDownloads": {
"$ref": "ContentSetting",
"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.",
"value": [
"automatic-downloads",
{"$ref":"MultipleAutomaticDownloadsContentSetting"}
]
}
}
}
]