|
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/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIURI; |
|
9 interface nsIVariant; |
|
10 |
|
11 [scriptable, uuid(f816b4df-f733-4dbd-964d-8bfc92a475b2)] |
|
12 interface nsITaggingService : nsISupports |
|
13 { |
|
14 /** |
|
15 * Tags a URL with the given set of tags. Current tags set for the URL |
|
16 * persist. Tags in aTags which are already set for the given URL are |
|
17 * ignored. |
|
18 * |
|
19 * @param aURI |
|
20 * the URL to tag. |
|
21 * @param aTags |
|
22 * Array of tags to set for the given URL. Each element within the |
|
23 * array can be either a tag name (non-empty string) or a concrete |
|
24 * itemId of a tag container. |
|
25 */ |
|
26 void tagURI(in nsIURI aURI, in nsIVariant aTags); |
|
27 |
|
28 /** |
|
29 * Removes tags from a URL. Tags from aTags which are not set for the |
|
30 * given URL are ignored. |
|
31 * |
|
32 * @param aURI |
|
33 * the URL to un-tag. |
|
34 * @param aTags |
|
35 * Array of tags to unset. Pass null to remove all tags from the given |
|
36 * url. Each element within the array can be either a tag name |
|
37 * (non-empty string) or a concrete itemId of a tag container. |
|
38 */ |
|
39 void untagURI(in nsIURI aURI, in nsIVariant aTags); |
|
40 |
|
41 /** |
|
42 * Retrieves all URLs tagged with the given tag. |
|
43 * |
|
44 * @param aTag |
|
45 * tag name |
|
46 * @returns Array of uris tagged with aTag. |
|
47 */ |
|
48 nsIVariant getURIsForTag(in AString aTag); |
|
49 |
|
50 /** |
|
51 * Retrieves all tags set for the given URL. |
|
52 * |
|
53 * @param aURI |
|
54 * a URL. |
|
55 * @returns array of tags (sorted by name). |
|
56 */ |
|
57 void getTagsForURI(in nsIURI aURI, |
|
58 [optional] out unsigned long length, |
|
59 [retval, array, size_is(length)] out wstring aTags); |
|
60 |
|
61 /** |
|
62 * Retrieves all tags used to tag URIs in the data-base (sorted by name). |
|
63 */ |
|
64 readonly attribute nsIVariant allTags; |
|
65 |
|
66 /** |
|
67 * Whether any tags exist. |
|
68 * |
|
69 * @note This is faster than allTags.length, since doesn't need to sort tags. |
|
70 */ |
|
71 readonly attribute boolean hasTags; |
|
72 }; |
|
73 |
|
74 %{C++ |
|
75 |
|
76 #define TAGGING_SERVICE_CID "@mozilla.org/browser/tagging-service;1" |
|
77 |
|
78 %} |