nsSecureBrowserUIImpl.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef nsSecureBrowserUIImpl_h
  6. #define nsSecureBrowserUIImpl_h
  7. #include "PLDHashTable.h"
  8. #include "mozilla/ReentrancyGuard.h"
  9. #include "nsCOMPtr.h"
  10. #include "nsINetUtil.h"
  11. #include "nsISSLStatusProvider.h"
  12. #include "nsISecureBrowserUI.h"
  13. #include "nsISecurityEventSink.h"
  14. #include "nsIURI.h"
  15. #include "nsIWebProgressListener.h"
  16. #include "nsWeakReference.h"
  17. class nsISSLStatus;
  18. class nsIChannel;
  19. #define NS_SECURE_BROWSER_UI_CID \
  20. { 0xcc75499a, 0x1dd1, 0x11b2, {0x8a, 0x82, 0xca, 0x41, 0x0a, 0xc9, 0x07, 0xb8}}
  21. class nsSecureBrowserUIImpl : public nsISecureBrowserUI,
  22. public nsIWebProgressListener,
  23. public nsSupportsWeakReference,
  24. public nsISSLStatusProvider
  25. {
  26. friend class mozilla::ReentrancyGuard;
  27. public:
  28. nsSecureBrowserUIImpl();
  29. NS_DECL_ISUPPORTS
  30. NS_DECL_NSIWEBPROGRESSLISTENER
  31. NS_DECL_NSISECUREBROWSERUI
  32. NS_DECL_NSISSLSTATUSPROVIDER
  33. protected:
  34. virtual ~nsSecureBrowserUIImpl() {};
  35. nsWeakPtr mWindow;
  36. nsWeakPtr mDocShell;
  37. nsCOMPtr<nsINetUtil> mIOService;
  38. nsCOMPtr<nsIURI> mCurrentURI;
  39. nsCOMPtr<nsISecurityEventSink> mToplevelEventSink;
  40. enum lockIconState {
  41. lis_no_security,
  42. lis_broken_security,
  43. lis_mixed_security,
  44. lis_high_security
  45. };
  46. lockIconState mNotifiedSecurityState;
  47. bool mNotifiedToplevelIsEV;
  48. void ResetStateTracking();
  49. uint32_t mNewToplevelSecurityState;
  50. bool mNewToplevelIsEV;
  51. bool mNewToplevelSecurityStateKnown;
  52. bool mIsViewSource;
  53. int32_t mDocumentRequestsInProgress;
  54. int32_t mSubRequestsBrokenSecurity;
  55. int32_t mSubRequestsNoSecurity;
  56. bool mCertUserOverridden;
  57. bool mRestoreSubrequests;
  58. bool mOnLocationChangeSeen;
  59. #ifdef DEBUG
  60. bool mEntered; // For ReentrancyGuard.
  61. #endif
  62. static already_AddRefed<nsISupports> ExtractSecurityInfo(nsIRequest* aRequest);
  63. nsresult MapInternalToExternalState(uint32_t* aState, lockIconState lock, bool ev);
  64. void UpdateSecurityState(nsIRequest* aRequest, bool withNewLocation,
  65. bool withUpdateStatus);
  66. void TellTheWorld(nsIRequest* aRequest);
  67. void EvaluateAndUpdateSecurityState(nsIRequest* aRequest, nsISupports *info,
  68. bool withNewLocation, bool withNewSink);
  69. void UpdateSubrequestMembers(nsISupports* securityInfo, nsIRequest* request);
  70. void ObtainEventSink(nsIChannel *channel,
  71. nsCOMPtr<nsISecurityEventSink> &sink);
  72. nsCOMPtr<nsISSLStatus> mSSLStatus;
  73. nsCOMPtr<nsISupports> mCurrentToplevelSecurityInfo;
  74. PLDHashTable mTransferringRequests;
  75. };
  76. #endif // nsSecureBrowserUIImpl_h