Songbird / Development / Songbird Add-Ons API Documentation

components/mediacore/base/public/sbIMediacoreFactory.idl

00001 /*
00002  //
00003 // BEGIN SONGBIRD GPL
00004 // 
00005 // This file is part of the Songbird web player.
00006 //
00007 // Copyright(c) 2005-2008 POTI, Inc.
00008 // http://songbirdnest.com
00009 // 
00010 // This file may be licensed under the terms of of the
00011 // GNU General Public License Version 2 (the "GPL").
00012 // 
00013 // Software distributed under the License is distributed 
00014 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
00015 // express or implied. See the GPL for the specific language 
00016 // governing rights and limitations.
00017 //
00018 // You should have received a copy of the GPL along with this 
00019 // program. If not, go to http://www.gnu.org/licenses/gpl.html
00020 // or write to the Free Software Foundation, Inc., 
00021 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00022 // 
00023 // END SONGBIRD GPL
00024 //
00025  */
00026 
00027 #include "nsISupports.idl"
00028 
00029 interface sbIMediacore;
00030 interface sbIMediacoreCapabilities;
00031 
00032 [scriptable, uuid(20a5b0ee-1869-4717-bbe4-c5d9db37c6fa)]
00033 interface sbIMediacoreFactory : nsISupports
00034 {
00035   readonly attribute AString contractID;
00036   readonly attribute AString name;
00037 
00038   readonly attribute sbIMediacoreCapabilities capabilities;
00039 
00040   sbIMediacore create(in AString aInstanceName);
00041 };
00042 
00043 %{C++
00044 
00045 #include <nsIComponentManager.h>
00046 #include <nsICategoryManager.h>
00047 #include <nsIGenericFactory.h>
00048 #include <nsIServiceManager.h>
00049 
00050 #include <nsCOMPtr.h>
00051 #include <nsServiceManagerUtils.h>
00052 #include <nsStringGlue.h>
00053 #include <nsXPCOMCID.h>
00054 
00055 class nsIFile;
00056 struct nsModuleComponentInfo;
00057 
00058 #define SB_MEDIACORE_FACTORY_CATEGORY "songbird-mediacore-factory"
00059 
00081 #define SB_MEDIACORE_FACTORY_REGISTERSELF(_name)                               \
00082                                                                                \
00083   NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr,                 \
00084                                 nsIFile* aPath,                                \
00085                                 const char* registryLocation,                  \
00086                                 const char* componentType,                     \
00087                                 const nsModuleComponentInfo* info);            \
00088                                                                                \
00089   NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr,               \
00090                                   nsIFile* aPath,                              \
00091                                   const char* registryLocation,                \
00092                                   const nsModuleComponentInfo* info)
00093 
00097 #define SB_MEDIACORE_FACTORY_REGISTERSELF_IMPL(_name, _desc)                   \
00098                                                                                \
00099   NS_METHOD                                                                    \
00100   _name##RegisterSelf(nsIComponentManager* aCompMgr,                           \
00101                       nsIFile* aPath,                                          \
00102                       const char* registryLocation,                            \
00103                       const char* componentType,                               \
00104                       const nsModuleComponentInfo* info)                       \
00105   {                                                                            \
00106     nsresult rv;                                                               \
00107     nsCOMPtr<nsICategoryManager> catMan =                                      \
00108       do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);                       \
00109     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00110     nsCAutoString prevEntry;                                                   \
00111     rv = catMan->AddCategoryEntry(SB_MEDIACORE_FACTORY_CATEGORY,               \
00112                                   _desc,                                       \
00113                                   info->mContractID,                           \
00114                                   PR_TRUE, PR_TRUE,                            \
00115                                   getter_Copies(prevEntry));                   \
00116     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00117     NS_WARN_IF_FALSE(prevEntry.IsEmpty(),                                      \
00118                      "Another controller was registered with that id!");       \
00119     return NS_OK;                                                              \
00120   }                                                                            \
00121                                                                                \
00122   NS_METHOD                                                                    \
00123   _name##UnregisterSelf(nsIComponentManager* aCompMgr,                         \
00124                         nsIFile* aPath,                                        \
00125                         const char* registryLocation,                          \
00126                         const nsModuleComponentInfo* info)                     \
00127   {                                                                            \
00128     nsresult rv;                                                               \
00129     nsCOMPtr<nsICategoryManager> catMan =                                      \
00130       do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);                       \
00131     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00132     rv = catMan->DeleteCategoryEntry(SB_MEDIACORE_FACTORY_CATEGORY,            \
00133                                      _desc,                                    \
00134                                      PR_TRUE);                                 \
00135     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00136     return NS_OK;                                                              \
00137   }
00138 %}

Generated on Tue Mar 10 14:28:55 2009 for Songbird by  doxygen 1.5.2