security/manager/boot/src/nsSecureBrowserUIImpl.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/manager/boot/src/nsSecureBrowserUIImpl.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,134 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef nsSecureBrowserUIImpl_h_
    1.10 +#define nsSecureBrowserUIImpl_h_
    1.11 +
    1.12 +#ifdef DEBUG
    1.13 +#include "mozilla/Atomics.h"
    1.14 +#endif
    1.15 +#include "mozilla/ReentrantMonitor.h"
    1.16 +#include "nsCOMPtr.h"
    1.17 +#include "nsString.h"
    1.18 +#include "nsIDOMElement.h"
    1.19 +#include "nsIDOMWindow.h"
    1.20 +#include "nsIDOMHTMLFormElement.h"
    1.21 +#include "nsISecureBrowserUI.h"
    1.22 +#include "nsIDocShell.h"
    1.23 +#include "nsIDocShellTreeItem.h"
    1.24 +#include "nsIWebProgressListener.h"
    1.25 +#include "nsIFormSubmitObserver.h"
    1.26 +#include "nsIURI.h"
    1.27 +#include "nsISecurityEventSink.h"
    1.28 +#include "nsWeakReference.h"
    1.29 +#include "nsISSLStatusProvider.h"
    1.30 +#include "nsIAssociatedContentSecurity.h"
    1.31 +#include "pldhash.h"
    1.32 +#include "nsINetUtil.h"
    1.33 +
    1.34 +class nsISSLStatus;
    1.35 +class nsITransportSecurityInfo;
    1.36 +class nsISecurityWarningDialogs;
    1.37 +class nsIChannel;
    1.38 +class nsIInterfaceRequestor;
    1.39 +
    1.40 +#define NS_SECURE_BROWSER_UI_CID \
    1.41 +{ 0xcc75499a, 0x1dd1, 0x11b2, {0x8a, 0x82, 0xca, 0x41, 0x0a, 0xc9, 0x07, 0xb8}}
    1.42 +
    1.43 +
    1.44 +class nsSecureBrowserUIImpl : public nsISecureBrowserUI,
    1.45 +                              public nsIWebProgressListener,
    1.46 +                              public nsIFormSubmitObserver,
    1.47 +                              public nsSupportsWeakReference,
    1.48 +                              public nsISSLStatusProvider
    1.49 +{
    1.50 +public:
    1.51 +  
    1.52 +  nsSecureBrowserUIImpl();
    1.53 +  virtual ~nsSecureBrowserUIImpl();
    1.54 +  
    1.55 +  NS_DECL_THREADSAFE_ISUPPORTS
    1.56 +  NS_DECL_NSIWEBPROGRESSLISTENER
    1.57 +  NS_DECL_NSISECUREBROWSERUI
    1.58 +  
    1.59 +  NS_DECL_NSISSLSTATUSPROVIDER
    1.60 +
    1.61 +  NS_IMETHOD Notify(nsIDOMHTMLFormElement* formNode, nsIDOMWindow* window,
    1.62 +                    nsIURI *actionURL, bool* cancelSubmit);
    1.63 +  NS_IMETHOD NotifyInvalidSubmit(nsIDOMHTMLFormElement* formNode,
    1.64 +                                 nsIArray* invalidElements) { return NS_OK; }
    1.65 +  
    1.66 +protected:
    1.67 +  mozilla::ReentrantMonitor mReentrantMonitor;
    1.68 +  
    1.69 +  nsWeakPtr mWindow;
    1.70 +  nsWeakPtr mDocShell;
    1.71 +  nsCOMPtr<nsINetUtil> mIOService;
    1.72 +  nsCOMPtr<nsIURI> mCurrentURI;
    1.73 +  nsCOMPtr<nsISecurityEventSink> mToplevelEventSink;
    1.74 +  
    1.75 +  enum lockIconState {
    1.76 +    lis_no_security,
    1.77 +    lis_broken_security,
    1.78 +    lis_mixed_security,
    1.79 +    lis_high_security
    1.80 +  };
    1.81 +
    1.82 +  lockIconState mNotifiedSecurityState;
    1.83 +  bool mNotifiedToplevelIsEV;
    1.84 +
    1.85 +  void ResetStateTracking();
    1.86 +  uint32_t mNewToplevelSecurityState;
    1.87 +  bool mNewToplevelIsEV;
    1.88 +  bool mNewToplevelSecurityStateKnown;
    1.89 +  bool mIsViewSource;
    1.90 +
    1.91 +  int32_t mDocumentRequestsInProgress;
    1.92 +  int32_t mSubRequestsBrokenSecurity;
    1.93 +  int32_t mSubRequestsNoSecurity;
    1.94 +  bool mRestoreSubrequests;
    1.95 +  bool mOnLocationChangeSeen;
    1.96 +#ifdef DEBUG
    1.97 +  /* related to mReentrantMonitor */
    1.98 +  mozilla::Atomic<int32_t> mOnStateLocationChangeReentranceDetection;
    1.99 +#endif
   1.100 +
   1.101 +  static already_AddRefed<nsISupports> ExtractSecurityInfo(nsIRequest* aRequest);
   1.102 +  nsresult MapInternalToExternalState(uint32_t* aState, lockIconState lock, bool ev);
   1.103 +  nsresult UpdateSecurityState(nsIRequest* aRequest, bool withNewLocation,
   1.104 +                               bool withUpdateStatus);
   1.105 +  bool UpdateMyFlags(lockIconState &warnSecurityState);
   1.106 +  nsresult TellTheWorld(lockIconState warnSecurityState, 
   1.107 +                        nsIRequest* aRequest);
   1.108 +
   1.109 +  nsresult EvaluateAndUpdateSecurityState(nsIRequest* aRequest, nsISupports *info,
   1.110 +                                          bool withNewLocation);
   1.111 +  void UpdateSubrequestMembers(nsISupports *securityInfo);
   1.112 +
   1.113 +  void ObtainEventSink(nsIChannel *channel, 
   1.114 +                       nsCOMPtr<nsISecurityEventSink> &sink);
   1.115 +
   1.116 +  nsCOMPtr<nsISSLStatus> mSSLStatus;
   1.117 +  nsCOMPtr<nsISupports> mCurrentToplevelSecurityInfo;
   1.118 +
   1.119 +  nsresult CheckPost(nsIURI *formURI, nsIURI *actionURL, bool *okayToPost);
   1.120 +  nsresult IsURLHTTPS(nsIURI* aURL, bool *value);
   1.121 +  nsresult IsURLJavaScript(nsIURI* aURL, bool *value);
   1.122 +
   1.123 +  bool ConfirmEnteringSecure();
   1.124 +  bool ConfirmEnteringWeak();
   1.125 +  bool ConfirmLeavingSecure();
   1.126 +  bool ConfirmMixedMode();
   1.127 +  bool ConfirmPostToInsecure();
   1.128 +  bool ConfirmPostToInsecureFromSecure();
   1.129 +
   1.130 +  bool GetNSSDialogs(nsCOMPtr<nsISecurityWarningDialogs> & dialogs,
   1.131 +                     nsCOMPtr<nsIInterfaceRequestor> & window);
   1.132 +
   1.133 +  PLDHashTable mTransferringRequests;
   1.134 +};
   1.135 +
   1.136 +
   1.137 +#endif /* nsSecureBrowserUIImpl_h_ */

mercurial