// 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":"webstorePrivate",
    "description": "none",
    "types": [
      {
        "id": "Result",
        "type": "string",
        "enum": [{
          "name": "",
          "description": "Empty string, used to indicate success by beginInstallWithManifest3"
        }, {
          "name": "success",
          "description": "Installation was successful"
        }, {
          "name": "user_gesture_required",
          "description": "Function was called without a user gesture"
        }, {
          "name": "unknown_error",
          "description": "An unknown error occured"
        }, {
          "name": "feature_disabled",
          "description": "The requested feature is not available"
        }, {
          "name": "unsupported_extension_type",
          "description": "The requested feature is not availabe for this type of extension"
        }, {
          "name": "missing_dependencies",
          "description": "There were unsatisfied dependencies, such as shared modules"
        }, {
          "name": "install_error",
          "description": "An error occured during installation"
        }, {
          "name": "user_cancelled",
          "description": "The user canceled the operation"
        }, {
          "name": "invalid_id",
          "description": "An invalid Chrome Web Store item ID was provided"
        }, {
          "name": "blacklisted",
          "description": "The given extension is blacklisted"
        }, {
          "name": "blocked_by_policy",
          "description": "The given extension is blocked by management policy"
        }, {
          "name": "install_in_progress",
          "description": "An installation of the same extension is already in progress"
        }, {
          "name": "launch_in_progress",
          "description": "A launch of the same extension is already in progress"
        }, {
          "name": "manifest_error",
          "description": "Parsing of the extension manifest failed"
        }, {
          "name": "icon_error",
          "description": "Failed to retrieve the extension's icon from the Web Store, or the icon was invalid"
        }, {
          "name": "invalid_icon_url",
          "description": "An invalid icon URL was provided"
        }, {
          "name": "already_installed",
          "description": "The extension is already installed"
        }, {
          "name": "blocked_for_child_account",
          "description": "The user is signed in to a child account, and not allowed to perform the operation"
        }],
        "description": "Whether the API call succeeded, or the reason for failure."
      },
      {
        "id": "WebGlStatus",
        "type": "string",
        "enum": ["webgl_allowed", "webgl_blocked"]
      },
      {
        "id": "ExtensionInstallStatus",
        "type": "string",
        "enum" : [{
          "name": "can_request",
          "description": "The extension install request feature is enabled and the extension can be requested."
        }, {
          "name": "request_pending",
          "description": "The extension install request has been sent and is waiting to be reviewed."
        }, {
          "name": "blocked_by_policy",
          "description": "The extension cannot be installed due to enterprise policy."
        }, {
          "name": "installable",
          "description": "The extension can be installed."
        }, {
          "name": "enabled",
          "description": "The extension has been installed already and it's enabled."
        }, {
          "name": "disabled",
          "description": "The extension has been installed already but it's disabled."
        }, {
          "name": "terminated",
          "description": "The extension has been installed already but it's terminated."
        }, {
          "name": "blacklisted",
          "description": "The extension has been blacklisted."
        }, {
          "name": "custodian_approval_required",
          "description": "The extension cannot be enabled due to lack of custodian approval for child users."
        }, {
          "name": "force_installed",
          "description": "The extension is force installed or recommended by policy."
        }]
      }
    ],
    "functions": [
      {
        "name": "install",
        "nocompile": true,
        "description": "Installs the extension corresponding to the given id",
        "parameters": [
          {
            "name": "expected_id",
            "type": "string",
            "description": "The id of the extension to install."
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": []
        }
      },
      {
        "name": "beginInstallWithManifest3",
        "description": "Initiates the install process for the given extension.",
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The id of the extension to be installed.",
                "minLength": 32,
                "maxLength": 32
              },
              "manifest": {
                "type": "string",
                "description": "A string with the contents of the extension's manifest.json file. During the install process, the browser will check that the downloaded extension's manifest matches what was passed in here.",
                "minLength": 1
              },
              "iconUrl": {
                "type": "string",
                "optional": true,
                "desciption": "A URL for the image to display in the confirmation dialog"
              },
              "localizedName": {
                "type": "string",
                "optional": true,
                "description": "A string to use instead of the raw value of the 'name' key from manifest.json."
              },
              "locale": {
                "type": "string",
                "optional": true,
                "description": "The name of the locale used for generating localizedName. This should be the name of one of the directories in the _locales folder of the extension, or the default_locale setting from the manifest."
              },
              "appInstallBubble": {
                "type": "boolean",
                "optional": true,
                "description": "A flag to change the UI we show when an app is installed - a value of true means to show a bubble pointing at the new tab button (instead of the default behavior of opening the new tab page and animating the app icon)."
              },
              "enableLauncher": {
                "type": "boolean",
                "optional": true,
                "description": "A flag to cause the app launcher to be installed before installing the extension, if it isn't installed already."
              },
              "authuser": {
                "type": "string",
                "optional": true,
                "description": "The authuser index to be included with CRX download requests in multi-login sessions."
              },
              "esbAllowlist": {
                "type": "boolean",
                "optional": true,
                "description": "A flag to specify if the extension is included in the ESB allowlist."
              }
            },
            "additionalProperties": { "type": "any" }
          }
        ],
        "returns_async": {
          "name": "callback",
          "description": "Called when the user has either accepted/rejected the dialog, or some error occurred (such as invalid manifest or icon image data).",
          "optional": true,
          "parameters": [
            {
              "name": "result",
              "$ref": "Result",
              "description": "A string result code, which will be empty upon success. The possible values in the case of errors include 'unknown_error', 'user_cancelled', 'manifest_error', 'icon_error', 'invalid_id', 'permission_denied', 'invalid_icon_url' and 'already_installed'."
            }
          ]
        }
      },
      {
        "name": "completeInstall",
        "description": "",
        "parameters": [
          {
            "name": "expected_id",
            "type": "string",
            "description": "The id of the extension to be installed. This should match a previous call to beginInstallWithManifest3."
          }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": []
        }
      },
      {
        "name": "enableAppLauncher",
        "description": "",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": []
        }
      },
      {
        "name": "getBrowserLogin",
        "description": "Returns the logged-in sync user login if there is one, or the empty string otherwise.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "info",
              "type": "object",
              "properties": {
                "login": { "type": "string" }
              }
            }
          ]
        }
      },
      {
        "name": "getStoreLogin",
        "description": "Returns the previous value set by setStoreLogin, or the empty string if there is none.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            { "name": "login", "type": "string" }
          ]
        }
      },
      {
        "name": "setStoreLogin",
        "description": "Sets a preference value with the store login.",
        "parameters": [
          { "name": "login", "type": "string" }
        ],
        "returns_async": {
          "name": "callback",
          "optional": true,
          "parameters": []
        }
      },
      {
        "name": "getWebGLStatus",
        "description": "Invokes a callback that returns whether WebGL is blacklisted or not.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            {
              "name": "webgl_status",
              "$ref": "WebGlStatus"
            }
          ]
        }
      },
      {
        "name": "getIsLauncherEnabled",
        "description": "Returns whether the apps launcher is enabled or not.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            { "name": "is_enabled", "type": "boolean" }
          ]
        }
      },
      {
        "name": "isInIncognitoMode",
        "description": "Returns whether the browser is in incognito mode or not.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            { "name": "is_incognito", "type": "boolean" }
          ]
        }
      },
      {
        "name": "isPendingCustodianApproval",
        "description": "Checks if an extension installed on a Supervised User profile is pending custodian approval.",
        "parameters": [
          {
            "name": "id",
            "type": "string",
            "description": "The extension id of the extension to be checked."
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            { "name": "is_pending_approval", "type": "boolean" }
          ]
        }
      },
      {
        "name": "getReferrerChain",
        "description": "Returns a base-64 encoded referrer chain leading to the webstore page. Should only be used for extension anti-abuse purposes.",
        "parameters": [],
        "returns_async": {
          "name": "callback",
          "parameters": [
            { "name": "referrerChain", "type": "string" }
          ]
        }
      },
      {
        "name": "getExtensionStatus",
        "description": "Returns the install status of the extension.",
        "parameters": [
          {
            "name": "id",
            "type": "string",
            "description": "The id of the extension"
          }, {
            "name": "manifest",
            "type": "string",
            "optional": true,
            "description": "The manifest of the extension"
          }
        ],
        "returns_async": {
          "name": "callback",
          "parameters": [
            { "name": "status", "$ref": "ExtensionInstallStatus" }
          ]
        }
      }
    ]
  }
]
