Bug 539076 - Part4: Rename ENUMERATE_OBSERVERS to NOTIFY_OBSERVERS, r=dietrich
This commit is contained in:
Родитель
4abcd89d97
Коммит
5ac8af106d
|
@ -1210,8 +1210,9 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder,
|
|||
rv = AddBookmarkToHash(childID, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemAdded(*aNewBookmarkId, aFolder, index, TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemAdded(*aNewBookmarkId, aFolder, index, TYPE_BOOKMARK));
|
||||
|
||||
// If the bookmark has been added to a tag container, notify all
|
||||
// bookmark-folder result nodes which contain a bookmark for the new
|
||||
|
@ -1227,13 +1228,11 @@ nsNavBookmarks::InsertBookmark(PRInt64 aFolder,
|
|||
|
||||
if (bookmarks.Length()) {
|
||||
for (PRUint32 i = 0; i < bookmarks.Length(); i++) {
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("tags"),
|
||||
PR_FALSE,
|
||||
EmptyCString(),
|
||||
0,
|
||||
TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i], NS_LITERAL_CSTRING("tags"),
|
||||
PR_FALSE, EmptyCString(), 0,
|
||||
TYPE_BOOKMARK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1284,8 +1283,9 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnBeforeItemRemoved(aItemId, itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnBeforeItemRemoved(aItemId, itemType));
|
||||
|
||||
mozStorageTransaction transaction(mDBConn, PR_FALSE);
|
||||
|
||||
|
@ -1328,8 +1328,9 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemRemoved(aItemId, folderId, childIndex, itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemRemoved(aItemId, folderId, childIndex, itemType));
|
||||
|
||||
if (itemType == TYPE_BOOKMARK) {
|
||||
// If the removed bookmark was a child of a tag container, notify all
|
||||
|
@ -1349,13 +1350,11 @@ nsNavBookmarks::RemoveItem(PRInt64 aItemId)
|
|||
|
||||
if (bookmarks.Length()) {
|
||||
for (PRUint32 i = 0; i < bookmarks.Length(); i++) {
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("tags"),
|
||||
PR_FALSE,
|
||||
EmptyCString(),
|
||||
0,
|
||||
TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("tags"), PR_FALSE,
|
||||
EmptyCString(), 0, TYPE_BOOKMARK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1476,8 +1475,9 @@ nsNavBookmarks::CreateContainerWithID(PRInt64 aItemId,
|
|||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemAdded(*aNewFolder, aParent, index, containerType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemAdded(*aNewFolder, aParent, index, containerType));
|
||||
|
||||
*aIndex = index;
|
||||
return NS_OK;
|
||||
|
@ -1521,8 +1521,9 @@ nsNavBookmarks::InsertSeparator(PRInt64 aParent,
|
|||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemAdded(*aNewItemId, aParent, index, TYPE_SEPARATOR));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemAdded(*aNewItemId, aParent, index, TYPE_SEPARATOR));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1613,8 +1614,9 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFolderId)
|
|||
{
|
||||
NS_ENSURE_TRUE(aFolderId != mRoot, NS_ERROR_INVALID_ARG);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnBeforeItemRemoved(aFolderId, TYPE_FOLDER));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnBeforeItemRemoved(aFolderId, TYPE_FOLDER));
|
||||
|
||||
mozStorageTransaction transaction(mDBConn, PR_FALSE);
|
||||
|
||||
|
@ -1692,8 +1694,9 @@ nsNavBookmarks::RemoveFolder(PRInt64 aFolderId)
|
|||
mToolbarFolder = 0;
|
||||
}
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemRemoved(aFolderId, parent, index, TYPE_FOLDER));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemRemoved(aFolderId, parent, index, TYPE_FOLDER));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1825,8 +1828,9 @@ nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
|||
folderChildrenInfo child = folderChildrenArray[i];
|
||||
|
||||
// Notify observers that we are about to remove this child.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnBeforeItemRemoved(child.itemId, child.itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnBeforeItemRemoved(child.itemId, child.itemType));
|
||||
|
||||
if (child.itemType == TYPE_FOLDER) {
|
||||
foldersToRemove.AppendLiteral(",");
|
||||
|
@ -1901,11 +1905,10 @@ nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
|||
for (PRInt32 i = folderChildrenArray.Length() - 1; i >= 0 ; i--) {
|
||||
folderChildrenInfo child = folderChildrenArray[i];
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemRemoved(child.itemId,
|
||||
child.parentId,
|
||||
child.index,
|
||||
child.itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemRemoved(child.itemId, child.parentId, child.index,
|
||||
child.itemType));
|
||||
|
||||
if (child.itemType == TYPE_BOOKMARK) {
|
||||
// If the removed bookmark was a child of a tag container, notify all
|
||||
|
@ -1923,13 +1926,11 @@ nsNavBookmarks::RemoveFolderChildren(PRInt64 aFolderId)
|
|||
|
||||
if (bookmarks.Length()) {
|
||||
for (PRUint32 i = 0; i < bookmarks.Length(); i++) {
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("tags"),
|
||||
PR_FALSE,
|
||||
EmptyCString(),
|
||||
0,
|
||||
TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("tags"), PR_FALSE,
|
||||
EmptyCString(), 0, TYPE_BOOKMARK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2095,10 +2096,10 @@ nsNavBookmarks::MoveItem(PRInt64 aItemId, PRInt64 aNewParent, PRInt32 aIndex)
|
|||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// notify bookmark observers
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemMoved(aItemId, oldParent, oldIndex, aNewParent,
|
||||
newIndex, itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemMoved(aItemId, oldParent, oldIndex, aNewParent,
|
||||
newIndex, itemType));
|
||||
|
||||
// notify dynamic container provider if there is one
|
||||
if (!folderType.IsEmpty()) {
|
||||
|
@ -2149,12 +2150,12 @@ nsNavBookmarks::SetItemDateAdded(PRInt64 aItemId, PRTime aDateAdded)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Note: mDBSetItemDateAdded also sets lastModified to aDateAdded.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, NS_LITERAL_CSTRING("dateAdded"),
|
||||
PR_FALSE,
|
||||
nsPrintfCString(16, "%lld", aDateAdded),
|
||||
aDateAdded,
|
||||
itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, NS_LITERAL_CSTRING("dateAdded"),
|
||||
PR_FALSE,
|
||||
nsPrintfCString(16, "%lld", aDateAdded),
|
||||
aDateAdded, itemType));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2193,13 +2194,12 @@ nsNavBookmarks::SetItemLastModified(PRInt64 aItemId, PRTime aLastModified)
|
|||
aItemId, aLastModified);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId,
|
||||
NS_LITERAL_CSTRING("lastModified"),
|
||||
PR_FALSE,
|
||||
nsPrintfCString(16, "%lld", aLastModified),
|
||||
aLastModified,
|
||||
itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, NS_LITERAL_CSTRING("lastModified"),
|
||||
PR_FALSE,
|
||||
nsPrintfCString(16, "%lld", aLastModified),
|
||||
aLastModified, itemType));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2342,13 +2342,10 @@ nsNavBookmarks::SetItemTitle(PRInt64 aItemId, const nsACString& aTitle)
|
|||
rv = statement->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId,
|
||||
NS_LITERAL_CSTRING("title"),
|
||||
PR_FALSE,
|
||||
aTitle,
|
||||
lastModified,
|
||||
itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, NS_LITERAL_CSTRING("title"), PR_FALSE,
|
||||
aTitle, lastModified, itemType));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2771,9 +2768,10 @@ nsNavBookmarks::ChangeBookmarkURI(PRInt64 aBookmarkId, nsIURI* aNewURI)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Pass the new URI to OnItemChanged.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("uri"), PR_FALSE, spec,
|
||||
lastModified, TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("uri"),
|
||||
PR_FALSE, spec, lastModified, TYPE_BOOKMARK));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2932,9 +2930,10 @@ nsNavBookmarks::SetItemIndex(PRInt64 aItemId, PRInt32 aNewIndex)
|
|||
rv = stmt->Execute();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemMoved(aItemId, parent, oldIndex, parent,
|
||||
aNewIndex, itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemMoved(aItemId, parent, oldIndex, parent, aNewIndex,
|
||||
itemType));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3023,10 +3022,11 @@ nsNavBookmarks::SetKeywordForBookmark(PRInt64 aBookmarkId,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Pass the new keyword to OnItemChanged.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("keyword"),
|
||||
PR_FALSE, NS_ConvertUTF16toUTF8(aKeyword),
|
||||
lastModified, TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aBookmarkId, NS_LITERAL_CSTRING("keyword"),
|
||||
PR_FALSE, NS_ConvertUTF16toUTF8(aKeyword),
|
||||
lastModified, TYPE_BOOKMARK));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3122,8 +3122,8 @@ nsNavBookmarks::BeginUpdateBatch()
|
|||
if (mBatchHasTransaction)
|
||||
conn->BeginTransaction();
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnBeginUpdateBatch());
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver, OnBeginUpdateBatch());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3136,8 +3136,8 @@ nsNavBookmarks::EndUpdateBatch()
|
|||
if (mBatchHasTransaction)
|
||||
mDBConn->CommitTransaction();
|
||||
mBatchHasTransaction = PR_FALSE;
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnEndUpdateBatch());
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver, OnEndUpdateBatch());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3207,8 +3207,9 @@ nsNavBookmarks::OnVisit(nsIURI* aURI, PRInt64 aVisitID, PRTime aTime,
|
|||
|
||||
if (bookmarks.Length()) {
|
||||
for (PRUint32 i = 0; i < bookmarks.Length(); i++)
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemVisited(bookmarks[i], aVisitID, aTime));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemVisited(bookmarks[i], aVisitID, aTime));
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -3237,13 +3238,12 @@ nsNavBookmarks::OnDeleteURI(nsIURI* aURI)
|
|||
|
||||
if (bookmarks.Length()) {
|
||||
for (PRUint32 i = 0; i < bookmarks.Length(); i ++)
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("cleartime"),
|
||||
PR_FALSE,
|
||||
EmptyCString(),
|
||||
0,
|
||||
TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("cleartime"),
|
||||
PR_FALSE, EmptyCString(), 0,
|
||||
TYPE_BOOKMARK));
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -3293,13 +3293,13 @@ nsNavBookmarks::OnPageChanged(nsIURI* aURI, PRUint32 aWhat,
|
|||
NS_ENSURE_STATE(queries.Count() == 1);
|
||||
NS_ENSURE_STATE(queries[0]->Folders().Length() == 1);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(queries[0]->Folders()[0],
|
||||
NS_LITERAL_CSTRING("favicon"),
|
||||
PR_FALSE,
|
||||
NS_ConvertUTF16toUTF8(aValue),
|
||||
0,
|
||||
TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(queries[0]->Folders()[0],
|
||||
NS_LITERAL_CSTRING("favicon"),
|
||||
PR_FALSE,
|
||||
NS_ConvertUTF16toUTF8(aValue),
|
||||
0, TYPE_BOOKMARK));
|
||||
}
|
||||
else {
|
||||
// query for all bookmarks for that URI, notify for each
|
||||
|
@ -3309,13 +3309,13 @@ nsNavBookmarks::OnPageChanged(nsIURI* aURI, PRUint32 aWhat,
|
|||
|
||||
if (bookmarks.Length()) {
|
||||
for (PRUint32 i = 0; i < bookmarks.Length(); i ++)
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("favicon"),
|
||||
PR_FALSE,
|
||||
NS_ConvertUTF16toUTF8(aValue),
|
||||
0,
|
||||
TYPE_BOOKMARK));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(bookmarks[i],
|
||||
NS_LITERAL_CSTRING("favicon"),
|
||||
PR_FALSE,
|
||||
NS_ConvertUTF16toUTF8(aValue),
|
||||
0, TYPE_BOOKMARK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3353,10 +3353,10 @@ nsNavBookmarks::OnItemAnnotationSet(PRInt64 aItemId, const nsACString& aName)
|
|||
aItemId, lastModified);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
|
||||
lastModified, itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
|
||||
lastModified, itemType));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3382,10 +3382,10 @@ nsNavBookmarks::OnItemAnnotationRemoved(PRInt64 aItemId, const nsACString& aName
|
|||
aItemId, lastModified);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
|
||||
lastModified, itemType));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavBookmarkObserver,
|
||||
OnItemChanged(aItemId, aName, PR_TRUE, EmptyCString(),
|
||||
lastModified, itemType));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -2782,9 +2782,10 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
|||
PRUint32 added = 0;
|
||||
if (!hidden && aTransitionType != TRANSITION_EMBED &&
|
||||
aTransitionType != TRANSITION_DOWNLOAD) {
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
|
||||
OnVisit(aURI, *aVisitID, aTime, aSessionID,
|
||||
referringVisitID, aTransitionType, &added));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver,
|
||||
OnVisit(aURI, *aVisitID, aTime, aSessionID,
|
||||
referringVisitID, aTransitionType, &added));
|
||||
}
|
||||
|
||||
// Normally docshell sends the link visited observer notification for us (this
|
||||
|
@ -4219,8 +4220,8 @@ nsNavHistory::BeginUpdateBatch()
|
|||
if (mBatchHasTransaction)
|
||||
mDBConn->BeginTransaction();
|
||||
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
|
||||
OnBeginUpdateBatch());
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnBeginUpdateBatch());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4233,8 +4234,8 @@ nsNavHistory::EndUpdateBatch()
|
|||
if (mBatchHasTransaction)
|
||||
mDBConn->CommitTransaction();
|
||||
mBatchHasTransaction = PR_FALSE;
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
|
||||
OnEndUpdateBatch());
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnEndUpdateBatch());
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4547,16 +4548,16 @@ nsNavHistory::RemovePage(nsIURI *aURI)
|
|||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
// Before we remove, we have to notify our observers!
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnBeforeDeleteURI(aURI));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnBeforeDeleteURI(aURI));
|
||||
|
||||
nsIURI** URIs = &aURI;
|
||||
nsresult rv = RemovePages(URIs, 1, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Notify our observers that the URI has been removed.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteURI(aURI));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteURI(aURI));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -4879,8 +4880,8 @@ nsNavHistory::RemoveAllPages()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Expiration will take care of orphans.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnClearHistory());
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnClearHistory());
|
||||
|
||||
// privacy cleanup, if there's an old history.dat around, just delete it
|
||||
nsCOMPtr<nsIFile> oldHistoryFile;
|
||||
|
@ -5500,14 +5501,13 @@ nsNavHistory::NotifyOnPageExpired(nsIURI *aURI, PRTime aVisitTime,
|
|||
{
|
||||
if (aWholeEntry) {
|
||||
// Notify our observers that the page has been removed.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteURI(aURI));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteURI(aURI));
|
||||
}
|
||||
else {
|
||||
// Notify our observers that some visits for the page have been removed.
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver,
|
||||
OnDeleteVisits(aURI, aVisitTime));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnDeleteVisits(aURI, aVisitTime));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -6939,8 +6939,8 @@ void
|
|||
nsNavHistory::SendPageChangedNotification(nsIURI* aURI, PRUint32 aWhat,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
|
||||
OnPageChanged(aURI, aWhat, aValue));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnPageChanged(aURI, aWhat, aValue));
|
||||
}
|
||||
|
||||
// nsNavHistory::TitleForDomain
|
||||
|
@ -7072,8 +7072,8 @@ nsNavHistory::SetPageTitleInternal(nsIURI* aURI, const nsAString& aTitle)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// observers (have to check first if it's bookmarked)
|
||||
ENUMERATE_OBSERVERS(mCanNotify, mCacheObservers, mObservers, nsINavHistoryObserver,
|
||||
OnTitleChanged(aURI, aTitle));
|
||||
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
|
||||
nsINavHistoryObserver, OnTitleChanged(aURI, aTitle));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
// Call a method on each observer in a category cache, then call the same
|
||||
// method on the observer array.
|
||||
|
||||
#define ENUMERATE_OBSERVERS(canFire, cache, array, type, method) \
|
||||
#define NOTIFY_OBSERVERS(canFire, cache, array, type, method) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (canFire) { \
|
||||
const nsCOMArray<type> &entries = cache.GetEntries(); \
|
||||
|
|
Загрузка…
Ссылка в новой задаче