Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / embedding / browser / webBrowser / nsWebBrowser.h
blob694eea66ecffef880e2bb11e73f5300368ad9d98
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
16 * The Original Code is the Mozilla browser.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications, Inc.
20 * Portions created by the Initial Developer are Copyright (C) 1999
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Travis Bogard <travis@netscape.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef nsWebBrowser_h__
41 #define nsWebBrowser_h__
43 // Local Includes
44 #include "nsDocShellTreeOwner.h"
46 // Core Includes
47 #include "nsCOMPtr.h"
49 // Interfaces needed
50 #include "nsCWebBrowser.h"
51 #include "nsIBaseWindow.h"
52 #include "nsIDocShell.h"
53 #include "nsIDocShellTreeItem.h"
54 #include "nsIDocShellTreeNode.h"
55 #include "nsIInterfaceRequestor.h"
56 #include "nsIInterfaceRequestorUtils.h"
57 #include "nsIScrollable.h"
58 #include "nsISHistory.h"
59 #include "nsITextScroll.h"
60 #include "nsIWidget.h"
61 #include "nsIWebProgress.h"
62 #include "nsISecureBrowserUI.h"
63 #include "nsIWebBrowser.h"
64 #include "nsIWebNavigation.h"
65 #include "nsIWebBrowserSetup.h"
66 #include "nsIWebBrowserPersist.h"
67 #include "nsIWebBrowserFocus.h"
68 #include "nsIWebBrowserStream.h"
69 #include "nsIWindowWatcher.h"
70 #include "nsIPrintSettings.h"
71 #include "nsEmbedStream.h"
73 #include "nsVoidArray.h"
74 #include "nsWeakPtr.h"
76 class nsIContentViewerFile;
78 class nsWebBrowserInitInfo
80 public:
81 //nsIBaseWindow Stuff
82 PRInt32 x;
83 PRInt32 y;
84 PRInt32 cx;
85 PRInt32 cy;
86 PRBool visible;
87 nsCOMPtr<nsISHistory> sessionHistory;
88 nsString name;
91 class nsWebBrowserListenerState
93 public:
94 PRBool Equals(nsIWeakReference *aListener, const nsIID& aID) {
95 if (mWeakPtr.get() == aListener && mID.Equals(aID)) return PR_TRUE;
96 return PR_FALSE;
99 nsWeakPtr mWeakPtr;
100 nsIID mID;
103 // {F1EAC761-87E9-11d3-AF80-00A024FFC08C} -
104 #define NS_WEBBROWSER_CID \
105 {0xf1eac761, 0x87e9, 0x11d3, { 0xaf, 0x80, 0x00, 0xa0, 0x24, 0xff, 0xc0, 0x8c }}
108 class nsWebBrowser : public nsIWebBrowser,
109 public nsIWebNavigation,
110 public nsIWebBrowserSetup,
111 public nsIDocShellTreeItem,
112 public nsIBaseWindow,
113 public nsIScrollable,
114 public nsITextScroll,
115 public nsIInterfaceRequestor,
116 public nsIWebBrowserPersist,
117 public nsIWebBrowserFocus,
118 public nsIWebProgressListener,
119 public nsIWebBrowserStream,
120 public nsSupportsWeakReference
122 friend class nsDocShellTreeOwner;
123 public:
124 nsWebBrowser();
126 NS_DECL_ISUPPORTS
128 NS_DECL_NSIBASEWINDOW
129 NS_DECL_NSIDOCSHELLTREEITEM
130 NS_DECL_NSIDOCSHELLTREENODE
131 NS_DECL_NSIINTERFACEREQUESTOR
132 NS_DECL_NSISCROLLABLE
133 NS_DECL_NSITEXTSCROLL
134 NS_DECL_NSIWEBBROWSER
135 NS_DECL_NSIWEBNAVIGATION
136 NS_DECL_NSIWEBBROWSERSETUP
137 NS_DECL_NSIWEBBROWSERPERSIST
138 NS_DECL_NSICANCELABLE
139 NS_DECL_NSIWEBBROWSERFOCUS
140 NS_DECL_NSIWEBBROWSERSTREAM
141 NS_DECL_NSIWEBPROGRESSLISTENER
143 protected:
144 virtual ~nsWebBrowser();
145 NS_IMETHOD InternalDestroy();
147 NS_IMETHOD SetDocShell(nsIDocShell* aDocShell);
148 NS_IMETHOD EnsureDocShellTreeOwner();
149 NS_IMETHOD GetPrimaryContentWindow(nsIDOMWindowInternal **aDomWindow);
150 NS_IMETHOD BindListener(nsISupports *aListener, const nsIID& aIID);
151 NS_IMETHOD UnBindListener(nsISupports *aListener, const nsIID& aIID);
152 NS_IMETHOD EnableGlobalHistory(PRBool aEnable);
154 static nsEventStatus HandleEvent(nsGUIEvent *aEvent);
156 protected:
157 nsDocShellTreeOwner* mDocShellTreeOwner;
158 nsCOMPtr<nsIDocShell> mDocShell;
159 nsCOMPtr<nsIInterfaceRequestor> mDocShellAsReq;
160 nsCOMPtr<nsIBaseWindow> mDocShellAsWin;
161 nsCOMPtr<nsIDocShellTreeItem> mDocShellAsItem;
162 nsCOMPtr<nsIWebNavigation> mDocShellAsNav;
163 nsCOMPtr<nsIScrollable> mDocShellAsScrollable;
164 nsCOMPtr<nsITextScroll> mDocShellAsTextScroll;
165 nsCOMPtr<nsIWidget> mInternalWidget;
166 nsCOMPtr<nsIWindowWatcher> mWWatch;
167 nsWebBrowserInitInfo* mInitInfo;
168 PRUint32 mContentType;
169 PRPackedBool mActivating;
170 PRPackedBool mShouldEnableHistory;
171 nativeWindow mParentNativeWindow;
172 nsIWebProgressListener *mProgressListener;
173 nsCOMPtr<nsIWebProgress> mWebProgress;
175 nsCOMPtr<nsIPrintSettings> mPrintSettings;
177 // cached background color
178 nscolor mBackgroundColor;
180 // persistence object
181 nsCOMPtr<nsIWebBrowserPersist> mPersist;
182 PRUint32 mPersistCurrentState;
183 PRUint32 mPersistResult;
184 PRUint32 mPersistFlags;
186 // stream
187 nsEmbedStream *mStream;
188 nsCOMPtr<nsISupports> mStreamGuard;
190 //Weak Reference interfaces...
191 nsIWidget* mParentWidget;
192 nsVoidArray * mListenerArray;
195 #endif /* nsWebBrowser_h__ */