1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/embedding/browser/webBrowser/nsWebBrowser.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,168 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- 1.5 + * 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef nsWebBrowser_h__ 1.11 +#define nsWebBrowser_h__ 1.12 + 1.13 +// Local Includes 1.14 +#include "nsDocShellTreeOwner.h" 1.15 + 1.16 +// Core Includes 1.17 +#include "nsCOMPtr.h" 1.18 + 1.19 +// Interfaces needed 1.20 +#include "nsCWebBrowser.h" 1.21 +#include "nsIBaseWindow.h" 1.22 +#include "nsIDocShell.h" 1.23 +#include "nsIDocShellTreeItem.h" 1.24 +#include "nsIInterfaceRequestor.h" 1.25 +#include "nsIInterfaceRequestorUtils.h" 1.26 +#include "nsIScrollable.h" 1.27 +#include "nsISHistory.h" 1.28 +#include "nsITextScroll.h" 1.29 +#include "nsIWidget.h" 1.30 +#include "nsIWebProgress.h" 1.31 +#include "nsISecureBrowserUI.h" 1.32 +#include "nsIWebBrowser.h" 1.33 +#include "nsIWebNavigation.h" 1.34 +#include "nsIWebBrowserSetup.h" 1.35 +#include "nsIWebBrowserPersist.h" 1.36 +#include "nsIWebBrowserFocus.h" 1.37 +#include "nsIWebBrowserStream.h" 1.38 +#include "nsIWindowWatcher.h" 1.39 +#include "nsIPrintSettings.h" 1.40 +#include "nsEmbedStream.h" 1.41 +#include "nsIWidgetListener.h" 1.42 + 1.43 +#include "nsTArray.h" 1.44 +#include "nsWeakPtr.h" 1.45 + 1.46 +class nsIContentViewerFile; 1.47 + 1.48 +class nsWebBrowserInitInfo 1.49 +{ 1.50 +public: 1.51 + //nsIBaseWindow Stuff 1.52 + int32_t x; 1.53 + int32_t y; 1.54 + int32_t cx; 1.55 + int32_t cy; 1.56 + bool visible; 1.57 + nsCOMPtr<nsISHistory> sessionHistory; 1.58 + nsString name; 1.59 +}; 1.60 + 1.61 +class nsWebBrowserListenerState 1.62 +{ 1.63 +public: 1.64 + bool Equals(nsIWeakReference *aListener, const nsIID& aID) { 1.65 + if (mWeakPtr.get() == aListener && mID.Equals(aID)) return true; 1.66 + return false; 1.67 + } 1.68 + 1.69 + nsWeakPtr mWeakPtr; 1.70 + nsIID mID; 1.71 +}; 1.72 + 1.73 +// {cda5863a-aa9c-411e-be49-ea0d525ab4b5} - 1.74 +#define NS_WEBBROWSER_CID \ 1.75 +{0xcda5863a, 0xaa9c, 0x411e, { 0xbe, 0x49, 0xea, 0x0d, 0x52, 0x5a, 0xb4, 0xb5 }} 1.76 + 1.77 + 1.78 +class nsWebBrowser : public nsIWebBrowser, 1.79 + public nsIWebNavigation, 1.80 + public nsIWebBrowserSetup, 1.81 + public nsIDocShellTreeItem, 1.82 + public nsIBaseWindow, 1.83 + public nsIScrollable, 1.84 + public nsITextScroll, 1.85 + public nsIInterfaceRequestor, 1.86 + public nsIWebBrowserPersist, 1.87 + public nsIWebBrowserFocus, 1.88 + public nsIWebProgressListener, 1.89 + public nsIWebBrowserStream, 1.90 + public nsIWidgetListener, 1.91 + public nsSupportsWeakReference 1.92 +{ 1.93 +friend class nsDocShellTreeOwner; 1.94 +public: 1.95 + nsWebBrowser(); 1.96 + 1.97 + NS_DECL_ISUPPORTS 1.98 + 1.99 + NS_DECL_NSIBASEWINDOW 1.100 + NS_DECL_NSIDOCSHELLTREEITEM 1.101 + NS_DECL_NSIINTERFACEREQUESTOR 1.102 + NS_DECL_NSISCROLLABLE 1.103 + NS_DECL_NSITEXTSCROLL 1.104 + NS_DECL_NSIWEBBROWSER 1.105 + NS_DECL_NSIWEBNAVIGATION 1.106 + NS_DECL_NSIWEBBROWSERSETUP 1.107 + NS_DECL_NSIWEBBROWSERPERSIST 1.108 + NS_DECL_NSICANCELABLE 1.109 + NS_DECL_NSIWEBBROWSERFOCUS 1.110 + NS_DECL_NSIWEBBROWSERSTREAM 1.111 + NS_DECL_NSIWEBPROGRESSLISTENER 1.112 + 1.113 +protected: 1.114 + virtual ~nsWebBrowser(); 1.115 + NS_IMETHOD InternalDestroy(); 1.116 + 1.117 + // XXXbz why are these NS_IMETHOD? They're not interface methods! 1.118 + NS_IMETHOD SetDocShell(nsIDocShell* aDocShell); 1.119 + NS_IMETHOD EnsureDocShellTreeOwner(); 1.120 + NS_IMETHOD GetPrimaryContentWindow(nsIDOMWindow **aDomWindow); 1.121 + NS_IMETHOD BindListener(nsISupports *aListener, const nsIID& aIID); 1.122 + NS_IMETHOD UnBindListener(nsISupports *aListener, const nsIID& aIID); 1.123 + NS_IMETHOD EnableGlobalHistory(bool aEnable); 1.124 + 1.125 + // nsIWidgetListener 1.126 + virtual void WindowRaised(nsIWidget* aWidget); 1.127 + virtual void WindowLowered(nsIWidget* aWidget); 1.128 + virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) MOZ_OVERRIDE; 1.129 + 1.130 +protected: 1.131 + nsDocShellTreeOwner* mDocShellTreeOwner; 1.132 + nsCOMPtr<nsIDocShell> mDocShell; 1.133 + nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq; 1.134 + nsCOMPtr<nsIBaseWindow> mDocShellAsWin; 1.135 + nsCOMPtr<nsIWebNavigation> mDocShellAsNav; 1.136 + nsCOMPtr<nsIScrollable> mDocShellAsScrollable; 1.137 + nsCOMPtr<nsITextScroll> mDocShellAsTextScroll; 1.138 + nsCOMPtr<nsIWidget> mInternalWidget; 1.139 + nsCOMPtr<nsIWindowWatcher> mWWatch; 1.140 + nsWebBrowserInitInfo* mInitInfo; 1.141 + uint32_t mContentType; 1.142 + bool mActivating; 1.143 + bool mShouldEnableHistory; 1.144 + bool mIsActive; 1.145 + nativeWindow mParentNativeWindow; 1.146 + nsIWebProgressListener *mProgressListener; 1.147 + nsCOMPtr<nsIWebProgress> mWebProgress; 1.148 + 1.149 + nsCOMPtr<nsIPrintSettings> mPrintSettings; 1.150 + 1.151 + // cached background color 1.152 + nscolor mBackgroundColor; 1.153 + 1.154 + // persistence object 1.155 + nsCOMPtr<nsIWebBrowserPersist> mPersist; 1.156 + uint32_t mPersistCurrentState; 1.157 + nsresult mPersistResult; 1.158 + uint32_t mPersistFlags; 1.159 + 1.160 + // stream 1.161 + nsEmbedStream *mStream; 1.162 + nsCOMPtr<nsISupports> mStreamGuard; 1.163 + 1.164 + //Weak Reference interfaces... 1.165 + nsIWidget* mParentWidget; 1.166 + nsTArray<nsWebBrowserListenerState*>* mListenerArray; 1.167 +}; 1.168 + 1.169 +#endif /* nsWebBrowser_h__ */ 1.170 + 1.171 +