aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphyBrowser.cpp33
-rw-r--r--embed/mozilla/EphyBrowser.h2
-rw-r--r--embed/mozilla/mozilla-embed.cpp7
3 files changed, 42 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;
+}
diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h
index 56962d183..05e93235e 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -147,6 +147,8 @@ public:
nsresult GetSecurityInfo (PRUint32 *aState, nsACString &aDescription);
nsresult ShowCertificate ();
+ EmbedDocumentType GetDocumentType ();
+
nsCOMPtr<nsIWebBrowser> mWebBrowser;
private:
GtkWidget *mEmbed;
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index fd71b5cb9..4a33a80ff 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -789,6 +789,13 @@ update_load_state (MozillaEmbed *membed, gint state)
{
MozillaEmbedPrivate *priv = membed->priv;
+ if (state & GTK_MOZ_EMBED_FLAG_IS_DOCUMENT &&
+ state & (GTK_MOZ_EMBED_FLAG_START | GTK_MOZ_EMBED_FLAG_STOP))
+ {
+ g_signal_emit_by_name (membed, "ge-document-type",
+ priv->browser->GetDocumentType ());
+ }
+
if (state & GTK_MOZ_EMBED_FLAG_IS_NETWORK)
{
if (state & GTK_MOZ_EMBED_FLAG_START)