|
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 |
|
6 #ifndef nsContentDLF_h__ |
|
7 #define nsContentDLF_h__ |
|
8 |
|
9 #include "nsIDocumentLoaderFactory.h" |
|
10 #include "nsMimeTypes.h" |
|
11 |
|
12 class nsIChannel; |
|
13 class nsIContentViewer; |
|
14 class nsIFile; |
|
15 class nsIInputStream; |
|
16 class nsILoadGroup; |
|
17 class nsIStreamListener; |
|
18 |
|
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" |
|
21 |
|
22 class nsContentDLF : public nsIDocumentLoaderFactory |
|
23 { |
|
24 public: |
|
25 nsContentDLF(); |
|
26 virtual ~nsContentDLF(); |
|
27 |
|
28 NS_DECL_ISUPPORTS |
|
29 NS_DECL_NSIDOCUMENTLOADERFACTORY |
|
30 |
|
31 nsresult InitUAStyleSheet(); |
|
32 |
|
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); |
|
40 |
|
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); |
|
49 |
|
50 private: |
|
51 static nsresult EnsureUAStyleSheet(); |
|
52 static bool IsImageContentType(const char* aContentType); |
|
53 }; |
|
54 |
|
55 nsresult |
|
56 NS_NewContentDocumentLoaderFactory(nsIDocumentLoaderFactory** aResult); |
|
57 |
|
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 |
|
65 |
|
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 |
|
88 |
|
89 |
|
90 #endif |
|
91 |