dom/interfaces/apps/nsIDOMApplicationRegistry.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/interfaces/apps/nsIDOMApplicationRegistry.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,201 @@
     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 "domstubs.idl"
     1.9 +#include "nsIDOMEventTarget.idl"
    1.10 +
    1.11 +interface nsIDOMDOMRequest;
    1.12 +
    1.13 +[scriptable, uuid(f8cb08ed-588e-465f-b2b3-a4b0afde711a)]
    1.14 +interface mozIDOMApplication  : nsISupports
    1.15 +{
    1.16 +  readonly attribute jsval manifest;
    1.17 +  readonly attribute jsval updateManifest;
    1.18 +  readonly attribute DOMString manifestURL;
    1.19 +  readonly attribute jsval receipts; /* an array of strings */
    1.20 +  readonly attribute DOMString origin;
    1.21 +  readonly attribute DOMString installOrigin;
    1.22 +  readonly attribute unsigned long long installTime;
    1.23 +  readonly attribute boolean removable;
    1.24 +
    1.25 +  /**
    1.26 +   * The current progress when downloading an offline cache.
    1.27 +   */
    1.28 +  readonly attribute double progress;
    1.29 +
    1.30 +  /**
    1.31 +   * The application installation state :
    1.32 +   * "pending"   : The application is being installed (eg, we're downloading the
    1.33 +   *               offline cache or the package).
    1.34 +   * "installed" : The application is installed and ready to be launched.
    1.35 +   * "updating"  : We are updating the offline-cache or the package.
    1.36 +   */
    1.37 +  readonly attribute DOMString installState;
    1.38 +
    1.39 +  /**
    1.40 +   * fires a nsIDOMApplicationEvent when a change in appcache download or
    1.41 +   * package download happens.
    1.42 +   */
    1.43 +  attribute nsIDOMEventListener onprogress;
    1.44 +
    1.45 +  /**
    1.46 +   * The date of the last update check.
    1.47 +   */
    1.48 +  readonly attribute unsigned long long lastUpdateCheck;
    1.49 +
    1.50 +  /**
    1.51 +   * The date of the last updated manifest.
    1.52 +   */
    1.53 +  readonly attribute unsigned long long updateTime;
    1.54 +
    1.55 +  /**
    1.56 +   * Starts the process of looking for an update.
    1.57 +   */
    1.58 +  nsIDOMDOMRequest checkForUpdate();
    1.59 +
    1.60 +  readonly attribute boolean downloadAvailable;
    1.61 +  readonly attribute boolean downloading;
    1.62 +  readonly attribute boolean readyToApplyDownload;
    1.63 +  readonly attribute long downloadSize;
    1.64 +
    1.65 +  // This is a DOMError
    1.66 +  readonly attribute nsISupports downloadError;
    1.67 +
    1.68 +  attribute nsIDOMEventListener ondownloadsuccess;
    1.69 +  attribute nsIDOMEventListener ondownloaderror;
    1.70 +  attribute nsIDOMEventListener ondownloadavailable;
    1.71 +
    1.72 +  /**
    1.73 +   * Will fire once the mgmt.applyDownload() call succeeds.
    1.74 +   */
    1.75 +  attribute nsIDOMEventListener ondownloadapplied;
    1.76 +
    1.77 +  /**
    1.78 +   * Starts to download an update. If |downloading| is true, this
    1.79 +   * is a no-op.
    1.80 +   */
    1.81 +  void download();
    1.82 +
    1.83 +  /**
    1.84 +   * Cancels an ongoing update download.
    1.85 +   */
    1.86 +  void cancelDownload();
    1.87 +
    1.88 +  /* startPoint will be used when several launch_path exists for an app */
    1.89 +  nsIDOMDOMRequest launch([optional] in DOMString startPoint);
    1.90 +
    1.91 +  /**
    1.92 +   * Clear data that has been collected through mozbrowser elements.
    1.93 +   * onsuccess will be called once data is actually cleared.
    1.94 +   */
    1.95 +  nsIDOMDOMRequest clearBrowserData();
    1.96 +
    1.97 +  /**
    1.98 +   * Inter-App Communication APIs.
    1.99 +   *
   1.100 +   * https://wiki.mozilla.org/WebAPI/Inter_App_Communication_Alt_proposal
   1.101 +   */
   1.102 +  nsISupports connect(in DOMString keyword,
   1.103 +                      [optional] in jsval rules); // nsISupports is a Promise.
   1.104 +
   1.105 +  nsISupports getConnections(); // nsISupports is a Promise.
   1.106 +
   1.107 +  /* Receipts handling functions */
   1.108 +  nsIDOMDOMRequest addReceipt(in DOMString receipt);
   1.109 +  nsIDOMDOMRequest removeReceipt(in DOMString receipt);
   1.110 +  nsIDOMDOMRequest replaceReceipt(in DOMString oldReceipt, in DOMString newReceipt);
   1.111 +};
   1.112 +
   1.113 +[scriptable, uuid(cf742022-5ba3-11e2-868f-03310341b006)]
   1.114 +interface mozIDOMApplicationMgmt : nsISupports
   1.115 +{
   1.116 +  /**
   1.117 +   * the request will return the all the applications installed. Only accessible
   1.118 +   * to privileged callers.
   1.119 +   */
   1.120 +  nsIDOMDOMRequest getAll();
   1.121 +
   1.122 +  /**
   1.123 +   * the request will return the applications acquired from all origins but
   1.124 +   * which are not launchable (e.g. by not being natively installed), or null.
   1.125 +   */
   1.126 +  nsIDOMDOMRequest getNotInstalled();
   1.127 +
   1.128 +  /**
   1.129 +   * event listener to get notified of application installs. Only settable by
   1.130 +   * privileged callers.
   1.131 +   * the event will be a mozIDOMApplicationEvent
   1.132 +   */
   1.133 +  attribute nsIDOMEventListener oninstall;
   1.134 +
   1.135 +  /**
   1.136 +   * event listener to get notified of application uninstalls. Only settable by
   1.137 +   * privileged callers.
   1.138 +   * the event will be a mozIDOMApplicationEvent
   1.139 +   */
   1.140 +  attribute nsIDOMEventListener onuninstall;
   1.141 +
   1.142 +  /**
   1.143 +   * Applies a downloaded update.
   1.144 +   * This function is a no-op if it's passed an app object which doesn't have
   1.145 +   * |readyToApplyDownload| set to true.
   1.146 +   */
   1.147 +  void applyDownload(in mozIDOMApplication app);
   1.148 +
   1.149 +  /**
   1.150 +   * Uninstall a web app.
   1.151 +   *
   1.152 +   * @param app : the app object of the web app to be uninstalled.
   1.153 +   * @returns   : A DOMRequest object, returning the app's origin in |result|
   1.154 +   *              if uninstall succeeds; returning "NOT_INSTALLED" error otherwise.
   1.155 +   */
   1.156 +  nsIDOMDOMRequest uninstall(in mozIDOMApplication app);
   1.157 +};
   1.158 +
   1.159 +[scriptable, uuid(52710c5f-b2a2-4b27-b5b9-f679a1bcc79b)]
   1.160 +interface mozIDOMApplicationRegistry : nsISupports
   1.161 +{
   1.162 +  /**
   1.163 +   * Install a web app.
   1.164 +   *
   1.165 +   * @param manifestUrl : the URL of the webapps manifest.
   1.166 +   * @param parameters  : A structure with optional information.
   1.167 +   *                      {
   1.168 +   *                       receipts: ...    Will be used to specify the payment receipts for this installation.
   1.169 +   *                       categories: ...  Will be used to specify the categories of the webapp.
   1.170 +   *                      }
   1.171 +   * @returns           : A DOMRequest object, returning the app object in |result| if install succeeds.
   1.172 +   */
   1.173 +  nsIDOMDOMRequest install(in DOMString manifestUrl, [optional] in jsval parameters);
   1.174 +
   1.175 +  /**
   1.176 +   * the request will return the application currently installed, or null.
   1.177 +   */
   1.178 +  nsIDOMDOMRequest getSelf();
   1.179 +
   1.180 +  /**
   1.181 +   * the request will return the application if the app from that origin is installed
   1.182 +   */
   1.183 +  nsIDOMDOMRequest checkInstalled(in DOMString manifestUrl);
   1.184 +
   1.185 +  /**
   1.186 +   * the request will return the applications installed from this origin, or null.
   1.187 +   */
   1.188 +  nsIDOMDOMRequest getInstalled();
   1.189 +
   1.190 +  /**
   1.191 +   * Install a packaged web app.
   1.192 +   *
   1.193 +   * @param packageUrl : the URL of the webapps manifest.
   1.194 +   * @param parameters : A structure with optional information.
   1.195 +   *                      {
   1.196 +   *                       receipts: ...    Will be used to specify the payment receipts for this installation.
   1.197 +   *                       categories: ...  Will be used to specify the categories of the webapp.
   1.198 +   *                      }
   1.199 +   * @returns          : A DOMRequest object, returning the app object in |result| if install succeeds.
   1.200 +   */
   1.201 +  nsIDOMDOMRequest installPackage(in DOMString packageUrl, [optional] in jsval parameters);
   1.202 +
   1.203 +  readonly attribute mozIDOMApplicationMgmt mgmt;
   1.204 +};

mercurial