// 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": "webstore", "description": "Use the <code>chrome.webstore</code> API to initiate app and extension installations \"inline\" from your site.", "types": [ { "id": "InstallStage", "type": "string", "enum": ["installing", "downloading"], "description": "Enum used to indicate the stage of the installation process. 'downloading' indicates that the necessary files are being downloaded, and 'installing' indicates that the files are downloaded and are being actively installed." } ], // types "events": [ { "name": "onInstallStageChanged", "description": "Fired when an inline installation enters a new InstallStage. In order to receive notifications about this event, listeners must be registered before the inline installation begins.", "type": "function", "parameters": [ { "name": "stage", "$ref": "InstallStage", "description": "The InstallStage that just began." } ] }, // onInstallStageChanged { "name": "onDownloadProgress", "description": "Fired periodically with the download progress of an inline install. In order to receive notifications about this event, listeners must be registered before the inline installation begins.", "type": "function", "parameters": [ { "name": "percentDownloaded", "type": "number", "description": "The progress of the download, between 0 and 1. 0 indicates no progress; 1.0 indicates complete." } ] } // onDownloadProgress ], // events "functions": [ { "name": "install", "allowAmbiguousOptionalArguments": true, "parameters": [ { "name": "url", "type": "string", "optional": true, "description": "If you have more than one <code><link></code> tag on your page with the <code>chrome-webstore-item</code> relation, you can choose which item you'd like to install by passing in its URL here. If it is omitted, then the first (or only) link will be used. An exception will be thrown if the passed in URL does not exist on the page." }, { "name": "successCallback", "type": "function", "optional": true, "parameters": [], "description": "This function is invoked when inline installation successfully completes (after the dialog is shown and the user agrees to add the item to Chrome). You may wish to use this to hide the user interface element that prompted the user to install the app or extension." }, { "name": "failureCallback", "type": "function", "optional": true, "parameters": [ { "name": "error", "type": "string", "description": "The failure detail. You may wish to inspect or log this for debugging purposes, but you should not rely on specific strings being passed back." } ], "description": "This function is invoked when inline installation does not successfully complete. Possible reasons for this include the user canceling the dialog, the linked item not being found in the store, or the install being initiated from a non-verified site." } ] } // install ] // functions } // webstore ]