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