nsINavBookmarkObserver
From MDC
This article covers features introduced in Firefox 3
The nsINavBookmarkObserver interface is an observer for bookmark changes.
Contents |
nsINavBookmarksService is defined in toolkit/components/places/public/nsINavBookmarksService.idl. It is scriptable and
unfrozen (hasn't changed since Mozilla 1.9).
Inherits from: nsISupports
[edit] Method overview
void onBeginUpdateBatch();
|
void onEndUpdateBatch();
|
void onItemAdded(in long long aItemId, in long long aFolder, in long aIndex);
|
void onItemRemoved(in long long aItemId, in long long aFolder, in long aIndex);
|
void onItemChanged(in long long aBookmarkId, in ACString aProperty, in boolean aIsAnnotationProperty, in AUTF8String aValue);
|
void onItemVisited(in long long aBookmarkId, in long long aVisitID, in PRTime time);
|
void onItemMoved(in long long aItemId, in long long aOldParent, in long aOldIndex, in long long aNewParent, in long aNewIndex);
|
[edit] Methods
[edit] onBeginUpdateBatch()
This method notifies 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.
void onBeginUpdateBatch();
[edit] Parameters
None.
[edit] onEndUpdateBatch()
This method notifies this observer that a batch transaction has ended.
void onEndUpdateBatch();
[edit] Parameters
None.
[edit] onItemAdded()
This method notifies this observer that an item was added. It is called after the actual add took place. The items following the index will be shifted down, but no additional notifications will be sent.
void onItemAdded( in long long aItemId, in long long aFolder, in long aIndex );
[edit] Parameters
- aItemId
- The ID of the bookmark that was added.
- aFolder
- The folder that the item was added to.
- aIndex
- The item's index in the folder.
[edit] onItemRemoved()
This method notifies this observer that an item was removed. It is called after the actual remove took place. The items following the index will be shifted up, but no additional notifications will be sent.
void onItemRemoved( in long long aItemId, in long long aFolder, in long aIndex );
[edit] Parameters
- aItemId
- The ID of the bookmark that was removed.
- aFolder
- The folder that the item was removed from.
- aIndex
- The item's index in the folder.
[edit] onItemChanged()
This method notifies this observer that an item's information has changed. It is called whenever any attributes like "title" are changed.
void onItemChanged( in long long aBookmarkId, in ACString aProperty, in boolean aIsAnnotationProperty, in AUTF8String aValue );
[edit] Parameters
- aBookmarkId
- The ID of the item that was changed.
- aProperty
- The property which changed.
- aIsAnnotationProperty
- Is
aPropertythe name of an item annotation.
property = "cleartime": (history was deleted, there is no last visit date): value = none property = "title": value = new title property = "favicon": value = new "moz-anno" URL of favicon image property = "uri": value = new uri spec aIsAnnotationProperty = true: value = empty string
- aValue
- The value of the item.
[edit] onItemVisited()
This method notifies 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.
See onItemChanged method property = "cleartime" for when all visit dates are deleted for the URI.
void onItemVisited( in long long aBookmarkId, in long long aVisitID, in PRTime time );
[edit] Parameters
- aBookmarkId
- The ID of the item that was visited.
- aVisitID
- The ID of the item visit.
- time
- The visit time.
[edit] onItemMoved()
This method notifies this observer that an item has been moved.
void onItemMoved( in long long aItemId, in long long aOldParent, in long aOldIndex, in long long aNewParent, in long aNewIndex );
[edit] Parameters
- aItemId
- The ID of the item that was moved.
- aOldParent
- The ID of the old parent.
- aOldIndex
- The old index inside
aOldParent. - aNewParent
- The id of the new parent.
- aNewIndex
- The new index inside
aNewParent.