1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/nsITaggingService.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,78 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIURI; 1.12 +interface nsIVariant; 1.13 + 1.14 +[scriptable, uuid(f816b4df-f733-4dbd-964d-8bfc92a475b2)] 1.15 +interface nsITaggingService : nsISupports 1.16 +{ 1.17 + /** 1.18 + * Tags a URL with the given set of tags. Current tags set for the URL 1.19 + * persist. Tags in aTags which are already set for the given URL are 1.20 + * ignored. 1.21 + * 1.22 + * @param aURI 1.23 + * the URL to tag. 1.24 + * @param aTags 1.25 + * Array of tags to set for the given URL. Each element within the 1.26 + * array can be either a tag name (non-empty string) or a concrete 1.27 + * itemId of a tag container. 1.28 + */ 1.29 + void tagURI(in nsIURI aURI, in nsIVariant aTags); 1.30 + 1.31 + /** 1.32 + * Removes tags from a URL. Tags from aTags which are not set for the 1.33 + * given URL are ignored. 1.34 + * 1.35 + * @param aURI 1.36 + * the URL to un-tag. 1.37 + * @param aTags 1.38 + * Array of tags to unset. Pass null to remove all tags from the given 1.39 + * url. Each element within the array can be either a tag name 1.40 + * (non-empty string) or a concrete itemId of a tag container. 1.41 + */ 1.42 + void untagURI(in nsIURI aURI, in nsIVariant aTags); 1.43 + 1.44 + /** 1.45 + * Retrieves all URLs tagged with the given tag. 1.46 + * 1.47 + * @param aTag 1.48 + * tag name 1.49 + * @returns Array of uris tagged with aTag. 1.50 + */ 1.51 + nsIVariant getURIsForTag(in AString aTag); 1.52 + 1.53 + /** 1.54 + * Retrieves all tags set for the given URL. 1.55 + * 1.56 + * @param aURI 1.57 + * a URL. 1.58 + * @returns array of tags (sorted by name). 1.59 + */ 1.60 + void getTagsForURI(in nsIURI aURI, 1.61 + [optional] out unsigned long length, 1.62 + [retval, array, size_is(length)] out wstring aTags); 1.63 + 1.64 + /** 1.65 + * Retrieves all tags used to tag URIs in the data-base (sorted by name). 1.66 + */ 1.67 + readonly attribute nsIVariant allTags; 1.68 + 1.69 + /** 1.70 + * Whether any tags exist. 1.71 + * 1.72 + * @note This is faster than allTags.length, since doesn't need to sort tags. 1.73 + */ 1.74 + readonly attribute boolean hasTags; 1.75 +}; 1.76 + 1.77 +%{C++ 1.78 + 1.79 +#define TAGGING_SERVICE_CID "@mozilla.org/browser/tagging-service;1" 1.80 + 1.81 +%}