1 | /* ***** BEGIN LICENSE BLOCK *****
|
---|
2 | * Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
---|
3 | *
|
---|
4 | * The contents of this file are subject to the Mozilla Public License Version
|
---|
5 | * 1.1 (the "License"); you may not use this file except in compliance with
|
---|
6 | * the License. You may obtain a copy of the License at
|
---|
7 | * http://www.mozilla.org/MPL/
|
---|
8 | *
|
---|
9 | * Software distributed under the License is distributed on an "AS IS" basis,
|
---|
10 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
---|
11 | * for the specific language governing rights and limitations under the
|
---|
12 | * License.
|
---|
13 | *
|
---|
14 | * The Original Code is XPCOM.
|
---|
15 | *
|
---|
16 | * The Initial Developer of the Original Code is Netscape Communications.
|
---|
17 | * Portions created by the Initial Developer are Copyright (C) 2001
|
---|
18 | * the Initial Developer. All Rights Reserved.
|
---|
19 | *
|
---|
20 | * Contributor(s):
|
---|
21 | *
|
---|
22 | * Alternatively, the contents of this file may be used under the terms of
|
---|
23 | * either the GNU General Public License Version 2 or later (the "GPL"), or
|
---|
24 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
---|
25 | * in which case the provisions of the GPL or the LGPL are applicable instead
|
---|
26 | * of those above. If you wish to allow use of your version of this file only
|
---|
27 | * under the terms of either the GPL or the LGPL, and not to allow others to
|
---|
28 | * use your version of this file under the terms of the MPL, indicate your
|
---|
29 | * decision by deleting the provisions above and replace them with the notice
|
---|
30 | * and other provisions required by the GPL or the LGPL. If you do not delete
|
---|
31 | * the provisions above, a recipient may use your version of this file under
|
---|
32 | * the terms of any one of the MPL, the GPL or the LGPL.
|
---|
33 | *
|
---|
34 | * ***** END LICENSE BLOCK ***** */
|
---|
35 |
|
---|
36 | /**
|
---|
37 | * The nsIComponentRegistrar interface.
|
---|
38 | * @status FROZEN
|
---|
39 | */
|
---|
40 |
|
---|
41 | #include "nsISupports.idl"
|
---|
42 |
|
---|
43 | interface nsIFile;
|
---|
44 | interface nsIFactory;
|
---|
45 | interface nsISimpleEnumerator;
|
---|
46 |
|
---|
47 | [scriptable, uuid(2417cbfe-65ad-48a6-b4b6-eb84db174392)]
|
---|
48 | interface nsIComponentRegistrar : nsISupports
|
---|
49 | {
|
---|
50 | /**
|
---|
51 | * autoRegister
|
---|
52 | *
|
---|
53 | * Register a component file or all component files in a directory.
|
---|
54 | *
|
---|
55 | * Component files must have an associated loader and export the required
|
---|
56 | * symbols which this loader defines. For example, if the given file is a
|
---|
57 | * native library (which is built into XPCOM), it must export the symbol
|
---|
58 | * "NSGetModule". Other loaders may have different semantics.
|
---|
59 | *
|
---|
60 | * This method may only be called from the main thread.
|
---|
61 | *
|
---|
62 | * @param aSpec : Filename spec for component file's location. If aSpec
|
---|
63 | * is a directory, then every component file in the
|
---|
64 | * directory will be registered.
|
---|
65 | * If the aSpec is null, then the application component's
|
---|
66 | * directory as defined by NS_XPCOM_COMPONENT_DIR will be
|
---|
67 | * registered (see nsIDirectoryService.idl)
|
---|
68 | *
|
---|
69 | * @return NS_OK : Registration was successful.
|
---|
70 | * NS_ERROR: Method failure.
|
---|
71 | */
|
---|
72 | void autoRegister(in nsIFile aSpec);
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * autoUnregister
|
---|
76 | *
|
---|
77 | * Unregister a component file or all component files in a directory.
|
---|
78 | * This method may only be called from the main thread.
|
---|
79 | *
|
---|
80 | * @param aSpec : Filename spec for component file's location. If aSpec
|
---|
81 | * is a directory, the every component file in the directory
|
---|
82 | * will be registered.
|
---|
83 | * If aSpec is null, then the application component's
|
---|
84 | * directory as defined by NS_XPCOM_COMPONENT_DIR will be
|
---|
85 | * registered. (see nsIDirectoryService.idl)
|
---|
86 | *
|
---|
87 | * @return NS_OK Unregistration was successful.
|
---|
88 | * NS_ERROR* Method failure.
|
---|
89 | */
|
---|
90 | void autoUnregister(in nsIFile aSpec);
|
---|
91 |
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * registerFactory
|
---|
95 | *
|
---|
96 | * Register a factory with a given ContractID, CID and Class Name.
|
---|
97 | *
|
---|
98 | * @param aClass : CID of object
|
---|
99 | * @param aClassName : Class Name of CID
|
---|
100 | * @param aContractID : ContractID associated with CID aClass
|
---|
101 | * @param aFactory : Factory that will be registered for CID aClass
|
---|
102 | *
|
---|
103 | * @return NS_OK Registration was successful.
|
---|
104 | * NS_ERROR* method failure.
|
---|
105 | */
|
---|
106 | void registerFactory(in nsCIDRef aClass,
|
---|
107 | in string aClassName,
|
---|
108 | in string aContractID,
|
---|
109 | in nsIFactory aFactory);
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * unregisterFactory
|
---|
113 | *
|
---|
114 | * Unregister a factory associated with CID aClass.
|
---|
115 | *
|
---|
116 | * @param aClass : CID being unregistered
|
---|
117 | * @param aFactory : Factory previously registered to create instances of
|
---|
118 | * CID aClass.
|
---|
119 | *
|
---|
120 | * @return NS_OK Unregistration was successful.
|
---|
121 | * NS_ERROR* Method failure.
|
---|
122 | */
|
---|
123 | void unregisterFactory(in nsCIDRef aClass,
|
---|
124 | in nsIFactory aFactory);
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * registerFactoryLocation
|
---|
128 | *
|
---|
129 | * Register a factory with a given ContractID, CID and Class Name
|
---|
130 | *
|
---|
131 | * @param aClass : CID of object
|
---|
132 | * @param aClassName : Class Name of CID
|
---|
133 | * @param aContractID : ContractID associated with CID aClass
|
---|
134 | * @param aFile : Component File. This file must have an associated
|
---|
135 | * loader and export the required symbols which this
|
---|
136 | * loader specifies.
|
---|
137 | * @param aLoaderStr : Opaque loader specific string. This value is
|
---|
138 | * passed into the nsIModule's registerSelf
|
---|
139 | * callback and must be fowarded unmodified when
|
---|
140 | * registering factories via their location.
|
---|
141 | * @param aType : Component Type of CID aClass. This value is
|
---|
142 | * passed into the nsIModule's registerSelf
|
---|
143 | * callback and must be fowarded unmodified when
|
---|
144 | * registering factories via their location.
|
---|
145 | *
|
---|
146 | * @return NS_OK Registration was successful.
|
---|
147 | * NS_ERROR* Method failure.
|
---|
148 | */
|
---|
149 | void registerFactoryLocation(in nsCIDRef aClass,
|
---|
150 | in string aClassName,
|
---|
151 | in string aContractID,
|
---|
152 | in nsIFile aFile,
|
---|
153 | in string aLoaderStr,
|
---|
154 | in string aType);
|
---|
155 |
|
---|
156 | /**
|
---|
157 | * unregisterFactoryLocation
|
---|
158 | *
|
---|
159 | * Unregister a factory associated with CID aClass.
|
---|
160 | *
|
---|
161 | * @param aClass : CID being unregistered
|
---|
162 | * @param aFile : Component File previously registered
|
---|
163 | *
|
---|
164 | * @return NS_OK Unregistration was successful.
|
---|
165 | * NS_ERROR* Method failure.
|
---|
166 | */
|
---|
167 | void unregisterFactoryLocation(in nsCIDRef aClass,
|
---|
168 | in nsIFile aFile);
|
---|
169 |
|
---|
170 | /**
|
---|
171 | * isCIDRegistered
|
---|
172 | *
|
---|
173 | * Returns true if a factory is registered for the CID.
|
---|
174 | *
|
---|
175 | * @param aClass : CID queried for registeration
|
---|
176 | * @return : true if a factory is registered for CID
|
---|
177 | * false otherwise.
|
---|
178 | */
|
---|
179 | boolean isCIDRegistered(in nsCIDRef aClass);
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * isContractIDRegistered
|
---|
183 | *
|
---|
184 | * Returns true if a factory is registered for the contract id.
|
---|
185 | *
|
---|
186 | * @param aClass : contract id queried for registeration
|
---|
187 | * @return : true if a factory is registered for contract id
|
---|
188 | * false otherwise.
|
---|
189 | */
|
---|
190 | boolean isContractIDRegistered(in string aContractID);
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * enumerateCIDs
|
---|
194 | *
|
---|
195 | * Enumerate the list of all registered CIDs.
|
---|
196 | *
|
---|
197 | * @return : enumerator for CIDs. Elements of the enumeration can be QI'ed
|
---|
198 | * for the nsISupportsID interface. From the nsISupportsID, you
|
---|
199 | * can obtain the actual CID.
|
---|
200 | */
|
---|
201 | nsISimpleEnumerator enumerateCIDs();
|
---|
202 |
|
---|
203 | /**
|
---|
204 | * enumerateContractIDs
|
---|
205 | *
|
---|
206 | * Enumerate the list of all registered ContractIDs.
|
---|
207 | *
|
---|
208 | * @return : enumerator for ContractIDs. Elements of the enumeration can be
|
---|
209 | * QI'ed for the nsISupportsCString interface. From the
|
---|
210 | * nsISupportsCString interface, you can obtain the actual
|
---|
211 | * Contract ID string.
|
---|
212 | */
|
---|
213 | nsISimpleEnumerator enumerateContractIDs();
|
---|
214 |
|
---|
215 | /**
|
---|
216 | * CIDToContractID
|
---|
217 | *
|
---|
218 | * Returns the Contract ID for a given CID, if one exists and is registered.
|
---|
219 | *
|
---|
220 | * @return : Contract ID.
|
---|
221 | */
|
---|
222 | string CIDToContractID(in nsCIDRef aClass);
|
---|
223 |
|
---|
224 | /**
|
---|
225 | * contractIDToCID
|
---|
226 | *
|
---|
227 | * Returns the CID for a given Contract ID, if one exists and is registered.
|
---|
228 | *
|
---|
229 | * @return : Contract ID.
|
---|
230 | */
|
---|
231 | nsCIDPtr contractIDToCID(in string aContractID);
|
---|
232 |
|
---|
233 | };
|
---|
234 |
|
---|
235 |
|
---|
236 |
|
---|
237 |
|
---|
238 |
|
---|
239 |
|
---|
240 |
|
---|
241 |
|
---|
242 |
|
---|
243 |
|
---|