1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/webidl/InstallTrigger.webidl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,90 @@ 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 file, 1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 + 1.10 +/** 1.11 + * A callback function that webpages can implement to be notified when triggered 1.12 + * installs complete. 1.13 + */ 1.14 +callback InstallTriggerCallback = void(DOMString url, short status); 1.15 + 1.16 +dictionary InstallTriggerData { 1.17 + DOMString URL; 1.18 + DOMString? IconURL; 1.19 + DOMString? Hash; 1.20 +}; 1.21 + 1.22 +/** 1.23 + * The interface for the InstallTrigger object available to all websites. 1.24 + */ 1.25 +[ChromeOnly, 1.26 + JSImplementation="@mozilla.org/addons/installtrigger;1"] 1.27 +interface InstallTriggerImpl { 1.28 + /** 1.29 + * Retained for backwards compatibility. 1.30 + */ 1.31 + const unsigned short SKIN = 1; 1.32 + const unsigned short LOCALE = 2; 1.33 + const unsigned short CONTENT = 4; 1.34 + const unsigned short PACKAGE = 7; 1.35 + 1.36 + /** 1.37 + * Tests if installation is enabled. 1.38 + */ 1.39 + boolean enabled(); 1.40 + 1.41 + /** 1.42 + * Tests if installation is enabled. 1.43 + * 1.44 + * @deprecated Use "enabled" in the future. 1.45 + */ 1.46 + boolean updateEnabled(); 1.47 + 1.48 + /** 1.49 + * Starts a new installation of a set of add-ons. 1.50 + * 1.51 + * @param aArgs 1.52 + * The add-ons to install. This should be a JS object, each property 1.53 + * is the name of an add-on to be installed. The value of the 1.54 + * property should either be a string URL, or an object with the 1.55 + * following properties: 1.56 + * * URL for the add-on's URL 1.57 + * * IconURL for an icon for the add-on 1.58 + * * Hash for a hash of the add-on 1.59 + * @param aCallback 1.60 + * A callback to call as each installation succeeds or fails 1.61 + * @return true if the installations were successfully started 1.62 + */ 1.63 + boolean install(MozMap<(DOMString or InstallTriggerData)> installs, 1.64 + optional InstallTriggerCallback callback); 1.65 + 1.66 + /** 1.67 + * Starts installing a new add-on. 1.68 + * 1.69 + * @deprecated use "install" in the future. 1.70 + * 1.71 + * @param aType 1.72 + * Unused, retained for backwards compatibility 1.73 + * @param aUrl 1.74 + * The URL of the add-on 1.75 + * @param aSkin 1.76 + * Unused, retained for backwards compatibility 1.77 + * @return true if the installation was successfully started 1.78 + */ 1.79 + boolean installChrome(unsigned short type, DOMString url, DOMString skin); 1.80 + 1.81 + /** 1.82 + * Starts installing a new add-on. 1.83 + * 1.84 + * @deprecated use "install" in the future. 1.85 + * 1.86 + * @param aUrl 1.87 + * The URL of the add-on 1.88 + * @param aFlags 1.89 + * Unused, retained for backwards compatibility 1.90 + * @return true if the installation was successfully started 1.91 + */ 1.92 + boolean startSoftwareUpdate(DOMString url, optional unsigned short flags); 1.93 +};