sbIMediacoreFactory.idl
Go to the documentation of this file.
1 /*
2  //
3 // BEGIN SONGBIRD GPL
4 //
5 // This file is part of the Songbird web player.
6 //
7 // Copyright(c) 2005-2008 POTI, Inc.
8 // http://songbirdnest.com
9 //
10 // This file may be licensed under the terms of of the
11 // GNU General Public License Version 2 (the "GPL").
12 //
13 // Software distributed under the License is distributed
14 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
15 // express or implied. See the GPL for the specific language
16 // governing rights and limitations.
17 //
18 // You should have received a copy of the GPL along with this
19 // program. If not, go to http://www.gnu.org/licenses/gpl.html
20 // or write to the Free Software Foundation, Inc.,
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 //
23 // END SONGBIRD GPL
24 //
25  */
26 
27 #include "nsISupports.idl"
28 
29 interface sbIMediacore;
30 interface sbIMediacoreCapabilities;
31 
32 [scriptable, uuid(20a5b0ee-1869-4717-bbe4-c5d9db37c6fa)]
34 {
35  readonly attribute AString contractID;
36  readonly attribute AString name;
37 
39 
40  sbIMediacore create(in AString aInstanceName);
41 };
42 
43 %{C++
44 
45 #include <nsIComponentManager.h>
46 #include <nsICategoryManager.h>
47 #include <nsIGenericFactory.h>
48 #include <nsIServiceManager.h>
49 
50 #include <nsCOMPtr.h>
51 #include <nsServiceManagerUtils.h>
52 #include <nsStringGlue.h>
53 #include <nsXPCOMCID.h>
54 
55 class nsIFile;
56 struct nsModuleComponentInfo;
57 
58 #define SB_MEDIACORE_FACTORY_CATEGORY "songbird-mediacore-factory"
59 
81 #define SB_MEDIACORE_FACTORY_REGISTERSELF(_name) \
82  \
83  NS_METHOD _name##RegisterSelf(nsIComponentManager* aCompMgr, \
84  nsIFile* aPath, \
85  const char* registryLocation, \
86  const char* componentType, \
87  const nsModuleComponentInfo* info); \
88  \
89  NS_METHOD _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
90  nsIFile* aPath, \
91  const char* registryLocation, \
92  const nsModuleComponentInfo* info)
93 
97 #define SB_MEDIACORE_FACTORY_REGISTERSELF_IMPL(_name, _desc) \
98  \
99  NS_METHOD \
100  _name##RegisterSelf(nsIComponentManager* aCompMgr, \
101  nsIFile* aPath, \
102  const char* registryLocation, \
103  const char* componentType, \
104  const nsModuleComponentInfo* info) \
105  { \
106  nsresult rv; \
107  nsCOMPtr<nsICategoryManager> catMan = \
108  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
109  NS_ENSURE_SUCCESS(rv, rv); \
110  nsCAutoString prevEntry; \
111  rv = catMan->AddCategoryEntry(SB_MEDIACORE_FACTORY_CATEGORY, \
112  _desc, \
113  info->mContractID, \
114  PR_TRUE, PR_TRUE, \
115  getter_Copies(prevEntry)); \
116  NS_ENSURE_SUCCESS(rv, rv); \
117  NS_WARN_IF_FALSE(prevEntry.IsEmpty(), \
118  "Another controller was registered with that id!"); \
119  return NS_OK; \
120  } \
121  \
122  NS_METHOD \
123  _name##UnregisterSelf(nsIComponentManager* aCompMgr, \
124  nsIFile* aPath, \
125  const char* registryLocation, \
126  const nsModuleComponentInfo* info) \
127  { \
128  nsresult rv; \
129  nsCOMPtr<nsICategoryManager> catMan = \
130  do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv); \
131  NS_ENSURE_SUCCESS(rv, rv); \
132  rv = catMan->DeleteCategoryEntry(SB_MEDIACORE_FACTORY_CATEGORY, \
133  _desc, \
134  PR_TRUE); \
135  NS_ENSURE_SUCCESS(rv, rv); \
136  return NS_OK; \
137  }
138 %}
sbIMediacore create(in AString aInstanceName)
readonly attribute AString contractID
readonly attribute sbIMediacoreCapabilities capabilities
var uuid
function C(H)
readonly attribute AString name