Bug 633274 - Improve nsINavBookmarkObserver (Places changes).

r=sdwilsh
This commit is contained in:
Marco Bonardo 2011-05-13 21:24:22 +02:00
Родитель 46fcd08fc1
Коммит ba37b44cc9
4 изменённых файлов: 926 добавлений и 873 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -57,21 +57,34 @@ namespace places {
, DB_GET_BOOKMARKS_FOR_URI
};
struct BookmarkData {
PRInt64 id;
nsCString url;
nsCString title;
PRInt32 position;
PRInt64 placeId;
PRInt64 parentId;
PRInt64 grandParentId;
PRInt32 type;
nsCString serviceCID;
PRTime dateAdded;
PRTime lastModified;
nsCString guid;
nsCString parentGuid;
};
struct ItemVisitData {
PRInt64 itemId;
nsCOMPtr<nsIURI> uri;
BookmarkData bookmark;
PRInt64 visitId;
PRUint32 transitionType;
PRTime time;
};
struct ItemChangeData {
PRInt64 itemId;
nsCOMPtr<nsIURI> uri;
BookmarkData bookmark;
nsCString property;
PRBool isAnnotation;
nsCString newValue;
PRTime lastModified;
PRUint16 itemType;
};
typedef void (nsNavBookmarks::*ItemVisitMethod)(const ItemVisitData&);
@ -80,7 +93,6 @@ namespace places {
} // namespace places
} // namespace mozilla
class nsIOutputStream;
class nsNavBookmarks : public nsINavBookmarksService,
@ -167,7 +179,7 @@ public:
// the index of the new folder in aIndex, whether it was passed in or
// generated by autoincrement.
nsresult CreateContainerWithID(PRInt64 aId, PRInt64 aParent,
const nsACString& aName,
const nsACString& aTitle,
const nsAString& aContractId,
PRBool aIsBookmarkFolder,
PRInt32* aIndex,
@ -182,7 +194,16 @@ public:
*/
PRBool IsRealBookmark(PRInt64 aPlaceId);
PRBool ItemExists(PRInt64 aItemId);
/**
* Fetches information about the specified id from the database.
*
* @param aItemId
* Id of the item to fetch information for.
* @param aBookmark
* BookmarkData to store the information.
*/
nsresult FetchItemInfo(PRInt64 aItemId,
mozilla::places::BookmarkData& _bookmark);
/**
* Finalize all internal statements.
@ -266,18 +287,24 @@ private:
PRInt32 aEndIndex,
PRInt32 aDelta);
nsresult RemoveFolder(PRInt64 aFolderId);
/**
* Calculates number of children for the given folder.
* Fetches properties of a folder.
*
* @param aFolderId Folder to count children for.
*
* @return aFolderCount The number of children in this folder.
* @param aFolderId
* Folder to count children for.
* @param _folderCount
* Number of children in the folder.
* @param _guid
* Unique id of the folder.
* @param _parentId
* Id of the parent of the folder.
*
* @throws If folder does not exist.
*/
nsresult FolderCount(PRInt64 aFolderId, PRInt32* aFolderCount);
nsresult FetchFolderInfo(PRInt64 aFolderId,
PRInt32* _folderCount,
nsACString& _guid,
PRInt64* _parentId);
nsresult GetFolderType(PRInt64 aFolder, nsACString& aType);
@ -306,33 +333,17 @@ private:
PRInt64 mUnfiledRoot;
PRInt64 mToolbarRoot;
nsresult GetParentAndIndexOfFolder(PRInt64 aFolder,
PRInt64* aParent,
PRInt32* aIndex);
nsresult IsBookmarkedInDatabase(PRInt64 aBookmarkID, PRBool* aIsBookmarked);
nsresult SetItemDateInternal(mozIStorageStatement* aStatement,
PRInt64 aItemId,
PRTime aValue);
// Structure to hold folder's children informations
struct folderChildrenInfo
{
PRInt64 itemId;
PRUint16 itemType;
PRInt64 placeId;
PRInt64 parentId;
PRInt64 grandParentId;
PRInt32 index;
nsCString url;
nsCString folderType;
};
// Recursive method to build an array of folder's children
nsresult GetDescendantChildren(PRInt64 aFolderId,
const nsACString& aFolderGuid,
PRInt64 aGrandParentId,
nsTArray<folderChildrenInfo>& aFolderChildrenArray);
nsTArray<mozilla::places::BookmarkData>& aFolderChildrenArray);
enum ItemType {
BOOKMARK = TYPE_BOOKMARK,
@ -371,8 +382,7 @@ private:
*
* @note This will also update last modified date of the parent folder.
*/
nsresult InsertBookmarkInDB(PRInt64 aItemId,
PRInt64 aPlaceId,
nsresult InsertBookmarkInDB(PRInt64 aPlaceId,
enum ItemType aItemType,
PRInt64 aParentId,
PRInt32 aIndex,
@ -380,7 +390,8 @@ private:
PRTime aDateAdded,
PRTime aLastModified,
const nsAString& aServiceContractId,
PRInt64* _retval);
PRInt64* _itemId,
nsACString& _guid);
/**
* TArray version of getBookmarksIdForURI for ease of use in C++ code.
@ -398,6 +409,9 @@ private:
nsTArray<PRInt64>& aResult,
bool aSkipTags);
nsresult GetBookmarksForURI(nsIURI* aURI,
nsTArray<mozilla::places::BookmarkData>& _bookmarks);
PRInt64 RecursiveFindRedirectedBookmark(PRInt64 aPlaceId);
/**
@ -406,32 +420,36 @@ private:
mozIStorageStatement* GetStatement(const nsCOMPtr<mozIStorageStatement>& aStmt);
nsCOMPtr<mozIStorageStatement> mDBGetChildren;
// kGetInfoIndex_* results + kGetChildrenIndex_* results
// These columns sit to the right of the kGetInfoIndex_* columns.
static const PRInt32 kGetChildrenIndex_Position;
static const PRInt32 kGetChildrenIndex_Type;
static const PRInt32 kGetChildrenIndex_PlaceID;
static const PRInt32 kGetChildrenIndex_FolderTitle;
static const PRInt32 kGetChildrenIndex_ServiceContractId;
static const PRInt32 kGetChildrenIndex_Guid;
nsCOMPtr<mozIStorageStatement> mDBFindURIBookmarks;
static const PRInt32 kFindBookmarksIndex_ID;
static const PRInt32 kFindBookmarksIndex_Type;
static const PRInt32 kFindBookmarksIndex_PlaceID;
static const PRInt32 kFindBookmarksIndex_Parent;
static const PRInt32 kFindBookmarksIndex_Position;
static const PRInt32 kFindBookmarksIndex_Title;
static const PRInt32 kFindURIBookmarksIndex_Id;
static const PRInt32 kFindURIBookmarksIndex_Guid;
static const PRInt32 kFindURIBookmarksIndex_ParentId;
static const PRInt32 kFindURIBookmarksIndex_LastModified;
static const PRInt32 kFindURIBookmarksIndex_ParentGuid;
static const PRInt32 kFindURIBookmarksIndex_GrandParentId;
nsCOMPtr<mozIStorageStatement> mDBGetItemProperties;
static const PRInt32 kGetItemPropertiesIndex_ID;
static const PRInt32 kGetItemPropertiesIndex_URI;
static const PRInt32 kGetItemPropertiesIndex_Id;
static const PRInt32 kGetItemPropertiesIndex_Url;
static const PRInt32 kGetItemPropertiesIndex_Title;
static const PRInt32 kGetItemPropertiesIndex_Position;
static const PRInt32 kGetItemPropertiesIndex_PlaceID;
static const PRInt32 kGetItemPropertiesIndex_Parent;
static const PRInt32 kGetItemPropertiesIndex_PlaceId;
static const PRInt32 kGetItemPropertiesIndex_ParentId;
static const PRInt32 kGetItemPropertiesIndex_Type;
static const PRInt32 kGetItemPropertiesIndex_ServiceContractId;
static const PRInt32 kGetItemPropertiesIndex_DateAdded;
static const PRInt32 kGetItemPropertiesIndex_LastModified;
static const PRInt32 kGetItemPropertiesIndex_Guid;
static const PRInt32 kGetItemPropertiesIndex_ParentGuid;
static const PRInt32 kGetItemPropertiesIndex_GrandParentId;
nsCOMPtr<mozIStorageStatement> mDBInsertBookmark;
static const PRInt32 kInsertBookmarkIndex_Id;
@ -444,7 +462,7 @@ private:
static const PRInt32 kInsertBookmarkIndex_DateAdded;
static const PRInt32 kInsertBookmarkIndex_LastModified;
nsCOMPtr<mozIStorageStatement> mDBFolderCount;
nsCOMPtr<mozIStorageStatement> mDBFolderInfo;
nsCOMPtr<mozIStorageStatement> mDBGetItemIndex;
nsCOMPtr<mozIStorageStatement> mDBGetChildAt;
nsCOMPtr<mozIStorageStatement> mDBGetItemIdForGUID;
@ -474,8 +492,11 @@ private:
NS_IMETHOD DoTransaction() {
nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = bookmarks->GetParentAndIndexOfFolder(mID, &mParent, &mIndex);
NS_ENSURE_SUCCESS(rv, rv);
mozilla::places::BookmarkData folder;
nsresult rv = bookmarks->FetchItemInfo(mID, folder);
// TODO (Bug 656935): store the BookmarkData struct instead.
mParent = folder.parentId;
mIndex = folder.position;
rv = bookmarks->GetItemTitle(mID, mTitle);
NS_ENSURE_SUCCESS(rv, rv);
@ -485,7 +506,7 @@ private:
NS_ENSURE_SUCCESS(rv, rv);
CopyUTF8toUTF16(type, mType);
return bookmarks->RemoveFolder(mID);
return bookmarks->RemoveItem(mID);
}
NS_IMETHOD UndoTransaction() {

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

@ -3251,7 +3251,11 @@ nsNavHistoryQueryResultNode::OnItemAdded(PRInt64 aItemId,
PRInt64 aParentId,
PRInt32 aIndex,
PRUint16 aItemType,
nsIURI* aURI)
nsIURI* aURI,
const nsACString& aTitle,
PRTime aDateAdded,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK &&
mLiveUpdate != QUERYUPDATE_SIMPLE && mLiveUpdate != QUERYUPDATE_TIME) {
@ -3264,7 +3268,10 @@ nsNavHistoryQueryResultNode::OnItemAdded(PRInt64 aItemId,
NS_IMETHODIMP
nsNavHistoryQueryResultNode::OnBeforeItemRemoved(PRInt64 aItemId,
PRUint16 aItemType)
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK &&
(mLiveUpdate == QUERYUPDATE_SIMPLE || mLiveUpdate == QUERYUPDATE_TIME)) {
@ -3281,7 +3288,10 @@ NS_IMETHODIMP
nsNavHistoryQueryResultNode::OnItemRemoved(PRInt64 aItemId,
PRInt64 aParentId,
PRInt32 aIndex,
PRUint16 aItemType)
PRUint16 aItemType,
nsIURI* aURI,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK &&
mLiveUpdate != QUERYUPDATE_SIMPLE && mLiveUpdate != QUERYUPDATE_TIME) {
@ -3298,7 +3308,10 @@ nsNavHistoryQueryResultNode::OnItemChanged(PRInt64 aItemId,
PRBool aIsAnnotationProperty,
const nsACString& aNewValue,
PRTime aLastModified,
PRUint16 aItemType)
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
// History observers should not get OnItemChanged
// but should get the corresponding history notifications instead.
@ -3342,14 +3355,20 @@ nsNavHistoryQueryResultNode::OnItemChanged(PRInt64 aItemId,
return nsNavHistoryResultNode::OnItemChanged(aItemId, aProperty,
aIsAnnotationProperty,
aNewValue,
aLastModified,
aItemType);
aNewValue, aLastModified,
aItemType, aParentId, aGUID,
aParentGUID);
}
NS_IMETHODIMP
nsNavHistoryQueryResultNode::OnItemVisited(PRInt64 aItemId,
PRInt64 aVisitId, PRTime aTime)
PRInt64 aVisitId,
PRTime aTime,
PRUint32 aTransitionType,
nsIURI* aURI,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
// for bookmark queries, "all bookmark" observer should get OnItemVisited
// but it is ignored.
@ -3361,9 +3380,14 @@ nsNavHistoryQueryResultNode::OnItemVisited(PRInt64 aItemId,
NS_IMETHODIMP
nsNavHistoryQueryResultNode::OnItemMoved(PRInt64 aFolder,
PRInt64 aOldParent, PRInt32 aOldIndex,
PRInt64 aNewParent, PRInt32 aNewIndex,
PRUint16 aItemType)
PRInt64 aOldParent,
PRInt32 aOldIndex,
PRInt64 aNewParent,
PRInt32 aNewIndex,
PRUint16 aItemType,
const nsACString& aGUID,
const nsACString& aOldParentGUID,
const nsACString& aNewParentGUID)
{
// 1. The query cannot be affected by the item's position
// 2. For the time being, we cannot optimize this not to update
@ -3984,7 +4008,11 @@ nsNavHistoryFolderResultNode::OnItemAdded(PRInt64 aItemId,
PRInt64 aParentFolder,
PRInt32 aIndex,
PRUint16 aItemType,
nsIURI* aURI)
nsIURI* aURI,
const nsACString& aTitle,
PRTime aDateAdded,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
NS_ASSERTION(aParentFolder == mItemId, "Got wrong bookmark update");
@ -4069,7 +4097,10 @@ nsNavHistoryFolderResultNode::OnItemAdded(PRInt64 aItemId,
NS_IMETHODIMP
nsNavHistoryFolderResultNode::OnBeforeItemRemoved(PRInt64 aItemId,
PRUint16 aItemType)
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
return NS_OK;
}
@ -4079,7 +4110,10 @@ NS_IMETHODIMP
nsNavHistoryFolderResultNode::OnItemRemoved(PRInt64 aItemId,
PRInt64 aParentFolder,
PRInt32 aIndex,
PRUint16 aItemType)
PRUint16 aItemType,
nsIURI* aURI,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
// We only care about notifications when a child changes. When the deleted
// item is us, our parent should also be registered and will remove us from
@ -4131,7 +4165,10 @@ nsNavHistoryResultNode::OnItemChanged(PRInt64 aItemId,
PRBool aIsAnnotationProperty,
const nsACString& aNewValue,
PRTime aLastModified,
PRUint16 aItemType)
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
if (aItemId != mItemId)
return NS_OK;
@ -4216,7 +4253,11 @@ nsNavHistoryFolderResultNode::OnItemChanged(PRInt64 aItemId,
PRBool aIsAnnotationProperty,
const nsACString& aNewValue,
PRTime aLastModified,
PRUint16 aItemType) {
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString&aParentGUID)
{
// The query-item's title is used for simple-query nodes
if (mQueryItemId != -1) {
PRBool isTitleChange = aProperty.EqualsLiteral("title");
@ -4230,9 +4271,9 @@ nsNavHistoryFolderResultNode::OnItemChanged(PRInt64 aItemId,
return nsNavHistoryResultNode::OnItemChanged(aItemId, aProperty,
aIsAnnotationProperty,
aNewValue,
aLastModified,
aItemType);
aNewValue, aLastModified,
aItemType, aParentId, aGUID,
aParentGUID);
}
/**
@ -4240,7 +4281,13 @@ nsNavHistoryFolderResultNode::OnItemChanged(PRInt64 aItemId,
*/
NS_IMETHODIMP
nsNavHistoryFolderResultNode::OnItemVisited(PRInt64 aItemId,
PRInt64 aVisitId, PRTime aTime)
PRInt64 aVisitId,
PRTime aTime,
PRUint32 aTransitionType,
nsIURI* aURI,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
PRBool excludeItems = (mResult && mResult->mRootNode->mOptions->ExcludeItems()) ||
(mParent && mParent->mOptions->ExcludeItems()) ||
@ -4295,9 +4342,15 @@ nsNavHistoryFolderResultNode::OnItemVisited(PRInt64 aItemId,
NS_IMETHODIMP
nsNavHistoryFolderResultNode::OnItemMoved(PRInt64 aItemId, PRInt64 aOldParent,
PRInt32 aOldIndex, PRInt64 aNewParent,
PRInt32 aNewIndex, PRUint16 aItemType)
nsNavHistoryFolderResultNode::OnItemMoved(PRInt64 aItemId,
PRInt64 aOldParent,
PRInt32 aOldIndex,
PRInt64 aNewParent,
PRInt32 aNewIndex,
PRUint16 aItemType,
const nsACString& aGUID,
const nsACString& aOldParentGUID,
const nsACString& aNewParentGUID)
{
NS_ASSERTION(aOldParent == mItemId || aNewParent == mItemId,
"Got a bookmark message that doesn't belong to us");
@ -4330,19 +4383,24 @@ nsNavHistoryFolderResultNode::OnItemMoved(PRInt64 aItemId, PRInt64 aOldParent,
return NS_OK;
} else {
// moving between two different folders, just do a remove and an add
if (aOldParent == mItemId)
OnItemRemoved(aItemId, aOldParent, aOldIndex, aItemType);
nsCOMPtr<nsIURI> itemURI;
nsCAutoString itemTitle;
if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK) {
nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = bookmarks->GetBookmarkURI(aItemId, getter_AddRefs(itemURI));
NS_ENSURE_SUCCESS(rv, rv);
rv = bookmarks->GetItemTitle(aItemId, itemTitle);
NS_ENSURE_SUCCESS(rv, rv);
}
if (aOldParent == mItemId) {
OnItemRemoved(aItemId, aOldParent, aOldIndex, aItemType, itemURI,
aGUID, aOldParentGUID);
}
if (aNewParent == mItemId) {
nsCOMPtr<nsIURI> itemURI;
if (aItemType == nsINavBookmarksService::TYPE_BOOKMARK) {
nsNavBookmarks* bookmarks = nsNavBookmarks::GetBookmarksService();
NS_ENSURE_TRUE(bookmarks, NS_ERROR_OUT_OF_MEMORY);
nsresult rv =
bookmarks->GetBookmarkURI(aItemId, getter_AddRefs(itemURI));
NS_ENSURE_SUCCESS(rv, rv);
}
OnItemAdded(aItemId, aNewParent, aNewIndex, aItemType, itemURI);
OnItemAdded(aItemId, aNewParent, aNewIndex, aItemType, itemURI, itemTitle,
PR_Now(), // This is a dummy dateAdded, not the real value.
aGUID, aNewParentGUID);
}
}
return NS_OK;
@ -4842,26 +4900,37 @@ nsNavHistoryResult::OnItemAdded(PRInt64 aItemId,
PRInt64 aParentId,
PRInt32 aIndex,
PRUint16 aItemType,
nsIURI* aURI)
nsIURI* aURI,
const nsACString& aTitle,
PRTime aDateAdded,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(aParentId,
OnItemAdded(aItemId, aParentId, aIndex, aItemType, aURI)
OnItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle, aDateAdded,
aGUID, aParentGUID)
);
ENUMERATE_HISTORY_OBSERVERS(
OnItemAdded(aItemId, aParentId, aIndex, aItemType, aURI)
OnItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle, aDateAdded,
aGUID, aParentGUID)
);
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(
OnItemAdded(aItemId, aParentId, aIndex, aItemType, aURI)
OnItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle, aDateAdded,
aGUID, aParentGUID)
);
return NS_OK;
}
NS_IMETHODIMP
nsNavHistoryResult::OnBeforeItemRemoved(PRInt64 aItemId, PRUint16 aItemType)
nsNavHistoryResult::OnBeforeItemRemoved(PRInt64 aItemId,
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(
OnBeforeItemRemoved(aItemId, aItemType);
OnBeforeItemRemoved(aItemId, aItemType, aParentId, aGUID, aParentGUID);
);
return NS_OK;
}
@ -4869,15 +4938,22 @@ nsNavHistoryResult::OnBeforeItemRemoved(PRInt64 aItemId, PRUint16 aItemType)
NS_IMETHODIMP
nsNavHistoryResult::OnItemRemoved(PRInt64 aItemId,
PRInt64 aParentId, PRInt32 aIndex,
PRUint16 aItemType)
PRInt64 aParentId,
PRInt32 aIndex,
PRUint16 aItemType,
nsIURI* aURI,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(aParentId,
OnItemRemoved(aItemId, aParentId, aIndex, aItemType));
OnItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGUID,
aParentGUID));
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(
OnItemRemoved(aItemId, aParentId, aIndex, aItemType));
OnItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGUID,
aParentGUID));
ENUMERATE_HISTORY_OBSERVERS(
OnItemRemoved(aItemId, aParentId, aIndex, aItemType));
OnItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGUID,
aParentGUID));
return NS_OK;
}
@ -4888,11 +4964,14 @@ nsNavHistoryResult::OnItemChanged(PRInt64 aItemId,
PRBool aIsAnnotationProperty,
const nsACString &aNewValue,
PRTime aLastModified,
PRUint16 aItemType)
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(
OnItemChanged(aItemId, aProperty, aIsAnnotationProperty, aNewValue,
aLastModified, aItemType));
aLastModified, aItemType, aParentId, aGUID, aParentGUID));
// Note: folder-nodes set their own bookmark observer only once they're
// opened, meaning we cannot optimize this code path for changes done to
@ -4923,7 +5002,8 @@ nsNavHistoryResult::OnItemChanged(PRInt64 aItemId,
(!excludeItems || !(node->IsURI() || node->IsSeparator())) &&
folder->StartIncrementalUpdate()) {
node->OnItemChanged(aItemId, aProperty, aIsAnnotationProperty,
aNewValue, aLastModified, aItemType);
aNewValue, aLastModified, aItemType, aParentId,
aGUID, aParentGUID);
}
}
}
@ -4937,8 +5017,14 @@ nsNavHistoryResult::OnItemChanged(PRInt64 aItemId,
NS_IMETHODIMP
nsNavHistoryResult::OnItemVisited(PRInt64 aItemId, PRInt64 aVisitId,
PRTime aVisitTime)
nsNavHistoryResult::OnItemVisited(PRInt64 aItemId,
PRInt64 aVisitId,
PRTime aVisitTime,
PRUint32 aTransitionType,
nsIURI* aURI,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID)
{
nsresult rv;
nsNavBookmarks* bookmarkService = nsNavBookmarks::GetBookmarksService();
@ -4949,9 +5035,11 @@ nsNavHistoryResult::OnItemVisited(PRInt64 aItemId, PRInt64 aVisitId,
rv = bookmarkService->GetFolderIdForItem(aItemId, &folderId);
NS_ENSURE_SUCCESS(rv, rv);
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(folderId,
OnItemVisited(aItemId, aVisitId, aVisitTime));
OnItemVisited(aItemId, aVisitId, aVisitTime, aTransitionType, aURI,
aParentId, aGUID, aParentGUID));
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(
OnItemVisited(aItemId, aVisitId, aVisitTime));
OnItemVisited(aItemId, aVisitId, aVisitTime, aTransitionType, aURI,
aParentId, aGUID, aParentGUID));
// Note: we do NOT call history observers in this case. This notification is
// the same as OnVisit, except that here we know the item is a bookmark.
// History observers will handle the history notification instead.
@ -4965,25 +5053,34 @@ nsNavHistoryResult::OnItemVisited(PRInt64 aItemId, PRInt64 aVisitId,
*/
NS_IMETHODIMP
nsNavHistoryResult::OnItemMoved(PRInt64 aItemId,
PRInt64 aOldParent, PRInt32 aOldIndex,
PRInt64 aNewParent, PRInt32 aNewIndex,
PRUint16 aItemType)
PRInt64 aOldParent,
PRInt32 aOldIndex,
PRInt64 aNewParent,
PRInt32 aNewIndex,
PRUint16 aItemType,
const nsACString& aGUID,
const nsACString& aOldParentGUID,
const nsACString& aNewParentGUID)
{
{ // scope for loop index for VC6's broken for loop scoping
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(aOldParent,
OnItemMoved(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex,
aItemType));
aItemType, aGUID, aOldParentGUID, aNewParentGUID));
}
if (aNewParent != aOldParent) {
ENUMERATE_BOOKMARK_FOLDER_OBSERVERS(aNewParent,
OnItemMoved(aItemId, aOldParent, aOldIndex, aNewParent, aNewIndex,
aItemType));
aItemType, aGUID, aOldParentGUID, aNewParentGUID));
}
ENUMERATE_ALL_BOOKMARKS_OBSERVERS(OnItemMoved(aItemId, aOldParent, aOldIndex,
aNewParent, aNewIndex,
aItemType));
aItemType, aGUID,
aOldParentGUID,
aNewParentGUID));
ENUMERATE_HISTORY_OBSERVERS(OnItemMoved(aItemId, aOldParent, aOldIndex,
aNewParent, aNewIndex, aItemType));
aNewParent, aNewIndex, aItemType,
aGUID, aOldParentGUID,
aNewParentGUID));
return NS_OK;
}

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

@ -290,7 +290,10 @@ public:
PRBool aIsAnnotationProperty,
const nsACString &aValue,
PRTime aNewLastModified,
PRUint16 aItemType);
PRUint16 aItemType,
PRInt64 aParentId,
const nsACString& aGUID,
const nsACString& aParentGUID);
public: