Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsSecureBrowserUIImpl.cpp File Reference
#include "nspr.h"
#include "prlog.h"
#include "prmem.h"
#include "nsISecureBrowserUI.h"
#include "nsSecureBrowserUIImpl.h"
#include "nsCOMPtr.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIServiceManager.h"
#include "nsIScriptGlobalObject.h"
#include "nsIObserverService.h"
#include "nsIDocumentLoader.h"
#include "nsCURILoader.h"
#include "nsIDocShell.h"
#include "nsIDocumentViewer.h"
#include "nsIDocument.h"
#include "nsIPrincipal.h"
#include "nsIDOMElement.h"
#include "nsPIDOMWindow.h"
#include "nsIContent.h"
#include "nsIWebProgress.h"
#include "nsIChannel.h"
#include "nsIHttpChannel.h"
#include "nsIFileChannel.h"
#include "nsIWyciwygChannel.h"
#include "nsIFTPChannel.h"
#include "nsITransportSecurityInfo.h"
#include "nsIURI.h"
#include "nsISecurityEventSink.h"
#include "nsIPrompt.h"
#include "nsIFormSubmitObserver.h"
#include "nsISecurityWarningDialogs.h"
#include "nsIProxyObjectManager.h"
#include "nsNetUtil.h"
#include "nsCRT.h"

Go to the source code of this file.


struct  RequestHashEntry
class  nsUIContext


#define SECURITY_STRING_BUNDLE_URL   "chrome://pipnss/locale/"
#define IS_SECURE(state)   ((state & 0xFFFF) == STATE_IS_SECURE)


 RequestMapGetKey (PLDHashTable *table, PLDHashEntryHdr *hdr)
 RequestMapMatchEntry (PLDHashTable *table, const PLDHashEntryHdr *hdr, const void *key)
 RequestMapInitEntry (PLDHashTable *table, PLDHashEntryHdr *hdr, const void *key)
 NS_IMPL_ISUPPORTS6 (nsSecureBrowserUIImpl, nsISecureBrowserUI, nsIWebProgressListener, nsIFormSubmitObserver, nsIObserver, nsISupportsWeakReference, nsISSLStatusProvider) NS_IMETHODIMP nsSecureBrowserUIImpl
static nsresult IsChildOfDomWindow (nsIDOMWindow *parent, nsIDOMWindow *child, PRBool *value)
static PRUint32 GetSecurityStateFromChannel (nsIChannel *aChannel)


static PLDHashTableOps gMapOps

Define Documentation

#define IS_SECURE (   state)    ((state & 0xFFFF) == STATE_IS_SECURE)

Definition at line 87 of file nsSecureBrowserUIImpl.cpp.

#define SECURITY_STRING_BUNDLE_URL   "chrome://pipnss/locale/"

Definition at line 85 of file nsSecureBrowserUIImpl.cpp.

Function Documentation

static PRUint32 GetSecurityStateFromChannel ( nsIChannel aChannel) [static]

Definition at line 320 of file nsSecureBrowserUIImpl.cpp.

  nsresult res;
  PRUint32 securityState;

  // qi for the psm information about this channel load.
  nsCOMPtr<nsISupports> info;
  nsCOMPtr<nsITransportSecurityInfo> psmInfo(do_QueryInterface(info));
  if (!psmInfo) {
    PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState:%p - no nsITransportSecurityInfo for %p\n",
                                         aChannel, (nsISupports *)info));
    return nsIWebProgressListener::STATE_IS_INSECURE;
  PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState:%p - info is %p\n", aChannel,
                                       (nsISupports *)info));
  res = psmInfo->GetSecurityState(&securityState);
  if (NS_FAILED(res)) {
    PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState:%p - GetSecurityState failed: %d\n",
                                         aChannel, res));
    securityState = nsIWebProgressListener::STATE_IS_BROKEN;
  PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState:%p - Returning %d\n", aChannel,
  return securityState;

Here is the call graph for this function:

Here is the caller graph for this function:

static nsresult IsChildOfDomWindow ( nsIDOMWindow parent,
nsIDOMWindow child,
PRBool value 
) [static]

Definition at line 301 of file nsSecureBrowserUIImpl.cpp.

  *value = PR_FALSE;
  if (parent == child) {
    *value = PR_TRUE;
    return NS_OK;
  nsCOMPtr<nsIDOMWindow> childsParent;
  if (childsParent && childsParent.get() != child)
    IsChildOfDomWindow(parent, childsParent, value);
  return NS_OK;

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 168 of file nsSecureBrowserUIImpl.cpp.

  PR_LOG(gSecureDocLog, PR_LOG_DEBUG,
         ("SecureUI:%p: Init: mWindow: %p, window: %p\n", this, mWindow.get(),

  if (!window) {
    NS_WARNING("Null window passed to nsSecureBrowserUIImpl::Init()");

  if (mWindow) {
    NS_WARNING("Trying to init an nsSecureBrowserUIImpl twice");
  nsresult rv = NS_OK;
  mWindow = window;

  nsCOMPtr<nsIStringBundleService> service(do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv));
  if (NS_FAILED(rv)) return rv;
  // We do not need to test for mStringBundle here...
  // Anywhere we use it, we will test before using.  Some
  // embedded users of PSM may want to reuse our
  // nsSecureBrowserUIImpl implementation without the
  // bundle.
  service->CreateBundle(SECURITY_STRING_BUNDLE_URL, getter_AddRefs(mStringBundle));

  // hook up to the form post notifications:
  nsCOMPtr<nsIObserverService> svc(do_GetService(";1", &rv));
  if (NS_SUCCEEDED(rv)) {
    rv = svc->AddObserver(this, NS_FORMSUBMIT_SUBJECT, PR_TRUE);
  nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(mWindow));
  if (!sgo) return NS_ERROR_FAILURE;

  nsIDocShell *docShell = sgo->GetDocShell();

  // The Docshell will own the SecureBrowserUI object
  if (!docShell)
    return NS_ERROR_FAILURE;


  /* GetWebProgress(mWindow) */
  // hook up to the webprogress notifications.
  nsCOMPtr<nsIWebProgress> wp(do_GetInterface(docShell));
  if (!wp) return NS_ERROR_FAILURE;
  /* end GetWebProgress */
                          nsIWebProgress::NOTIFY_STATE_ALL | 
                          nsIWebProgress::NOTIFY_LOCATION  |

  return NS_OK;

Here is the call graph for this function:

RequestMapGetKey ( PLDHashTable table,
PLDHashEntryHdr hdr 

Definition at line 109 of file nsSecureBrowserUIImpl.cpp.

  RequestHashEntry *entry = NS_STATIC_CAST(RequestHashEntry*, hdr);
  return entry->r;
RequestMapInitEntry ( PLDHashTable table,
PLDHashEntryHdr hdr,
const void key 

Definition at line 124 of file nsSecureBrowserUIImpl.cpp.

  RequestHashEntry *entry = NS_STATIC_CAST(RequestHashEntry*, hdr);
  entry->r = (void*)key;
  return PR_TRUE;
RequestMapMatchEntry ( PLDHashTable table,
const PLDHashEntryHdr hdr,
const void key 

Definition at line 116 of file nsSecureBrowserUIImpl.cpp.

  const RequestHashEntry *entry = NS_STATIC_CAST(const RequestHashEntry*, hdr);
  return entry->r == key;

Variable Documentation