dom/interfaces/apps/nsIDOMApplicationRegistry.idl

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:2815ce653f38
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 "domstubs.idl"
6 #include "nsIDOMEventTarget.idl"
7
8 interface nsIDOMDOMRequest;
9
10 [scriptable, uuid(f8cb08ed-588e-465f-b2b3-a4b0afde711a)]
11 interface mozIDOMApplication : nsISupports
12 {
13 readonly attribute jsval manifest;
14 readonly attribute jsval updateManifest;
15 readonly attribute DOMString manifestURL;
16 readonly attribute jsval receipts; /* an array of strings */
17 readonly attribute DOMString origin;
18 readonly attribute DOMString installOrigin;
19 readonly attribute unsigned long long installTime;
20 readonly attribute boolean removable;
21
22 /**
23 * The current progress when downloading an offline cache.
24 */
25 readonly attribute double progress;
26
27 /**
28 * The application installation state :
29 * "pending" : The application is being installed (eg, we're downloading the
30 * offline cache or the package).
31 * "installed" : The application is installed and ready to be launched.
32 * "updating" : We are updating the offline-cache or the package.
33 */
34 readonly attribute DOMString installState;
35
36 /**
37 * fires a nsIDOMApplicationEvent when a change in appcache download or
38 * package download happens.
39 */
40 attribute nsIDOMEventListener onprogress;
41
42 /**
43 * The date of the last update check.
44 */
45 readonly attribute unsigned long long lastUpdateCheck;
46
47 /**
48 * The date of the last updated manifest.
49 */
50 readonly attribute unsigned long long updateTime;
51
52 /**
53 * Starts the process of looking for an update.
54 */
55 nsIDOMDOMRequest checkForUpdate();
56
57 readonly attribute boolean downloadAvailable;
58 readonly attribute boolean downloading;
59 readonly attribute boolean readyToApplyDownload;
60 readonly attribute long downloadSize;
61
62 // This is a DOMError
63 readonly attribute nsISupports downloadError;
64
65 attribute nsIDOMEventListener ondownloadsuccess;
66 attribute nsIDOMEventListener ondownloaderror;
67 attribute nsIDOMEventListener ondownloadavailable;
68
69 /**
70 * Will fire once the mgmt.applyDownload() call succeeds.
71 */
72 attribute nsIDOMEventListener ondownloadapplied;
73
74 /**
75 * Starts to download an update. If |downloading| is true, this
76 * is a no-op.
77 */
78 void download();
79
80 /**
81 * Cancels an ongoing update download.
82 */
83 void cancelDownload();
84
85 /* startPoint will be used when several launch_path exists for an app */
86 nsIDOMDOMRequest launch([optional] in DOMString startPoint);
87
88 /**
89 * Clear data that has been collected through mozbrowser elements.
90 * onsuccess will be called once data is actually cleared.
91 */
92 nsIDOMDOMRequest clearBrowserData();
93
94 /**
95 * Inter-App Communication APIs.
96 *
97 * https://wiki.mozilla.org/WebAPI/Inter_App_Communication_Alt_proposal
98 */
99 nsISupports connect(in DOMString keyword,
100 [optional] in jsval rules); // nsISupports is a Promise.
101
102 nsISupports getConnections(); // nsISupports is a Promise.
103
104 /* Receipts handling functions */
105 nsIDOMDOMRequest addReceipt(in DOMString receipt);
106 nsIDOMDOMRequest removeReceipt(in DOMString receipt);
107 nsIDOMDOMRequest replaceReceipt(in DOMString oldReceipt, in DOMString newReceipt);
108 };
109
110 [scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)]
111 interface mozIDOMApplicationMgmt : nsISupports
112 {
113 /**
114 * the request will return the all the applications installed. Only accessible
115 * to privileged callers.
116 */
117 nsIDOMDOMRequest getAll();
118
119 /**
120 * the request will return the applications acquired from all origins but
121 * which are not launchable (e.g. by not being natively installed), or null.
122 */
123 nsIDOMDOMRequest getNotInstalled();
124
125 /**
126 * event listener to get notified of application installs. Only settable by
127 * privileged callers.
128 * the event will be a mozIDOMApplicationEvent
129 */
130 attribute nsIDOMEventListener oninstall;
131
132 /**
133 * event listener to get notified of application uninstalls. Only settable by
134 * privileged callers.
135 * the event will be a mozIDOMApplicationEvent
136 */
137 attribute nsIDOMEventListener onuninstall;
138
139 /**
140 * Applies a downloaded update.
141 * This function is a no-op if it's passed an app object which doesn't have
142 * |readyToApplyDownload| set to true.
143 */
144 void applyDownload(in mozIDOMApplication app);
145
146 /**
147 * Uninstall a web app.
148 *
149 * @param app : the app object of the web app to be uninstalled.
150 * @returns : A DOMRequest object, returning the app's origin in |result|
151 * if uninstall succeeds; returning "NOT_INSTALLED" error otherwise.
152 */
153 nsIDOMDOMRequest uninstall(in mozIDOMApplication app);
154 };
155
156 [scriptable, uuid(52710c5f-b2a2-4b27-b5b9-f679a1bcc79b)]
157 interface mozIDOMApplicationRegistry : nsISupports
158 {
159 /**
160 * Install a web app.
161 *
162 * @param manifestUrl : the URL of the webapps manifest.
163 * @param parameters : A structure with optional information.
164 * {
165 * receipts: ... Will be used to specify the payment receipts for this installation.
166 * categories: ... Will be used to specify the categories of the webapp.
167 * }
168 * @returns : A DOMRequest object, returning the app object in |result| if install succeeds.
169 */
170 nsIDOMDOMRequest install(in DOMString manifestUrl, [optional] in jsval parameters);
171
172 /**
173 * the request will return the application currently installed, or null.
174 */
175 nsIDOMDOMRequest getSelf();
176
177 /**
178 * the request will return the application if the app from that origin is installed
179 */
180 nsIDOMDOMRequest checkInstalled(in DOMString manifestUrl);
181
182 /**
183 * the request will return the applications installed from this origin, or null.
184 */
185 nsIDOMDOMRequest getInstalled();
186
187 /**
188 * Install a packaged web app.
189 *
190 * @param packageUrl : the URL of the webapps manifest.
191 * @param parameters : A structure with optional information.
192 * {
193 * receipts: ... Will be used to specify the payment receipts for this installation.
194 * categories: ... Will be used to specify the categories of the webapp.
195 * }
196 * @returns : A DOMRequest object, returning the app object in |result| if install succeeds.
197 */
198 nsIDOMDOMRequest installPackage(in DOMString packageUrl, [optional] in jsval parameters);
199
200 readonly attribute mozIDOMApplicationMgmt mgmt;
201 };

mercurial