aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--embed/ephy-embed.c13
-rw-r--r--embed/ephy-embed.h11
-rw-r--r--embed/mozilla/EphyBrowser.cpp34
-rw-r--r--embed/mozilla/EphyBrowser.h1
-rw-r--r--embed/mozilla/mozilla-embed.cpp9
6 files changed, 76 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4975a0aee..75b572dc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-11-16 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/ephy-embed.c: (ephy_embed_show_page_certificate):
+ * embed/ephy-embed.h:
+ * embed/mozilla/EphyBrowser.cpp:
+ * embed/mozilla/EphyBrowser.h:
+ * embed/mozilla/mozilla-embed.cpp:
+
+ Add ephy_embed_show_page_certificate () (merged from HEAD).
+
2004-11-14 Christian Persch <chpe@cvs.gnome.org>
* configure.in:
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 36e87fa24..1deaea025 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -670,6 +670,19 @@ ephy_embed_get_security_level (EphyEmbed *embed,
EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
iface->get_security_level (embed, level, description);
}
+/**
+ * ephy_embed_show_page_certificate:
+ * @embed: an #EphyEmbed
+ *
+ * Shows a dialogue displaying the certificate of the currently loaded page
+ * of @embed, if it was loaded over a secure connection; else does nothing.
+ **/
+void
+ephy_embed_show_page_certificate (EphyEmbed *embed)
+{
+ EphyEmbedIface *iface = EPHY_EMBED_GET_IFACE (embed);
+ iface->show_page_certificate (embed);
+}
/**
* ephy_embed_find_set_properties:
diff --git a/embed/ephy-embed.h b/embed/ephy-embed.h
index daa9cba0e..7538c779d 100644
--- a/embed/ephy-embed.h
+++ b/embed/ephy-embed.h
@@ -131,8 +131,6 @@ struct _EphyEmbedIface
float new_zoom);
void (* content_change) (EphyEmbed *embed,
const char *uri);
- gboolean (* modal_alert) (EphyEmbed *embed);
- void (* modal_alert_closed) (EphyEmbed *embed);
/* Methods */
void (* load_url) (EphyEmbed *embed,
@@ -187,6 +185,13 @@ struct _EphyEmbedIface
int page);
void (* activate) (EphyEmbed *embed);
gboolean (* has_modified_forms) (EphyEmbed *embed);
+
+ /* added at the end to preserve ABI */
+ /* Signals */
+ gboolean (* modal_alert) (EphyEmbed *embed);
+ void (* modal_alert_closed) (EphyEmbed *embed);
+ /* Methods */
+ void (* show_page_certificate) (EphyEmbed *embed);
};
GType ephy_embed_chrome_get_type (void);
@@ -243,6 +248,8 @@ void ephy_embed_get_security_level (EphyEmbed *embed,
EmbedSecurityLevel *level,
char **description);
+void ephy_embed_show_page_certificate (EphyEmbed *embed);
+
/* Zoom */
void ephy_embed_set_zoom (EphyEmbed *embed,
float zoom);
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index a203e0b9e..d3a49fd34 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -72,6 +72,7 @@
#include "nsIChannel.h"
#include "nsIScriptSecurityManager.h"
#include "nsIServiceManager.h"
+#include "nsIInterfaceRequestor.h"
#ifdef ALLOW_PRIVATE_API
/* not frozen yet */
@@ -82,6 +83,11 @@
#ifdef HAVE_MOZILLA_PSM
/* not sure about this one: */
#include <nsITransportSecurityInfo.h>
+/* these are in pipnss/, are they really private? */
+#include <nsISSLStatus.h>
+#include <nsISSLStatusProvider.h>
+#include <nsIX509Cert.h>
+#include <nsICertificateDialogs.h>
#endif
#endif
@@ -1085,3 +1091,31 @@ EphyBrowser::GetSecurityDescription (nsACString &aDescription)
return NS_ERROR_NOT_IMPLEMENTED;
#endif
}
+
+nsresult
+EphyBrowser::ShowCertificate ()
+{
+#ifdef HAVE_MOZILLA_PSM
+ if (!mSecurityInfo) return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsISSLStatusProvider> statusProvider (do_QueryInterface (mSecurityInfo));
+ NS_ENSURE_TRUE (statusProvider, NS_ERROR_FAILURE);
+
+ nsCOMPtr<nsISSLStatus> SSLStatus;
+ statusProvider->GetSSLStatus (getter_AddRefs (SSLStatus));
+ NS_ENSURE_TRUE (SSLStatus, NS_ERROR_FAILURE);
+
+ nsCOMPtr<nsIX509Cert> serverCert;
+ SSLStatus->GetServerCert (getter_AddRefs (serverCert));
+ NS_ENSURE_TRUE (serverCert, NS_ERROR_FAILURE);
+
+ nsCOMPtr<nsICertificateDialogs> certDialogs (do_GetService (NS_CERTIFICATEDIALOGS_CONTRACTID));
+ NS_ENSURE_TRUE (certDialogs, NS_ERROR_FAILURE);
+
+ nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface (mDOMWindow));
+
+ return certDialogs->ViewCert (requestor, serverCert);
+#else
+ return NS_OK;
+#endif
+}
diff --git a/embed/mozilla/EphyBrowser.h b/embed/mozilla/EphyBrowser.h
index 68811f550..931adb7ba 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -138,6 +138,7 @@ public:
nsresult SetSecurityInfo (nsIRequest *aRequest);
nsresult GetSecurityDescription (nsACString &aDescription);
+ nsresult ShowCertificate ();
nsCOMPtr<nsIWebBrowser> mWebBrowser;
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index 98dd9209a..dec89c7d0 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -655,6 +655,14 @@ impl_get_security_level (EphyEmbed *embed,
}
static void
+impl_show_page_certificate (EphyEmbed *embed)
+{
+ MozillaEmbedPrivate *mpriv = MOZILLA_EMBED (embed)->priv;
+
+ mpriv->browser->ShowCertificate ();
+}
+
+static void
impl_print (EphyEmbed *embed)
{
MozillaEmbedPrivate *mpriv = MOZILLA_EMBED(embed)->priv;
@@ -1145,6 +1153,7 @@ ephy_embed_iface_init (EphyEmbedIface *iface)
iface->shistory_get_pos = impl_shistory_get_pos;
iface->shistory_go_nth = impl_shistory_go_nth;
iface->get_security_level = impl_get_security_level;
+ iface->show_page_certificate = impl_show_page_certificate;
iface->find_next = impl_find_next;
iface->activate = impl_activate;
iface->find_set_properties = impl_find_set_properties;