// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

[
  {
    "namespace":"dashboardPrivate",
    "description": "none",
    "compiler_options": {
      "modernised_enums": true
    },
    "types": [
      {
        "id": "Result",
        "type": "string",
        "enum": [{
          "name": "",
          "description": "Empty string, used to indicate success by showPermissionPromptForDelegatedInstall"
        }, {
          "name": "unknown_error",
          "description": "An unknown error occured"
        }, {
          "name": "user_cancelled",
          "description": "The user canceled the operation"
        }, {
          "name": "invalid_id",
          "description": "An invalid Chrome Web Store item ID was provided"
        }, {
          "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"
        }],
        "description": "Whether the API call succeeded, or the reason for failure."
      }
    ],
    "functions": [
      {
        "name": "showPermissionPromptForDelegatedInstall",
        "description": "Shows a permission prompt for the given extension, for installing to a different account.",
        "parameters": [
          {
            "name": "details",
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "description": "The id of the extension to be installled.",
                "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
              },
              "delegatedUser": {
                "type": "string",
                "description": "The display name of the user for whom the extension should be installed."
              },
              "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."
              }
            }
          }
        ],
        "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', and 'invalid_icon_url'."
            }
          ]
        }
      }
    ]
  }
]
