Line data Source code
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 :
6 : #ifndef nsSecureBrowserUIImpl_h
7 : #define nsSecureBrowserUIImpl_h
8 :
9 : #include "PLDHashTable.h"
10 : #include "mozilla/ReentrancyGuard.h"
11 : #include "nsCOMPtr.h"
12 : #include "nsINetUtil.h"
13 : #include "nsISSLStatusProvider.h"
14 : #include "nsISecureBrowserUI.h"
15 : #include "nsISecurityEventSink.h"
16 : #include "nsIURI.h"
17 : #include "nsIWebProgressListener.h"
18 : #include "nsWeakReference.h"
19 :
20 : class nsISSLStatus;
21 : class nsIChannel;
22 :
23 : #define NS_SECURE_BROWSER_UI_CID \
24 : { 0xcc75499a, 0x1dd1, 0x11b2, {0x8a, 0x82, 0xca, 0x41, 0x0a, 0xc9, 0x07, 0xb8}}
25 :
26 :
27 : class nsSecureBrowserUIImpl : public nsISecureBrowserUI,
28 : public nsIWebProgressListener,
29 : public nsSupportsWeakReference,
30 : public nsISSLStatusProvider
31 : {
32 : friend class mozilla::ReentrancyGuard;
33 :
34 : public:
35 : nsSecureBrowserUIImpl();
36 :
37 : NS_DECL_ISUPPORTS
38 : NS_DECL_NSIWEBPROGRESSLISTENER
39 : NS_DECL_NSISECUREBROWSERUI
40 : NS_DECL_NSISSLSTATUSPROVIDER
41 :
42 : protected:
43 0 : virtual ~nsSecureBrowserUIImpl() {};
44 :
45 : nsWeakPtr mWindow;
46 : nsWeakPtr mDocShell;
47 : nsCOMPtr<nsINetUtil> mIOService;
48 : nsCOMPtr<nsIURI> mCurrentURI;
49 : nsCOMPtr<nsISecurityEventSink> mToplevelEventSink;
50 :
51 : enum lockIconState {
52 : lis_no_security,
53 : lis_broken_security,
54 : lis_mixed_security,
55 : lis_high_security
56 : };
57 :
58 : lockIconState mNotifiedSecurityState;
59 : bool mNotifiedToplevelIsEV;
60 :
61 : void ResetStateTracking();
62 : uint32_t mNewToplevelSecurityState;
63 : bool mNewToplevelIsEV;
64 : bool mNewToplevelSecurityStateKnown;
65 : bool mIsViewSource;
66 :
67 : int32_t mDocumentRequestsInProgress;
68 : int32_t mSubRequestsBrokenSecurity;
69 : int32_t mSubRequestsNoSecurity;
70 : bool mCertUserOverridden;
71 : bool mRestoreSubrequests;
72 : bool mOnLocationChangeSeen;
73 : #ifdef DEBUG
74 : bool mEntered; // For ReentrancyGuard.
75 : #endif
76 :
77 : static already_AddRefed<nsISupports> ExtractSecurityInfo(nsIRequest* aRequest);
78 : nsresult MapInternalToExternalState(uint32_t* aState, lockIconState lock, bool ev);
79 : void UpdateSecurityState(nsIRequest* aRequest, bool withNewLocation,
80 : bool withUpdateStatus);
81 : void TellTheWorld(nsIRequest* aRequest);
82 :
83 : void EvaluateAndUpdateSecurityState(nsIRequest* aRequest, nsISupports *info,
84 : bool withNewLocation, bool withNewSink);
85 : void UpdateSubrequestMembers(nsISupports* securityInfo, nsIRequest* request);
86 :
87 : void ObtainEventSink(nsIChannel *channel,
88 : nsCOMPtr<nsISecurityEventSink> &sink);
89 :
90 : nsCOMPtr<nsISSLStatus> mSSLStatus;
91 : nsCOMPtr<nsISupports> mCurrentToplevelSecurityInfo;
92 :
93 : PLDHashTable mTransferringRequests;
94 : };
95 :
96 : #endif // nsSecureBrowserUIImpl_h
|