chromium/extensions/common/api/types.json

// 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.

[
  {
    "namespace": "types",
    "description": "The <code>chrome.types</code> API contains type declarations for Chrome.",
    "types": [
      {
        "id": "ChromeSettingScope",
        "type": "string",
        "enum": ["regular", "regular_only", "incognito_persistent", "incognito_session_only"],
        "description": "The scope of the ChromeSetting. One of<ul><li><var>regular</var>: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere),</li><li><var>regular_only</var>: setting for the regular profile only (not inherited by the incognito profile),</li><li><var>incognito_persistent</var>: setting for the incognito profile that survives browser restarts (overrides regular preferences),</li><li><var>incognito_session_only</var>: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences).</li></ul>"
      },
      {
        "id": "LevelOfControl",
        "type": "string",
        "enum": ["not_controllable", "controlled_by_other_extensions", "controllable_by_this_extension", "controlled_by_this_extension"],
        "description": "One of<ul><li><var>not_controllable</var>: cannot be controlled by any extension</li><li><var>controlled_by_other_extensions</var>: controlled by extensions with higher precedence</li><li><var>controllable_by_this_extension</var>: can be controlled by this extension</li><li><var>controlled_by_this_extension</var>: controlled by this extension</li></ul>"
      },
      {
        "id": "ChromeSetting",
        "type": "object",
        "js_module": "ChromeSetting",
        "customBindings": "ChromeSetting",
        "description": "An interface that allows access to a Chrome browser setting. See $(ref:accessibilityFeatures) for an example.",
        "functions": [
          {
            "name": "get",
            "type": "function",
            "nocompile": true,
            "description": "Gets the value of a setting.",
            "parameters": [
              {
                "name": "details",
                "type": "object",
                "description": "Which setting to consider.",
                "properties": {
                  "incognito": {
                    "type": "boolean",
                    "optional": true,
                    "description": "Whether to return the value that applies to the incognito session (default false)."
                  }
                }
              }
            ],
            "returns_async": {
              "name": "callback",
              "parameters": [
                {
                  "name": "details",
                  "type": "object",
                  "description": "Details of the currently effective value.",
                  "properties": {
                    "value": {
                      "description": "The value of the setting.",
                      "type": "any"
                    },
                    "levelOfControl": {
                      "$ref": "LevelOfControl",
                      "description": "The level of control of the setting."
                    },
                    "incognitoSpecific": {
                      "description": "Whether the effective value is specific to the incognito session.<br/>This property will <em>only</em> be present if the <var>incognito</var> property in the <var>details</var> parameter of <code>get()</code> was true.",
                      "type": "boolean",
                      "optional": true
                    }
                  }
                }
              ]
            }
          },
          {
            "name": "set",
            "type": "function",
            "nocompile": true,
            "description": "Sets the value of a setting.",
            "parameters": [
              {
                "name": "details",
                "type": "object",
                "description": "Which setting to change.",
                "properties": {
                  "value": {
                    "description": "The value of the setting. <br/>Note that every setting has a specific value type, which is described together with the setting. An extension should <em>not</em> set a value of a different type.",
                    "type": "any"
                  },
                  "scope": {
                    "$ref": "ChromeSettingScope",
                    "optional": true,
                    "description": "Where to set the setting (default: regular)."
                  }
                }
              }
            ],
            "returns_async": {
              "name": "callback",
              "description": "Called at the completion of the set operation.",
              "optional": true,
              "parameters": []
            }
          },
          {
            "name": "clear",
            "type": "function",
            "nocompile": true,
            "description": "Clears the setting, restoring any default value.",
            "parameters": [
              {
                "name": "details",
                "type": "object",
                "description": "Which setting to clear.",
                "properties": {
                  "scope": {
                    "$ref": "ChromeSettingScope",
                    "optional": true,
                    "description": "Where to clear the setting (default: regular)."
                  }
                }
              }
            ],
            "returns_async": {
              "name": "callback",
              "description": "Called at the completion of the clear operation.",
              "optional": true,
              "parameters": []
            }
          }
        ],
        "events": [
          {
            "name": "onChange",
            "description": "Fired after the setting changes.",
            "parameters": [
              {
                "type": "object",
                "name": "details",
                "properties": {
                  "value": {
                    "description": "The value of the setting after the change.",
                    "type": "any"
                  },
                  "levelOfControl": {
                    "$ref": "LevelOfControl",
                    "description": "The level of control of the setting."
                  },
                  "incognitoSpecific": {
                    "description": "Whether the value that has changed is specific to the incognito session.<br/>This property will <em>only</em> be present if the user has enabled the extension in incognito mode.",
                    "type": "boolean",
                    "optional": true
                  }
                }
              }
            ]
          }
        ]
      }
    ]
  }
]