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