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 file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/.
4 */
5
6
7/**
8 * A callback function that webpages can implement to be notified when triggered
9 * installs complete.
10 */
11callback InstallTriggerCallback = void(DOMString url, short status);
12
13dictionary InstallTriggerData {
14  DOMString URL;
15  DOMString? IconURL;
16  DOMString? Hash;
17};
18
19/**
20 * The interface for the InstallTrigger object available to all websites.
21 */
22[ChromeOnly,
23 JSImplementation="@mozilla.org/addons/installtrigger;1"]
24interface InstallTriggerImpl {
25  /**
26   * Retained for backwards compatibility.
27   */
28  const unsigned short SKIN = 1;
29  const unsigned short LOCALE = 2;
30  const unsigned short CONTENT = 4;
31  const unsigned short PACKAGE = 7;
32
33  /**
34   * Tests if installation is enabled.
35   */
36  boolean enabled();
37
38  /**
39   * Tests if installation is enabled.
40   *
41   * @deprecated Use "enabled" in the future.
42   */
43  boolean updateEnabled();
44
45  /**
46   * Starts a new installation of a set of add-ons.
47   *
48   * @param  aArgs
49   *         The add-ons to install. This should be a JS object, each property
50   *         is the name of an add-on to be installed. The value of the
51   *         property should either be a string URL, or an object with the
52   *         following properties:
53   *          * URL for the add-on's URL
54   *          * IconURL for an icon for the add-on
55   *          * Hash for a hash of the add-on
56   * @param  aCallback
57   *         A callback to call as each installation succeeds or fails
58   * @return true if the installations were successfully started
59   */
60  boolean install(record<DOMString, (DOMString or InstallTriggerData)> installs,
61                  optional InstallTriggerCallback callback);
62
63  /**
64   * Starts installing a new add-on.
65   *
66   * @deprecated use "install" in the future.
67   *
68   * @param  aType
69   *         Unused, retained for backwards compatibility
70   * @param  aUrl
71   *         The URL of the add-on
72   * @param  aSkin
73   *         Unused, retained for backwards compatibility
74   * @return true if the installation was successfully started
75   */
76  boolean installChrome(unsigned short type, DOMString url, DOMString skin);
77
78  /**
79   * Starts installing a new add-on.
80   *
81   * @deprecated use "install" in the future.
82   *
83   * @param  aUrl
84   *         The URL of the add-on
85   * @param  aFlags
86   *         Unused, retained for backwards compatibility
87   * @return true if the installation was successfully started
88   */
89  boolean startSoftwareUpdate(DOMString url, optional unsigned short flags);
90};
91