nsIDirectoryService.idl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is mozilla.org code.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * Netscape Communications Corporation.
  19. * Portions created by the Initial Developer are Copyright (C) 1998
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s):
  23. *
  24. * Alternatively, the contents of this file may be used under the terms of
  25. * either of the GNU General Public License Version 2 or later (the "GPL"),
  26. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  27. * in which case the provisions of the GPL or the LGPL are applicable instead
  28. * of those above. If you wish to allow use of your version of this file only
  29. * under the terms of either the GPL or the LGPL, and not to allow others to
  30. * use your version of this file under the terms of the MPL, indicate your
  31. * decision by deleting the provisions above and replace them with the notice
  32. * and other provisions required by the GPL or the LGPL. If you do not delete
  33. * the provisions above, a recipient may use your version of this file under
  34. * the terms of any one of the MPL, the GPL or the LGPL.
  35. *
  36. * ***** END LICENSE BLOCK ***** */
  37. #include "nsISupports.idl"
  38. #include "nsIFile.idl"
  39. /**
  40. * nsIDirectoryServiceProvider
  41. *
  42. * Used by Directory Service to get file locations.
  43. *
  44. * @status FROZEN
  45. */
  46. [scriptable, uuid(bbf8cab0-d43a-11d3-8cc2-00609792278c)]
  47. interface nsIDirectoryServiceProvider: nsISupports
  48. {
  49. /**
  50. * getFile
  51. *
  52. * Directory Service calls this when it gets the first request for
  53. * a prop or on every request if the prop is not persistent.
  54. *
  55. * @param prop The symbolic name of the file.
  56. * @param persistent TRUE - The returned file will be cached by Directory
  57. * Service. Subsequent requests for this prop will
  58. * bypass the provider and use the cache.
  59. * FALSE - The provider will be asked for this prop
  60. * each time it is requested.
  61. *
  62. * @return The file represented by the property.
  63. *
  64. */
  65. nsIFile getFile(in string prop, out PRBool persistent);
  66. };
  67. /**
  68. * nsIDirectoryServiceProvider2
  69. *
  70. * An extension of nsIDirectoryServiceProvider which allows
  71. * multiple files to be returned for the given key.
  72. *
  73. * @status FROZEN
  74. */
  75. [scriptable, uuid(2f977d4b-5485-11d4-87e2-0010a4e75ef2)]
  76. interface nsIDirectoryServiceProvider2: nsIDirectoryServiceProvider
  77. {
  78. /**
  79. * getFiles
  80. *
  81. * Directory Service calls this when it gets a request for
  82. * a prop and the requested type is nsISimpleEnumerator.
  83. *
  84. * @param prop The symbolic name of the file list.
  85. *
  86. * @return An enumerator for a list of file locations.
  87. * The elements in the enumeration are nsIFile
  88. * @returnCode NS_SUCCESS_AGGREGATE_RESULT if this result should be
  89. * aggregated with other "lower" providers.
  90. */
  91. nsISimpleEnumerator getFiles(in string prop);
  92. };
  93. /**
  94. * nsIDirectoryService
  95. *
  96. * @status FROZEN
  97. */
  98. [scriptable, uuid(57a66a60-d43a-11d3-8cc2-00609792278c)]
  99. interface nsIDirectoryService: nsISupports
  100. {
  101. /**
  102. * init
  103. *
  104. * Must be called. Used internally by XPCOM initialization.
  105. *
  106. */
  107. void init();
  108. /**
  109. * registerProvider
  110. *
  111. * Register a provider with the service.
  112. *
  113. * @param prov The service will keep a strong reference
  114. * to this object. It will be released when
  115. * the service is released.
  116. *
  117. */
  118. void registerProvider(in nsIDirectoryServiceProvider prov);
  119. /**
  120. * unregisterProvider
  121. *
  122. * Unregister a provider with the service.
  123. *
  124. * @param prov
  125. *
  126. */
  127. void unregisterProvider(in nsIDirectoryServiceProvider prov);
  128. };