michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "domstubs.idl" michael@0: #include "nsIDOMEventTarget.idl" michael@0: michael@0: interface nsIDOMDOMRequest; michael@0: michael@0: [scriptable, uuid(f8cb08ed-588e-465f-b2b3-a4b0afde711a)] michael@0: interface mozIDOMApplication : nsISupports michael@0: { michael@0: readonly attribute jsval manifest; michael@0: readonly attribute jsval updateManifest; michael@0: readonly attribute DOMString manifestURL; michael@0: readonly attribute jsval receipts; /* an array of strings */ michael@0: readonly attribute DOMString origin; michael@0: readonly attribute DOMString installOrigin; michael@0: readonly attribute unsigned long long installTime; michael@0: readonly attribute boolean removable; michael@0: michael@0: /** michael@0: * The current progress when downloading an offline cache. michael@0: */ michael@0: readonly attribute double progress; michael@0: michael@0: /** michael@0: * The application installation state : michael@0: * "pending" : The application is being installed (eg, we're downloading the michael@0: * offline cache or the package). michael@0: * "installed" : The application is installed and ready to be launched. michael@0: * "updating" : We are updating the offline-cache or the package. michael@0: */ michael@0: readonly attribute DOMString installState; michael@0: michael@0: /** michael@0: * fires a nsIDOMApplicationEvent when a change in appcache download or michael@0: * package download happens. michael@0: */ michael@0: attribute nsIDOMEventListener onprogress; michael@0: michael@0: /** michael@0: * The date of the last update check. michael@0: */ michael@0: readonly attribute unsigned long long lastUpdateCheck; michael@0: michael@0: /** michael@0: * The date of the last updated manifest. michael@0: */ michael@0: readonly attribute unsigned long long updateTime; michael@0: michael@0: /** michael@0: * Starts the process of looking for an update. michael@0: */ michael@0: nsIDOMDOMRequest checkForUpdate(); michael@0: michael@0: readonly attribute boolean downloadAvailable; michael@0: readonly attribute boolean downloading; michael@0: readonly attribute boolean readyToApplyDownload; michael@0: readonly attribute long downloadSize; michael@0: michael@0: // This is a DOMError michael@0: readonly attribute nsISupports downloadError; michael@0: michael@0: attribute nsIDOMEventListener ondownloadsuccess; michael@0: attribute nsIDOMEventListener ondownloaderror; michael@0: attribute nsIDOMEventListener ondownloadavailable; michael@0: michael@0: /** michael@0: * Will fire once the mgmt.applyDownload() call succeeds. michael@0: */ michael@0: attribute nsIDOMEventListener ondownloadapplied; michael@0: michael@0: /** michael@0: * Starts to download an update. If |downloading| is true, this michael@0: * is a no-op. michael@0: */ michael@0: void download(); michael@0: michael@0: /** michael@0: * Cancels an ongoing update download. michael@0: */ michael@0: void cancelDownload(); michael@0: michael@0: /* startPoint will be used when several launch_path exists for an app */ michael@0: nsIDOMDOMRequest launch([optional] in DOMString startPoint); michael@0: michael@0: /** michael@0: * Clear data that has been collected through mozbrowser elements. michael@0: * onsuccess will be called once data is actually cleared. michael@0: */ michael@0: nsIDOMDOMRequest clearBrowserData(); michael@0: michael@0: /** michael@0: * Inter-App Communication APIs. michael@0: * michael@0: * https://wiki.mozilla.org/WebAPI/Inter_App_Communication_Alt_proposal michael@0: */ michael@0: nsISupports connect(in DOMString keyword, michael@0: [optional] in jsval rules); // nsISupports is a Promise. michael@0: michael@0: nsISupports getConnections(); // nsISupports is a Promise. michael@0: michael@0: /* Receipts handling functions */ michael@0: nsIDOMDOMRequest addReceipt(in DOMString receipt); michael@0: nsIDOMDOMRequest removeReceipt(in DOMString receipt); michael@0: nsIDOMDOMRequest replaceReceipt(in DOMString oldReceipt, in DOMString newReceipt); michael@0: }; michael@0: michael@0: [scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)] michael@0: interface mozIDOMApplicationMgmt : nsISupports michael@0: { michael@0: /** michael@0: * the request will return the all the applications installed. Only accessible michael@0: * to privileged callers. michael@0: */ michael@0: nsIDOMDOMRequest getAll(); michael@0: michael@0: /** michael@0: * the request will return the applications acquired from all origins but michael@0: * which are not launchable (e.g. by not being natively installed), or null. michael@0: */ michael@0: nsIDOMDOMRequest getNotInstalled(); michael@0: michael@0: /** michael@0: * event listener to get notified of application installs. Only settable by michael@0: * privileged callers. michael@0: * the event will be a mozIDOMApplicationEvent michael@0: */ michael@0: attribute nsIDOMEventListener oninstall; michael@0: michael@0: /** michael@0: * event listener to get notified of application uninstalls. Only settable by michael@0: * privileged callers. michael@0: * the event will be a mozIDOMApplicationEvent michael@0: */ michael@0: attribute nsIDOMEventListener onuninstall; michael@0: michael@0: /** michael@0: * Applies a downloaded update. michael@0: * This function is a no-op if it's passed an app object which doesn't have michael@0: * |readyToApplyDownload| set to true. michael@0: */ michael@0: void applyDownload(in mozIDOMApplication app); michael@0: michael@0: /** michael@0: * Uninstall a web app. michael@0: * michael@0: * @param app : the app object of the web app to be uninstalled. michael@0: * @returns : A DOMRequest object, returning the app's origin in |result| michael@0: * if uninstall succeeds; returning "NOT_INSTALLED" error otherwise. michael@0: */ michael@0: nsIDOMDOMRequest uninstall(in mozIDOMApplication app); michael@0: }; michael@0: michael@0: [scriptable, uuid(52710c5f-b2a2-4b27-b5b9-f679a1bcc79b)] michael@0: interface mozIDOMApplicationRegistry : nsISupports michael@0: { michael@0: /** michael@0: * Install a web app. michael@0: * michael@0: * @param manifestUrl : the URL of the webapps manifest. michael@0: * @param parameters : A structure with optional information. michael@0: * { michael@0: * receipts: ... Will be used to specify the payment receipts for this installation. michael@0: * categories: ... Will be used to specify the categories of the webapp. michael@0: * } michael@0: * @returns : A DOMRequest object, returning the app object in |result| if install succeeds. michael@0: */ michael@0: nsIDOMDOMRequest install(in DOMString manifestUrl, [optional] in jsval parameters); michael@0: michael@0: /** michael@0: * the request will return the application currently installed, or null. michael@0: */ michael@0: nsIDOMDOMRequest getSelf(); michael@0: michael@0: /** michael@0: * the request will return the application if the app from that origin is installed michael@0: */ michael@0: nsIDOMDOMRequest checkInstalled(in DOMString manifestUrl); michael@0: michael@0: /** michael@0: * the request will return the applications installed from this origin, or null. michael@0: */ michael@0: nsIDOMDOMRequest getInstalled(); michael@0: michael@0: /** michael@0: * Install a packaged web app. michael@0: * michael@0: * @param packageUrl : the URL of the webapps manifest. michael@0: * @param parameters : A structure with optional information. michael@0: * { michael@0: * receipts: ... Will be used to specify the payment receipts for this installation. michael@0: * categories: ... Will be used to specify the categories of the webapp. michael@0: * } michael@0: * @returns : A DOMRequest object, returning the app object in |result| if install succeeds. michael@0: */ michael@0: nsIDOMDOMRequest installPackage(in DOMString packageUrl, [optional] in jsval parameters); michael@0: michael@0: readonly attribute mozIDOMApplicationMgmt mgmt; michael@0: };