Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
6 #ifndef nsContentDLF_h__
7 #define nsContentDLF_h__
9 #include "nsIDocumentLoaderFactory.h"
10 #include "nsMimeTypes.h"
12 class nsIChannel;
13 class nsIContentViewer;
14 class nsIFile;
15 class nsIInputStream;
16 class nsILoadGroup;
17 class nsIStreamListener;
19 #define CONTENT_DLF_CONTRACTID "@mozilla.org/content/document-loader-factory;1"
20 #define PLUGIN_DLF_CONTRACTID "@mozilla.org/content/plugin/document-loader-factory;1"
22 class nsContentDLF : public nsIDocumentLoaderFactory
23 {
24 public:
25 nsContentDLF();
26 virtual ~nsContentDLF();
28 NS_DECL_ISUPPORTS
29 NS_DECL_NSIDOCUMENTLOADERFACTORY
31 nsresult InitUAStyleSheet();
33 nsresult CreateDocument(const char* aCommand,
34 nsIChannel* aChannel,
35 nsILoadGroup* aLoadGroup,
36 nsIDocShell* aContainer,
37 const nsCID& aDocumentCID,
38 nsIStreamListener** aDocListener,
39 nsIContentViewer** aContentViewer);
41 nsresult CreateXULDocument(const char* aCommand,
42 nsIChannel* aChannel,
43 nsILoadGroup* aLoadGroup,
44 const char* aContentType,
45 nsIDocShell* aContainer,
46 nsISupports* aExtraInfo,
47 nsIStreamListener** aDocListener,
48 nsIContentViewer** aContentViewer);
50 private:
51 static nsresult EnsureUAStyleSheet();
52 static bool IsImageContentType(const char* aContentType);
53 };
55 nsresult
56 NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
58 #ifdef MOZ_WEBM
59 #define CONTENTDLF_WEBM_CATEGORIES \
60 { "Gecko-Content-Viewers", VIDEO_WEBM, "@mozilla.org/content/document-loader-factory;1" }, \
61 { "Gecko-Content-Viewers", AUDIO_WEBM, "@mozilla.org/content/document-loader-factory;1" },
62 #else
63 #define CONTENTDLF_WEBM_CATEGORIES
64 #endif
66 #define CONTENTDLF_CATEGORIES \
67 { "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
68 { "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
69 { "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
70 { "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
71 { "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
72 { "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
73 { "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
74 { "Gecko-Content-Viewers", APPLICATION_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
75 { "Gecko-Content-Viewers", APPLICATION_XJAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
76 { "Gecko-Content-Viewers", APPLICATION_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
77 { "Gecko-Content-Viewers", APPLICATION_XHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
78 { "Gecko-Content-Viewers", TEXT_XML, "@mozilla.org/content/document-loader-factory;1" }, \
79 { "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
80 { "Gecko-Content-Viewers", APPLICATION_RDF_XML, "@mozilla.org/content/document-loader-factory;1" }, \
81 { "Gecko-Content-Viewers", TEXT_RDF, "@mozilla.org/content/document-loader-factory;1" }, \
82 { "Gecko-Content-Viewers", TEXT_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
83 { "Gecko-Content-Viewers", APPLICATION_CACHED_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
84 { "Gecko-Content-Viewers", VIEWSOURCE_CONTENT_TYPE, "@mozilla.org/content/document-loader-factory;1" }, \
85 { "Gecko-Content-Viewers", IMAGE_SVG_XML, "@mozilla.org/content/document-loader-factory;1" }, \
86 { "Gecko-Content-Viewers", APPLICATION_MATHML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
87 CONTENTDLF_WEBM_CATEGORIES
90 #endif