diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-07-24 18:16:10 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-07-24 18:16:10 +0800 |
commit | af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed (patch) | |
tree | e92bd101d32468f46208992e5bade9ad2bdc2280 /embed/mozilla/EphyBrowser.cpp | |
parent | 4d4808cdc6c565dbdefea90b567b3efe9718c5c4 (diff) | |
download | gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.tar gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.tar.gz gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.tar.bz2 gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.tar.lz gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.tar.xz gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.tar.zst gsoc2013-epiphany-af8bbdbc5bc95e1e3cd3fc6fc49f9f1e3eea91ed.zip |
Refactores storing the security info, move it into EphyBrowser.
2004-07-24 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphyBrowser.cpp:
* embed/mozilla/EphyBrowser.h:
* embed/mozilla/mozilla-embed.cpp:
Refactores storing the security info, move it into
EphyBrowser.
Diffstat (limited to 'embed/mozilla/EphyBrowser.cpp')
-rw-r--r-- | embed/mozilla/EphyBrowser.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/embed/mozilla/EphyBrowser.cpp b/embed/mozilla/EphyBrowser.cpp index 7e500f431..fe45beb4d 100644 --- a/embed/mozilla/EphyBrowser.cpp +++ b/embed/mozilla/EphyBrowser.cpp @@ -65,9 +65,16 @@ #include "nsIDOMWindow2.h" #include "nsEmbedString.h" #include "nsMemory.h" +#include "nsIServiceManager.h" +#include "nsIChannel.h" +#include "nsIInterfaceRequestor.h" #ifdef ALLOW_PRIVATE_API #include "nsIMarkupDocumentViewer.h" +#ifdef HAVE_MOZILLA_PSM +/* not sure about this one: */ +#include <nsITransportSecurityInfo.h> +#endif #endif static PRUnichar DOMLinkAdded[] = { 'D', 'O', 'M', 'L', 'i', 'n', 'k', @@ -938,3 +945,45 @@ nsresult EphyBrowser::GetHasModifiedForms (PRBool *modified) return NS_OK; } + +nsresult +EphyBrowser::SetSecurityInfo (nsIRequest *aRequest) +{ +#ifdef HAVE_MOZILLA_PSM + /* clear previous security info */ + mSecurityInfo = nsnull; + + nsCOMPtr<nsIChannel> channel (do_QueryInterface (aRequest)); + NS_ENSURE_TRUE (channel, NS_ERROR_FAILURE); + + channel->GetSecurityInfo (getter_AddRefs (mSecurityInfo)); + + return NS_OK; +#else + return NS_ERROR_NOT_IMPLEMENTED; +#endif +} + +nsresult +EphyBrowser::GetSecurityDescription (nsACString &aDescription) +{ +#ifdef HAVE_MOZILLA_PSM + if (!mSecurityInfo) return NS_ERROR_FAILURE; + + nsCOMPtr<nsITransportSecurityInfo> tsInfo (do_QueryInterface (mSecurityInfo)); + NS_ENSURE_TRUE (tsInfo, NS_ERROR_FAILURE); + + nsresult rv; + PRUnichar *tooltip = nsnull; + rv = tsInfo->GetShortSecurityDescription (&tooltip); + NS_ENSURE_TRUE (NS_SUCCEEDED (rv) && tooltip, NS_ERROR_FAILURE); + + NS_UTF16ToCString (nsEmbedString (tooltip), + NS_CSTRING_ENCODING_UTF8, aDescription); + if (tooltip) nsMemory::Free (tooltip); + + return NS_OK; +#else + return NS_ERROR_NOT_IMPLEMENTED; +#endif +} |