Bug 633274 - Improve nsINavBookmarkObserver (idl changes).

r=sdwilsh sr=gavin
This commit is contained in:
Marco Bonardo 2011-05-13 21:23:40 +02:00
Родитель 0de7099681
Коммит 5014273615
1 изменённых файлов: 170 добавлений и 86 удалений

Просмотреть файл

@ -24,6 +24,7 @@
* Joe Hughes <joe@retrovirus.com>
* Dietrich Ayala <dietrich@mozilla.com>
* Asaf Romano <mano@mozilla.com>
* Marco Bonardo <mak77@bonardo.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -47,62 +48,89 @@ interface nsITransaction;
interface nsINavHistoryBatchCallback;
/**
* Observer for bookmark changes.
* Observer for bookmarks changes.
*/
[scriptable, uuid(76f892d9-31ea-4061-b38c-6b40fad57e9d)]
[scriptable, uuid(2fb820a9-9331-4c02-ae41-32a82a4b7aa1)]
interface nsINavBookmarkObserver : nsISupports
{
/**
* Notify this observer that a batch transaction has started.
* Other notifications will be sent during the batch change,
* but the observer is guaranteed that onEndUpdateBatch() will be called
* at the completion of changes.
* Notifies that a batch transaction has started.
* Other notifications will be sent during the batch, but the observer is
* guaranteed that onEndUpdateBatch() will be called at its completion.
* During a batch the observer should do its best to reduce the work done to
* handle notifications, since multiple changes are going to happen in a short
* timeframe.
*/
void onBeginUpdateBatch();
/**
* Notify this observer that a batch transaction has ended.
* Notifies that a batch transaction has ended.
*/
void onEndUpdateBatch();
/**
* Notify this observer that an item was added. Called after the actual
* add took place. The items following the index will be shifted down, but
* no additional notifications will be sent.
* Notifies that an item (any type) was added. Called after the actual
* addition took place.
* When a new item is created, all the items following it in the same folder
* will have their index shifted down, but no additional notifications will
* be sent.
*
* @param aItemId
* The id of the bookmark that was added.
* The id of the item that was added.
* @param aParentId
* The id of the folder to which the item was added.
* @param aIndex
* The item's index in the folder.
* @param aItemType
* The type of the item that was added (one of the TYPE_* constants
* defined above).
* The type of the added item (see TYPE_* constants below).
* @param aURI
* The URI of the item that was added when aItemType is TYPE_BOOKMARK,
* null otherwise.
* The URI of the added item if it was TYPE_BOOKMARK, null otherwise.
* @param aTitle
* The title of the added item.
* @param aDateAdded
* The stored date added value, in microseconds from the epoch.
* @param aGUID
* The unique ID associated with the item.
* @param aParentGUID
* The unique ID associated with the item's parent.
*/
void onItemAdded(in long long aItemId, in long long aParentId,
in long aIndex, in unsigned short aItemType,
in nsIURI aURI);
void onItemAdded(in long long aItemId,
in long long aParentId,
in long aIndex,
in unsigned short aItemType,
in nsIURI aURI,
in AUTF8String aTitle,
in PRTime aDateAdded,
in ACString aGUID,
in ACString aParentGUID);
/**
* Notify this observer that an item is about to be removed. Called before
* the actual removal will take place.
* Notifies that an item is about to be removed. Called before the actual
* removal will take place.
*
* @param aItemId
* The id of the bookmark to be removed.
* @param aItemType
* The type of the item to be removed (one of the TYPE_* constants
* defined above).
* The type of the item to be removed (see TYPE_* constants below).
* @param aParentId
* The id of the folder containing the item.
* @param aGUID
* The unique ID associated with the item.
* @param aParentGUID
* The unique ID associated with the item's parent.
*/
void onBeforeItemRemoved(in long long aItemId, in unsigned short aItemType);
void onBeforeItemRemoved(in long long aItemId,
in unsigned short aItemType,
in long long aParentId,
in ACString aGUID,
in ACString aParentGUID);
/**
* Notify this observer that an item was removed. Called after the actual
* remove took place. The items following the index will be shifted up, but
* no additional notifications will be sent.
* Notifies that an item was removed. Called after the actual remove took
* place.
* When an item is removed, all the items following it in the same folder
* will have their index shifted down, but no additional notifications will
* be sent.
*
* @param aItemId
* The id of the item that was removed.
@ -111,84 +139,140 @@ interface nsINavBookmarkObserver : nsISupports
* @param aIndex
* The bookmark's index in the folder.
* @param aItemType
* The type of the item that was removed (one of the TYPE_* constants
* defined above).
* The type of the item to be removed (see TYPE_* constants below).
* @param aURI
* The URI of the added item if it was TYPE_BOOKMARK, null otherwise.
* @param aGUID
* The unique ID associated with the item.
* @param aParentGUID
* The unique ID associated with the item's parent.
*/
void onItemRemoved(in long long aItemId, in long long aParentId,
in long aIndex, in unsigned short aItemType);
void onItemRemoved(in long long aItemId,
in long long aParentId,
in long aIndex,
in unsigned short aItemType,
in nsIURI aURI,
in ACString aGUID,
in ACString aParentGUID);
/**
* Notify this observer that an item's information has changed. This
* will be called whenever any attributes like "title" are changed.
* Notifies that an item's information has changed. This will be called
* whenever any attributes like "title" are changed.
*
* @param aItemId
* The id of the item that was changed.
* @param aProperty
* The property which changed.
* The property which changed. Can be null for the removal of all of
* the annotations, in this case aIsAnnotationProperty is true.
* @param aIsAnnotationProperty
* Whether or not aProperty the name of an item annotation.
* @param aProperty
* The property which has been changed (see list below).
* Whether or not aProperty is the name of an annotation. If true
* aNewValue is always an empty string.
* @param aNewValue
* For certain properties, this is set to the new value of the
* property (see list below).
* property (see the list below).
* @param aLastModified
* If the item's lastModified field has changed, this parameter is
* set to the new value, otherwise it's set to 0.
* If lastModified changed, this parameter is the new value, otherwise
* it's set to 0.
* @param aItemType
* The type of the item that has been changed(one of the TYPE_* constants
* defined above).
*
* property = "cleartime": (history was deleted, there is no last visit date):
* value = empty string.
* property = "title": value = new title.
* property = "favicon": value = new "moz-anno" URL of favicon image
* property = "uri": value = new uri spec.
* property = "tags: (tags set for the bookmarked uri have changed)
* value = empty string.
* property = "dateAdded": value = PRTime when the item was first added
* property = "lastModified": value = PRTime when the item was last modified
* aIsAnnotationProperty = true: value = empty string.
*/
void onItemChanged(in long long aItemId, in ACString aProperty,
in boolean aIsAnnotationProperty,
in AUTF8String aNewValue, in PRTime aLastModified,
in unsigned short aItemType);
/**
* Notify that the item was visited. Normally in bookmarks we use the last
* visit date, and normally the time will be a new visit that will be more
* recent, but this is not guaranteed. You should check to see if it's
* actually more recent before using this new time.
* The type of the item to be removed (see TYPE_* constants below).
* @param aParentId
* The id of the folder containing the item.
* @param aGUID
* The unique ID associated with the item.
* @param aParentGUID
* The unique ID associated with the item's parent.
*
* @param aBookmarkId
* The id of the bookmark that was visited.
* @see onItemChanged property = "cleartime" for when all visit dates are
* deleted for the URI.
* @note List of values that may be associated with properties:
* aProperty | aNewValue
* =====================================================================
* cleartime | Empty string (all visits to this item were removed).
* title | The new title.
* favicon | The "moz-anno" URL of the new favicon.
* uri | new URL.
* tags | Empty string (tags for this item changed)
* dateAdded | PRTime (as string) when the item was first added.
* lastModified | PRTime (as string) when the item was last modified.
*/
void onItemVisited(in long long aBookmarkId, in long long aVisitID,
in PRTime time);
void onItemChanged(in long long aItemId,
in ACString aProperty,
in boolean aIsAnnotationProperty,
in AUTF8String aNewValue,
in PRTime aLastModified,
in unsigned short aItemType,
in long long aParentId,
in ACString aGUID,
in ACString aParentGUID);
/**
* Notify this observer that an item has been moved.
* @param aItemId
* The id of the item that was moved.
* @param aOldParentId
* The id of the old parent.
* @param aOldIndex
* The old index inside the old parent.
* @param aNewParentId
* The id of the new parent.
* @param aNewIndex
* The index inside the new parent.
* @param aItemType
* The type of the item that was moved (one of the TYPE_* constants
* defined above).
* Notifies that the item was visited. Can be invoked only for TYPE_BOOKMARK
* items.
*
* @param aItemId
* The id of the bookmark that was visited.
* @param aVisitId
* The id of the visit.
* @param aTime
* The time of the visit.
* @param aTransitionType
* The transition for the visit. See nsINavHistoryService::TRANSITION_*
* constants for a list of possible values.
* @param aURI
* The nsIURI for this bookmark.
* @param aParentId
* The id of the folder containing the item.
* @param aGUID
* The unique ID associated with the item.
* @param aParentGUID
* The unique ID associated with the item's parent.
*
* @see onItemChanged with property = "cleartime" for when all visits to an
* item are removed.
*
* @note The reported time is the time of the visit that was added, which may
* be well in the past since the visit time can be specified. This
* means that the visit the observer is told about may not be the most
* recent visit for that page.
*/
void onItemVisited(in long long aItemId,
in long long aVisitId,
in PRTime aTime,
in unsigned long aTransitionType,
in nsIURI aURI,
in long long aParentId,
in ACString aGUID,
in ACString aParentGUID);
/**
* Notifies that an item has been moved.
*
* @param aItemId
* The id of the item that was moved.
* @param aOldParentId
* The id of the old parent.
* @param aOldIndex
* The old index inside the old parent.
* @param aNewParentId
* The id of the new parent.
* @param aNewIndex
* The index inside the new parent.
* @param aItemType
* The type of the item to be removed (see TYPE_* constants below).
* @param aGUID
* The unique ID associated with the item.
* @param aOldParentGUID
* The unique ID associated with the old item's parent.
* @param aNewParentGUID
* The unique ID associated with the new item's parent.
*/
void onItemMoved(in long long aItemId,
in long long aOldParentId, in long aOldIndex,
in long long aNewParentId, in long aNewIndex,
in unsigned short aItemType);
in long long aOldParentId,
in long aOldIndex,
in long long aNewParentId,
in long aNewIndex,
in unsigned short aItemType,
in ACString aGUID,
in ACString aOldParentGUID,
in ACString aNewParentGUID);
};
/**