Bug 1468402 - Part 3: Add test for subgrids in the grid list. r=pbro
[gecko.git] / layout / build / nsContentDLF.h
blob4e8ad5e43ced05f9acfa933371a57f64731e8f99
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsContentDLF_h__
8 #define nsContentDLF_h__
10 #include "nsIDocumentLoaderFactory.h"
11 #include "nsMimeTypes.h"
13 class nsDocShell;
14 class nsIChannel;
15 class nsIContentViewer;
16 class nsILoadGroup;
17 class nsIStreamListener;
19 #define CONTENT_DLF_CONTRACTID "@mozilla.org/content/document-loader-factory;1"
20 #define PLUGIN_DLF_CONTRACTID \
21 "@mozilla.org/content/plugin/document-loader-factory;1"
23 class nsContentDLF final : public nsIDocumentLoaderFactory {
24 protected:
25 virtual ~nsContentDLF();
27 public:
28 nsContentDLF();
30 NS_DECL_ISUPPORTS
31 NS_DECL_NSIDOCUMENTLOADERFACTORY
33 nsresult InitUAStyleSheet();
35 typedef already_AddRefed<mozilla::dom::Document> (*DocumentCreator)();
36 nsresult CreateDocument(const char* aCommand, nsIChannel* aChannel,
37 nsILoadGroup* aLoadGroup, nsIDocShell* aContainer,
38 DocumentCreator aDocumentCreator,
39 nsIStreamListener** aDocListener,
40 nsIContentViewer** aContentViewer);
42 nsresult CreateXULDocument(const char* aCommand, nsIChannel* aChannel,
43 nsILoadGroup* aLoadGroup, nsIDocShell* aContainer,
44 nsISupports* aExtraInfo,
45 nsIStreamListener** aDocListener,
46 nsIContentViewer** aContentViewer);
48 /**
49 * Create a blank document using the given loadgroup and given
50 * principal. aPrincipal is allowed to be null, in which case the
51 * new document will get the about:blank codebase principal.
53 static already_AddRefed<mozilla::dom::Document> CreateBlankDocument(
54 nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal,
55 nsDocShell* aContainer);
57 private:
58 static nsresult EnsureUAStyleSheet();
59 static bool IsImageContentType(const char* aContentType);
62 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
64 // clang-format off
65 #ifdef MOZ_WEBM
66 #define CONTENTDLF_WEBM_CATEGORIES \
67 { "Gecko-Content-Viewers", VIDEO_WEBM, "@mozilla.org/content/document-loader-factory;1" }, \
68 { "Gecko-Content-Viewers", AUDIO_WEBM, "@mozilla.org/content/document-loader-factory;1" },
69 #else
70 #define CONTENTDLF_WEBM_CATEGORIES
71 #endif
73 #define CONTENTDLF_CATEGORIES \
74 { "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
75 { "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
76 { "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
77 { "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
78 { "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
79 { "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
80 { "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
81 { "Gecko-Content-Viewers", APPLICATION_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
82 { "Gecko-Content-Viewers", APPLICATION_XJAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
83 { "Gecko-Content-Viewers", APPLICATION_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
84 { "Gecko-Content-Viewers", TEXT_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
85 { "Gecko-Content-Viewers", APPLICATION_XHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
86 { "Gecko-Content-Viewers", TEXT_XML, "@mozilla.org/content/document-loader-factory;1" }, \
87 { "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
88 { "Gecko-Content-Viewers", APPLICATION_RDF_XML, "@mozilla.org/content/document-loader-factory;1" }, \
89 { "Gecko-Content-Viewers", TEXT_RDF, "@mozilla.org/content/document-loader-factory;1" }, \
90 { "Gecko-Content-Viewers", TEXT_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
91 { "Gecko-Content-Viewers", APPLICATION_CACHED_XUL, "@mozilla.org/content/document-loader-factory;1" }, \
92 { "Gecko-Content-Viewers", VIEWSOURCE_CONTENT_TYPE, "@mozilla.org/content/document-loader-factory;1" }, \
93 { "Gecko-Content-Viewers", IMAGE_SVG_XML, "@mozilla.org/content/document-loader-factory;1" }, \
94 { "Gecko-Content-Viewers", APPLICATION_MATHML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
95 { "Gecko-Content-Viewers", TEXT_VTT, "@mozilla.org/content/document-loader-factory;1" }, \
96 { "Gecko-Content-Viewers", APPLICATION_WAPXHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
97 CONTENTDLF_WEBM_CATEGORIES
98 // clang-format on
100 #endif