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 nsIURI; |
michael@0 | 9 | interface nsILocalHandlerApp; |
michael@0 | 10 | interface nsIMutableArray; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * Implements Win7 Taskbar jump list item interfaces. |
michael@0 | 14 | * |
michael@0 | 15 | * Note to consumers: it's reasonable to expect we'll need support for other types |
michael@0 | 16 | * of jump list items (an audio file, an email message, etc.). To add types, |
michael@0 | 17 | * create the specific interface here, add an implementation class to WinJumpListItem, |
michael@0 | 18 | * and add support to addListBuild & removed items processing. |
michael@0 | 19 | * |
michael@0 | 20 | */ |
michael@0 | 21 | |
michael@0 | 22 | [scriptable, uuid(ACB8FB3C-E1B0-4044-8A50-E52C3E7C1057)] |
michael@0 | 23 | interface nsIJumpListItem : nsISupports |
michael@0 | 24 | { |
michael@0 | 25 | const short JUMPLIST_ITEM_EMPTY = 0; // Empty list item |
michael@0 | 26 | const short JUMPLIST_ITEM_SEPARATOR = 1; // Separator |
michael@0 | 27 | const short JUMPLIST_ITEM_LINK = 2; // Web link item |
michael@0 | 28 | const short JUMPLIST_ITEM_SHORTCUT = 3; // Application shortcut |
michael@0 | 29 | |
michael@0 | 30 | /** |
michael@0 | 31 | * Retrieves the jump list item type. |
michael@0 | 32 | */ |
michael@0 | 33 | readonly attribute short type; |
michael@0 | 34 | |
michael@0 | 35 | /** |
michael@0 | 36 | * Compare this item to another. |
michael@0 | 37 | * |
michael@0 | 38 | * Compares the type and other properties specific to this item's |
michael@0 | 39 | * type. |
michael@0 | 40 | * |
michael@0 | 41 | * separator: type |
michael@0 | 42 | * link: type, uri, title |
michael@0 | 43 | * shortcut: type, handler app |
michael@0 | 44 | */ |
michael@0 | 45 | boolean equals(in nsIJumpListItem item); |
michael@0 | 46 | }; |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * A menu separator. |
michael@0 | 50 | */ |
michael@0 | 51 | |
michael@0 | 52 | [scriptable, uuid(69A2D5C5-14DC-47da-925D-869E0BD64D27)] |
michael@0 | 53 | interface nsIJumpListSeparator : nsIJumpListItem |
michael@0 | 54 | { |
michael@0 | 55 | /* nothing needed here */ |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | /** |
michael@0 | 59 | * A URI link jump list item. |
michael@0 | 60 | * |
michael@0 | 61 | * Note the application must be the registered protocol |
michael@0 | 62 | * handler for the protocol of the link. |
michael@0 | 63 | */ |
michael@0 | 64 | |
michael@0 | 65 | [scriptable, uuid(76EA47B1-C797-49b3-9F18-5E740A688524)] |
michael@0 | 66 | interface nsIJumpListLink : nsIJumpListItem |
michael@0 | 67 | { |
michael@0 | 68 | /** |
michael@0 | 69 | * Set or get the uri for this link item. |
michael@0 | 70 | */ |
michael@0 | 71 | attribute nsIURI uri; |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Set or get the title for a link item. |
michael@0 | 75 | */ |
michael@0 | 76 | attribute AString uriTitle; |
michael@0 | 77 | |
michael@0 | 78 | /** |
michael@0 | 79 | * Get a 'privacy safe' unique string hash of the uri's |
michael@0 | 80 | * spec. Useful in tracking removed items using visible |
michael@0 | 81 | * data stores such as prefs. Generates an MD5 hash of |
michael@0 | 82 | * the URI spec using nsICryptoHash. |
michael@0 | 83 | */ |
michael@0 | 84 | readonly attribute ACString uriHash; |
michael@0 | 85 | |
michael@0 | 86 | /** |
michael@0 | 87 | * Compare this item's hash to another uri. |
michael@0 | 88 | * |
michael@0 | 89 | * Generates a spec hash of the incoming uri and compares |
michael@0 | 90 | * it to this item's uri spec hash. |
michael@0 | 91 | */ |
michael@0 | 92 | boolean compareHash(in nsIURI uri); |
michael@0 | 93 | }; |
michael@0 | 94 | |
michael@0 | 95 | /** |
michael@0 | 96 | * A generic application shortcut with command line support. |
michael@0 | 97 | */ |
michael@0 | 98 | |
michael@0 | 99 | [scriptable, uuid(CBE3A37C-BCE1-4fec-80A5-5FFBC7F33EEA)] |
michael@0 | 100 | interface nsIJumpListShortcut : nsIJumpListItem |
michael@0 | 101 | { |
michael@0 | 102 | /** |
michael@0 | 103 | * Set or get the handler app for this shortcut item. |
michael@0 | 104 | * |
michael@0 | 105 | * The handler app may also be used along with iconIndex to generate an icon |
michael@0 | 106 | * for the jump list item. |
michael@0 | 107 | * |
michael@0 | 108 | * @throw NS_ERROR_FILE_NOT_FOUND if the handler app can |
michael@0 | 109 | * not be found on the system. |
michael@0 | 110 | * |
michael@0 | 111 | * @see faviconPageUri |
michael@0 | 112 | */ |
michael@0 | 113 | attribute nsILocalHandlerApp app; |
michael@0 | 114 | |
michael@0 | 115 | /** |
michael@0 | 116 | * Set or get the icon displayed with the jump list item. |
michael@0 | 117 | * |
michael@0 | 118 | * Indicates the resource index of the icon contained within the handler |
michael@0 | 119 | * executable which may be used as the jump list icon. |
michael@0 | 120 | * |
michael@0 | 121 | * @see faviconPageUri |
michael@0 | 122 | */ |
michael@0 | 123 | attribute long iconIndex; |
michael@0 | 124 | |
michael@0 | 125 | /** |
michael@0 | 126 | * Set or get the URI of a page whose favicon may be used as the icon. |
michael@0 | 127 | * |
michael@0 | 128 | * When a jump list build occurs, the favicon to be used for the item is |
michael@0 | 129 | * obtained using the following steps: |
michael@0 | 130 | * - First, attempt to use the asynchronously retrieved and scaled favicon |
michael@0 | 131 | * associated with the faviconPageUri. |
michael@0 | 132 | * - If faviconPageUri is null, or if retrieving the favicon fails, fall |
michael@0 | 133 | * back to using the handler executable and iconIndex. |
michael@0 | 134 | */ |
michael@0 | 135 | attribute nsIURI faviconPageUri; |
michael@0 | 136 | }; |
michael@0 | 137 |