|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #include "nsISupports.idl" |
|
6 |
|
7 interface nsIDOMWindow; |
|
8 interface nsIVariant; |
|
9 interface nsIURI; |
|
10 |
|
11 /** |
|
12 * A callback function used to notify webpages when a requested install has |
|
13 * ended. |
|
14 * |
|
15 * NOTE: This is *not* the same as InstallListener. |
|
16 */ |
|
17 [scriptable, function, uuid(bb22f5c0-3ca1-48f6-873c-54e87987700f)] |
|
18 interface amIInstallCallback : nsISupports |
|
19 { |
|
20 /** |
|
21 * Called when an install completes or fails. |
|
22 * |
|
23 * @param aUrl |
|
24 * The url of the add-on being installed |
|
25 * @param aStatus |
|
26 * 0 if the install was successful or negative if not |
|
27 */ |
|
28 void onInstallEnded(in AString aUrl, in int32_t aStatus); |
|
29 }; |
|
30 |
|
31 |
|
32 /** |
|
33 * This interface is used to allow webpages to start installing add-ons. |
|
34 */ |
|
35 [scriptable, uuid(4fdf4f84-73dc-4857-9bbe-84895e8afd5d)] |
|
36 interface amIWebInstaller : nsISupports |
|
37 { |
|
38 /** |
|
39 * Checks if installation is enabled for a webpage. |
|
40 * |
|
41 * @param aMimetype |
|
42 * The mimetype for the add-on to be installed |
|
43 * @param referer |
|
44 * The URL of the webpage trying to install an add-on |
|
45 * @return true if installation is enabled |
|
46 */ |
|
47 boolean isInstallEnabled(in AString aMimetype, in nsIURI aReferer); |
|
48 |
|
49 /** |
|
50 * Installs an array of add-ons at the request of a webpage |
|
51 * |
|
52 * @param aMimetype |
|
53 * The mimetype for the add-ons |
|
54 * @param aWindow |
|
55 * The window installing the add-ons |
|
56 * @param aReferer |
|
57 * The URI for the webpage installing the add-ons |
|
58 * @param aUris |
|
59 * The URIs of add-ons to be installed |
|
60 * @param aHashes |
|
61 * The hashes for the add-ons to be installed |
|
62 * @param aNames |
|
63 * The names for the add-ons to be installed |
|
64 * @param aIcons |
|
65 * The icons for the add-ons to be installed |
|
66 * @param aCallback |
|
67 * An optional callback to notify about installation success and |
|
68 * failure |
|
69 * @param aInstallCount |
|
70 * An optional argument including the number of add-ons to install |
|
71 * @return true if the installation was successfully started |
|
72 */ |
|
73 boolean installAddonsFromWebpage(in AString aMimetype, |
|
74 in nsIDOMWindow aWindow, |
|
75 in nsIURI aReferer, |
|
76 [array, size_is(aInstallCount)] in wstring aUris, |
|
77 [array, size_is(aInstallCount)] in wstring aHashes, |
|
78 [array, size_is(aInstallCount)] in wstring aNames, |
|
79 [array, size_is(aInstallCount)] in wstring aIcons, |
|
80 [optional] in amIInstallCallback aCallback, |
|
81 [optional] in uint32_t aInstallCount); |
|
82 }; |