29 #include <sbIDatabaseQuery.h>
30 #include <sbILibrary.h>
31 #include <sbILocalDatabaseLibrary.h>
32 #include <sbIMediaList.h>
33 #include <sbIMediaItem.h>
34 #include <sbIPropertyArray.h>
36 #include <nsAutoPtr.h>
38 #include <nsComponentManagerUtils.h>
44 #define SB_SMART_MEDIALIST_FACTORY_TYPE "smart"
46 #define SB_SMART_MEDIALIST_METRICS_TYPE "smart"
66 sbLocalDatabaseSmartMediaListFactory::GetContractID(nsACString& aContractID)
76 sbLocalDatabaseSmartMediaListFactory::CreateMediaList(
sbIMediaItem* aInner,
79 NS_ENSURE_ARG_POINTER(aInner);
80 NS_ENSURE_ARG_POINTER(_retval);
86 nsAutoString dataGuid;
92 if (dataGuid.IsEmpty()) {
96 nsCOMPtr<sbILibrary> library;
97 rv = aInner->GetLibrary(getter_AddRefs(library));
98 NS_ENSURE_SUCCESS(rv, rv);
100 nsCOMPtr<sbIMutablePropertyArray> properties =
102 NS_ENSURE_SUCCESS(rv, rv);
105 NS_LITERAL_STRING(
"1"));
106 NS_ENSURE_SUCCESS(rv, rv);
108 nsCOMPtr<sbIMediaList> dataList;
109 rv = library->CreateMediaList(NS_LITERAL_STRING(
"simple"),
111 getter_AddRefs(dataList));
112 NS_ENSURE_SUCCESS(rv, rv);
115 rv = dataList->GetGuid(guid);
116 NS_ENSURE_SUCCESS(rv, rv);
120 NS_ENSURE_SUCCESS(rv, rv);
123 NS_LITERAL_STRING(
"1"));
124 NS_ENSURE_SUCCESS(rv, rv);
127 NS_LITERAL_STRING(
"1"));
128 NS_ENSURE_SUCCESS(rv, rv);
131 nsRefPtr<sbLocalDatabaseSmartMediaList> newSmartList(
133 NS_ENSURE_TRUE(newSmartList, NS_ERROR_OUT_OF_MEMORY);
135 rv = newSmartList->Init(aInner);
136 NS_ENSURE_SUCCESS(rv, rv);
140 nsAutoString customType;
142 if (customType.IsEmpty()) {
150 NS_LITERAL_STRING(
"1"));
151 NS_ENSURE_SUCCESS(rv, rv);
153 NS_ADDREF(*_retval = newSmartList);
#define SB_PROPERTY_ISCONTENTREADONLY
#define SB_LOCALDATABASE_SMARTMEDIALISTFACTORY_CONTRACTID
#define SB_PROPERTY_HIDDEN
#define SB_PROPERTY_STORAGEGUID
#define SB_PROPERTY_ISREADONLY
#define SB_PROPERTY_CUSTOMTYPE