// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// 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"
        }],
        "description": "Whether the API call succeeded, or the reason for failure."
      },
      {
        "id": "WebGlStatus",
        "type": "string",
        "enum": ["webgl_allowed", "webgl_blocked"]
      }
    ],
    "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."
          },
          {
            "name": "callback",
            "type": "function",
            "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."
              }
            },
            "additionalProperties": { "type": "any" }
          },
          {
            "name": "callback",
            "type": "function",
            "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."
          },
          {
            "name": "callback",
            "type": "function",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "installBundle",
        "description": "Initiates the install process for the given bundle of extensions.",
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "localizedName": {
                "type": "string",
                "description": "A title to use for display in a confirmation dialog."
              },
              "iconUrl": {
                "type": "string",
                "optional": true,
                "desciption": "A URL for the image to display in the confirmation dialog"
              },
              "authuser": {
                "type": "string",
                "optional": true,
                "description": "The authuser index to be included with CRX download requests in multi-login sessions."
              }
            },
            "additionalProperties": { "type": "any" }
          },
          {
            "name": "contents",
            "description": "An array of extension details to be installed.",
            "type": "array",
            "items": {
              "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",
                  "description": "A string to use instead of the raw value of the 'name' key from manifest.json."
                }
              }
            }
          },
          {
            "name": "callback",
            "type": "function",
            "description": "Called when the install process completes. Upon failures, chrome.runtime.lastError will be set to 'Invalid bundle', 'Invalid icon url', 'This item is already installed', or 'User cancelled install'.",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "enableAppLauncher",
        "description": "",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "getBrowserLogin",
        "description": "Returns the logged-in sync user login if there is one, or the empty string otherwise.",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "optional": false,
            "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": [
          {
            "name": "callback",
            "type": "function",
            "optional": false,
            "parameters": [
              { "name": "login", "type": "string" }
            ]
          }
        ]
      },
      {
        "name": "setStoreLogin",
        "description": "Sets a preference value with the store login.",
        "parameters": [
          { "name": "login", "type": "string" },
          {
            "name": "callback",
            "type": "function",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "getWebGLStatus",
        "description": "Invokes a callback that returns whether WebGL is blacklisted or not.",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "optional": false,
            "parameters": [
              {
                "name": "webgl_status",
                "$ref": "WebGlStatus"
              }
            ]
          }
        ]
      },
      {
        "name": "getIsLauncherEnabled",
        "description": "Returns whether the apps launcher is enabled or not.",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "optional": false,
            "parameters": [
              { "name": "is_enabled", "type": "boolean" }
            ]
          }
        ]
      },
      {
        "name": "isInIncognitoMode",
        "description": "Returns whether the browser is in incognito mode or not.",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "optional": false,
            "parameters": [
              { "name": "is_incognito", "type": "boolean" }
            ]
          }
        ]
      },
      {
        "name": "getEphemeralAppsEnabled",
        "description": "Returns whether the ephemeral apps feature is enabled.",
        "parameters": [
          {
            "name": "callback",
            "type": "function",
            "optional": false,
            "parameters": [
              { "name": "is_enabled", "type": "boolean" }
            ]
          }
        ]
      },
      {
        "name": "launchEphemeralApp",
        "description": "Installs an app ephemerally in Chrome (if not already fully installed) and launches the app. A user gesture is required.",
        "parameters": [
          {
            "name": "id",
            "type": "string",
            "description": "The extension id of the app to launch."
          },
          {
            "name": "callback",
            "type": "function",
            "optional": true,
            "parameters": [
              {
                "name": "result",
                "$ref": "Result",
                "description": "Whether an attempt to launch an app succeeded, or the reason for failure."
              }
            ]
          }
        ]
      }
    ]
  }
]