Bug 1867190 - Add prefs for PHC probablities r=glandium
[gecko.git] / layout / build / nsContentDLF.h
blobb16ec7550368d23fc682cafee0db6dc072b94da6
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 nsIDocumentViewer;
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 nsIDocumentViewer** aDocumentViewer);
42 /**
43 * Create a blank document using the given loadgroup and given
44 * principal. aPrincipal is allowed to be null, in which case the
45 * new document will get the about:blank content principal.
47 static already_AddRefed<mozilla::dom::Document> CreateBlankDocument(
48 nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal,
49 nsIPrincipal* aPartitionedPrincipal, nsDocShell* aContainer);
51 private:
52 static nsresult EnsureUAStyleSheet();
53 static bool IsImageContentType(const nsACString&);
56 nsresult NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult);
58 // clang-format off
59 #ifdef MOZ_WEBM
60 #define CONTENTDLF_WEBM_CATEGORIES \
61 { "Gecko-Content-Viewers", VIDEO_WEBM, "@mozilla.org/content/document-loader-factory;1" }, \
62 { "Gecko-Content-Viewers", AUDIO_WEBM, "@mozilla.org/content/document-loader-factory;1" },
63 #else
64 #define CONTENTDLF_WEBM_CATEGORIES
65 #endif
67 #define CONTENTDLF_CATEGORIES \
68 { "Gecko-Content-Viewers", TEXT_HTML, "@mozilla.org/content/document-loader-factory;1" }, \
69 { "Gecko-Content-Viewers", TEXT_PLAIN, "@mozilla.org/content/document-loader-factory;1" }, \
70 { "Gecko-Content-Viewers", TEXT_CACHE_MANIFEST, "@mozilla.org/content/document-loader-factory;1" }, \
71 { "Gecko-Content-Viewers", TEXT_CSS, "@mozilla.org/content/document-loader-factory;1" }, \
72 { "Gecko-Content-Viewers", TEXT_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
73 { "Gecko-Content-Viewers", TEXT_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
74 { "Gecko-Content-Viewers", APPLICATION_JAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
75 { "Gecko-Content-Viewers", APPLICATION_ECMASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
76 { "Gecko-Content-Viewers", APPLICATION_XJAVASCRIPT, "@mozilla.org/content/document-loader-factory;1" }, \
77 { "Gecko-Content-Viewers", APPLICATION_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
78 { "Gecko-Content-Viewers", TEXT_JSON, "@mozilla.org/content/document-loader-factory;1" }, \
79 { "Gecko-Content-Viewers", APPLICATION_XHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
80 { "Gecko-Content-Viewers", TEXT_XML, "@mozilla.org/content/document-loader-factory;1" }, \
81 { "Gecko-Content-Viewers", APPLICATION_XML, "@mozilla.org/content/document-loader-factory;1" }, \
82 { "Gecko-Content-Viewers", APPLICATION_RDF_XML, "@mozilla.org/content/document-loader-factory;1" }, \
83 { "Gecko-Content-Viewers", TEXT_RDF, "@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 { "Gecko-Content-Viewers", TEXT_VTT, "@mozilla.org/content/document-loader-factory;1" }, \
88 { "Gecko-Content-Viewers", APPLICATION_WAPXHTML_XML, "@mozilla.org/content/document-loader-factory;1" }, \
89 CONTENTDLF_WEBM_CATEGORIES
90 // clang-format on
92 #endif