michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * The nsIServiceManager manager interface provides a means to obtain michael@0: * global services in an application. The service manager depends on the michael@0: * repository to find and instantiate factories to obtain services. michael@0: * michael@0: * Users of the service manager must first obtain a pointer to the global michael@0: * service manager by calling NS_GetServiceManager. After that, michael@0: * they can request specific services by calling GetService. When they are michael@0: * finished they can NS_RELEASE() the service as usual. michael@0: * michael@0: * A user of a service may keep references to particular services indefinitely michael@0: * and only must call Release when it shuts down. michael@0: */ michael@0: michael@0: [scriptable, uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)] michael@0: interface nsIServiceManager : nsISupports michael@0: { michael@0: /** michael@0: * getServiceByContractID michael@0: * michael@0: * Returns the instance that implements aClass or aContractID and the michael@0: * interface aIID. This may result in the instance being created. michael@0: * michael@0: * @param aClass or aContractID : aClass or aContractID of object michael@0: * instance requested michael@0: * @param aIID : IID of interface requested michael@0: * @param result : resulting service michael@0: */ michael@0: void getService(in nsCIDRef aClass, michael@0: in nsIIDRef aIID, michael@0: [iid_is(aIID),retval] out nsQIResult result); michael@0: michael@0: void getServiceByContractID(in string aContractID, michael@0: in nsIIDRef aIID, michael@0: [iid_is(aIID),retval] out nsQIResult result); michael@0: michael@0: /** michael@0: * isServiceInstantiated michael@0: * michael@0: * isServiceInstantiated will return a true if the service has already michael@0: * been created, or throw otherwise michael@0: * michael@0: * @param aClass or aContractID : aClass or aContractID of object michael@0: * instance requested michael@0: * @param aIID : IID of interface requested michael@0: * @throws NS_ERROR_SERVICE_NOT_AVAILABLE if the service hasn't been michael@0: * instantiated michael@0: * @throws NS_NOINTERFACE if the IID given isn't supported by the object michael@0: */ michael@0: boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID); michael@0: boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID); michael@0: }; michael@0: michael@0: michael@0: %{C++ michael@0: // Observing xpcom autoregistration. Topics will be 'start' and 'stop'. michael@0: #define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration" michael@0: michael@0: #ifdef MOZILLA_INTERNAL_API michael@0: #include "nsXPCOM.h" michael@0: #include "nsComponentManagerUtils.h" michael@0: #include "nsServiceManagerUtils.h" michael@0: #endif michael@0: %} michael@0: