27 #ifndef __SB_PLAYBACKHISTORYSERVICE_H__
28 #define __SB_PLAYBACKHISTORYSERVICE_H__
30 #include <sbIPlaybackHistoryService.h>
33 #include <nsIClassInfo.h>
34 #include <nsIComponentManager.h>
36 #include <nsIGenericFactory.h>
37 #include <nsIObserver.h>
38 #include <nsIWeakReference.h>
41 #include <nsDataHashtable.h>
42 #include <nsHashKeys.h>
43 #include <nsInterfaceHashtable.h>
44 #include <nsStringGlue.h>
49 #include <sbIDatabaseQuery.h>
50 #include <sbILibrary.h>
51 #include <sbIMediacoreEventListener.h>
52 #include <sbIMediaItem.h>
53 #include <sbIMediaListView.h>
54 #ifdef METRICS_ENABLED
55 #include <sbIMetrics.h>
57 #include <sbIPlaybackHistoryListener.h>
68 NS_DECL_SBIMEDIACOREEVENTLISTENER
69 NS_DECL_SBIPLAYBACKHISTORYSERVICE
71 static NS_METHOD
RegisterSelf(nsIComponentManager* aCompMgr,
73 const char* aLoaderStr,
75 const nsModuleComponentInfo *aInfo);
78 nsISupportsHashKey::KeyType aKey,
106 nsresult
GetItem(
const nsAString &aLibraryGuid,
107 const nsAString &aItemGuid,
111 PRUint32 *aPropertyDBID);
113 PRUint32 *aPropertyDBID);
133 #ifdef METRICS_ENABLED
135 nsresult UpdateMetrics();
142 nsString mAddEntryQuery;
144 nsString mAddAnnotationQuery;
145 nsString mInsertAnnotationQuery;
146 nsString mUpdateAnnotationQuery;
147 nsString mRemoveAnnotationQuery;
148 nsString mIsAnnotationPresentQuery;
150 nsString mGetEntryCountQuery;
152 nsString mGetEntryIDQuery;
154 nsString mInsertPropertyIDQuery;
156 nsString mGetAllEntriesQuery;
157 nsString mGetEntriesByIndexQuery;
158 nsString mGetEntriesByIndexQueryAscending;
160 nsString mGetEntriesByTimestampQuery;
161 nsString mGetEntriesByTimestampQueryAscending;
163 nsString mGetAnnotationsForEntryQuery;
165 nsString mRemoveEntriesQuery;
166 nsString mRemoveAnnotationsQuery;
168 nsString mRemoveAllEntriesQuery;
169 nsString mRemoveAllAnnotationsQuery;
171 nsInterfaceHashtableMT<nsStringHashKey, sbILibrary> mLibraries;
173 nsInterfaceHashtableMT<nsISupportsHashKey,
176 nsDataHashtableMT<nsUint32HashKey, nsString> mPropertyDBIDToID;
177 nsDataHashtableMT<nsStringHashKey, PRUint32> mPropertyIDToDBID;
179 nsCOMPtr<nsIWeakReference> mMediacoreManager;
183 PRPackedBool mCurrentlyTracking;
185 PRTime mCurrentStartTime;
186 PRTime mCurrentPauseTime;
187 PRTime mCurrentDelta;
189 nsCOMPtr<sbIMediaItem> mCurrentItem;
190 nsCOMPtr<sbIMediaListView> mCurrentView;
192 #ifdef METRICS_ENABLED
193 nsCOMPtr<sbIMetrics> mMetrics;
nsresult UpdateCurrentViewFromEvent(sbIMediacoreEvent *aEvent)
nsresult FillAddQueryParameters(sbIDatabaseQuery *aQuery, sbIPlaybackHistoryEntry *aEntry)
nsresult DoEntryRemovedCallback(sbIPlaybackHistoryEntry *aEntry)
nsresult DoEntryUpdatedCallback(sbIPlaybackHistoryEntry *aEntry)
nsresult CreateAnnotationsFromEntryId(PRInt64 aEntryId, sbIPropertyArray **aAnnotations)
nsresult DoEntriesRemovedCallback(nsIArray *aEntry)
nsresult FillRemoveEntryQueryParameters(sbIDatabaseQuery *aQuery, sbIPlaybackHistoryEntry *aEntry)
nsresult GetPropertyDBID(const nsAString &aPropertyID, PRUint32 *aPropertyDBID)
nsresult DoEntriesAddedCallback(nsIArray *aEntries)
nsresult EnsureHistoryDatabaseAvailable()
nsresult FillAddAnnotationsQueryParameters(sbIDatabaseQuery *aQuery, sbIPlaybackHistoryEntry *aEntry)
nsresult CreateDefaultQuery(sbIDatabaseQuery **aQuery)
NS_DECL_ISUPPORTS NS_DECL_NSIOBSERVER NS_DECL_SBIMEDIACOREEVENTLISTENER static NS_DECL_SBIPLAYBACKHISTORYSERVICE NS_METHOD RegisterSelf(nsIComponentManager *aCompMgr, nsIFile *aPath, const char *aLoaderStr, const char *aType, const nsModuleComponentInfo *aInfo)
nsresult CreateEntriesFromResultSet(sbIDatabaseResult *aResult, nsIArray **aEntries)
nsresult ResetTrackingData()
sbPlaybackHistoryService()
nsresult LoadPropertyIDs()
~sbPlaybackHistoryService()
nsresult DoEntriesClearedCallback()
An object containing the results of a database SELECT query.
nsresult InsertPropertyID(const nsAString &aPropertyID, PRUint32 *aPropertyDBID)
nsresult VerifyDataAndCreateNewEntry()
An object responsible for executing SQL queries on the database.
nsresult UpdateTrackingDataFromEvent(sbIMediacoreEvent *aEvent)
nsresult GetItem(const nsAString &aLibraryGuid, const nsAString &aItemGuid, sbIMediaItem **aItem)
nsresult DoEntryAddedCallback(sbIPlaybackHistoryEntry *aEntry)
An interface to carry around arrays of nsIProperty instances. Users of this interface should only QI ...
nsresult DoEntriesUpdatedCallback(nsIArray *aEntry)
nsresult CreateEntryFromResultSet(sbIDatabaseResult *aResult, PRUint32 aRow, sbIPlaybackHistoryEntry **aEntry)
static PLDHashOperator PR_CALLBACK AddListenersToCOMArrayCallback(nsISupportsHashKey::KeyType aKey, sbIPlaybackHistoryListener *aEntry, void *aUserData)