nsContentDLF.h 4.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. * This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsContentDLF_h__
  6. #define nsContentDLF_h__
  7. #include "nsIDocumentLoaderFactory.h"
  8. #include "nsMimeTypes.h"
  9. class nsIChannel;
  10. class nsIContentViewer;
  11. class nsILoadGroup;
  12. class nsIStreamListener;
  13. #define CONTENT_DLF_CONTRACTID "@mozilla.org/content/document-loader-factory;1"
  14. #define PLUGIN_DLF_CONTRACTID "@mozilla.org/content/plugin/document-loader-factory;1"
  15. class nsContentDLF : public nsIDocumentLoaderFactory
  16. {
  17. protected:
  18. virtual ~nsContentDLF();
  19. public:
  20. nsContentDLF();
  21. NS_DECL_ISUPPORTS
  22. NS_DECL_NSIDOCUMENTLOADERFACTORY
  23. nsresult InitUAStyleSheet();
  24. nsresult CreateDocument(const char* aCommand,
  25. nsIChannel* aChannel,
  26. nsILoadGroup* aLoadGroup,
  27. nsIDocShell* aContainer,
  28. const nsCID& aDocumentCID,
  29. nsIStreamListener** aDocListener,
  30. nsIContentViewer** aContentViewer);
  31. nsresult CreateXULDocument(const char* aCommand,
  32. nsIChannel* aChannel,
  33. nsILoadGroup* aLoadGroup,
  34. nsIDocShell* aContainer,
  35. nsISupports* aExtraInfo,
  36. nsIStreamListener** aDocListener,
  37. nsIContentViewer** aContentViewer);
  38. private:
  39. static nsresult EnsureUAStyleSheet();
  40. static bool IsImageContentType(const char* aContentType);
  41. };
  42. nsresult
  43. NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
  44. #ifdef MOZ_WEBM
  45. #define CONTENTDLF_WEBM_CATEGORIES \
  46. { "Gecko-Content-Viewers", VIDEO_WEBM, "@mozilla.org/content/document-loader-factory;1" }, \
  47. { "Gecko-Content-Viewers", AUDIO_WEBM, "@mozilla.org/content/document-loader-factory;1" },
  48. #else
  49. #define CONTENTDLF_WEBM_CATEGORIES
  50. #endif
  51. #define CONTENTDLF_CATEGORIES \
  52. { "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
  53. { "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
  54. { "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
  55. { "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
  56. { "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
  57. { "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
  58. { "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
  59. { "Gecko-Content-Viewers", APPLICATION_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
  60. { "Gecko-Content-Viewers", APPLICATION_XJAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
  61. { "Gecko-Content-Viewers", APPLICATION_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
  62. { "Gecko-Content-Viewers", TEXT_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
  63. { "Gecko-Content-Viewers", APPLICATION_XHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  64. { "Gecko-Content-Viewers", TEXT_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  65. { "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  66. { "Gecko-Content-Viewers", APPLICATION_RDF_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  67. { "Gecko-Content-Viewers", TEXT_RDF, "@mozilla.org/content/document-loader-factory;1" }, \
  68. { "Gecko-Content-Viewers", TEXT_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
  69. { "Gecko-Content-Viewers", APPLICATION_CACHED_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
  70. { "Gecko-Content-Viewers", VIEWSOURCE_CONTENT_TYPE, "@mozilla.org/content/document-loader-factory;1" }, \
  71. { "Gecko-Content-Viewers", IMAGE_SVG_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  72. { "Gecko-Content-Viewers", APPLICATION_MATHML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  73. { "Gecko-Content-Viewers", TEXT_VTT, "@mozilla.org/content/document-loader-factory;1" }, \
  74. { "Gecko-Content-Viewers", APPLICATION_WAPXHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
  75. CONTENTDLF_WEBM_CATEGORIES
  76. #endif