diff options
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 36 |
1 files changed, 36 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 +} |