|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 |
|
8 /** |
|
9 * The nsIServiceManager manager interface provides a means to obtain |
|
10 * global services in an application. The service manager depends on the |
|
11 * repository to find and instantiate factories to obtain services. |
|
12 * |
|
13 * Users of the service manager must first obtain a pointer to the global |
|
14 * service manager by calling NS_GetServiceManager. After that, |
|
15 * they can request specific services by calling GetService. When they are |
|
16 * finished they can NS_RELEASE() the service as usual. |
|
17 * |
|
18 * A user of a service may keep references to particular services indefinitely |
|
19 * and only must call Release when it shuts down. |
|
20 */ |
|
21 |
|
22 [scriptable, uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)] |
|
23 interface nsIServiceManager : nsISupports |
|
24 { |
|
25 /** |
|
26 * getServiceByContractID |
|
27 * |
|
28 * Returns the instance that implements aClass or aContractID and the |
|
29 * interface aIID. This may result in the instance being created. |
|
30 * |
|
31 * @param aClass or aContractID : aClass or aContractID of object |
|
32 * instance requested |
|
33 * @param aIID : IID of interface requested |
|
34 * @param result : resulting service |
|
35 */ |
|
36 void getService(in nsCIDRef aClass, |
|
37 in nsIIDRef aIID, |
|
38 [iid_is(aIID),retval] out nsQIResult result); |
|
39 |
|
40 void getServiceByContractID(in string aContractID, |
|
41 in nsIIDRef aIID, |
|
42 [iid_is(aIID),retval] out nsQIResult result); |
|
43 |
|
44 /** |
|
45 * isServiceInstantiated |
|
46 * |
|
47 * isServiceInstantiated will return a true if the service has already |
|
48 * been created, or throw otherwise |
|
49 * |
|
50 * @param aClass or aContractID : aClass or aContractID of object |
|
51 * instance requested |
|
52 * @param aIID : IID of interface requested |
|
53 * @throws NS_ERROR_SERVICE_NOT_AVAILABLE if the service hasn't been |
|
54 * instantiated |
|
55 * @throws NS_NOINTERFACE if the IID given isn't supported by the object |
|
56 */ |
|
57 boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID); |
|
58 boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID); |
|
59 }; |
|
60 |
|
61 |
|
62 %{C++ |
|
63 // Observing xpcom autoregistration. Topics will be 'start' and 'stop'. |
|
64 #define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration" |
|
65 |
|
66 #ifdef MOZILLA_INTERNAL_API |
|
67 #include "nsXPCOM.h" |
|
68 #include "nsComponentManagerUtils.h" |
|
69 #include "nsServiceManagerUtils.h" |
|
70 #endif |
|
71 %} |
|
72 |