Bug 1910362 - Create new Nimbus helper r=aaronmt,ohorvath
[gecko.git] / xpcom / components / nsIServiceManager.idl
blobe327b49d793b3b0894e83772427e793144e826fc
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/. */
6 #include "nsISupports.idl"
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.
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.
18 * A user of a service may keep references to particular services indefinitely
19 * and only must call Release when it shuts down.
22 [builtinclass, scriptable, uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)]
23 interface nsIServiceManager : nsISupports
25 /**
26 * getServiceByContractID
28 * Returns the instance that implements aClass or aContractID and the
29 * interface aIID. This may result in the instance being created.
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
36 void getService(in nsCIDRef aClass,
37 in nsIIDRef aIID,
38 [iid_is(aIID),retval] out nsQIResult result);
40 void getServiceByContractID(in string aContractID,
41 in nsIIDRef aIID,
42 [iid_is(aIID),retval] out nsQIResult result);
44 /**
45 * isServiceInstantiated
47 * isServiceInstantiated will return a true if the service has already
48 * been created, or false otherwise. Throws if the service does not
49 * implement the given IID.
51 * @param aClass or aContractID : aClass or aContractID of object
52 * instance requested
53 * @param aIID : IID of interface requested
54 * @throws NS_NOINTERFACE if the IID given isn't supported by the object
56 boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID);
57 boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID);
61 %{C++
62 #ifdef MOZILLA_INTERNAL_API
63 #include "nsXPCOM.h"
64 #include "nsComponentManagerUtils.h"
65 #include "nsServiceManagerUtils.h"
66 #endif