Extension Manager:Sqlite Storage:nsIAddon

From MozillaWiki
Jump to: navigation, search

This replaces nsIUpdateItem

nsIAddon

/**
 * An item managed by the Extension System. Contains metadata that describes
 * the item.
 */
[scriptable, uuid(89c8d1a5-ac74-46e0-b983-7778c275d625)]
interface nsIAddon : nsISupports
{
  const unsigned long TYPE_APP         = 0x01;
  const unsigned long TYPE_EXTENSION   = 0x02;
  const unsigned long TYPE_THEME       = 0x04;
  const unsigned long TYPE_LOCALE      = 0x08;
  const unsigned long TYPE_MULTI_XPI   = 0x20;
  const unsigned long TYPE_ADDON       = TYPE_EXTENSION + TYPE_THEME + TYPE_LOCALE;
  const unsigned long TYPE_ANY         = 0xff;

  /**
   * The GUID of the item.
   */
  readonly attribute AString  id;

  /**
   * The name of the Install Location where this item is installed.
   */
  readonly attribute AString  installLocationKey;

  /**
   * The Version of the item, in FVF format.
   */
  readonly attribute AString  version;

  /**
   * The type of this item.
   */
  readonly attribute long type;

  /**
   * The URL of the update manifest for this item.
   */
  readonly attribute AString  updateURL;

  /**
   * The public key to verify updates for this item. This must be the public
   * part of the key that was used to sign update manifests for this add-on.
   */
  readonly attribute AString  updateKey;

  /**
   * The URL of the options dialog for for this item.
   */
  readonly attribute AString  optionsURL;

  /**
   * The URL of the about dialog for this item.
   */
  readonly attribute AString  aboutURL;

  /**
   * The URL of the icon that can be shown for this item.
   */
  readonly attribute AString  iconURL;

  /**
   * The internal chrome name for this item if it is a theme.
   */
  readonly attribute AString  internalName;

  /**
   * This attribute is true if the item is locked and cannot be
   * uninstalled.
   */
  readonly attribute boolean  locked;

  /**
   * This attribute is true if the item is hidden and should not be
   * displayed to the user.
   */
  readonly attribute boolean  hidden;

  /**
   * This attribute is true if the item is managed by the application.
   */
  readonly attribute boolean  appManaged;

  /**
   * This attribute is true if the user has disabled the item.
   */
  readonly attribute boolean  userDisabled;


  /**
   * This attribute is true if anything is causing the item to be
   * disabled.
   */
  readonly attribute boolean  isDisabled;

  /**
   * This attribute is true if the item is blocklisted.
   */
  readonly attribute boolean  isBlocklisted;

  /**
   * This attribute is true if the item is compatible with the
   * current application.
   */
  readonly attribute boolean  isCompatible;

  
  /**
   * The target application ID used for checking compatibility for this item.
   *
   * @note Add-ons can specify a targetApplication id of toolkit@mozilla.org in
   *       their install manifest for compatibility with all apps using a
   *       specific release of the toolkit.
   */
  readonly attribute AString  targetAppID;

  /**
   * The minimum version of this application that this item works with,
   * in FVF format.
   */
  readonly attribute AString  minAppVersion;

  /**
   * The maximum version of this application that this item works with,
   * in FVF format.
   */
  readonly attribute AString  maxAppVersion;


  /**
   * The name of this item.
   */
  readonly attribute AString  name;

  /**
   * The description of this item.
   */
  readonly attribute AString  description;

  /**
   * The creator of this item.
   */
  readonly attribute AString  creator;

  /**
   * The homepageURL of this item.
   */
  readonly attribute AString  homepageURL;

  /**
   * Retrieve the list of developers of this item.
   */
  void getDevelopers(out unsigned long count,
                     [retval, array, size_is(count)] out AString developers)

  /**
   * Retrieve the list of translators of this item.
   */
  void getTranslators(out unsigned long count,
                     [retval, array, size_is(count)] out AString translators)

  /**
   * Retrieve the list of contributors of this item.
   */
  void getContributors(out unsigned long count,
                     [retval, array, size_is(count)] out AString contributors)
};

nsIAddonDownload

Should this really extend nsIAddon. If instead it had an nsIAddon addon attribute then that could change between the partially filled downloading item and the fully filled installed item for cases where no restart were necessary.

/**
 * An item that is currently waiting to be downloaded/installed.
 * Certain of the nsIAddon properties are only available after the
 * xpi has been downloaded.
 */
[scriptable, uuid(89c8d1a5-ac74-46e0-b983-7778c275d625)]
interface nsIAddonDownload : nsIAddon
{
  /**
   * Before download has started, e.g. for available updates. Maybe
   * also for new installs awaiting confirmation, might want a
   * separate state for that though
   */
  const unsigned long STATE_PENDING = 0;
  const unsigned long STATE_DOWNLOADING = 1;
  /**
   * This state may be skipped if no check is necessary.
   */
  const unsigned long STATE_CHECKING_COMPATIBILITY = 2;
  const unsigned long STATE_INSTALLING = 3;
  /**
   * This state may be skipped if no restart is necessary.
   */
  const unsigned long STATE_PENDING_RESTART = 4;
  const unsigned long STATE_INSTALLED = 5;

  /**
   * The current state of the install. There are notifications
   * in nsIAddonInstallListener whenever this changes.
   */
  readonly attribute unsigned long state

  /**
   * The url of any information about the update
   */
  readonly attribute nsIURL        updateInfoURL

  /**
   * The url the xpi is downloaded from (may be file: if there was
   * no download necessary.
   */
  readonly attribute nsIURL        xpiURL

  /**
   * The expected hash of the xpi
   */
  readonly attribute AString       xpiHash

  /**
   * The temporary file for the xpi
   */
  readonly attribute nsIFile       xpiFile

  /**
   * The certificate signing the xpi
   */
  readonly attribute nsIPrincipal  certificate

  /**
   * Adds an install listener that will be notified of state changes
   * for this install.
   */
  void addInstallListener(in nsIAddonInstallListener installListener);

  /**
   * Removes an install listener.
   */
  void removeInstallListener(in nsIAddonInstallListener installListener);
}