WebDataSource.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*
  2. * Copyright (C) 2006, 2007 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 WebDataSource_H
  26. #define WebDataSource_H
  27. #include "WebKit.h"
  28. #include <WebCore/COMPtr.h>
  29. #include <wtf/RefPtr.h>
  30. class WebDocumentLoader;
  31. class WebMutableURLRequest;
  32. extern const GUID IID_WebDataSource;
  33. class WebDataSource : public IWebDataSource, public IWebDataSourcePrivate
  34. {
  35. public:
  36. static WebDataSource* createInstance(WebDocumentLoader*);
  37. protected:
  38. WebDataSource(WebDocumentLoader*);
  39. ~WebDataSource();
  40. public:
  41. // IUnknown
  42. virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
  43. virtual ULONG STDMETHODCALLTYPE AddRef(void);
  44. virtual ULONG STDMETHODCALLTYPE Release(void);
  45. // IWebDataSource
  46. virtual HRESULT STDMETHODCALLTYPE initWithRequest(
  47. /* [in] */ IWebURLRequest *request);
  48. virtual HRESULT STDMETHODCALLTYPE data(
  49. /* [retval][out] */ IStream **stream);
  50. virtual HRESULT STDMETHODCALLTYPE representation(
  51. /* [retval][out] */ IWebDocumentRepresentation **rep);
  52. virtual HRESULT STDMETHODCALLTYPE webFrame(
  53. /* [retval][out] */ IWebFrame **frame);
  54. virtual HRESULT STDMETHODCALLTYPE initialRequest(
  55. /* [retval][out] */ IWebURLRequest **request);
  56. virtual HRESULT STDMETHODCALLTYPE request(
  57. /* [retval][out] */ IWebMutableURLRequest **request);
  58. virtual HRESULT STDMETHODCALLTYPE response(
  59. /* [retval][out] */ IWebURLResponse **response);
  60. virtual HRESULT STDMETHODCALLTYPE textEncodingName(
  61. /* [retval][out] */ BSTR *name);
  62. virtual HRESULT STDMETHODCALLTYPE isLoading(
  63. /* [retval][out] */ BOOL *loading);
  64. virtual HRESULT STDMETHODCALLTYPE pageTitle(
  65. /* [retval][out] */ BSTR *title);
  66. virtual HRESULT STDMETHODCALLTYPE unreachableURL(
  67. /* [retval][out] */ BSTR *url);
  68. virtual HRESULT STDMETHODCALLTYPE webArchive(
  69. /* [retval][out] */ IWebArchive **archive);
  70. virtual HRESULT STDMETHODCALLTYPE mainResource(
  71. /* [retval][out] */ IWebResource **resource);
  72. virtual HRESULT STDMETHODCALLTYPE subresources(
  73. /* [retval][out] */ IEnumVARIANT **enumResources);
  74. virtual HRESULT STDMETHODCALLTYPE subresourceForURL(
  75. /* [in] */ BSTR url,
  76. /* [retval][out] */ IWebResource **resource);
  77. virtual HRESULT STDMETHODCALLTYPE addSubresource(
  78. /* [in] */ IWebResource *subresource);
  79. // IWebDataSourcePrivate
  80. virtual HRESULT STDMETHODCALLTYPE overrideEncoding(
  81. /* [retval][out] */ BSTR *encoding);
  82. virtual HRESULT STDMETHODCALLTYPE setOverrideEncoding(
  83. /* [in] */ BSTR encoding);
  84. virtual HRESULT STDMETHODCALLTYPE mainDocumentError(
  85. /* [retval][out] */ IWebError** error);
  86. virtual HRESULT STDMETHODCALLTYPE setDeferMainResourceDataLoad(
  87. /* [in] */ BOOL flag);
  88. // WebDataSource
  89. WebDocumentLoader* documentLoader() const;
  90. protected:
  91. ULONG m_refCount;
  92. RefPtr<WebDocumentLoader> m_loader;
  93. COMPtr<IWebDocumentRepresentation> m_representation;
  94. };
  95. #endif