2012-02-24 04:42:21 -08:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIURI;
|
|
|
|
|
|
|
|
interface mozILivemarkInfo;
|
|
|
|
interface mozILivemark;
|
|
|
|
|
|
|
|
interface nsINavHistoryResultObserver;
|
|
|
|
|
2015-04-25 01:51:48 -07:00
|
|
|
[scriptable, uuid(672387b7-a75d-4e8f-9b49-5c1dcbfff46b)]
|
2012-02-24 04:42:21 -08:00
|
|
|
interface mozIAsyncLivemarks : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Creates a new livemark
|
|
|
|
*
|
|
|
|
* @param aLivemarkInfo
|
|
|
|
* mozILivemarkInfo object containing at least title, parentId,
|
|
|
|
* index and feedURI of the livemark to create.
|
2015-04-25 01:51:48 -07:00
|
|
|
*
|
2013-11-20 02:00:02 -08:00
|
|
|
* @return {Promise}
|
2012-02-24 04:42:21 -08:00
|
|
|
* @throws NS_ERROR_INVALID_ARG if the supplied information is insufficient
|
|
|
|
* for the creation.
|
|
|
|
*/
|
2015-04-25 01:51:48 -07:00
|
|
|
jsval addLivemark(in jsval aLivemarkInfo);
|
2012-02-24 04:42:21 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes an existing livemark.
|
|
|
|
*
|
|
|
|
* @param aLivemarkInfo
|
|
|
|
* mozILivemarkInfo object containing either an id or a guid of the
|
|
|
|
* livemark to remove.
|
|
|
|
*
|
2013-11-20 02:00:02 -08:00
|
|
|
* @return {Promise}
|
2012-02-24 04:42:21 -08:00
|
|
|
* @throws NS_ERROR_INVALID_ARG if the id/guid is invalid.
|
|
|
|
*/
|
2015-04-25 01:51:48 -07:00
|
|
|
jsval removeLivemark(in jsval aLivemarkInfo);
|
2012-02-24 04:42:21 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets an existing livemark.
|
|
|
|
*
|
|
|
|
* @param aLivemarkInfo
|
|
|
|
* mozILivemarkInfo object containing either an id or a guid of the
|
|
|
|
* livemark to retrieve.
|
|
|
|
*
|
2013-11-20 02:00:02 -08:00
|
|
|
* @return {Promise}
|
2012-02-24 04:42:21 -08:00
|
|
|
* @throws NS_ERROR_INVALID_ARG if the id/guid is invalid or an invalid
|
|
|
|
* callback is provided.
|
|
|
|
*/
|
2015-04-25 01:51:48 -07:00
|
|
|
jsval getLivemark(in jsval aLivemarkInfo);
|
2012-02-24 04:42:21 -08:00
|
|
|
|
|
|
|
/**
|
2012-03-08 02:14:59 -08:00
|
|
|
* Reloads all livemarks if they are expired or if forced to do so.
|
|
|
|
*
|
|
|
|
* @param [optional]aForceUpdate
|
|
|
|
* If set to true forces a reload even if contents are still valid.
|
|
|
|
*
|
|
|
|
* @note The update process is asynchronous, observers registered through
|
|
|
|
* registerForUpdates will be notified of updated contents.
|
2012-02-24 04:42:21 -08:00
|
|
|
*/
|
2012-03-08 02:14:59 -08:00
|
|
|
void reloadLivemarks([optional]in boolean aForceUpdate);
|
2012-02-24 04:42:21 -08:00
|
|
|
};
|
|
|
|
|
2015-04-25 01:51:48 -07:00
|
|
|
[scriptable, uuid(3a3c5e8f-ec4a-4086-ae0a-d16420d30c9f)]
|
2012-02-24 04:42:21 -08:00
|
|
|
interface mozILivemarkInfo : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Id of the bookmarks folder representing this livemark.
|
2015-04-25 01:51:48 -07:00
|
|
|
*
|
|
|
|
* @deprecated Use guid instead.
|
2012-02-24 04:42:21 -08:00
|
|
|
*/
|
|
|
|
readonly attribute long long id;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The globally unique identifier of this livemark.
|
|
|
|
*/
|
|
|
|
readonly attribute ACString guid;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Title of this livemark.
|
|
|
|
*/
|
|
|
|
readonly attribute AString title;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Id of the bookmarks parent folder containing this livemark.
|
2015-04-25 01:51:48 -07:00
|
|
|
*
|
|
|
|
* @deprecated Use parentGuid instead.
|
2012-02-24 04:42:21 -08:00
|
|
|
*/
|
|
|
|
readonly attribute long long parentId;
|
|
|
|
|
2015-04-25 01:51:48 -07:00
|
|
|
/**
|
|
|
|
* Guid of the bookmarks parent folder containing this livemark.
|
|
|
|
*/
|
|
|
|
readonly attribute long long parentGuid;
|
|
|
|
|
2012-02-24 04:42:21 -08:00
|
|
|
/**
|
|
|
|
* The position of this livemark in the bookmarks parent folder.
|
|
|
|
*/
|
|
|
|
readonly attribute long index;
|
|
|
|
|
2014-11-25 04:34:20 -08:00
|
|
|
/**
|
|
|
|
* Time this livemark was created.
|
|
|
|
*/
|
|
|
|
readonly attribute PRTime dateAdded;
|
|
|
|
|
2012-02-24 04:42:21 -08:00
|
|
|
/**
|
|
|
|
* Time this livemark's details were last modified. Doesn't track changes to
|
|
|
|
* the livemark contents.
|
|
|
|
*/
|
|
|
|
readonly attribute PRTime lastModified;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URI of the syndication feed associated with this livemark.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIURI feedURI;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The URI of the website associated with this livemark.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIURI siteURI;
|
|
|
|
};
|
|
|
|
|
|
|
|
[scriptable, uuid(9f6fdfae-db9a-4bd8-bde1-148758cf1b18)]
|
|
|
|
interface mozILivemark : mozILivemarkInfo
|
|
|
|
{
|
|
|
|
// Indicates the livemark is inactive.
|
|
|
|
const unsigned short STATUS_READY = 0;
|
|
|
|
// Indicates the livemark is fetching new contents.
|
|
|
|
const unsigned short STATUS_LOADING = 1;
|
|
|
|
// Indicates the livemark failed to fetch new contents.
|
|
|
|
const unsigned short STATUS_FAILED = 2;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Status of this livemark. One of the STATUS_* constants above.
|
|
|
|
*/
|
|
|
|
readonly attribute unsigned short status;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reload livemark contents if they are expired or if forced to do so.
|
|
|
|
*
|
|
|
|
* @param [optional]aForceUpdate
|
|
|
|
* If set to true forces a reload even if contents are still valid.
|
|
|
|
*
|
|
|
|
* @note The update process is asynchronous, it's possible to register a
|
|
|
|
* result observer to be notified of updated contents through
|
|
|
|
* registerForUpdates.
|
|
|
|
*/
|
|
|
|
void reload([optional]in boolean aForceUpdate);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an array of nsINavHistoryResultNode objects, representing children
|
|
|
|
* of this livemark. The nodes will have aContainerNode as parent.
|
|
|
|
*
|
|
|
|
* @param aContainerNode
|
|
|
|
* Object implementing nsINavHistoryContainerResultNode, to be used as
|
|
|
|
* parent of the livemark nodes.
|
|
|
|
*/
|
|
|
|
jsval getNodesForContainer(in jsval aContainerNode);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Registers a container node for updates on this livemark.
|
|
|
|
* When the livemark contents change, an invalidateContainer(aContainerNode)
|
|
|
|
* request is sent to aResultObserver.
|
|
|
|
*
|
|
|
|
* @param aContainerNode
|
|
|
|
* Object implementing nsINavHistoryContainerResultNode, representing
|
|
|
|
* this livemark.
|
|
|
|
* @param aResultObserver
|
|
|
|
* The nsINavHistoryResultObserver that should be notified of changes
|
|
|
|
* to the livemark contents.
|
|
|
|
*/
|
|
|
|
void registerForUpdates(in jsval aContainerNode,
|
|
|
|
in nsINavHistoryResultObserver aResultObserver);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Unregisters a previously registered container node.
|
|
|
|
*
|
|
|
|
* @param aContainerNode
|
|
|
|
* Object implementing nsINavHistoryContainerResultNode, representing
|
|
|
|
* this livemark.
|
|
|
|
*
|
|
|
|
* @note it's suggested to always unregister containers that are no more used,
|
|
|
|
* to free up the associated resources. A good time to do so is when
|
|
|
|
* the container gets closed.
|
|
|
|
*/
|
|
|
|
void unregisterForUpdates(in jsval aContainerNode);
|
|
|
|
};
|