IWebDataSource.idl 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. /*
  2. * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
  14. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
  17. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  18. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  19. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  20. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  21. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  23. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef DO_NO_IMPORTS
  26. import "oaidl.idl";
  27. import "ocidl.idl";
  28. import "IWebMutableURLRequest.idl";
  29. import "IWebURLResponse.idl";
  30. import "IWebResource.idl";
  31. import "IWebArchive.idl";
  32. import "IWebDocument.idl";
  33. import "IWebFrame.idl";
  34. #endif
  35. interface IWebMutableURLRequest;
  36. interface IWebURLConnection;
  37. interface IWebURLRequest;
  38. interface IWebURLResponse;
  39. interface IWebArchive;
  40. interface IWebDataSourcePrivate;
  41. interface IWebError;
  42. interface IWebFrame;
  43. interface IWebResource;
  44. interface IWebDocumentRepresentation;
  45. /*!
  46. @class WebDataSource
  47. @discussion A WebDataSource represents the data associated with a web page.
  48. A datasource has a WebDocumentRepresentation which holds an appropriate
  49. representation of the data. WebDataSources manage a hierarchy of WebFrames.
  50. WebDataSources are typically related to a view by their containing WebFrame.
  51. */
  52. [
  53. object,
  54. oleautomation,
  55. uuid(5221A975-AE09-4a7b-A4DF-E3B1B5F38A21),
  56. pointer_default(unique)
  57. ]
  58. interface IWebDataSource : IUnknown
  59. {
  60. /*!
  61. @method initWithRequest:
  62. @abstract The designated initializer for WebDataSource.
  63. @param request The request to use in creating a datasource.
  64. @result Returns an initialized WebDataSource.
  65. - (id)initWithRequest:(NSURLRequest *)request;
  66. */
  67. HRESULT initWithRequest([in] IWebURLRequest* request);
  68. /*!
  69. @method data
  70. @discussion The data will be incomplete until the datasource has completely loaded.
  71. @result Returns the raw data associated with the datasource. Returns nil
  72. if the datasource hasn't loaded any data.
  73. - (NSData *)data;
  74. */
  75. HRESULT data([out, retval] IStream** stream);
  76. /*!
  77. @method representation
  78. @discussion A representation holds a type specific representation
  79. of the datasource's data. The representation class is determined by mapping
  80. a MIME type to a class. The representation is created once the MIME type
  81. of the datasource content has been determined.
  82. @result Returns the representation associated with this datasource.
  83. Returns nil if the datasource hasn't created it's representation.
  84. - (id <WebDocumentRepresentation>)representation;
  85. */
  86. HRESULT representation([out, retval] IWebDocumentRepresentation** rep);
  87. /*!
  88. @method webFrame
  89. @result Return the frame that represents this data source.
  90. - (WebFrame *)webFrame;
  91. */
  92. HRESULT webFrame([out, retval] IWebFrame** frame);
  93. /*!
  94. @method initialRequest
  95. @result Returns a reference to the original request that created the
  96. datasource. This request will be unmodified by WebKit.
  97. - (NSURLRequest *)initialRequest;
  98. */
  99. HRESULT initialRequest([out, retval] IWebURLRequest** request);
  100. /*!
  101. @method request
  102. @result Returns the request that was used to create this datasource.
  103. - (NSMutableURLRequest *)request;
  104. */
  105. HRESULT request([out, retval] IWebMutableURLRequest** request);
  106. /*!
  107. @method response
  108. @result returns the WebResourceResponse for the data source.
  109. - (NSURLResponse *)response;
  110. */
  111. HRESULT response([out, retval] IWebURLResponse** response);
  112. /*!
  113. @method textEncodingName
  114. @result Returns either the override encoding, as set on the WebView for this
  115. dataSource or the encoding from the response.
  116. - (NSString *)textEncodingName;
  117. */
  118. HRESULT textEncodingName([out, retval] BSTR* name);
  119. /*!
  120. @method isLoading
  121. @discussion Returns YES if there are any pending loads.
  122. - (BOOL)isLoading;
  123. */
  124. HRESULT isLoading([out, retval] BOOL* loading);
  125. /*!
  126. @method pageTitle
  127. @result Returns nil or the page title.
  128. - (NSString *)pageTitle;
  129. */
  130. HRESULT pageTitle([out, retval] BSTR* title);
  131. /*!
  132. @method unreachableURL
  133. @discussion This will be non-nil only for dataSources created by calls to the
  134. WebFrame method loadAlternateHTMLString:baseURL:forUnreachableURL:.
  135. @result returns the unreachableURL for which this dataSource is showing alternate content, or nil
  136. - (NSURL *)unreachableURL;
  137. */
  138. HRESULT unreachableURL([out, retval] BSTR* url);
  139. /*!
  140. @method webArchive
  141. @result A WebArchive representing the data source, its subresources and child frames.
  142. @description This method constructs a WebArchive using the original downloaded data.
  143. In the case of HTML, if the current state of the document is preferred, webArchive should be
  144. called on the DOM document instead.
  145. - (WebArchive *)webArchive;
  146. */
  147. HRESULT webArchive([out, retval] IWebArchive** archive);
  148. /*!
  149. @method mainResource
  150. @result A WebResource representing the data source.
  151. @description This method constructs a WebResource using the original downloaded data.
  152. This method can be used to construct a WebArchive in case the archive returned by
  153. WebDataSource's webArchive isn't sufficient.
  154. - (WebResource *)mainResource;
  155. */
  156. HRESULT mainResource([out, retval] IWebResource** resource);
  157. /*!
  158. @method subresources
  159. @abstract Returns all the subresources associated with the data source.
  160. @description The returned array only contains subresources that have fully downloaded.
  161. - (NSArray *)subresources;
  162. */
  163. HRESULT subresources([out, retval] IEnumVARIANT** enumResources);
  164. /*!
  165. method subresourceForURL:
  166. @abstract Returns a subresource for a given URL.
  167. @param URL The URL of the subresource.
  168. @description Returns non-nil if the data source has fully downloaded a subresource with the given URL.
  169. - (WebResource *)subresourceForURL:(NSURL *)URL;
  170. */
  171. HRESULT subresourceForURL([in] BSTR url, [out, retval] IWebResource** resource);
  172. /*!
  173. @method addSubresource:
  174. @abstract Adds a subresource to the data source.
  175. @param subresource The subresource to be added.
  176. @description addSubresource: adds a subresource to the data source's list of subresources.
  177. Later, if something causes the data source to load the URL of the subresource, the data source
  178. will load the data from the subresource instead of from the network. For example, if one wants to add
  179. an image that is already downloaded to a web page, addSubresource: can be called so that the data source
  180. uses the downloaded image rather than accessing the network. NOTE: If the data source already has a
  181. subresource with the same URL, addSubresource: will replace it.
  182. - (void)addSubresource:(WebResource *)subresource;
  183. */
  184. HRESULT addSubresource([in] IWebResource* subresource);
  185. }
  186. [
  187. object,
  188. oleautomation,
  189. uuid(4B80B7D4-98D7-4a80-AF46-2AF84B2F2E8F),
  190. pointer_default(unique)
  191. ]
  192. interface IWebDataSourcePrivate : IUnknown
  193. {
  194. HRESULT overrideEncoding([out, retval] BSTR* encoding);
  195. HRESULT setOverrideEncoding([in] BSTR encoding);
  196. HRESULT mainDocumentError([out, retval] IWebError** error);
  197. HRESULT setDeferMainResourceDataLoad([in] BOOL flag);
  198. }