1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
---|
2 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
3 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
4 | *
|
---|
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/
|
---|
9 | *
|
---|
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
|
---|
13 | * License.
|
---|
14 | *
|
---|
15 | * The Original Code is mozilla.org Code.
|
---|
16 | *
|
---|
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.
|
---|
21 | *
|
---|
22 | * Contributor(s):
|
---|
23 | *
|
---|
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.
|
---|
35 | *
|
---|
36 | * ***** END LICENSE BLOCK ***** */
|
---|
37 |
|
---|
38 | #include "nsISupports.idl"
|
---|
39 | #include "nsIFactory.idl"
|
---|
40 |
|
---|
41 | interface nsIFile;
|
---|
42 | interface nsIEnumerator;
|
---|
43 |
|
---|
44 | [scriptable, uuid(8458a740-d5dc-11d2-92fb-00e09805570f)]
|
---|
45 | interface nsIComponentManagerObsolete : nsISupports
|
---|
46 | {
|
---|
47 | /**
|
---|
48 | * findFactory
|
---|
49 | *
|
---|
50 | * Returns the factory object that can be used to create instances of
|
---|
51 | * CID aClass
|
---|
52 | *
|
---|
53 | * @param aClass The classid of the factory that is being requested
|
---|
54 | */
|
---|
55 | nsIFactory findFactory(in nsCIDRef aClass);
|
---|
56 |
|
---|
57 | /**
|
---|
58 | * getClassObject
|
---|
59 | *
|
---|
60 | * @param aClass : CID of the class whose class object is requested
|
---|
61 | * @param aIID : IID of an interface that the class object is known to
|
---|
62 | * to implement. nsISupports and nsIFactory are known to
|
---|
63 | * be implemented by the class object.
|
---|
64 | */
|
---|
65 | [noscript] voidPtr getClassObject(in nsCIDRef aClass, in nsIIDRef aIID);
|
---|
66 |
|
---|
67 | /**
|
---|
68 | * contractIDToClassID
|
---|
69 | *
|
---|
70 | * Get the ClassID for a given ContractID. Many ClassIDs may implement a
|
---|
71 | * ContractID. In such a situation, this returns the preferred ClassID, which
|
---|
72 | * happens to be the last registered ClassID.
|
---|
73 | *
|
---|
74 | * @param aContractID : Contractid for which ClassID is requested
|
---|
75 | * @return aClass : ClassID return
|
---|
76 | */
|
---|
77 | [notxpcom] nsresult contractIDToClassID(in string aContractID, out nsCID aClass);
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * classIDToContractid
|
---|
81 | *
|
---|
82 | * Get the ContractID for a given ClassID. A ClassIDs may implement multiple
|
---|
83 | * ContractIDs. This function return the last registered ContractID.
|
---|
84 | *
|
---|
85 | * @param aClass : ClassID for which ContractID is requested.
|
---|
86 | * @return aClassName : returns class name asssociated with aClass
|
---|
87 | * @return : ContractID last registered for aClass
|
---|
88 | */
|
---|
89 | string CLSIDToContractID(in nsCIDRef aClass, out string aClassName);
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * createInstance
|
---|
93 | *
|
---|
94 | * Create an instance of the CID aClass and return the interface aIID.
|
---|
95 | *
|
---|
96 | * @param aClass : ClassID of object instance requested
|
---|
97 | * @param aDelegate : Used for aggregation
|
---|
98 | * @param aIID : IID of interface requested
|
---|
99 | */
|
---|
100 | [noscript] voidPtr createInstance(in nsCIDRef aClass,
|
---|
101 | in nsISupports aDelegate,
|
---|
102 | in nsIIDRef aIID);
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * createInstanceByContractID
|
---|
106 | *
|
---|
107 | * Create an instance of the CID that implements aContractID and return the
|
---|
108 | * interface aIID. This is a convenience function that effectively does
|
---|
109 | * ContractIDToClassID() followed by CreateInstance().
|
---|
110 | *
|
---|
111 | * @param aContractID : aContractID of object instance requested
|
---|
112 | * @param aDelegate : Used for aggregation
|
---|
113 | * @param aIID : IID of interface requested
|
---|
114 | */
|
---|
115 | [noscript] voidPtr createInstanceByContractID(in string aContractID,
|
---|
116 | in nsISupports aDelegate,
|
---|
117 | in nsIIDRef IID);
|
---|
118 | /**
|
---|
119 | * registryLocationForSpec
|
---|
120 | *
|
---|
121 | * Given a file specification, return the registry representation of
|
---|
122 | * the filename. Files that are found relative to the components
|
---|
123 | * directory will have a registry representation
|
---|
124 | * "rel:<relative-native-path>" while filenames that are not, will have
|
---|
125 | * "abs:<full-native-path>".
|
---|
126 | */
|
---|
127 | string registryLocationForSpec(in nsIFile aSpec);
|
---|
128 |
|
---|
129 | /**
|
---|
130 | * specForRegistyLocation
|
---|
131 | *
|
---|
132 | * Create a file specification for the registry representation (rel:/abs:)
|
---|
133 | * got via registryLocationForSpec.
|
---|
134 | */
|
---|
135 | nsIFile specForRegistryLocation(in string aLocation);
|
---|
136 |
|
---|
137 | /**
|
---|
138 | * registerFactory
|
---|
139 | *
|
---|
140 | * Register a factory and ContractID associated with CID aClass
|
---|
141 | *
|
---|
142 | * @param aClass : CID of object
|
---|
143 | * @param aClassName : Class Name of CID
|
---|
144 | * @param aContractID : ContractID associated with CID aClass
|
---|
145 | * @param aFactory : Factory that will be registered for CID aClass
|
---|
146 | * @param aReplace : Boolean that indicates whether to replace a previous
|
---|
147 | * registration for the CID aClass.
|
---|
148 | */
|
---|
149 | void registerFactory(in nsCIDRef aClass, in string aClassName,
|
---|
150 | in string aContractID, in nsIFactory aFactory,
|
---|
151 | in boolean aReplace);
|
---|
152 |
|
---|
153 | /**
|
---|
154 | * registerComponent
|
---|
155 | *
|
---|
156 | * Register a native dll module via its registry representation as returned
|
---|
157 | * by registryLocationForSpec() as the container of CID implemenation
|
---|
158 | * aClass and associate aContractID and aClassName to the CID aClass. Native
|
---|
159 | * dll component type is assumed.
|
---|
160 | *
|
---|
161 | * @param aClass : CID implemenation contained in module
|
---|
162 | * @param aClassName : Class name associated with CID aClass
|
---|
163 | * @param aContractID : ContractID associated with CID aClass
|
---|
164 | * @param aLocation : Location of module (dll). Format of this is the
|
---|
165 | * registry representation as returned by
|
---|
166 | * registryLocationForSpec()
|
---|
167 | * @param aReplace : Boolean that indicates whether to replace a previous
|
---|
168 | * module registration for aClass.
|
---|
169 | * @param aPersist : Remember this registration across sessions.
|
---|
170 | */
|
---|
171 | void registerComponent(in nsCIDRef aClass, in string aClassName,
|
---|
172 | in string aContractID, in string aLocation,
|
---|
173 | in boolean aReplace, in boolean aPersist);
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * registerComponentWithType
|
---|
177 | *
|
---|
178 | * Register a module's location via its registry representation
|
---|
179 | * as returned by registryLocationForSpec() as the container of CID implemenation
|
---|
180 | * aClass of type aType and associate aContractID and aClassName to the CID aClass.
|
---|
181 | *
|
---|
182 | * @param aClass : CID implemenation contained in module
|
---|
183 | * @param aClassName : Class name associated with CID aClass
|
---|
184 | * @param aContractID : ContractID associated with CID aClass
|
---|
185 | * @param aSpec : Filename spec for module's location.
|
---|
186 | * @param aLocation : Location of module of type aType. Format of this string
|
---|
187 | * is the registry representation as returned by
|
---|
188 | * registryLocationForSpec()
|
---|
189 | * @param aReplace : Boolean that indicates whether to replace a previous
|
---|
190 | * loader registration for aClass.
|
---|
191 | * @param aPersist : Remember this registration across sessions.
|
---|
192 | * @param aType : Component Type of CID aClass.
|
---|
193 | */
|
---|
194 | void registerComponentWithType(in nsCIDRef aClass, in string aClassName,
|
---|
195 | in string aContractID, in nsIFile aSpec,
|
---|
196 | in string aLocation, in boolean aReplace,
|
---|
197 | in boolean aPersist, in string aType);
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * registerComponentSpec
|
---|
201 | *
|
---|
202 | * Register a native dll module via its file specification as the container
|
---|
203 | * of CID implemenation aClass and associate aContractID and aClassName to the
|
---|
204 | * CID aClass. Native dll component type is assumed.
|
---|
205 | *
|
---|
206 | * @param aClass : CID implemenation contained in module
|
---|
207 | * @param aClassName : Class name associated with CID aClass
|
---|
208 | * @param aContractID : ContractID associated with CID aClass
|
---|
209 | * @param aLibrary : File specification Location of module (dll).
|
---|
210 | * @param aReplace : Boolean that indicates whether to replace a previous
|
---|
211 | * module registration for aClass.
|
---|
212 | * @param aPersist : Remember this registration across sessions.
|
---|
213 | */
|
---|
214 | void registerComponentSpec(in nsCIDRef aClass, in string aClassName,
|
---|
215 | in string aContractID, in nsIFile aLibrary,
|
---|
216 | in boolean aReplace, in boolean aPersist);
|
---|
217 |
|
---|
218 | /**
|
---|
219 | * registerComponentLib
|
---|
220 | *
|
---|
221 | * Register a native dll module via its dll name (not full path) as the
|
---|
222 | * container of CID implemenation aClass and associate aContractID and aClassName
|
---|
223 | * to the CID aClass. Native dll component type is assumed and the system
|
---|
224 | * services will be used to load this dll.
|
---|
225 | *
|
---|
226 | * @param aClass : CID implemenation contained in module
|
---|
227 | * @param aClassName : Class name associated with CID aClass
|
---|
228 | * @param aContractID : ContractID associated with CID aClass
|
---|
229 | * @param aDllNameLocation : Dll name of module.
|
---|
230 | * @param aReplace : Boolean that indicates whether to replace a previous
|
---|
231 | * module registration for aClass.
|
---|
232 | * @param aPersist : Remember this registration across sessions.
|
---|
233 | */
|
---|
234 | void registerComponentLib(in nsCIDRef aClass, in string aClassName,
|
---|
235 | in string aContractID, in string aDllName,
|
---|
236 | in boolean aReplace, in boolean aPersist);
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * unregisterFactory
|
---|
240 | *
|
---|
241 | * Unregister a factory associated with CID aClass.
|
---|
242 | *
|
---|
243 | * @param aClass : ClassID being unregistered
|
---|
244 | * @param aFactory : Factory previously registered to create instances of
|
---|
245 | * ClassID aClass.
|
---|
246 | */
|
---|
247 | void unregisterFactory(in nsCIDRef aClass, in nsIFactory aFactory);
|
---|
248 |
|
---|
249 | /**
|
---|
250 | * unregisterComponent
|
---|
251 | *
|
---|
252 | * Disassociate module aLocation represented as registry location as returned
|
---|
253 | * by registryLocationForSpec() as containing ClassID aClass.
|
---|
254 | *
|
---|
255 | * @param aClass : ClassID being unregistered
|
---|
256 | * @param aLocation : Location of module. Format of this is the registry
|
---|
257 | * representation as returned by registryLocationForSpec().
|
---|
258 | * Components of any type will be unregistered.
|
---|
259 | */
|
---|
260 | void unregisterComponent(in nsCIDRef aClass, in string aLocation);
|
---|
261 |
|
---|
262 | /**
|
---|
263 | * unregisterComponentSpec
|
---|
264 | *
|
---|
265 | * Disassociate module references by file specification aLibrarySpec as
|
---|
266 | * containing ClassID aClass.
|
---|
267 | */
|
---|
268 | void unregisterComponentSpec(in nsCIDRef aClass, in nsIFile aLibrarySpec);
|
---|
269 |
|
---|
270 | /**
|
---|
271 | * freeLibraries
|
---|
272 | *
|
---|
273 | * Enumerates all loaded modules and unloads unused modules.
|
---|
274 | */
|
---|
275 | void freeLibraries();
|
---|
276 |
|
---|
277 | /**
|
---|
278 | * ID values for 'when'
|
---|
279 | */
|
---|
280 | const long NS_Startup = 0;
|
---|
281 | const long NS_Script = 1;
|
---|
282 | const long NS_Timer = 2;
|
---|
283 | const long NS_Shutdown = 3;
|
---|
284 |
|
---|
285 | /**
|
---|
286 | * autoRegister
|
---|
287 | *
|
---|
288 | * Enumerates directory looking for modules of all types and registers
|
---|
289 | * modules who have changed (modtime or size) since the last time
|
---|
290 | * autoRegister() was invoked.
|
---|
291 | *
|
---|
292 | * @param when : ID values of when the call is being made.
|
---|
293 | * @param directory : Directory the will be enumerated.
|
---|
294 | */
|
---|
295 | void autoRegister(in long when, in nsIFile directory);
|
---|
296 |
|
---|
297 | /**
|
---|
298 | * autoRegisterComponent
|
---|
299 | *
|
---|
300 | * Loads module using appropriate loader and gives it an opportunity to
|
---|
301 | * register its CIDs if module's modtime or size changed since the last
|
---|
302 | * time this was called.
|
---|
303 | *
|
---|
304 | * @param when : ID values of when the call is being made.
|
---|
305 | * @param aFileLocation : File specification of module.
|
---|
306 | */
|
---|
307 | void autoRegisterComponent(in long when, in nsIFile aFileLocation);
|
---|
308 |
|
---|
309 | /**
|
---|
310 | * autoUnregisterComponent
|
---|
311 | *
|
---|
312 | * Loads module using approriate loader and gives it an opportunity to
|
---|
313 | * unregister its CIDs
|
---|
314 | */
|
---|
315 | void autoUnregisterComponent(in long when, in nsIFile aFileLocation);
|
---|
316 |
|
---|
317 | /**
|
---|
318 | * isRegistered
|
---|
319 | *
|
---|
320 | * Returns true if a factory or module is registered for CID aClass.
|
---|
321 | *
|
---|
322 | * @param aClass : ClassID queried for registeration
|
---|
323 | * @return : true if a factory or module is registered for CID aClass.
|
---|
324 | * false otherwise.
|
---|
325 | */
|
---|
326 | boolean isRegistered(in nsCIDRef aClass);
|
---|
327 |
|
---|
328 | /**
|
---|
329 | * enumerateCLSIDs
|
---|
330 | *
|
---|
331 | * Enumerate the list of all registered ClassIDs.
|
---|
332 | *
|
---|
333 | * @return : enumerator for ClassIDs.
|
---|
334 | */
|
---|
335 | nsIEnumerator enumerateCLSIDs();
|
---|
336 |
|
---|
337 | /**
|
---|
338 | * enumerateContractIDs
|
---|
339 | *
|
---|
340 | * Enumerate the list of all registered ContractIDs.
|
---|
341 | *
|
---|
342 | * @return : enumerator for ContractIDs.
|
---|
343 | */
|
---|
344 | nsIEnumerator enumerateContractIDs();
|
---|
345 | };
|
---|
346 |
|
---|
347 | %{ C++
|
---|
348 | /* include after the class def'n, because it needs to see it. */
|
---|
349 | #include "nsComponentManagerUtils.h"
|
---|
350 | %} C++
|
---|
351 |
|
---|