Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsWebBrowser_h__ |
michael@0 | 8 | #define nsWebBrowser_h__ |
michael@0 | 9 | |
michael@0 | 10 | // Local Includes |
michael@0 | 11 | #include "nsDocShellTreeOwner.h" |
michael@0 | 12 | |
michael@0 | 13 | // Core Includes |
michael@0 | 14 | #include "nsCOMPtr.h" |
michael@0 | 15 | |
michael@0 | 16 | // Interfaces needed |
michael@0 | 17 | #include "nsCWebBrowser.h" |
michael@0 | 18 | #include "nsIBaseWindow.h" |
michael@0 | 19 | #include "nsIDocShell.h" |
michael@0 | 20 | #include "nsIDocShellTreeItem.h" |
michael@0 | 21 | #include "nsIInterfaceRequestor.h" |
michael@0 | 22 | #include "nsIInterfaceRequestorUtils.h" |
michael@0 | 23 | #include "nsIScrollable.h" |
michael@0 | 24 | #include "nsISHistory.h" |
michael@0 | 25 | #include "nsITextScroll.h" |
michael@0 | 26 | #include "nsIWidget.h" |
michael@0 | 27 | #include "nsIWebProgress.h" |
michael@0 | 28 | #include "nsISecureBrowserUI.h" |
michael@0 | 29 | #include "nsIWebBrowser.h" |
michael@0 | 30 | #include "nsIWebNavigation.h" |
michael@0 | 31 | #include "nsIWebBrowserSetup.h" |
michael@0 | 32 | #include "nsIWebBrowserPersist.h" |
michael@0 | 33 | #include "nsIWebBrowserFocus.h" |
michael@0 | 34 | #include "nsIWebBrowserStream.h" |
michael@0 | 35 | #include "nsIWindowWatcher.h" |
michael@0 | 36 | #include "nsIPrintSettings.h" |
michael@0 | 37 | #include "nsEmbedStream.h" |
michael@0 | 38 | #include "nsIWidgetListener.h" |
michael@0 | 39 | |
michael@0 | 40 | #include "nsTArray.h" |
michael@0 | 41 | #include "nsWeakPtr.h" |
michael@0 | 42 | |
michael@0 | 43 | class nsIContentViewerFile; |
michael@0 | 44 | |
michael@0 | 45 | class nsWebBrowserInitInfo |
michael@0 | 46 | { |
michael@0 | 47 | public: |
michael@0 | 48 | //nsIBaseWindow Stuff |
michael@0 | 49 | int32_t x; |
michael@0 | 50 | int32_t y; |
michael@0 | 51 | int32_t cx; |
michael@0 | 52 | int32_t cy; |
michael@0 | 53 | bool visible; |
michael@0 | 54 | nsCOMPtr<nsISHistory> sessionHistory; |
michael@0 | 55 | nsString name; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | class nsWebBrowserListenerState |
michael@0 | 59 | { |
michael@0 | 60 | public: |
michael@0 | 61 | bool Equals(nsIWeakReference *aListener, const nsIID& aID) { |
michael@0 | 62 | if (mWeakPtr.get() == aListener && mID.Equals(aID)) return true; |
michael@0 | 63 | return false; |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | nsWeakPtr mWeakPtr; |
michael@0 | 67 | nsIID mID; |
michael@0 | 68 | }; |
michael@0 | 69 | |
michael@0 | 70 | // {cda5863a-aa9c-411e-be49-ea0d525ab4b5} - |
michael@0 | 71 | #define NS_WEBBROWSER_CID \ |
michael@0 | 72 | {0xcda5863a, 0xaa9c, 0x411e, { 0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 }} |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | class nsWebBrowser : public nsIWebBrowser, |
michael@0 | 76 | public nsIWebNavigation, |
michael@0 | 77 | public nsIWebBrowserSetup, |
michael@0 | 78 | public nsIDocShellTreeItem, |
michael@0 | 79 | public nsIBaseWindow, |
michael@0 | 80 | public nsIScrollable, |
michael@0 | 81 | public nsITextScroll, |
michael@0 | 82 | public nsIInterfaceRequestor, |
michael@0 | 83 | public nsIWebBrowserPersist, |
michael@0 | 84 | public nsIWebBrowserFocus, |
michael@0 | 85 | public nsIWebProgressListener, |
michael@0 | 86 | public nsIWebBrowserStream, |
michael@0 | 87 | public nsIWidgetListener, |
michael@0 | 88 | public nsSupportsWeakReference |
michael@0 | 89 | { |
michael@0 | 90 | friend class nsDocShellTreeOwner; |
michael@0 | 91 | public: |
michael@0 | 92 | nsWebBrowser(); |
michael@0 | 93 | |
michael@0 | 94 | NS_DECL_ISUPPORTS |
michael@0 | 95 | |
michael@0 | 96 | NS_DECL_NSIBASEWINDOW |
michael@0 | 97 | NS_DECL_NSIDOCSHELLTREEITEM |
michael@0 | 98 | NS_DECL_NSIINTERFACEREQUESTOR |
michael@0 | 99 | NS_DECL_NSISCROLLABLE |
michael@0 | 100 | NS_DECL_NSITEXTSCROLL |
michael@0 | 101 | NS_DECL_NSIWEBBROWSER |
michael@0 | 102 | NS_DECL_NSIWEBNAVIGATION |
michael@0 | 103 | NS_DECL_NSIWEBBROWSERSETUP |
michael@0 | 104 | NS_DECL_NSIWEBBROWSERPERSIST |
michael@0 | 105 | NS_DECL_NSICANCELABLE |
michael@0 | 106 | NS_DECL_NSIWEBBROWSERFOCUS |
michael@0 | 107 | NS_DECL_NSIWEBBROWSERSTREAM |
michael@0 | 108 | NS_DECL_NSIWEBPROGRESSLISTENER |
michael@0 | 109 | |
michael@0 | 110 | protected: |
michael@0 | 111 | virtual ~nsWebBrowser(); |
michael@0 | 112 | NS_IMETHOD InternalDestroy(); |
michael@0 | 113 | |
michael@0 | 114 | // XXXbz why are these NS_IMETHOD? They're not interface methods! |
michael@0 | 115 | NS_IMETHOD SetDocShell(nsIDocShell* aDocShell); |
michael@0 | 116 | NS_IMETHOD EnsureDocShellTreeOwner(); |
michael@0 | 117 | NS_IMETHOD GetPrimaryContentWindow(nsIDOMWindow **aDomWindow); |
michael@0 | 118 | NS_IMETHOD BindListener(nsISupports *aListener, const nsIID& aIID); |
michael@0 | 119 | NS_IMETHOD UnBindListener(nsISupports *aListener, const nsIID& aIID); |
michael@0 | 120 | NS_IMETHOD EnableGlobalHistory(bool aEnable); |
michael@0 | 121 | |
michael@0 | 122 | // nsIWidgetListener |
michael@0 | 123 | virtual void WindowRaised(nsIWidget* aWidget); |
michael@0 | 124 | virtual void WindowLowered(nsIWidget* aWidget); |
michael@0 | 125 | virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) MOZ_OVERRIDE; |
michael@0 | 126 | |
michael@0 | 127 | protected: |
michael@0 | 128 | nsDocShellTreeOwner* mDocShellTreeOwner; |
michael@0 | 129 | nsCOMPtr<nsIDocShell> mDocShell; |
michael@0 | 130 | nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq; |
michael@0 | 131 | nsCOMPtr<nsIBaseWindow> mDocShellAsWin; |
michael@0 | 132 | nsCOMPtr<nsIWebNavigation> mDocShellAsNav; |
michael@0 | 133 | nsCOMPtr<nsIScrollable> mDocShellAsScrollable; |
michael@0 | 134 | nsCOMPtr<nsITextScroll> mDocShellAsTextScroll; |
michael@0 | 135 | nsCOMPtr<nsIWidget> mInternalWidget; |
michael@0 | 136 | nsCOMPtr<nsIWindowWatcher> mWWatch; |
michael@0 | 137 | nsWebBrowserInitInfo* mInitInfo; |
michael@0 | 138 | uint32_t mContentType; |
michael@0 | 139 | bool mActivating; |
michael@0 | 140 | bool mShouldEnableHistory; |
michael@0 | 141 | bool mIsActive; |
michael@0 | 142 | nativeWindow mParentNativeWindow; |
michael@0 | 143 | nsIWebProgressListener *mProgressListener; |
michael@0 | 144 | nsCOMPtr<nsIWebProgress> mWebProgress; |
michael@0 | 145 | |
michael@0 | 146 | nsCOMPtr<nsIPrintSettings> mPrintSettings; |
michael@0 | 147 | |
michael@0 | 148 | // cached background color |
michael@0 | 149 | nscolor mBackgroundColor; |
michael@0 | 150 | |
michael@0 | 151 | // persistence object |
michael@0 | 152 | nsCOMPtr<nsIWebBrowserPersist> mPersist; |
michael@0 | 153 | uint32_t mPersistCurrentState; |
michael@0 | 154 | nsresult mPersistResult; |
michael@0 | 155 | uint32_t mPersistFlags; |
michael@0 | 156 | |
michael@0 | 157 | // stream |
michael@0 | 158 | nsEmbedStream *mStream; |
michael@0 | 159 | nsCOMPtr<nsISupports> mStreamGuard; |
michael@0 | 160 | |
michael@0 | 161 | //Weak Reference interfaces... |
michael@0 | 162 | nsIWidget* mParentWidget; |
michael@0 | 163 | nsTArray<nsWebBrowserListenerState*>* mListenerArray; |
michael@0 | 164 | }; |
michael@0 | 165 | |
michael@0 | 166 | #endif /* nsWebBrowser_h__ */ |
michael@0 | 167 | |
michael@0 | 168 |