31 #include <nsComponentManagerUtils.h>
32 #include <nsIClassInfoImpl.h>
33 #include <nsIObjectInputStream.h>
34 #include <nsIObjectOutputStream.h>
35 #include <nsIProgrammingLanguage.h>
45 #define NOTIFY_LISTENERS_INDIRECT(_obj, _method, _params) \
47 if (!_obj->mSelectionNotificationsSuppressed) { \
48 sbObserverArray::ForwardIterator iter(_obj->mObservers); \
49 while (iter.HasMore()) { \
50 iter.GetNext()->_method _params; \
54 #define NOTIFY_LISTENERS(_method, _params) \
55 NOTIFY_LISTENERS_INDIRECT(this, _method, _params)
62 static PRLogModuleInfo* gLocalDatabaseMediaListViewSelectionLog = nsnull;
63 #define TRACE(args) PR_LOG(gLocalDatabaseMediaListViewSelectionLog, PR_LOG_DEBUG, args)
64 #define LOG(args) PR_LOG(gLocalDatabaseMediaListViewSelectionLog, PR_LOG_WARN, args)
71 : mSelectionIsAll(PR_FALSE),
76 mSelectionNotificationsSuppressed(PR_FALSE)
79 if (!gLocalDatabaseMediaListViewSelectionLog) {
80 gLocalDatabaseMediaListViewSelectionLog =
81 PR_NewLogModule(
"sbLocalDatabaseMediaListViewSelection");
88 const nsAString& aListGUID,
93 NS_ASSERTION(aArray,
"aArray is null");
98 mListGUID = aListGUID;
100 mIsLibrary = aIsLibrary;
102 PRBool success = mSelection.Init();
103 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
107 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
108 NS_ENSURE_SUCCESS(rv, rv);
111 if (!mSelectionIsAll) {
123 nsresult rv = mArray->GetLength(&mLength);
124 NS_ENSURE_SUCCESS(rv, rv);
127 if (!mCurrentUID.IsEmpty()) {
129 rv = GetIndexForUniqueId(mCurrentUID, &index);
130 if (NS_SUCCEEDED(rv)) {
131 mCurrentIndex = index;
132 }
else if (rv == NS_ERROR_NOT_AVAILABLE) {
135 NS_ENSURE_SUCCESS(rv, rv);
147 NS_ENSURE_ARG_POINTER(aState);
149 nsRefPtr<sbLocalDatabaseMediaListViewSelectionState> state =
151 NS_ENSURE_TRUE(state, NS_ERROR_OUT_OF_MEMORY);
153 nsresult rv = state->Init();
154 NS_ENSURE_SUCCESS(rv, rv);
156 state->mCurrentIndex = mCurrentIndex;
157 state->mSelectionIsAll = mSelectionIsAll;
159 if (!mSelectionIsAll) {
161 &state->mSelectionList);
164 NS_ADDREF(*aState = state);
169 sbLocalDatabaseMediaListViewSelection::GetCount(PRInt32*
aCount)
171 NS_ENSURE_ARG_POINTER(aCount);
173 if (mSelectionIsAll) {
174 *aCount = (PRInt32) mLength;
177 *aCount = (PRInt32) mSelection.Count();
184 sbLocalDatabaseMediaListViewSelection::GetCurrentIndex(PRInt32* aCurrentIndex)
186 NS_ENSURE_ARG_POINTER(aCurrentIndex);
187 *aCurrentIndex = mCurrentIndex;
192 sbLocalDatabaseMediaListViewSelection::SetCurrentIndex(PRInt32 aCurrentIndex)
194 NS_ENSURE_ARG_RANGE(aCurrentIndex, -1, (PRInt32) mLength - 1);
196 mCurrentIndex = aCurrentIndex;
197 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
198 NS_ENSURE_SUCCESS(rv, rv);
204 sbLocalDatabaseMediaListViewSelection::GetCurrentMediaItem(
sbIMediaItem** aCurrentMediaItem)
206 NS_ENSURE_ARG_POINTER(aCurrentMediaItem);
209 if (mCurrentIndex >= 0) {
211 rv = mArray->GetGuidByIndex(mCurrentIndex, guid);
212 NS_ENSURE_SUCCESS(rv, rv);
214 rv = mLibrary->GetMediaItem(guid, aCurrentMediaItem);
215 NS_ENSURE_SUCCESS(rv, rv);
218 *aCurrentMediaItem = nsnull;
225 sbLocalDatabaseMediaListViewSelection::IsIndexSelected(PRInt32 aIndex,
228 NS_ENSURE_ARG_POINTER(_retval);
232 if (aIndex < 0 || aIndex > (PRInt32) mLength - 1) {
237 if (mSelectionIsAll) {
243 rv = GetUniqueIdForIndex((PRUint32) aIndex, uid);
244 NS_ENSURE_SUCCESS(rv, rv);
246 *_retval = mSelection.Get(uid, nsnull);
253 const nsAString &aContentType,
256 NS_ENSURE_ARG_POINTER(aLibrary);
257 NS_ENSURE_ARG_POINTER(aIsSame);
260 nsCOMPtr<sbIMediaItem> item;
261 rv = aLibrary->GetItemByGuid(aGuid, getter_AddRefs(item));
262 NS_ENSURE_SUCCESS(rv, rv);
264 nsString contentType;
267 NS_ENSURE_SUCCESS(rv, rv);
269 *aIsSame = aContentType.Equals(contentType);
275 sbLocalDatabaseMediaListViewSelection::IsContentTypeSelected(
276 const nsAString &aContentType,
279 NS_ENSURE_ARG_POINTER(_retval);
283 if (mSelectionIsAll) {
284 for (PRUint32
i = 0;
i < mLength;
i++) {
286 rv = mArray->GetGuidByIndex(
i, guid);
287 NS_ENSURE_SUCCESS(rv, rv);
291 NS_ENSURE_SUCCESS(rv, rv);
300 PRUint32 selectionCount = mSelection.Count();
303 for (PRUint32
i = 0;
i < mLength && found < selectionCount;
i++) {
304 PRBool isIndexCached;
305 rv = mArray->IsIndexCached(
i, &isIndexCached);
306 NS_ENSURE_SUCCESS(rv, rv);
310 rv = GetUniqueIdForIndex(
i, uid);
311 NS_ENSURE_SUCCESS(rv, rv);
314 if (mSelection.Get(uid, &guid)) {
317 NS_ENSURE_SUCCESS(rv, rv);
330 if (found == selectionCount) {
337 for (PRUint32
i = 0;
i < mLength;
i++) {
339 rv = GetUniqueIdForIndex(
i, uid);
340 NS_ENSURE_SUCCESS(rv, rv);
343 if (mSelection.Get(uid, &guid)) {
346 NS_ENSURE_SUCCESS(rv, rv);
361 sbLocalDatabaseMediaListViewSelection::GetSelectedIndexedMediaItems(
nsISimpleEnumerator** aSelectedMediaItems)
363 NS_ENSURE_ARG_POINTER(aSelectedMediaItems);
367 if (mSelectionIsAll) {
369 NS_ENSURE_TRUE(*aSelectedMediaItems, NS_ERROR_OUT_OF_MEMORY);
371 NS_ADDREF(*aSelectedMediaItems);
378 nsRefPtr<sbGUIDArrayToIndexedMediaItemEnumerator>
380 NS_ENSURE_TRUE(enumerator, NS_ERROR_OUT_OF_MEMORY);
382 PRUint32 selectionCount = mSelection.Count();
385 for (PRUint32
i = 0;
i < mLength && found < selectionCount;
i++) {
386 PRBool isIndexCached;
387 rv = mArray->IsIndexCached(
i, &isIndexCached);
388 NS_ENSURE_SUCCESS(rv, rv);
392 rv = GetUniqueIdForIndex(
i, uid);
393 NS_ENSURE_SUCCESS(rv, rv);
396 if (mSelection.Get(uid, &guid)) {
397 rv = enumerator->AddGuid(guid,
i);
398 NS_ENSURE_SUCCESS(rv, rv);
405 if (found == selectionCount) {
406 NS_ADDREF(*aSelectedMediaItems = enumerator);
413 NS_ENSURE_TRUE(enumerator, NS_ERROR_OUT_OF_MEMORY);
415 for (PRUint32
i = 0;
i < mLength;
i++) {
417 rv = GetUniqueIdForIndex(
i, uid);
418 NS_ENSURE_SUCCESS(rv, rv);
421 if (mSelection.Get(uid, &guid)) {
422 rv = enumerator->AddGuid(guid,
i);
423 NS_ENSURE_SUCCESS(rv, rv);
427 NS_ADDREF(*aSelectedMediaItems = enumerator);
432 sbLocalDatabaseMediaListViewSelection::GetSelectedMediaItems(
nsISimpleEnumerator * *aSelectedMediaItems)
434 NS_ENSURE_ARG_POINTER(aSelectedMediaItems);
439 nsCOMPtr<nsISimpleEnumerator> indexedEnumerator;
440 rv = GetSelectedIndexedMediaItems(getter_AddRefs(indexedEnumerator));
441 NS_ENSURE_SUCCESS(rv, rv);
443 nsRefPtr<sbIndexedToUnindexedMediaItemEnumerator> unwrapper =
445 NS_ENSURE_TRUE(unwrapper, NS_ERROR_OUT_OF_MEMORY);
447 return CallQueryInterface(unwrapper.get(), aSelectedMediaItems);
453 NS_ENSURE_ARG_RANGE(aIndex, 0, (PRInt32) mLength - 1);
456 mCurrentIndex = aIndex;
457 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
458 NS_ENSURE_SUCCESS(rv, rv);
460 rv = AddToSelection(aIndex);
461 NS_ENSURE_SUCCESS(rv, rv);
475 sbLocalDatabaseMediaListViewSelection::SelectOnly(PRInt32 aIndex)
477 NS_ENSURE_ARG_RANGE(aIndex, 0, (PRInt32) mLength - 1);
480 mCurrentIndex = aIndex;
481 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
482 NS_ENSURE_SUCCESS(rv, rv);
485 mSelectionIsAll = PR_FALSE;
487 rv = AddToSelection(aIndex);
488 NS_ENSURE_SUCCESS(rv, rv);
502 sbLocalDatabaseMediaListViewSelection::TimedSelectOnly(PRInt32 aIndex, PRInt32
aDelay)
504 PRBool suppressed = mSelectionNotificationsSuppressed;
506 mSelectionNotificationsSuppressed = PR_TRUE;
507 nsresult rv = SelectOnly(aIndex);
508 mSelectionNotificationsSuppressed = suppressed;
509 NS_ENSURE_SUCCESS(rv, rv);
511 if (aDelay != -1 && !mSelectionNotificationsSuppressed) {
513 mSelectTimer->Cancel();
515 mSelectTimer = do_CreateInstance(
"@mozilla.org/timer;1");
516 mSelectTimer->InitWithFuncCallback(DelayedSelectNotification,
this, aDelay,
517 nsITimer::TYPE_ONE_SHOT);
524 sbLocalDatabaseMediaListViewSelection::DelayedSelectNotification(nsITimer* aTimer,
void*
aClosure)
526 nsRefPtr<sbLocalDatabaseMediaListViewSelection>
self =
531 self->mSelectTimer = nsnull;
536 sbLocalDatabaseMediaListViewSelection::Toggle(PRInt32 aIndex)
538 NS_ENSURE_ARG_RANGE((PRInt32) aIndex, 0, (PRInt32) mLength - 1);
541 mCurrentIndex = aIndex;
542 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
543 NS_ENSURE_SUCCESS(rv, rv);
547 if (mSelectionIsAll) {
548 mSelectionIsAll = PR_FALSE;
549 for (PRUint32
i = 0;
i < mLength;
i++) {
550 if (
i != (PRUint32) aIndex) {
551 rv = AddToSelection(
i);
552 NS_ENSURE_SUCCESS(rv, rv);
560 rv = IsIndexSelected(aIndex, &isSelected);
561 NS_ENSURE_SUCCESS(rv, rv);
564 rv = RemoveFromSelection(aIndex);
565 NS_ENSURE_SUCCESS(rv, rv);
568 rv = AddToSelection(aIndex);
569 NS_ENSURE_SUCCESS(rv, rv);
584 sbLocalDatabaseMediaListViewSelection::Clear(PRInt32 aIndex)
586 NS_ENSURE_ARG_RANGE(aIndex, 0, (PRInt32) mLength - 1);
590 mCurrentIndex = aIndex;
591 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
592 NS_ENSURE_SUCCESS(rv, rv);
596 if (mSelectionIsAll) {
597 mSelectionIsAll = PR_FALSE;
598 for (PRUint32
i = 0;
i < mLength;
i++) {
599 if (
i != (PRUint32) aIndex) {
600 rv = AddToSelection(
i);
601 NS_ENSURE_SUCCESS(rv, rv);
610 rv = RemoveFromSelection((PRUint32) aIndex);
611 NS_ENSURE_SUCCESS(rv, rv);
624 sbLocalDatabaseMediaListViewSelection::SelectRange(PRInt32 aStartIndex,
627 TRACE((
"sbLocalDatabaseMediaListViewSelection[0x%.8x] - SelectRange(%d, %d)",
628 this, aStartIndex, aEndIndex));
630 NS_ENSURE_ARG_RANGE(aStartIndex, 0, (PRInt32) mLength - 1);
631 NS_ENSURE_ARG_RANGE(aEndIndex, 0, (PRInt32) mLength - 1);
635 if (mSelectionIsAll) {
639 mCurrentIndex = aEndIndex;
640 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
641 NS_ENSURE_SUCCESS(rv, rv);
643 PRInt32
start = PR_MIN(aStartIndex, aEndIndex);
644 PRInt32 end = PR_MAX(aStartIndex, aEndIndex);
646 for (PRInt32
i = start;
i <= end;
i++) {
647 rv = AddToSelection((PRUint32)
i);
648 NS_ENSURE_SUCCESS(rv, rv);
663 sbLocalDatabaseMediaListViewSelection::ClearRange(PRInt32 aStartIndex,
666 NS_ENSURE_ARG_RANGE(aStartIndex, 0, (PRInt32) mLength - 1);
667 NS_ENSURE_ARG_RANGE(aEndIndex, 0, (PRInt32) mLength - 1);
671 mCurrentIndex = aEndIndex;
672 rv = GetUniqueIdForIndex(mCurrentIndex, mCurrentUID);
673 NS_ENSURE_SUCCESS(rv, rv);
677 if (mSelectionIsAll) {
678 mSelectionIsAll = PR_FALSE;
679 for (PRUint32
i = 0;
i < mLength;
i++) {
680 if (
i < (PRUint32) aStartIndex ||
i > (PRUint32) aEndIndex) {
681 rv = AddToSelection(
i);
682 NS_ENSURE_SUCCESS(rv, rv);
691 for (PRInt32
i = aStartIndex;
i <= aEndIndex;
i++) {
692 rv = RemoveFromSelection((PRUint32)
i);
693 NS_ENSURE_SUCCESS(rv, rv);
706 sbLocalDatabaseMediaListViewSelection::SelectNone()
709 mSelectionIsAll = PR_FALSE;
711 mCurrentUID.Truncate();
723 sbLocalDatabaseMediaListViewSelection::SelectAll()
726 mSelectionIsAll = PR_TRUE;
740 NS_ENSURE_ARG_POINTER(aListener);
742 PRBool success = mObservers.AppendElementUnlessExists(aListener);
743 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
750 NS_ENSURE_ARG_POINTER(aListener);
751 mObservers.RemoveElement(aListener);
756 sbLocalDatabaseMediaListViewSelection::SetSelectionNotificationsSuppressed(PRBool aSelectionEventsSuppressed)
758 mSelectionNotificationsSuppressed = aSelectionEventsSuppressed;
761 if (!mSelectionNotificationsSuppressed) {
769 sbLocalDatabaseMediaListViewSelection::GetSelectionNotificationsSuppressed(PRBool *aSelectionEventsSuppressed)
771 NS_ENSURE_ARG_POINTER(aSelectionEventsSuppressed);
772 *aSelectionEventsSuppressed = mSelectionNotificationsSuppressed;
777 sbLocalDatabaseMediaListViewSelection::AddToSelection(PRUint32 aIndex)
782 rv = GetUniqueIdForIndex(aIndex, uid);
783 NS_ENSURE_SUCCESS(rv, rv);
785 if (mSelection.Get(uid, nsnull)) {
790 rv = mArray->GetGuidByIndex(aIndex, guid);
791 NS_ENSURE_SUCCESS(rv, rv);
793 PRBool success = mSelection.Put(uid, guid);
794 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
800 sbLocalDatabaseMediaListViewSelection::RemoveFromSelection(PRUint32 aIndex)
805 rv = GetUniqueIdForIndex(aIndex, uid);
806 NS_ENSURE_SUCCESS(rv, rv);
808 mSelection.Remove(uid);
814 sbLocalDatabaseMediaListViewSelection::GetUniqueIdForIndex(PRUint32 aIndex,
823 aId.Assign(mListGUID);
827 rv = mArray->GetGuidByIndex(aIndex, guid);
828 NS_ENSURE_SUCCESS(rv, rv);
833 nsString viewItemUID;
834 rv = mArray->GetViewItemUIDByIndex(aIndex, viewItemUID);
835 NS_ENSURE_SUCCESS(rv, rv);
836 aId.Append(viewItemUID);
842 sbLocalDatabaseMediaListViewSelection::GetUniqueIdForIndex(PRInt32 aIndex,
849 return GetUniqueIdForIndex(static_cast<PRUint32>(aIndex), aId);
853 sbLocalDatabaseMediaListViewSelection::GetIndexForUniqueId
854 (
const nsAString& aId,
860 nsTArray<nsString> idComponentList;
862 if (idComponentList.Length() < 3)
863 return NS_ERROR_NOT_AVAILABLE;
867 nsString viewItemUID = idComponentList[2];
870 rv = mArray->GetIndexByViewItemUID(viewItemUID, aIndex);
871 if (rv == NS_ERROR_NOT_AVAILABLE)
872 return NS_ERROR_NOT_AVAILABLE;
873 NS_ENSURE_SUCCESS(rv, rv);
880 sbLocalDatabaseMediaListViewSelection::LogSelection()
885 if (mSelectionIsAll) {
886 list.AssignLiteral(
"all");
889 PRUint32 oldFetchSize;
890 nsresult rv = mArray->GetFetchSize(&oldFetchSize);
891 NS_ENSURE_SUCCESS(rv, );
893 rv = mArray->SetFetchSize(0);
894 NS_ENSURE_SUCCESS(rv, );
896 for (PRUint32
i = 0;
i < mLength;
i++) {
898 GetUniqueIdForIndex(
i, uid);
901 if (mSelection.Get(uid, nsnull)) {
907 rv = mArray->SetFetchSize(oldFetchSize);
908 NS_ENSURE_SUCCESS(rv, );
911 TRACE((
"sbLocalDatabaseMediaListViewSelection[0x%.8x] - LogSelection() "
912 "length: %d, selection: %s",
913 this, mLength, NS_LossyConvertUTF16toASCII(list).
get()));
923 mSelectionIsAll(PR_FALSE)
928 sbLocalDatabaseMediaListViewSelectionState::Read(nsIObjectInputStream* aStream)
930 NS_ENSURE_ARG_POINTER(aStream);
935 NS_ENSURE_SUCCESS(rv, rv);
937 PRUint32 selectionCount;
938 rv = aStream->Read32(&selectionCount);
939 NS_ENSURE_SUCCESS(rv, rv);
941 for (PRUint32
i = 0;
i < selectionCount;
i++) {
945 rv = aStream->ReadString(key);
946 NS_ENSURE_SUCCESS(rv, rv);
948 rv = aStream->ReadString(entry);
949 NS_ENSURE_SUCCESS(rv, rv);
952 NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY);
955 PRBool selectionIsAll;
956 rv = aStream->ReadBoolean(&selectionIsAll);
957 NS_ENSURE_SUCCESS(rv, rv);
964 sbLocalDatabaseMediaListViewSelectionState::Write(nsIObjectOutputStream* aStream)
966 NS_ENSURE_ARG_POINTER(aStream);
971 NS_ENSURE_SUCCESS(rv, rv);
974 NS_ENSURE_SUCCESS(rv, rv);
979 NS_ENSURE_SUCCESS(rv, rv);
988 NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
998 buff.AppendLiteral(
" currentIndex ");
999 buff.AppendInt(mCurrentIndex);
1001 buff.AppendLiteral(
" selection ");
1003 buff.AppendLiteral(
"is all");
1007 buff.AppendLiteral(
" items");
1032 sbGUIDArrayToIndexedMediaItemEnumerator::sbGUIDArrayToIndexedMediaItemEnumerator(
sbILibrary* aLibrary) :
1033 mInitalized(PR_FALSE),
1044 Item* item = mItems.AppendElement();
1045 NS_ENSURE_TRUE(item, NS_ERROR_OUT_OF_MEMORY);
1047 item->index = aIndex;
1054 sbGUIDArrayToIndexedMediaItemEnumerator::GetNextItem()
1057 mInitalized = PR_TRUE;
1061 PRUint32 length = mItems.Length();
1063 while (mNextIndex < length) {
1064 nsresult rv = mLibrary->GetMediaItem(mItems[mNextIndex].guid,
1065 getter_AddRefs(mNextItem));
1066 mNextItemIndex = mItems[mNextIndex].index;
1068 if (NS_SUCCEEDED(rv)) {
1073 return NS_ERROR_NOT_AVAILABLE;
1077 sbGUIDArrayToIndexedMediaItemEnumerator::HasMoreElements(PRBool *_retval)
1083 *_retval = mNextItem != nsnull;
1089 sbGUIDArrayToIndexedMediaItemEnumerator::GetNext(
nsISupports **_retval)
1096 return NS_ERROR_FAILURE;
1099 nsRefPtr<sbLocalDatabaseIndexedMediaItem> indexedItem
1101 NS_ENSURE_TRUE(indexedItem, NS_ERROR_OUT_OF_MEMORY);
1104 indexedItem.get()));
1121 sbIndexedGUIDArrayEnumerator::sbIndexedGUIDArrayEnumerator(
sbILibrary* aLibrary,
1126 mInitalized(PR_FALSE)
1128 NS_ASSERTION(aLibrary,
"aLibrary is null");
1129 NS_ASSERTION(aArray,
"aArray is null");
1133 sbIndexedGUIDArrayEnumerator::Init()
1136 nsresult rv = mArray->GetLength(&length);
1137 NS_ENSURE_SUCCESS(rv, rv);
1139 for (PRUint32
i = 0;
i < length;
i++) {
1141 rv = mArray->GetGuidByIndex(
i, guid);
1142 NS_ENSURE_SUCCESS(rv, rv);
1144 nsString* added = mGUIDArray.AppendElement(guid);
1145 NS_ENSURE_TRUE(added, NS_ERROR_OUT_OF_MEMORY);
1148 mInitalized = PR_TRUE;
1154 sbIndexedGUIDArrayEnumerator::HasMoreElements(PRBool *_retval)
1157 nsresult rv = Init();
1158 NS_ENSURE_SUCCESS(rv, rv);
1161 *_retval = mNextIndex < mGUIDArray.Length();
1166 sbIndexedGUIDArrayEnumerator::GetNext(
nsISupports **_retval)
1172 NS_ENSURE_SUCCESS(rv, rv);
1175 if (!(mNextIndex < mGUIDArray.Length())) {
1176 return NS_ERROR_FAILURE;
1179 nsCOMPtr<sbIMediaItem> item;
1180 rv = mLibrary->GetMediaItem(mGUIDArray[mNextIndex], getter_AddRefs(item));
1181 NS_ENSURE_SUCCESS(rv, rv);
1183 nsRefPtr<sbLocalDatabaseIndexedMediaItem> indexedItem
1185 NS_ENSURE_TRUE(indexedItem, NS_ERROR_OUT_OF_MEMORY);
1188 indexedItem.get()));
1210 sbIndexedToUnindexedMediaItemEnumerator::sbIndexedToUnindexedMediaItemEnumerator(nsISimpleEnumerator* aEnumerator) :
1211 mIndexedEnumerator(aEnumerator)
1216 sbIndexedToUnindexedMediaItemEnumerator::HasMoreElements(PRBool *_retval)
1218 NS_ENSURE_TRUE(mIndexedEnumerator, NS_ERROR_NOT_INITIALIZED);
1219 return mIndexedEnumerator->HasMoreElements(_retval);
1223 sbIndexedToUnindexedMediaItemEnumerator::GetNext(
nsISupports **_retval)
1225 NS_ENSURE_ARG_POINTER(_retval);
1226 NS_ENSURE_TRUE(mIndexedEnumerator, NS_ERROR_NOT_INITIALIZED);
1230 nsCOMPtr<sbIIndexedMediaItem> indexedItem;
1231 rv = mIndexedEnumerator->GetNext(getter_AddRefs(indexedItem));
1232 NS_ENSURE_SUCCESS(rv, rv);
1234 nsCOMPtr<sbIMediaItem> item;
1235 rv = indexedItem->GetMediaItem(getter_AddRefs(item));
1236 NS_ENSURE_SUCCESS(rv, rv);
1238 return CallQueryInterface(item, _retval);
[USER CODE SHOULD NOT REFERENCE THIS CLASS]
#define SB_PROPERTY_CONTENTTYPE
void nsString_Split(const nsAString &aString, const nsAString &aDelimiter, nsTArray< nsString > &aSubStringArray)
Media library abstraction.
PLDHashOperator PR_CALLBACK SB_CopySelectionListCallback(nsStringHashKey::KeyType aKey, nsString aEntry, void *aUserData)
restoreHistoryPrecursor aCount
NS_IMPL_CI_INTERFACE_GETTER2(sbDataRemoteWrapper, sbIDataRemote, nsIClassInfo) sbDataRemoteWrapper
_getSelectedPageStyle s i
PLDHashOperator PR_CALLBACK SB_SerializeSelectionListCallback(nsStringHashKey::KeyType aKey, nsString aEntry, void *aUserData)