00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00033 #include "nsISupports.idl"
00034
00035 interface sbILibrary;
00036 interface sbILibraryManager;
00037
00043 [scriptable, uuid(816e9cbe-e635-4abc-944f-aa4fa5ec918a)]
00044 interface sbILibraryLoader : nsISupports
00045 {
00052 void onRegisterStartupLibraries(in sbILibraryManager aLibraryManager);
00053
00063 void onLibraryStartupModified(in sbILibrary aLibrary,
00064 in boolean aLoadAtStartup);
00065 };
00066
00067 %{C++
00068
00069 #include <nsICategoryManager.h>
00070 #include <nsIComponentManager.h>
00071 #include <nsIFile.h>
00072
00073 #include <nsCOMPtr.h>
00074 #include <nsServiceManagerUtils.h>
00075 #include <nsStringGlue.h>
00076 #include <nsXPCOMCID.h>
00077
00078 #define SB_LIBRARY_LOADER_CATEGORY "songbird-library-loader"
00079
00103 #define SB_LIBRARY_LOADER_REGISTRATION(_name, _desc) \
00104 \
00105 NS_METHOD \
00106 _name##RegisterSelf(nsIComponentManager* aCompMgr, \
00107 nsIFile* aPath, \
00108 const char* registryLocation, \
00109 const char* componentType, \
00110 const nsModuleComponentInfo* info) \
00111 { \
00112 nsresult rv; \
00113 nsCOMPtr<nsICategoryManager> catMan = \
00114 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
00115 NS_ENSURE_SUCCESS(rv, rv); \
00116 \
00117 rv = catMan->AddCategoryEntry(SB_LIBRARY_LOADER_CATEGORY, \
00118 _desc, \
00119 info->mContractID, \
00120 PR_TRUE, PR_TRUE, \
00121 nsnull); \
00122 NS_ENSURE_SUCCESS(rv, rv); \
00123 \
00124 return NS_OK; \
00125 } \
00126 \
00127 NS_METHOD \
00128 _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
00129 nsIFile* aPath, \
00130 const char* registryLocation, \
00131 const nsModuleComponentInfo* info) \
00132 { \
00133 nsresult rv; \
00134 nsCOMPtr<nsICategoryManager> catMan = \
00135 do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
00136 NS_ENSURE_SUCCESS(rv, rv); \
00137 \
00138 rv = catMan->DeleteCategoryEntry(SB_LIBRARY_LOADER_CATEGORY, \
00139 _desc, \
00140 PR_FALSE); \
00141 NS_ENSURE_SUCCESS(rv, rv); \
00142 \
00143 return NS_OK; \
00144 }
00145 %}