nsIServiceManager.idl 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* ***** BEGIN LICENSE BLOCK *****
  2. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3. *
  4. * The contents of this file are subject to the Mozilla Public License Version
  5. * 1.1 (the "License"); you may not use this file except in compliance with
  6. * the License. You may obtain a copy of the License at
  7. * http://www.mozilla.org/MPL/
  8. *
  9. * Software distributed under the License is distributed on an "AS IS" basis,
  10. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. * for the specific language governing rights and limitations under the
  12. * License.
  13. *
  14. * The Original Code is XPCOM.
  15. *
  16. * The Initial Developer of the Original Code is Netscape Communications.
  17. * Portions created by the Initial Developer are Copyright (C) 2001
  18. * the Initial Developer. All Rights Reserved.
  19. *
  20. * Contributor(s):
  21. *
  22. * Alternatively, the contents of this file may be used under the terms of
  23. * either the GNU General Public License Version 2 or later (the "GPL"), or
  24. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  25. * in which case the provisions of the GPL or the LGPL are applicable instead
  26. * of those above. If you wish to allow use of your version of this file only
  27. * under the terms of either the GPL or the LGPL, and not to allow others to
  28. * use your version of this file under the terms of the MPL, indicate your
  29. * decision by deleting the provisions above and replace them with the notice
  30. * and other provisions required by the GPL or the LGPL. If you do not delete
  31. * the provisions above, a recipient may use your version of this file under
  32. * the terms of any one of the MPL, the GPL or the LGPL.
  33. *
  34. * ***** END LICENSE BLOCK ***** */
  35. #include "nsISupports.idl"
  36. /**
  37. * The nsIServiceManager manager interface provides a means to obtain
  38. * global services in an application. The service manager depends on the
  39. * repository to find and instantiate factories to obtain services.
  40. *
  41. * Users of the service manager must first obtain a pointer to the global
  42. * service manager by calling NS_GetServiceManager. After that,
  43. * they can request specific services by calling GetService. When they are
  44. * finished they can NS_RELEASE() the service as usual.
  45. *
  46. * A user of a service may keep references to particular services indefinitely
  47. * and only must call Release when it shuts down.
  48. *
  49. * @status FROZEN
  50. */
  51. [scriptable, uuid(8bb35ed9-e332-462d-9155-4a002ab5c958)]
  52. interface nsIServiceManager : nsISupports
  53. {
  54. /**
  55. * getServiceByContractID
  56. *
  57. * Returns the instance that implements aClass or aContractID and the
  58. * interface aIID. This may result in the instance being created.
  59. *
  60. * @param aClass or aContractID : aClass or aContractID of object
  61. * instance requested
  62. * @param aIID : IID of interface requested
  63. * @param result : resulting service
  64. */
  65. void getService(in nsCIDRef aClass,
  66. in nsIIDRef aIID,
  67. [iid_is(aIID),retval] out nsQIResult result);
  68. void getServiceByContractID(in string aContractID,
  69. in nsIIDRef aIID,
  70. [iid_is(aIID),retval] out nsQIResult result);
  71. /**
  72. * isServiceInstantiated
  73. *
  74. * isServiceInstantiated will return a true if the service has already
  75. * been created, otherwise false
  76. *
  77. * @param aClass or aContractID : aClass or aContractID of object
  78. * instance requested
  79. * @param aIID : IID of interface requested
  80. * @param aIID : IID of interface requested
  81. */
  82. boolean isServiceInstantiated(in nsCIDRef aClass, in nsIIDRef aIID);
  83. boolean isServiceInstantiatedByContractID(in string aContractID, in nsIIDRef aIID);
  84. };
  85. %{C++
  86. #define NS_ERROR_SERVICE_NOT_AVAILABLE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_XPCOM, 22)
  87. /**
  88. * @status DEPRECATED
  89. */
  90. #define NS_ERROR_SERVICE_NOT_FOUND NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 22)
  91. /**
  92. * @status DEPRECATED
  93. */
  94. #define NS_ERROR_SERVICE_IN_USE NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_XPCOM, 23)
  95. // Observing xpcom autoregistration. Topics will be 'start' and 'stop'.
  96. #define NS_XPCOM_AUTOREGISTRATION_OBSERVER_ID "xpcom-autoregistration"
  97. #ifdef MOZILLA_INTERNAL_API
  98. #include "nsXPCOM.h"
  99. #include "nsServiceManagerUtils.h"
  100. #include "nsIServiceManagerObsolete.h"
  101. #endif
  102. %}