2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-11-28 12:13:26 -08:00
|
|
|
|
|
|
|
#include "domstubs.idl"
|
2012-03-06 11:50:58 -08:00
|
|
|
#include "nsIDOMEventTarget.idl"
|
2011-11-28 12:13:26 -08:00
|
|
|
|
2012-03-06 11:50:58 -08:00
|
|
|
interface nsIDOMDOMRequest;
|
2011-11-28 12:13:26 -08:00
|
|
|
|
2013-05-20 10:20:19 -07:00
|
|
|
[scriptable, uuid(8bdeef38-e9cd-46f8-b8de-ed9e6b4d01ea)]
|
2012-03-06 11:50:58 -08:00
|
|
|
interface mozIDOMApplication : nsISupports
|
2011-11-28 12:13:26 -08:00
|
|
|
{
|
|
|
|
readonly attribute jsval manifest;
|
2012-09-26 18:01:18 -07:00
|
|
|
readonly attribute jsval updateManifest;
|
2012-03-06 11:50:58 -08:00
|
|
|
readonly attribute DOMString manifestURL;
|
2012-06-11 11:41:46 -07:00
|
|
|
readonly attribute jsval receipts; /* an array of strings */
|
2011-11-28 12:13:26 -08:00
|
|
|
readonly attribute DOMString origin;
|
|
|
|
readonly attribute DOMString installOrigin;
|
2012-06-11 11:41:46 -07:00
|
|
|
readonly attribute unsigned long long installTime;
|
2012-08-29 14:20:03 -07:00
|
|
|
readonly attribute boolean removable;
|
2012-06-11 11:41:46 -07:00
|
|
|
|
2012-09-26 18:01:18 -07:00
|
|
|
/**
|
2012-06-11 11:41:46 -07:00
|
|
|
* The current progress when downloading an offline cache.
|
|
|
|
*/
|
|
|
|
readonly attribute double progress;
|
|
|
|
|
2012-09-26 18:01:18 -07:00
|
|
|
/**
|
|
|
|
* The application installation state :
|
|
|
|
* "pending" : The application is being installed (eg, we're downloading the
|
|
|
|
* offline cache or the package).
|
|
|
|
* "installed" : The application is installed and ready to be launched.
|
|
|
|
* "updating" : We are updating the offline-cache or the package.
|
2012-06-11 11:41:46 -07:00
|
|
|
*/
|
2012-09-26 18:01:18 -07:00
|
|
|
readonly attribute DOMString installState;
|
2012-06-11 11:41:46 -07:00
|
|
|
|
2012-09-26 18:01:18 -07:00
|
|
|
/**
|
|
|
|
* fires a nsIDOMApplicationEvent when a change in appcache download or
|
|
|
|
* package download happens.
|
2012-06-11 11:41:46 -07:00
|
|
|
*/
|
|
|
|
attribute nsIDOMEventListener onprogress;
|
2012-06-14 16:03:55 -07:00
|
|
|
|
2012-09-26 18:01:18 -07:00
|
|
|
/**
|
2012-11-16 19:37:41 -08:00
|
|
|
* The date of the last update check.
|
2012-09-26 18:01:18 -07:00
|
|
|
*/
|
|
|
|
readonly attribute unsigned long long lastUpdateCheck;
|
|
|
|
|
2012-11-16 19:37:41 -08:00
|
|
|
/**
|
|
|
|
* The date of the last updated manifest.
|
|
|
|
*/
|
|
|
|
readonly attribute unsigned long long updateTime;
|
|
|
|
|
2012-09-26 18:01:18 -07:00
|
|
|
/**
|
|
|
|
* Starts the process of looking for an update.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest checkForUpdate();
|
|
|
|
|
|
|
|
readonly attribute boolean downloadAvailable;
|
|
|
|
readonly attribute boolean downloading;
|
|
|
|
readonly attribute boolean readyToApplyDownload;
|
|
|
|
readonly attribute long downloadSize;
|
|
|
|
|
2013-05-18 10:52:06 -07:00
|
|
|
// This is a DOMError
|
|
|
|
readonly attribute nsISupports downloadError;
|
2012-09-26 18:01:18 -07:00
|
|
|
|
|
|
|
attribute nsIDOMEventListener ondownloadsuccess;
|
|
|
|
attribute nsIDOMEventListener ondownloaderror;
|
|
|
|
attribute nsIDOMEventListener ondownloadavailable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Will fire once the mgmt.applyDownload() call succeeds.
|
|
|
|
*/
|
|
|
|
attribute nsIDOMEventListener ondownloadapplied;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Starts to download an update. If |downloading| is true, this
|
|
|
|
* is a no-op.
|
|
|
|
*/
|
|
|
|
void download();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Cancels an ongoing update download.
|
|
|
|
*/
|
|
|
|
void cancelDownload();
|
|
|
|
|
2012-03-06 11:50:58 -08:00
|
|
|
/* startPoint will be used when several launch_path exists for an app */
|
|
|
|
nsIDOMDOMRequest launch([optional] in DOMString startPoint);
|
2012-09-26 15:03:25 -07:00
|
|
|
|
2013-05-20 10:20:19 -07:00
|
|
|
/**
|
|
|
|
* Clear data that has been collected through mozbrowser elements.
|
|
|
|
* onsuccess will be called once data is actually cleared.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest clearBrowserData();
|
2011-11-28 12:13:26 -08:00
|
|
|
};
|
|
|
|
|
2013-01-11 04:50:46 -08:00
|
|
|
[scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)]
|
2012-06-06 09:42:54 -07:00
|
|
|
interface mozIDOMApplicationMgmt : nsISupports
|
2011-11-28 12:13:26 -08:00
|
|
|
{
|
2011-12-15 09:20:57 -08:00
|
|
|
/**
|
2012-03-06 11:50:58 -08:00
|
|
|
* the request will return the all the applications installed. Only accessible
|
|
|
|
* to privileged callers.
|
2011-12-15 09:20:57 -08:00
|
|
|
*/
|
2012-03-06 11:50:58 -08:00
|
|
|
nsIDOMDOMRequest getAll();
|
2011-12-15 09:20:57 -08:00
|
|
|
|
2012-08-20 10:19:56 -07:00
|
|
|
/**
|
|
|
|
* the request will return the applications acquired from all origins but
|
|
|
|
* which are not launchable (e.g. by not being natively installed), or null.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest getNotInstalled();
|
|
|
|
|
2011-12-15 09:20:57 -08:00
|
|
|
/**
|
2012-03-06 11:50:58 -08:00
|
|
|
* event listener to get notified of application installs. Only settable by
|
|
|
|
* privileged callers.
|
|
|
|
* the event will be a mozIDOMApplicationEvent
|
2011-12-15 09:20:57 -08:00
|
|
|
*/
|
2012-03-06 11:50:58 -08:00
|
|
|
attribute nsIDOMEventListener oninstall;
|
2011-12-15 09:20:57 -08:00
|
|
|
|
|
|
|
/**
|
2012-03-06 11:50:58 -08:00
|
|
|
* event listener to get notified of application uninstalls. Only settable by
|
|
|
|
* privileged callers.
|
|
|
|
* the event will be a mozIDOMApplicationEvent
|
2011-12-15 09:20:57 -08:00
|
|
|
*/
|
2012-03-06 11:50:58 -08:00
|
|
|
attribute nsIDOMEventListener onuninstall;
|
2012-09-26 18:01:18 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Applies a downloaded update.
|
|
|
|
* This function is a no-op if it's passed an app object which doesn't have
|
|
|
|
* |readyToApplyDownload| set to true.
|
|
|
|
*/
|
|
|
|
void applyDownload(in mozIDOMApplication app);
|
2013-01-11 04:50:46 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Uninstall a web app.
|
|
|
|
*
|
|
|
|
* @param app : the app object of the web app to be uninstalled.
|
|
|
|
* @returns : A DOMRequest object, returning the app's origin in |result|
|
|
|
|
* if uninstall succeeds; returning "NOT_INSTALLED" error otherwise.
|
|
|
|
*/
|
|
|
|
nsIDOMDOMRequest uninstall(in mozIDOMApplication app);
|
2012-03-06 11:50:58 -08:00
|
|
|
};
|
2011-12-15 09:20:57 -08:00
|
|
|
|
2012-10-02 13:38:51 -07:00
|
|
|
[scriptable, uuid(abfc6c15-8b92-4b9a-b892-52e6ae76f379)]
|
2012-03-06 11:50:58 -08:00
|
|
|
interface mozIDOMApplicationRegistry : nsISupports
|
|
|
|
{
|
2011-12-15 09:20:57 -08:00
|
|
|
/**
|
2012-07-11 08:38:33 -07:00
|
|
|
* Install a web app.
|
2011-12-15 09:20:57 -08:00
|
|
|
*
|
2012-03-06 11:50:58 -08:00
|
|
|
* @param manifestUrl : the URL of the webapps manifest.
|
2012-07-11 08:38:33 -07:00
|
|
|
* @param parameters : A structure with optional information.
|
2012-08-06 18:16:00 -07:00
|
|
|
* {
|
|
|
|
* receipts: ... Will be used to specify the payment receipts for this installation.
|
|
|
|
* categories: ... Will be used to specify the categories of the webapp.
|
|
|
|
* }
|
2012-07-11 08:38:33 -07:00
|
|
|
* @returns : A DOMRequest object, returning the app object in |result| if install succeeds.
|
2011-12-15 09:20:57 -08:00
|
|
|
*/
|
2012-03-06 11:50:58 -08:00
|
|
|
nsIDOMDOMRequest install(in DOMString manifestUrl, [optional] in jsval parameters);
|
2011-11-28 12:13:26 -08:00
|
|
|
|
2011-12-15 09:20:57 -08:00
|
|
|
/**
|
2012-03-06 11:50:58 -08:00
|
|
|
* the request will return the application currently installed, or null.
|
2011-12-15 09:20:57 -08:00
|
|
|
*/
|
2012-03-06 11:50:58 -08:00
|
|
|
nsIDOMDOMRequest getSelf();
|
2011-12-15 09:20:57 -08:00
|
|
|
|
2012-09-25 08:04:24 -07:00
|
|
|
/**
|
2012-10-02 13:38:51 -07:00
|
|
|
* the request will return the application if the app from that origin is installed
|
2012-09-25 08:04:24 -07:00
|
|
|
*/
|
2012-10-02 13:38:51 -07:00
|
|
|
nsIDOMDOMRequest checkInstalled(in DOMString manifestUrl);
|
2012-09-25 08:04:24 -07:00
|
|
|
|
2011-12-15 09:20:57 -08:00
|
|
|
/**
|
2012-03-06 11:50:58 -08:00
|
|
|
* the request will return the applications installed from this origin, or null.
|
2011-12-15 09:20:57 -08:00
|
|
|
*/
|
2012-03-06 11:50:58 -08:00
|
|
|
nsIDOMDOMRequest getInstalled();
|
2011-12-15 09:20:57 -08:00
|
|
|
|
2012-03-06 11:50:58 -08:00
|
|
|
readonly attribute mozIDOMApplicationMgmt mgmt;
|
2011-11-28 12:13:26 -08:00
|
|
|
};
|