PageRenderTime 35ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_sdk/idl/nsIURIContentListener.idl

http://firefox-mac-pdf.googlecode.com/
IDL | 167 lines | 19 code | 9 blank | 139 comment | 0 complexity | 57505a8cb1232ca4591f9188106abfde MD5 | raw file
  1. /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  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) 1999
  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. interface nsIRequest;
  39. interface nsIStreamListener;
  40. interface nsIURI;
  41. /**
  42. * nsIURIContentListener is an interface used by components which
  43. * want to know (and have a chance to handle) a particular content type.
  44. * Typical usage scenarios will include running applications which register
  45. * a nsIURIContentListener for each of its content windows with the uri
  46. * dispatcher service.
  47. *
  48. * @status FROZEN
  49. */
  50. [scriptable, uuid(94928AB3-8B63-11d3-989D-001083010E9B)]
  51. interface nsIURIContentListener : nsISupports
  52. {
  53. /**
  54. * Gives the original content listener first crack at stopping a load before
  55. * it happens.
  56. *
  57. * @param aURI URI that is being opened.
  58. *
  59. * @return <code>false</code> if the load can continue;
  60. * <code>true</code> if the open should be aborted.
  61. */
  62. boolean onStartURIOpen(in nsIURI aURI);
  63. /**
  64. * Notifies the content listener to hook up an nsIStreamListener capable of
  65. * consuming the data stream.
  66. *
  67. * @param aContentType Content type of the data.
  68. * @param aIsContentPreferred Indicates whether the content should be
  69. * preferred by this listener.
  70. * @param aRequest Request that is providing the data.
  71. * @param aContentHandler nsIStreamListener that will consume the data.
  72. * This should be set to <code>nsnull</code> if
  73. * this content listener can't handle the content
  74. * type.
  75. *
  76. * @return <code>true</code> if the consumer wants to
  77. * handle the load completely by itself. This
  78. * causes the URI Loader do nothing else...
  79. * <code>false</code> if the URI Loader should
  80. * continue handling the load and call the
  81. * returned streamlistener's methods.
  82. */
  83. boolean doContent(in string aContentType,
  84. in boolean aIsContentPreferred,
  85. in nsIRequest aRequest,
  86. out nsIStreamListener aContentHandler);
  87. /**
  88. * When given a uri to dispatch, if the URI is specified as 'preferred
  89. * content' then the uri loader tries to find a preferred content handler
  90. * for the content type. The thought is that many content listeners may
  91. * be able to handle the same content type if they have to. i.e. the mail
  92. * content window can handle text/html just like a browser window content
  93. * listener. However, if the user clicks on a link with text/html content,
  94. * then the browser window should handle that content and not the mail
  95. * window where the user may have clicked the link. This is the difference
  96. * between isPreferred and canHandleContent.
  97. *
  98. * @param aContentType Content type of the data.
  99. * @param aDesiredContentType Indicates that aContentType must be converted
  100. * to aDesiredContentType before processing the
  101. * data. This causes a stream converted to be
  102. * inserted into the nsIStreamListener chain.
  103. * This argument can be <code>nsnull</code> if
  104. * the content should be consumed directly as
  105. * aContentType.
  106. *
  107. * @return <code>true</code> if this is a preferred
  108. * content handler for aContentType;
  109. * <code>false<code> otherwise.
  110. */
  111. boolean isPreferred(in string aContentType, out string aDesiredContentType);
  112. /**
  113. * When given a uri to dispatch, if the URI is not specified as 'preferred
  114. * content' then the uri loader calls canHandleContent to see if the content
  115. * listener is capable of handling the content.
  116. *
  117. * @param aContentType Content type of the data.
  118. * @param aIsContentPreferred Indicates whether the content should be
  119. * preferred by this listener.
  120. * @param aDesiredContentType Indicates that aContentType must be converted
  121. * to aDesiredContentType before processing the
  122. * data. This causes a stream converted to be
  123. * inserted into the nsIStreamListener chain.
  124. * This argument can be <code>nsnull</code> if
  125. * the content should be consumed directly as
  126. * aContentType.
  127. *
  128. * @return <code>true</code> if the data can be consumed.
  129. * <code>false</code> otherwise.
  130. *
  131. * Note: I really envision canHandleContent as a method implemented
  132. * by the docshell as the implementation is generic to all doc
  133. * shells. The isPreferred decision is a decision made by a top level
  134. * application content listener that sits at the top of the docshell
  135. * hierarchy.
  136. */
  137. boolean canHandleContent(in string aContentType,
  138. in boolean aIsContentPreferred,
  139. out string aDesiredContentType);
  140. /**
  141. * The load context associated with a particular content listener.
  142. * The URI Loader stores and accesses this value as needed.
  143. */
  144. attribute nsISupports loadCookie;
  145. /**
  146. * The parent content listener if this particular listener is part of a chain
  147. * of content listeners (i.e. a docshell!)
  148. *
  149. * @note If this attribute is set to an object that implements
  150. * nsISupportsWeakReference, the implementation should get the
  151. * nsIWeakReference and hold that. Otherwise, the implementation
  152. * should not refcount this interface; it should assume that a non
  153. * null value is always valid. In that case, the caller is
  154. * responsible for explicitly setting this value back to null if the
  155. * parent content listener is destroyed.
  156. */
  157. attribute nsIURIContentListener parentContentListener;
  158. };