Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIArray; |
michael@0 | 9 | interface nsIMutableArray; |
michael@0 | 10 | |
michael@0 | 11 | [scriptable, uuid(1FE6A9CD-2B18-4dd5-A176-C2B32FA4F683)] |
michael@0 | 12 | interface nsIJumpListBuilder : nsISupports |
michael@0 | 13 | { |
michael@0 | 14 | /** |
michael@0 | 15 | * JumpLists |
michael@0 | 16 | * |
michael@0 | 17 | * Jump lists are built and then applied. Modifying an applied jump list is not |
michael@0 | 18 | * permitted. Callers should begin the creation of a new jump list using |
michael@0 | 19 | * initListBuild, add sub lists using addListToBuild, then commit the jump list |
michael@0 | 20 | * using commitListBuild. Lists are built in real-time during the sequence of |
michael@0 | 21 | * build calls, make sure to check for errors on each individual step. |
michael@0 | 22 | * |
michael@0 | 23 | * The default number of allowed items in a jump list is ten. Users can change |
michael@0 | 24 | * the number through system preferences. User may also pin items to jump lists, |
michael@0 | 25 | * which take up additional slots. Applications do not have control over the |
michael@0 | 26 | * number of items allowed in jump lists; excess items added are dropped by the |
michael@0 | 27 | * system. Item insertion priority is defined as first to last added. |
michael@0 | 28 | * |
michael@0 | 29 | * Users may remove items from jump lists after they are commited. The system |
michael@0 | 30 | * tracks removed items between commits. A list of these items is returned by |
michael@0 | 31 | * a call to initListBuild. nsIJumpListBuilder does not filter entries added that |
michael@0 | 32 | * have been removed since the last commit. To prevent repeatedly adding entries |
michael@0 | 33 | * users have removed, applications are encoraged to track removed items |
michael@0 | 34 | * internally. |
michael@0 | 35 | * |
michael@0 | 36 | * Each list is made up of an array of nsIJumpListItem representing items |
michael@0 | 37 | * such as shortcuts, links, and separators. See nsIJumpListItem for information |
michael@0 | 38 | * on adding additional jump list types. |
michael@0 | 39 | */ |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * List Types |
michael@0 | 43 | */ |
michael@0 | 44 | |
michael@0 | 45 | /** |
michael@0 | 46 | * Task List |
michael@0 | 47 | * |
michael@0 | 48 | * Tasks are common actions performed by users within the application. A task |
michael@0 | 49 | * can be represented by an application shortcut and associated command line |
michael@0 | 50 | * parameters or a URI. Task lists should generally be static lists that do not |
michael@0 | 51 | * change often, if at all - similar to an application menu. |
michael@0 | 52 | * |
michael@0 | 53 | * Tasks are given the highest priority of all lists when space is limited. |
michael@0 | 54 | */ |
michael@0 | 55 | const short JUMPLIST_CATEGORY_TASKS = 0; |
michael@0 | 56 | |
michael@0 | 57 | /** |
michael@0 | 58 | * Recent or Frequent list |
michael@0 | 59 | * |
michael@0 | 60 | * Recent and frequent lists are based on Window's recent document lists. The |
michael@0 | 61 | * lists are generated automatically by Windows. Applications that use recent |
michael@0 | 62 | * or frequent lists should keep document use tracking up to date by calling |
michael@0 | 63 | * the SHAddToRecentDocs shell api. |
michael@0 | 64 | */ |
michael@0 | 65 | const short JUMPLIST_CATEGORY_RECENT = 1; |
michael@0 | 66 | const short JUMPLIST_CATEGORY_FREQUENT = 2; |
michael@0 | 67 | |
michael@0 | 68 | /** |
michael@0 | 69 | * Custom Lists |
michael@0 | 70 | * |
michael@0 | 71 | * Custom lists can be made up of tasks, links, and separators. The title of |
michael@0 | 72 | * of the list is passed through the optional string parameter of addBuildList. |
michael@0 | 73 | */ |
michael@0 | 74 | const short JUMPLIST_CATEGORY_CUSTOMLIST = 3; |
michael@0 | 75 | |
michael@0 | 76 | /** |
michael@0 | 77 | * Indicates whether jump list taskbar features are supported by the current |
michael@0 | 78 | * host. |
michael@0 | 79 | */ |
michael@0 | 80 | readonly attribute short available; |
michael@0 | 81 | |
michael@0 | 82 | /** |
michael@0 | 83 | * JumpList management |
michael@0 | 84 | * |
michael@0 | 85 | * @throw NS_ERROR_NOT_AVAILABLE on all calls if taskbar functionality |
michael@0 | 86 | * is not supported by the operating system. |
michael@0 | 87 | */ |
michael@0 | 88 | |
michael@0 | 89 | /** |
michael@0 | 90 | * Indicates if a commit has already occurred in this session. |
michael@0 | 91 | */ |
michael@0 | 92 | readonly attribute boolean isListCommitted; |
michael@0 | 93 | |
michael@0 | 94 | /** |
michael@0 | 95 | * The maximum number of jump list items the current desktop can support. |
michael@0 | 96 | */ |
michael@0 | 97 | readonly attribute short maxListItems; |
michael@0 | 98 | |
michael@0 | 99 | /** |
michael@0 | 100 | * Initializes a jump list build and returns a list of items the user removed |
michael@0 | 101 | * since the last time a jump list was committed. Removed items can become state |
michael@0 | 102 | * after initListBuild is called, lists should be built in single-shot fasion. |
michael@0 | 103 | * |
michael@0 | 104 | * @param removedItems |
michael@0 | 105 | * A list of items that were removed by the user since the last commit. |
michael@0 | 106 | * |
michael@0 | 107 | * @returns true if the operation completed successfully. |
michael@0 | 108 | */ |
michael@0 | 109 | boolean initListBuild(in nsIMutableArray removedItems); |
michael@0 | 110 | |
michael@0 | 111 | /** |
michael@0 | 112 | * Adds a list and if required, a set of items for the list. |
michael@0 | 113 | * |
michael@0 | 114 | * @param aCatType |
michael@0 | 115 | * The type of list to add. |
michael@0 | 116 | * @param items |
michael@0 | 117 | * An array of nsIJumpListItem items to add to the list. |
michael@0 | 118 | * @param catName |
michael@0 | 119 | * For custom lists, the title of the list. |
michael@0 | 120 | * |
michael@0 | 121 | * @returns true if the operation completed successfully. |
michael@0 | 122 | * |
michael@0 | 123 | * @throw NS_ERROR_INVALID_ARG if incorrect parameters are passed for |
michael@0 | 124 | * a particular category or item type. |
michael@0 | 125 | * @throw NS_ERROR_ILLEGAL_VALUE if an item is added that was removed |
michael@0 | 126 | * since the last commit. |
michael@0 | 127 | * @throw NS_ERROR_UNEXPECTED on internal errors. |
michael@0 | 128 | */ |
michael@0 | 129 | boolean addListToBuild(in short aCatType, [optional] in nsIArray items, [optional] in AString catName); |
michael@0 | 130 | |
michael@0 | 131 | /** |
michael@0 | 132 | * Aborts and clears the current jump list build. |
michael@0 | 133 | */ |
michael@0 | 134 | void abortListBuild(); |
michael@0 | 135 | |
michael@0 | 136 | /** |
michael@0 | 137 | * Commits the current jump list build to the Taskbar. |
michael@0 | 138 | * |
michael@0 | 139 | * @returns true if the operation completed successfully. |
michael@0 | 140 | */ |
michael@0 | 141 | boolean commitListBuild(); |
michael@0 | 142 | |
michael@0 | 143 | /** |
michael@0 | 144 | * Deletes any currently applied taskbar jump list for this application. |
michael@0 | 145 | * Common uses would be the enabling of a privacy mode and uninstallation. |
michael@0 | 146 | * |
michael@0 | 147 | * @returns true if the operation completed successfully. |
michael@0 | 148 | * |
michael@0 | 149 | * @throw NS_ERROR_UNEXPECTED on internal errors. |
michael@0 | 150 | */ |
michael@0 | 151 | boolean deleteActiveList(); |
michael@0 | 152 | }; |