1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include
"nsISupports.idl"
10 [scriptable
, function
, uuid(5131a62a
-e99f
-4631-9138-751f8aad1ae4
)]
11 interface nsIJumpListCommittedCallback
: nsISupports
13 void done
(in boolean result
);
16 [scriptable
, uuid(1FE6A9CD
-2B18
-4dd5
-A176
-C2B32FA4F683
)]
17 interface nsIJumpListBuilder
: nsISupports
22 * Jump lists are built and then applied. Modifying an applied jump list is not
23 * permitted. Callers should begin the creation of a new jump list using
24 * initListBuild, add sub lists using addListToBuild, then commit the jump list
25 * using commitListBuild. Lists are built in real-time during the sequence of
26 * build calls, make sure to check for errors on each individual step.
28 * The default number of allowed items in a jump list is ten. Users can change
29 * the number through system preferences. User may also pin items to jump lists,
30 * which take up additional slots. Applications do not have control over the
31 * number of items allowed in jump lists; excess items added are dropped by the
32 * system. Item insertion priority is defined as first to last added.
34 * Users may remove items from jump lists after they are commited. The system
35 * tracks removed items between commits. A list of these items is returned by
36 * a call to initListBuild. nsIJumpListBuilder does not filter entries added that
37 * have been removed since the last commit. To prevent repeatedly adding entries
38 * users have removed, applications are encoraged to track removed items
41 * Each list is made up of an array of nsIJumpListItem representing items
42 * such as shortcuts, links, and separators. See nsIJumpListItem for information
43 * on adding additional jump list types.
53 * Tasks are common actions performed by users within the application. A task
54 * can be represented by an application shortcut and associated command line
55 * parameters or a URI. Task lists should generally be static lists that do not
56 * change often, if at all - similar to an application menu.
58 * Tasks are given the highest priority of all lists when space is limited.
60 const short JUMPLIST_CATEGORY_TASKS
= 0;
63 * Recent or Frequent list
65 * Recent and frequent lists are based on Window's recent document lists. The
66 * lists are generated automatically by Windows. Applications that use recent
67 * or frequent lists should keep document use tracking up to date by calling
68 * the SHAddToRecentDocs shell api.
70 const short JUMPLIST_CATEGORY_RECENT
= 1;
71 const short JUMPLIST_CATEGORY_FREQUENT
= 2;
76 * Custom lists can be made up of tasks, links, and separators. The title of
77 * of the list is passed through the optional string parameter of addBuildList.
79 const short JUMPLIST_CATEGORY_CUSTOMLIST
= 3;
82 * Indicates whether jump list taskbar features are supported by the current
85 readonly attribute
short available
;
90 * @throw NS_ERROR_NOT_AVAILABLE on all calls if taskbar functionality
91 * is not supported by the operating system.
95 * Indicates if a commit has already occurred in this session.
97 readonly attribute
boolean isListCommitted
;
100 * The maximum number of jump list items the current desktop can support.
102 readonly attribute
short maxListItems
;
105 * Initializes a jump list build and returns a promise with the list of
106 * items the user removed since the last time a jump list was committed.
107 * Removed items can become state after initListBuild is called, lists
108 * should be built in single-shot fasion.
110 * @returns a promise with the list of items that were removed by the user
111 * since the last commit.
114 Promise initListBuild
();
117 * Adds a list and if required, a set of items for the list.
120 * The type of list to add.
122 * An array of nsIJumpListItem items to add to the list.
124 * For custom lists, the title of the list.
126 * @returns true if the operation completed successfully.
128 * @throw NS_ERROR_INVALID_ARG if incorrect parameters are passed for
129 * a particular category or item type.
130 * @throw NS_ERROR_ILLEGAL_VALUE if an item is added that was removed
131 * since the last commit.
132 * @throw NS_ERROR_UNEXPECTED on internal errors.
134 boolean addListToBuild
(in short aCatType
, [optional] in nsIArray items
, [optional] in AString catName
);
137 * Aborts and clears the current jump list build.
139 void abortListBuild
();
142 * Commits the current jump list build to the Taskbar.
145 * Receives one argument, which is true if the operation completed
146 * successfully, otherwise it is false.
148 void commitListBuild
([optional] in nsIJumpListCommittedCallback
callback);
151 * Deletes any currently applied taskbar jump list for this application.
152 * Common uses would be the enabling of a privacy mode and uninstallation.
154 * @returns true if the operation completed successfully.
156 * @throw NS_ERROR_UNEXPECTED on internal errors.
158 boolean deleteActiveList
();