nsIServiceManager.idl 2.5 KB

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