27 #ifndef __SB_LOCALDATABASELIBRARYLOADER_H__
28 #define __SB_LOCALDATABASELIBRARYLOADER_H__
30 #include <sbILibraryLoader.h>
32 #include <nsClassHashtable.h>
33 #include <nsHashKeys.h>
34 #include <nsIObserver.h>
35 #include <nsIPrefBranch.h>
36 #include <nsStringGlue.h>
38 class nsIComponentManager;
46 struct nsModuleComponentInfo;
56 libraryFactory(aLibraryFactory)
63 struct sbLibraryExistsInfo
65 sbLibraryExistsInfo(
const nsAString& aResourceGUID)
66 : resourceGUID(aResourceGUID),
70 nsString resourceGUID;
76 NS_DECL_SBILIBRARYLOADER
84 ~sbLocalDatabaseLibraryLoader();
86 nsresult LoadLibraries();
88 nsresult EnsureDefaultLibraries();
90 nsresult EnsureDefaultLibrary(
const nsACString& aLibraryGUIDPref,
91 const nsAString& aDefaultDatabaseGUID,
92 const nsAString& aLibraryNameKey,
93 const nsAString& aCustomType,
94 const nsAString& aDefaultColumnSpec);
97 CreateDefaultLibraryInfo(
const nsACString& aPrefKey,
98 const nsAString& aDatabaseGUID = EmptyString(),
99 nsILocalFile* aDatabaseFile = nsnull,
100 const nsAString& aLibraryNameKey = EmptyString());
102 NS_METHOD PromptToDeleteLibraries();
103 NS_METHOD PromptInaccessibleLibraries();
105 PRUint32 GetNextLibraryIndex();
107 static void RemovePrefBranch(
const nsACString& aPrefBranch);
109 static PLDHashOperator PR_CALLBACK
110 LoadLibrariesCallback(nsUint32HashKey::KeyType aKey,
114 static PLDHashOperator PR_CALLBACK
115 LibraryExistsCallback(nsUint32HashKey::KeyType aKey,
119 static PLDHashOperator PR_CALLBACK
120 VerifyEntriesCallback(nsUint32HashKey::KeyType aKey,
121 nsAutoPtr<sbLibraryLoaderInfo>& aEntry,
124 PRBool m_DetectedCorruptLibrary;
125 PRBool m_DeleteLibrariesAtShutdown;
128 nsClassHashtable<nsUint32HashKey, sbLibraryLoaderInfo> mLibraryInfoTable;
129 nsCOMPtr<nsIPrefBranch> mRootBranch;
139 nsresult
Init(
const nsACString& aPrefKey);
156 nsCOMPtr<nsIPrefBranch> mPrefBranch;
160 nsCString mDatabaseGUIDKey;
161 nsCString mLocationKey;
162 nsCString mStartupKey;
163 nsCString mResourceGUIDKey;
nsresult Init(const nsACString &aPrefKey)
already_AddRefed< nsILocalFile > GetDatabaseLocation()
nsresult SetLoadAtStartup(PRBool aLoadAtStartup)
Manages the lifecycle of libraries in the system.
nsresult SetDatabaseLocation(nsILocalFile *aLocation)
void GetPrefBranch(nsACString &_retval)
void GetResourceGUID(nsAString &_retval)
PRBool GetLoadAtStartup()
[USER CODE SHOULD NOT REFERENCE THIS CLASS]
void GetDatabaseGUID(nsAString &_retval)
nsresult SetDatabaseGUID(const nsAString &aGUID)
nsresult SetResourceGUID(const nsAString &aGUID)
NS_DECL_ISUPPORTS NS_DECL_SBILIBRARYLOADER NS_DECL_NSIOBSERVER sbLocalDatabaseLibraryLoader()