Songbird / Development / Songbird Add-Ons API Documentation

components/devices/marshall/public/sbIDeviceMarshall.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 sbIDeviceControllerRegistrar;
00030 
00034 [scriptable, uuid(3dc4e74e-104e-416f-ba1b-9c6685bc416f)]
00035 interface sbIDeviceMarshall : nsISupports
00036 {
00040   readonly attribute nsIDPtr id;
00041 
00045   readonly attribute AString name;
00046 
00051   void loadControllers(in sbIDeviceControllerRegistrar aRegistrar);
00052 
00053   void beginMonitoring();
00054 
00059   void stopMonitoring();
00060 };
00061 
00062 %{C++
00063 #include "nsCOMPtr.h"
00064 #include "nsIComponentManager.h"
00065 #include "nsICategoryManager.h"
00066 #include "nsIServiceManager.h"
00067 #include "nsStringGlue.h"
00068 #include "nsXPCOMCID.h"
00069 
00070 class nsIFile;
00071 struct nsModuleComponentInfo;
00072 
00073 #define SB_DEVICE_MARSHALL_CATEGORY "songbird-device-marshall"
00074 
00096 #define SB_DEVICE_MARSHALL_REGISTERSELF(_name)                                 \
00097                                                                                \
00098   static NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr,          \
00099                                        nsIFile* aPath,                         \
00100                                        const char* registryLocation,           \
00101                                        const char* componentType,              \
00102                                        const nsModuleComponentInfo* info);     \
00103                                                                                \
00104   static NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr,        \
00105                                          nsIFile* aPath,                       \
00106                                          const char* registryLocation,         \
00107                                          const nsModuleComponentInfo* info)
00108 
00112 #define SB_DEVICE_MARSHALL_REGISTERSELF_IMPL(_name)                            \
00113                                                                                \
00114   NS_METHOD                                                                    \
00115   _name##RegisterSelf(nsIComponentManager* aCompMgr,                           \
00116                       nsIFile* aPath,                                          \
00117                       const char* registryLocation,                            \
00118                       const char* componentType,                               \
00119                       const nsModuleComponentInfo* info)                       \
00120   {                                                                            \
00121     nsresult rv;                                                               \
00122     nsCOMPtr<nsICategoryManager> catMan =                                      \
00123       do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);                       \
00124     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00125     nsID id;                                                                   \
00126     rv = this->GetIdInPlace(&id);                                              \
00127     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00128     nsCAutoString idString(id.ToString());                                     \
00129     NS_ENSURE_STATE(!idString.IsEmpty());                                      \
00130     nsXPIDLCString prevEntry;                                                  \
00131     rv = catMan->AddCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY,                 \
00132                                   idString.get(),                              \
00133                                   info->mContractID,                           \
00134                                   PR_TRUE, PR_TRUE,                            \
00135                                   getter_Copies(prevEntry));                   \
00136     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00137     NS_WARN_IF_FALSE(prevEntry.IsEmpty(),                                      \
00138                      "Another marshall was registered with that id!");         \
00139     return NS_OK;                                                              \
00140   }                                                                            \
00141                                                                                \
00142   NS_METHOD                                                                    \
00143   _name##UnregisterSelf(nsIComponentManager* aCompMgr,                         \
00144                         nsIFile* aPath,                                        \
00145                         const char* registryLocation,                          \
00146                         const nsModuleComponentInfo* info)                     \
00147   {                                                                            \
00148     nsresult rv;                                                               \
00149     nsCOMPtr<nsICategoryManager> catMan =                                      \
00150       do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);                       \
00151     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00152     nsID id;                                                                   \
00153     rv = this->GetIdInPlace(&id);                                              \
00154     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00155     nsCAutoString idString(id.ToString());                                     \
00156     NS_ENSURE_STATE(!idString.IsEmpty());                                      \
00157     rv = catMan->DeleteCategoryEntry(SB_DEVICE_MARSHALL_CATEGORY,              \
00158                                      idString.get(),                           \
00159                                      PR_TRUE);                                 \
00160     NS_ENSURE_SUCCESS(rv, rv);                                                 \
00161     return NS_OK;                                                              \
00162   }
00163 %}

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