2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Mozilla Public License Version
6
* 1.1 (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/MPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is XPCOM.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998
20
* the Initial Developer. All Rights Reserved.
24
* Alternatively, the contents of this file may be used under the terms of
25
* either of the GNU General Public License Version 2 or later (the "GPL"),
26
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27
* in which case the provisions of the GPL or the LGPL are applicable instead
28
* of those above. If you wish to allow use of your version of this file only
29
* under the terms of either the GPL or the LGPL, and not to allow others to
30
* use your version of this file under the terms of the MPL, indicate your
31
* decision by deleting the provisions above and replace them with the notice
32
* and other provisions required by the GPL or the LGPL. If you do not delete
33
* the provisions above, a recipient may use your version of this file under
34
* the terms of any one of the MPL, the GPL or the LGPL.
36
* ***** END LICENSE BLOCK ***** */
38
////////////////////////////////////////////////////////////////////////////////
39
// Global Static Component Manager Methods
40
// (for when you need to link with xpcom)
42
#include "nsIComponentManagerObsolete.h"
43
#include "nsComponentManagerObsolete.h"
47
nsComponentManager::Initialize(void)
53
nsComponentManager::FindFactory(const nsCID &aClass,
54
nsIFactory **aFactory)
56
nsIComponentManagerObsolete* cm;
57
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
58
if (NS_FAILED(rv)) return rv;
59
return cm->FindFactory(aClass, aFactory);
63
nsComponentManager::GetClassObject(const nsCID &aClass, const nsIID &aIID,
66
nsIComponentManagerObsolete* cm;
67
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
68
if (NS_FAILED(rv)) return rv;
69
return cm->GetClassObject(aClass, aIID, aResult);
73
nsComponentManager::ContractIDToClassID(const char *aContractID,
76
nsIComponentManagerObsolete* cm;
77
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
78
if (NS_FAILED(rv)) return rv;
79
return cm->ContractIDToClassID(aContractID, aClass);
83
nsComponentManager::CLSIDToContractID(nsCID *aClass,
87
nsIComponentManagerObsolete* cm;
88
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
89
if (NS_FAILED(rv)) return rv;
90
return cm->CLSIDToContractID(*aClass, aClassName, aContractID);
94
nsComponentManager::CreateInstance(const nsCID &aClass,
95
nsISupports *aDelegate,
99
nsIComponentManagerObsolete* cm;
100
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
101
if (NS_FAILED(rv)) return rv;
102
return cm->CreateInstance(aClass, aDelegate, aIID, aResult);
106
nsComponentManager::CreateInstance(const char *aContractID,
107
nsISupports *aDelegate,
111
nsIComponentManagerObsolete* cm;
112
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
113
if (NS_FAILED(rv)) return rv;
114
return cm->CreateInstanceByContractID(aContractID, aDelegate, aIID, aResult);
118
nsComponentManager::RegisterFactory(const nsCID &aClass,
119
const char *aClassName,
120
const char *aContractID,
121
nsIFactory *aFactory,
124
nsIComponentManagerObsolete* cm;
125
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
126
if (NS_FAILED(rv)) return rv;
127
return cm->RegisterFactory(aClass, aClassName, aContractID,
132
nsComponentManager::RegisterComponent(const nsCID &aClass,
133
const char *aClassName,
134
const char *aContractID,
135
const char *aLibraryPersistentDescriptor,
139
nsIComponentManagerObsolete* cm;
140
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
141
if (NS_FAILED(rv)) return rv;
142
return cm->RegisterComponent(aClass, aClassName, aContractID,
143
aLibraryPersistentDescriptor, aReplace, aPersist);
147
nsComponentManager::RegisterComponentSpec(const nsCID &aClass,
148
const char *aClassName,
149
const char *aContractID,
154
nsIComponentManagerObsolete* cm;
155
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
156
if (NS_FAILED(rv)) return rv;
157
return cm->RegisterComponentSpec(aClass, aClassName, aContractID,
158
aLibrary, aReplace, aPersist);
162
nsComponentManager::RegisterComponentLib(const nsCID &aClass,
163
const char *aClassName,
164
const char *aContractID,
165
const char *adllName,
169
nsIComponentManagerObsolete* cm;
170
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
171
if (NS_FAILED(rv)) return rv;
172
return cm->RegisterComponentLib(aClass, aClassName, aContractID,
173
adllName, aReplace, aPersist);
177
nsComponentManager::UnregisterFactory(const nsCID &aClass,
178
nsIFactory *aFactory)
180
nsIComponentManagerObsolete* cm;
181
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
182
if (NS_FAILED(rv)) return rv;
183
return cm->UnregisterFactory(aClass, aFactory);
187
nsComponentManager::UnregisterComponent(const nsCID &aClass,
188
const char *aLibrary)
190
nsIComponentManagerObsolete* cm;
191
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
192
if (NS_FAILED(rv)) return rv;
193
return cm->UnregisterComponent(aClass, aLibrary);
197
nsComponentManager::UnregisterComponentSpec(const nsCID &aClass,
198
nsIFile *aLibrarySpec)
200
nsIComponentManagerObsolete* cm;
201
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
202
if (NS_FAILED(rv)) return rv;
203
return cm->UnregisterComponentSpec(aClass, aLibrarySpec);
207
nsComponentManager::FreeLibraries(void)
209
nsIComponentManagerObsolete* cm;
210
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
211
if (NS_FAILED(rv)) return rv;
212
return cm->FreeLibraries();
216
nsComponentManager::AutoRegister(PRInt32 when, nsIFile *directory)
218
nsIComponentManagerObsolete* cm;
219
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
220
if (NS_FAILED(rv)) return rv;
221
return cm->AutoRegister(when, directory);
225
nsComponentManager::AutoRegisterComponent(PRInt32 when,
228
nsIComponentManagerObsolete* cm;
229
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
230
if (NS_FAILED(rv)) return rv;
231
return cm->AutoRegisterComponent(when, fullname);
235
nsComponentManager::AutoUnregisterComponent(PRInt32 when,
238
nsIComponentManagerObsolete* cm;
239
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
240
if (NS_FAILED(rv)) return rv;
241
return cm->AutoUnregisterComponent(when, fullname);
245
nsComponentManager::IsRegistered(const nsCID &aClass,
248
nsIComponentManagerObsolete* cm;
249
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
250
if (NS_FAILED(rv)) return rv;
251
return cm->IsRegistered(aClass, aRegistered);
255
nsComponentManager::EnumerateCLSIDs(nsIEnumerator** aEnumerator)
257
nsIComponentManagerObsolete* cm;
258
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
259
if (NS_FAILED(rv)) return rv;
260
return cm->EnumerateCLSIDs(aEnumerator);
264
nsComponentManager::EnumerateContractIDs(nsIEnumerator** aEnumerator)
266
nsIComponentManagerObsolete* cm;
267
nsresult rv = NS_GetGlobalComponentManager((nsIComponentManager**)&cm);
268
if (NS_FAILED(rv)) return rv;
269
return cm->EnumerateContractIDs(aEnumerator);