diff options
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 8dffaa74d..2894b6e56 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -73,8 +73,11 @@ #include "nsIScriptSecurityManager.h" #include "nsIServiceManager.h" #include "nsIInterfaceRequestor.h" +#include <nsIDOMHTMLDocument.h> +#include <nsIDOMXMLDocument.h> #ifdef ALLOW_PRIVATE_API +#include <content/nsIImageDocument.h> /* not frozen yet */ #include "nsIContentPolicy.h" /* will never be frozen */ @@ -1129,3 +1132,33 @@ EphyBrowser::ShowCertificate () return NS_OK; #endif } + +EmbedDocumentType +EphyBrowser::GetDocumentType () +{ + EmbedDocumentType type = EMBED_DOCUMENT_OTHER; + + nsresult rv; + nsCOMPtr<nsIDOMDocument> domDoc; + rv = GetDocument (getter_AddRefs (domDoc)); + NS_ENSURE_SUCCESS (rv, type); + + nsCOMPtr<nsIDOMHTMLDocument> htmlDoc (do_QueryInterface (domDoc)); + nsCOMPtr<nsIDOMXMLDocument> xmlDoc (do_QueryInterface (domDoc)); + nsCOMPtr<nsIImageDocument> imgDoc (do_QueryInterface (domDoc)); + + if (xmlDoc) + { + type = EMBED_DOCUMENT_XML; + } + else if (imgDoc) + { + type = EMBED_DOCUMENT_IMAGE; + } + else if (htmlDoc) + { + type = EMBED_DOCUMENT_HTML; + } + + return type; +} |