1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/components/nsIServiceManager.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +/** 1.12 + * The nsIServiceManager manager interface provides a means to obtain 1.13 + * global services in an application. The service manager depends on the 1.14 + * repository to find and instantiate factories to obtain services. 1.15 + * 1.16 + * Users of the service manager must first obtain a pointer to the global 1.17 + * service manager by calling NS_GetServiceManager. After that, 1.18 + * they can request specific services by calling GetService. When they are 1.19 + * finished they can NS_RELEASE() the service as usual. 1.20 + * 1.21 + * A user of a service may keep references to particular services indefinitely 1.22 + * and only must call Release when it shuts down. 1.23 + */ 1.24 + 1.25 +[scriptable, uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)] 1.26 +interface nsIServiceManager : nsISupports 1.27 +{ 1.28 + /** 1.29 + * getServiceByContractID 1.30 + * 1.31 + * Returns the instance that implements aClass or aContractID and the 1.32 + * interface aIID. This may result in the instance being created. 1.33 + * 1.34 + * @param aClass or aContractID : aClass or aContractID of object 1.35 + * instance requested 1.36 + * @param aIID : IID of interface requested 1.37 + * @param result : resulting service 1.38 + */ 1.39 + void getService(in nsCIDRef aClass, 1.40 + in nsIIDRef aIID, 1.41 + [iid_is(aIID),retval] out nsQIResult result); 1.42 + 1.43 + void getServiceByContractID(in string aContractID, 1.44 + in nsIIDRef aIID, 1.45 + [iid_is(aIID),retval] out nsQIResult result); 1.46 + 1.47 + /** 1.48 + * isServiceInstantiated 1.49 + * 1.50 + * isServiceInstantiated will return a true if the service has already 1.51 + * been created, or throw otherwise 1.52 + * 1.53 + * @param aClass or aContractID : aClass or aContractID of object 1.54 + * instance requested 1.55 + * @param aIID : IID of interface requested 1.56 + * @throws NS_ERROR_SERVICE_NOT_AVAILABLE if the service hasn't been 1.57 + * instantiated 1.58 + * @throws NS_NOINTERFACE if the IID given isn't supported by the object 1.59 + */ 1.60 + boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID); 1.61 + boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID); 1.62 +}; 1.63 + 1.64 + 1.65 +%{C++ 1.66 +// Observing xpcom autoregistration. Topics will be 'start' and 'stop'. 1.67 +#define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration" 1.68 + 1.69 +#ifdef MOZILLA_INTERNAL_API 1.70 +#include "nsXPCOM.h" 1.71 +#include "nsComponentManagerUtils.h" 1.72 +#include "nsServiceManagerUtils.h" 1.73 +#endif 1.74 +%} 1.75 +