michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsWebBrowser_h__ michael@0: #define nsWebBrowser_h__ michael@0: michael@0: // Local Includes michael@0: #include "nsDocShellTreeOwner.h" michael@0: michael@0: // Core Includes michael@0: #include "nsCOMPtr.h" michael@0: michael@0: // Interfaces needed michael@0: #include "nsCWebBrowser.h" michael@0: #include "nsIBaseWindow.h" michael@0: #include "nsIDocShell.h" michael@0: #include "nsIDocShellTreeItem.h" michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsIInterfaceRequestorUtils.h" michael@0: #include "nsIScrollable.h" michael@0: #include "nsISHistory.h" michael@0: #include "nsITextScroll.h" michael@0: #include "nsIWidget.h" michael@0: #include "nsIWebProgress.h" michael@0: #include "nsISecureBrowserUI.h" michael@0: #include "nsIWebBrowser.h" michael@0: #include "nsIWebNavigation.h" michael@0: #include "nsIWebBrowserSetup.h" michael@0: #include "nsIWebBrowserPersist.h" michael@0: #include "nsIWebBrowserFocus.h" michael@0: #include "nsIWebBrowserStream.h" michael@0: #include "nsIWindowWatcher.h" michael@0: #include "nsIPrintSettings.h" michael@0: #include "nsEmbedStream.h" michael@0: #include "nsIWidgetListener.h" michael@0: michael@0: #include "nsTArray.h" michael@0: #include "nsWeakPtr.h" michael@0: michael@0: class nsIContentViewerFile; michael@0: michael@0: class nsWebBrowserInitInfo michael@0: { michael@0: public: michael@0: //nsIBaseWindow Stuff michael@0: int32_t x; michael@0: int32_t y; michael@0: int32_t cx; michael@0: int32_t cy; michael@0: bool visible; michael@0: nsCOMPtr sessionHistory; michael@0: nsString name; michael@0: }; michael@0: michael@0: class nsWebBrowserListenerState michael@0: { michael@0: public: michael@0: bool Equals(nsIWeakReference *aListener, const nsIID& aID) { michael@0: if (mWeakPtr.get() == aListener && mID.Equals(aID)) return true; michael@0: return false; michael@0: } michael@0: michael@0: nsWeakPtr mWeakPtr; michael@0: nsIID mID; michael@0: }; michael@0: michael@0: // {cda5863a-aa9c-411e-be49-ea0d525ab4b5} - michael@0: #define NS_WEBBROWSER_CID \ michael@0: {0xcda5863a, 0xaa9c, 0x411e, { 0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 }} michael@0: michael@0: michael@0: class nsWebBrowser : public nsIWebBrowser, michael@0: public nsIWebNavigation, michael@0: public nsIWebBrowserSetup, michael@0: public nsIDocShellTreeItem, michael@0: public nsIBaseWindow, michael@0: public nsIScrollable, michael@0: public nsITextScroll, michael@0: public nsIInterfaceRequestor, michael@0: public nsIWebBrowserPersist, michael@0: public nsIWebBrowserFocus, michael@0: public nsIWebProgressListener, michael@0: public nsIWebBrowserStream, michael@0: public nsIWidgetListener, michael@0: public nsSupportsWeakReference michael@0: { michael@0: friend class nsDocShellTreeOwner; michael@0: public: michael@0: nsWebBrowser(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: michael@0: NS_DECL_NSIBASEWINDOW michael@0: NS_DECL_NSIDOCSHELLTREEITEM michael@0: NS_DECL_NSIINTERFACEREQUESTOR michael@0: NS_DECL_NSISCROLLABLE michael@0: NS_DECL_NSITEXTSCROLL michael@0: NS_DECL_NSIWEBBROWSER michael@0: NS_DECL_NSIWEBNAVIGATION michael@0: NS_DECL_NSIWEBBROWSERSETUP michael@0: NS_DECL_NSIWEBBROWSERPERSIST michael@0: NS_DECL_NSICANCELABLE michael@0: NS_DECL_NSIWEBBROWSERFOCUS michael@0: NS_DECL_NSIWEBBROWSERSTREAM michael@0: NS_DECL_NSIWEBPROGRESSLISTENER michael@0: michael@0: protected: michael@0: virtual ~nsWebBrowser(); michael@0: NS_IMETHOD InternalDestroy(); michael@0: michael@0: // XXXbz why are these NS_IMETHOD? They're not interface methods! michael@0: NS_IMETHOD SetDocShell(nsIDocShell* aDocShell); michael@0: NS_IMETHOD EnsureDocShellTreeOwner(); michael@0: NS_IMETHOD GetPrimaryContentWindow(nsIDOMWindow **aDomWindow); michael@0: NS_IMETHOD BindListener(nsISupports *aListener, const nsIID& aIID); michael@0: NS_IMETHOD UnBindListener(nsISupports *aListener, const nsIID& aIID); michael@0: NS_IMETHOD EnableGlobalHistory(bool aEnable); michael@0: michael@0: // nsIWidgetListener michael@0: virtual void WindowRaised(nsIWidget* aWidget); michael@0: virtual void WindowLowered(nsIWidget* aWidget); michael@0: virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) MOZ_OVERRIDE; michael@0: michael@0: protected: michael@0: nsDocShellTreeOwner* mDocShellTreeOwner; michael@0: nsCOMPtr mDocShell; michael@0: nsCOMPtr mDocShellAsReq; michael@0: nsCOMPtr mDocShellAsWin; michael@0: nsCOMPtr mDocShellAsNav; michael@0: nsCOMPtr mDocShellAsScrollable; michael@0: nsCOMPtr mDocShellAsTextScroll; michael@0: nsCOMPtr mInternalWidget; michael@0: nsCOMPtr mWWatch; michael@0: nsWebBrowserInitInfo* mInitInfo; michael@0: uint32_t mContentType; michael@0: bool mActivating; michael@0: bool mShouldEnableHistory; michael@0: bool mIsActive; michael@0: nativeWindow mParentNativeWindow; michael@0: nsIWebProgressListener *mProgressListener; michael@0: nsCOMPtr mWebProgress; michael@0: michael@0: nsCOMPtr mPrintSettings; michael@0: michael@0: // cached background color michael@0: nscolor mBackgroundColor; michael@0: michael@0: // persistence object michael@0: nsCOMPtr mPersist; michael@0: uint32_t mPersistCurrentState; michael@0: nsresult mPersistResult; michael@0: uint32_t mPersistFlags; michael@0: michael@0: // stream michael@0: nsEmbedStream *mStream; michael@0: nsCOMPtr mStreamGuard; michael@0: michael@0: //Weak Reference interfaces... michael@0: nsIWidget* mParentWidget; michael@0: nsTArray* mListenerArray; michael@0: }; michael@0: michael@0: #endif /* nsWebBrowser_h__ */ michael@0: michael@0: