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> * Joe Hughes <joe@retrovirus.com>
* Dietrich Ayala <dietrich@mozilla.com> * Dietrich Ayala <dietrich@mozilla.com>
* Asaf Romano <mano@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 * 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 * either the GNU General Public License Version 2 or later (the "GPL"), or
@ -47,62 +48,89 @@ interface nsITransaction;
interface nsINavHistoryBatchCallback; 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 interface nsINavBookmarkObserver : nsISupports
{ {
/** /**
* Notify this observer that a batch transaction has started. * Notifies that a batch transaction has started.
* Other notifications will be sent during the batch change, * Other notifications will be sent during the batch, but the observer is
* but the observer is guaranteed that onEndUpdateBatch() will be called * guaranteed that onEndUpdateBatch() will be called at its completion.
* at the completion of changes. * 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(); void onBeginUpdateBatch();
/** /**
* Notify this observer that a batch transaction has ended. * Notifies that a batch transaction has ended.
*/ */
void onEndUpdateBatch(); void onEndUpdateBatch();
/** /**
* Notify this observer that an item was added. Called after the actual * Notifies that an item (any type) was added. Called after the actual
* add took place. The items following the index will be shifted down, but * addition took place.
* no additional notifications will be sent. * 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 * @param aItemId
* The id of the bookmark that was added. * The id of the item that was added.
* @param aParentId * @param aParentId
* The id of the folder to which the item was added. * The id of the folder to which the item was added.
* @param aIndex * @param aIndex
* The item's index in the folder. * The item's index in the folder.
* @param aItemType * @param aItemType
* The type of the item that was added (one of the TYPE_* constants * The type of the added item (see TYPE_* constants below).
* defined above).
* @param aURI * @param aURI
* The URI of the item that was added when aItemType is TYPE_BOOKMARK, * The URI of the added item if it was TYPE_BOOKMARK, null otherwise.
* 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, void onItemAdded(in long long aItemId,
in long aIndex, in unsigned short aItemType, in long long aParentId,
in nsIURI aURI); 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 * Notifies that an item is about to be removed. Called before the actual
* the actual removal will take place. * removal will take place.
* *
* @param aItemId * @param aItemId
* The id of the bookmark to be removed. * The id of the bookmark to be removed.
* @param aItemType * @param aItemType
* The type of the item to be removed (one of the TYPE_* constants * The type of the item to be removed (see TYPE_* constants below).
* defined above). * @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 * Notifies that an item was removed. Called after the actual remove took
* remove took place. The items following the index will be shifted up, but * place.
* no additional notifications will be sent. * 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 * @param aItemId
* The id of the item that was removed. * The id of the item that was removed.
@ -111,66 +139,112 @@ interface nsINavBookmarkObserver : nsISupports
* @param aIndex * @param aIndex
* The bookmark's index in the folder. * The bookmark's index in the folder.
* @param aItemType * @param aItemType
* The type of the item that was removed (one of the TYPE_* constants * The type of the item to be removed (see TYPE_* constants below).
* defined above). * @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, void onItemRemoved(in long long aItemId,
in long aIndex, in unsigned short aItemType); 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 * Notifies that an item's information has changed. This will be called
* will be called whenever any attributes like "title" are changed. * whenever any attributes like "title" are changed.
* *
* @param aItemId * @param aItemId
* The id of the item that was changed. * The id of the item that was changed.
* @param aProperty * @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 * @param aIsAnnotationProperty
* Whether or not aProperty the name of an item annotation. * Whether or not aProperty is the name of an annotation. If true
* @param aProperty * aNewValue is always an empty string.
* The property which has been changed (see list below).
* @param aNewValue * @param aNewValue
* For certain properties, this is set to the new value of the * For certain properties, this is set to the new value of the
* property (see list below). * property (see the list below).
* @param aLastModified * @param aLastModified
* If the item's lastModified field has changed, this parameter is * If lastModified changed, this parameter is the new value, otherwise
* set to the new value, otherwise it's set to 0. * it's set to 0.
* @param aItemType * @param aItemType
* The type of the item that has been changed(one of the TYPE_* constants * The type of the item to be removed (see TYPE_* constants below).
* defined above). * @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.
* *
* property = "cleartime": (history was deleted, there is no last visit date): * @note List of values that may be associated with properties:
* value = empty string. * aProperty | aNewValue
* property = "title": value = new title. * =====================================================================
* property = "favicon": value = new "moz-anno" URL of favicon image * cleartime | Empty string (all visits to this item were removed).
* property = "uri": value = new uri spec. * title | The new title.
* property = "tags: (tags set for the bookmarked uri have changed) * favicon | The "moz-anno" URL of the new favicon.
* value = empty string. * uri | new URL.
* property = "dateAdded": value = PRTime when the item was first added * tags | Empty string (tags for this item changed)
* property = "lastModified": value = PRTime when the item was last modified * dateAdded | PRTime (as string) when the item was first added.
* aIsAnnotationProperty = true: value = empty string. * lastModified | PRTime (as string) when the item was last modified.
*/ */
void onItemChanged(in long long aItemId, in ACString aProperty, void onItemChanged(in long long aItemId,
in ACString aProperty,
in boolean aIsAnnotationProperty, in boolean aIsAnnotationProperty,
in AUTF8String aNewValue, in PRTime aLastModified, in AUTF8String aNewValue,
in unsigned short aItemType); in PRTime aLastModified,
in unsigned short aItemType,
in long long aParentId,
in ACString aGUID,
in ACString aParentGUID);
/** /**
* Notify that the item was visited. Normally in bookmarks we use the last * Notifies that the item was visited. Can be invoked only for TYPE_BOOKMARK
* visit date, and normally the time will be a new visit that will be more * items.
* recent, but this is not guaranteed. You should check to see if it's
* actually more recent before using this new time.
* *
* @param aBookmarkId * @param aItemId
* The id of the bookmark that was visited. * The id of the bookmark that was visited.
* @see onItemChanged property = "cleartime" for when all visit dates are * @param aVisitId
* deleted for the URI. * 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 aBookmarkId, in long long aVisitID, void onItemVisited(in long long aItemId,
in PRTime time); in long long aVisitId,
in PRTime aTime,
in unsigned long aTransitionType,
in nsIURI aURI,
in long long aParentId,
in ACString aGUID,
in ACString aParentGUID);
/** /**
* Notify this observer that an item has been moved. * Notifies that an item has been moved.
*
* @param aItemId * @param aItemId
* The id of the item that was moved. * The id of the item that was moved.
* @param aOldParentId * @param aOldParentId
@ -182,13 +256,23 @@ interface nsINavBookmarkObserver : nsISupports
* @param aNewIndex * @param aNewIndex
* The index inside the new parent. * The index inside the new parent.
* @param aItemType * @param aItemType
* The type of the item that was moved (one of the TYPE_* constants * The type of the item to be removed (see TYPE_* constants below).
* defined above). * @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, void onItemMoved(in long long aItemId,
in long long aOldParentId, in long aOldIndex, in long long aOldParentId,
in long long aNewParentId, in long aNewIndex, in long aOldIndex,
in unsigned short aItemType); in long long aNewParentId,
in long aNewIndex,
in unsigned short aItemType,
in ACString aGUID,
in ACString aOldParentGUID,
in ACString aNewParentGUID);
}; };
/** /**