aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-11-16 22:21:23 +0800
committerChristian Persch <chpe@src.gnome.org>2004-11-16 22:21:23 +0800
commitfc8b2f38ec97eaeb1090c5c4fa10318fa573a76d (patch)
treea80f131e5c485fb7d4109b61162983d6b8437193 /embed/mozilla
parent1d8df1dcd8dd809ab8d9936e9a682e0c8e62faee (diff)
downloadgsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.tar
gsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.tar.gz
gsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.tar.bz2
gsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.tar.lz
gsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.tar.xz
gsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.tar.zst
gsoc2013-epiphany-fc8b2f38ec97eaeb1090c5c4fa10318fa573a76d.zip
Add a way to show the cert info dialogue for the page's certificate.
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 a way to show the cert info dialogue for the page's certificate.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphyBrowser.cpp36
-rw-r--r--embed/mozilla/EphyBrowser.h1
-rw-r--r--embed/mozilla/mozilla-embed.cpp9
3 files changed, 46 insertions, 0 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp
index 316034c2d..de5def194 100644
--- a/embed/mozilla/EphyBrowser.cpp
+++ b/embed/mozilla/EphyBrowser.cpp
@@ -63,6 +63,8 @@
#include "nsIDOMNode.h"
#include "nsIDOMElement.h"
#include "nsIDOMWindow2.h"
+#include "nsIDOMDocumentView.h"
+#include "nsIDOMAbstractView.h"
#define MOZILLA_STRICT_API
#include "nsEmbedString.h"
#undef MOZILLA_STRICT_API
@@ -70,6 +72,7 @@
#include "nsIChannel.h"
#include "nsIScriptSecurityManager.h"
#include "nsIServiceManager.h"
+#include "nsIInterfaceRequestor.h"
#ifdef ALLOW_PRIVATE_API
/* not frozen yet */
@@ -80,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
@@ -1081,3 +1089,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 e2892797f..76a5b6bfd 100644
--- a/embed/mozilla/EphyBrowser.h
+++ b/embed/mozilla/EphyBrowser.h
@@ -136,6 +136,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 c00fc26ab..dcd07d816 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -653,6 +653,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;
@@ -1143,6 +1151,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;