1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/amIWebInstallListener.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,113 @@ 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 nsIURI; 1.12 +interface nsIVariant; 1.13 + 1.14 +/** 1.15 + * amIWebInstallInfo is used by the default implementation of 1.16 + * amIWebInstallListener to communicate with the running application and allow 1.17 + * it to warn the user about blocked installs and start the installs running. 1.18 + */ 1.19 +[scriptable, uuid(8710e692-3989-4dc7-b607-40d57610ae75)] 1.20 +interface amIWebInstallInfo : nsISupports 1.21 +{ 1.22 + readonly attribute nsIDOMWindow originatingWindow; 1.23 + readonly attribute nsIURI originatingURI; 1.24 + readonly attribute nsIVariant installs; 1.25 + 1.26 + /** 1.27 + * Starts all installs. 1.28 + */ 1.29 + void install(); 1.30 +}; 1.31 + 1.32 +/** 1.33 + * The registered amIWebInstallListener is used to notify about new installs 1.34 + * triggered by websites. The default implementation displays a confirmation 1.35 + * dialog when add-ons are ready to install and uses the observer service to 1.36 + * notify when installations are blocked. 1.37 + */ 1.38 +[scriptable, uuid(a5503979-89c8-441e-9e4a-321df379c172)] 1.39 +interface amIWebInstallListener : nsISupports 1.40 +{ 1.41 + /** 1.42 + * Called when installation by websites is currently disabled. 1.43 + * 1.44 + * @param aWindow 1.45 + * The window that triggered the installs 1.46 + * @param aUri 1.47 + * The URI of the site that triggered the installs 1.48 + * @param aInstalls 1.49 + * The AddonInstalls that were blocked 1.50 + * @param aCount 1.51 + * The number of AddonInstalls 1.52 + */ 1.53 + void onWebInstallDisabled(in nsIDOMWindow aWindow, in nsIURI aUri, 1.54 + [array, size_is(aCount)] in nsIVariant aInstalls, 1.55 + [optional] in uint32_t aCount); 1.56 + 1.57 + /** 1.58 + * Called when the website is not allowed to directly prompt the user to 1.59 + * install add-ons. 1.60 + * 1.61 + * @param aWindow 1.62 + * The window that triggered the installs 1.63 + * @param aUri 1.64 + * The URI of the site that triggered the installs 1.65 + * @param aInstalls 1.66 + * The AddonInstalls that were blocked 1.67 + * @param aCount 1.68 + * The number of AddonInstalls 1.69 + * @return true if the caller should start the installs 1.70 + */ 1.71 + boolean onWebInstallBlocked(in nsIDOMWindow aWindow, in nsIURI aUri, 1.72 + [array, size_is(aCount)] in nsIVariant aInstalls, 1.73 + [optional] in uint32_t aCount); 1.74 + 1.75 + /** 1.76 + * Called when a website wants to ask the user to install add-ons. 1.77 + * 1.78 + * @param aWindow 1.79 + * The window that triggered the installs 1.80 + * @param aUri 1.81 + * The URI of the site that triggered the installs 1.82 + * @param aInstalls 1.83 + * The AddonInstalls that were requested 1.84 + * @param aCount 1.85 + * The number of AddonInstalls 1.86 + * @return true if the caller should start the installs 1.87 + */ 1.88 + boolean onWebInstallRequested(in nsIDOMWindow aWindow, in nsIURI aUri, 1.89 + [array, size_is(aCount)] in nsIVariant aInstalls, 1.90 + [optional] in uint32_t aCount); 1.91 +}; 1.92 + 1.93 +/** 1.94 + * amIWebInstallPrompt is used, if available, by the default implementation of 1.95 + * amIWebInstallInfo to display a confirmation UI to the user before running 1.96 + * installs. 1.97 + */ 1.98 +[scriptable, uuid(c5529918-4291-4b56-bd46-e9268900f2a3)] 1.99 +interface amIWebInstallPrompt : nsISupports 1.100 +{ 1.101 + /** 1.102 + * Get a confirmation that the user wants to start the installs. 1.103 + * 1.104 + * @param aWindow 1.105 + * The window that triggered the installs 1.106 + * @param aUri 1.107 + * The URI of the site that triggered the installs 1.108 + * @param aInstalls 1.109 + * The AddonInstalls that were requested 1.110 + * @param aCount 1.111 + * The number of AddonInstalls 1.112 + */ 1.113 + void confirm(in nsIDOMWindow aWindow, in nsIURI aUri, 1.114 + [array, size_is(aCount)] in nsIVariant aInstalls, 1.115 + [optional] in uint32_t aCount); 1.116 +};