1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
/*
* Copyright © Christopher Blizzard
* Copyright © 2006 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* ---------------------------------------------------------------------------
* Derived from Mozilla.org code, which had the following attributions:
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Christopher Blizzard. Portions created by Christopher Blizzard are Copyright © Christopher Blizzard. All Rights Reserved.
* Portions created by the Initial Developer are Copyright © 2001
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Christopher Blizzard <blizzard@mozilla.org>
* ---------------------------------------------------------------------------
*
* $Id$
*/
#ifndef __GeckoBrowser_h
#define __GeckoBrowser_h
#include <nsCOMPtr.h>
#include <nsEmbedString.h>
#include <nsIWebNavigation.h>
#include <nsISHistory.h>
// for our one function that gets the GeckoBrowser via the chrome
// object.
#include <nsIWebBrowserChrome.h>
#include <nsIAppShell.h>
#include <nsPIDOMEventTarget.h>
// app component registration
#include <nsIGenericFactory.h>
#include <nsIComponentRegistrar.h>
#include "gecko-embed.h"
class EmbedProfile;
class EmbedProgress;
class EmbedWindow;
class EmbedContentListener;
class EmbedEventListener;
class nsPIDOMWindow;
class nsIDirectoryServiceProvider;
class nsProfileDirServiceProvider;
class GeckoBrowser {
public:
GeckoBrowser();
~GeckoBrowser();
nsresult Init (GeckoEmbed *aOwningWidget);
nsresult Realize (PRBool *aAlreadRealized);
void Unrealize (void);
void Show (void);
void Hide (void);
void Resize (PRUint32 aWidth, PRUint32 aHeight);
void Destroy (void);
void SetURI (const char *aURI);
void LoadCurrentURI (void);
void Reload (PRUint32 reloadFlags);
void SetChromeMask (PRUint32 chromeMask);
void ApplyChromeMask ();
nsresult OpenStream (const char *aBaseURI, const char *aContentType);
nsresult AppendToStream (const char *aData, PRInt32 aLen);
nsresult CloseStream (void);
// This is an upcall that will come from the progress listener
// whenever there is a content state change. We need this so we can
// attach event listeners.
void ContentStateChange (void);
// This is an upcall from the progress listener when content is
// finished loading. We have this so that if it's chrome content
// that we can size to content properly and show ourselves if
// visibility is set.
void ContentFinishedLoading(void);
// these let the widget code know when the toplevel window gets and
// looses focus.
void TopLevelFocusIn (void);
void TopLevelFocusOut(void);
// these are when the widget itself gets focus in and focus out
// events
void ChildFocusIn (void);
void ChildFocusOut(void);
#ifdef MOZ_ACCESSIBILITY_ATK
void *GetAtkObjectForCurrentDocument();
#endif
GeckoEmbed *mOwningWidget;
// all of the objects that we own
EmbedWindow *mWindow;
nsCOMPtr<nsISupports> mWindowGuard;
EmbedProgress *mProgress;
nsCOMPtr<nsISupports> mProgressGuard;
EmbedContentListener *mContentListener;
nsCOMPtr<nsISupports> mContentListenerGuard;
EmbedEventListener *mEventListener;
nsCOMPtr<nsISupports> mEventListenerGuard;
nsCOMPtr<nsIWebNavigation> mNavigation;
nsCOMPtr<nsISHistory> mSessionHistory;
// our event receiver
nsCOMPtr<nsPIDOMEventTarget> mEventTarget;
// the currently loaded uri
nsEmbedCString mURI;
// chrome mask
PRUint32 mChromeMask;
// is this a chrome window?
PRBool mIsChrome;
// has the chrome finished loading?
PRBool mChromeLoaded;
// saved window ID for reparenting later
GtkWidget *mMozWindowWidget;
// has someone called Destroy() on us?
PRBool mIsDestroyed;
private:
// is the chrome listener attached yet?
PRBool mListenersAttached;
void GetListener (void);
void AttachListeners (void);
void DetachListeners (void);
// this will get the PIDOMWindow for this widget
nsresult GetPIDOMWindow (nsPIDOMWindow **aPIWin);
};
#endif /* __GeckoBrowser_h */
|