1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/amIWebInstaller.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,82 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 + 1.10 +interface nsIDOMWindow; 1.11 +interface nsIVariant; 1.12 +interface nsIURI; 1.13 + 1.14 +/** 1.15 + * A callback function used to notify webpages when a requested install has 1.16 + * ended. 1.17 + * 1.18 + * NOTE: This is *not* the same as InstallListener. 1.19 + */ 1.20 +[scriptable, function, uuid(bb22f5c0-3ca1-48f6-873c-54e87987700f)] 1.21 +interface amIInstallCallback : nsISupports 1.22 +{ 1.23 + /** 1.24 + * Called when an install completes or fails. 1.25 + * 1.26 + * @param aUrl 1.27 + * The url of the add-on being installed 1.28 + * @param aStatus 1.29 + * 0 if the install was successful or negative if not 1.30 + */ 1.31 + void onInstallEnded(in AString aUrl, in int32_t aStatus); 1.32 +}; 1.33 + 1.34 + 1.35 +/** 1.36 + * This interface is used to allow webpages to start installing add-ons. 1.37 + */ 1.38 +[scriptable, uuid(4fdf4f84-73dc-4857-9bbe-84895e8afd5d)] 1.39 +interface amIWebInstaller : nsISupports 1.40 +{ 1.41 + /** 1.42 + * Checks if installation is enabled for a webpage. 1.43 + * 1.44 + * @param aMimetype 1.45 + * The mimetype for the add-on to be installed 1.46 + * @param referer 1.47 + * The URL of the webpage trying to install an add-on 1.48 + * @return true if installation is enabled 1.49 + */ 1.50 + boolean isInstallEnabled(in AString aMimetype, in nsIURI aReferer); 1.51 + 1.52 + /** 1.53 + * Installs an array of add-ons at the request of a webpage 1.54 + * 1.55 + * @param aMimetype 1.56 + * The mimetype for the add-ons 1.57 + * @param aWindow 1.58 + * The window installing the add-ons 1.59 + * @param aReferer 1.60 + * The URI for the webpage installing the add-ons 1.61 + * @param aUris 1.62 + * The URIs of add-ons to be installed 1.63 + * @param aHashes 1.64 + * The hashes for the add-ons to be installed 1.65 + * @param aNames 1.66 + * The names for the add-ons to be installed 1.67 + * @param aIcons 1.68 + * The icons for the add-ons to be installed 1.69 + * @param aCallback 1.70 + * An optional callback to notify about installation success and 1.71 + * failure 1.72 + * @param aInstallCount 1.73 + * An optional argument including the number of add-ons to install 1.74 + * @return true if the installation was successfully started 1.75 + */ 1.76 + boolean installAddonsFromWebpage(in AString aMimetype, 1.77 + in nsIDOMWindow aWindow, 1.78 + in nsIURI aReferer, 1.79 + [array, size_is(aInstallCount)] in wstring aUris, 1.80 + [array, size_is(aInstallCount)] in wstring aHashes, 1.81 + [array, size_is(aInstallCount)] in wstring aNames, 1.82 + [array, size_is(aInstallCount)] in wstring aIcons, 1.83 + [optional] in amIInstallCallback aCallback, 1.84 + [optional] in uint32_t aInstallCount); 1.85 +};