1
//copyright xiphos; license gpl2
3
#ifndef __PCF_MIRO_BROWSER_EMBED_H__
4
#define __PCF_MIRO_BROWSER_EMBED_H__
8
#include "nsIWebBrowserChrome.h"
9
#include "nsIEmbeddingSiteWindow.h"
10
#include "nsIWebBrowser.h"
11
#include "nsIInterfaceRequestor.h"
12
#include "nsIWebBrowserChromeFocus.h"
13
#include "docshell/nsIWebNavigation.h"
14
#include "widget/nsIBaseWindow.h"
15
#include "uriloader/nsIURIContentListener.h"
16
#include "uriloader/nsIWebProgressListener.h"
17
#include "xpcom/nsWeakReference.h"
18
#include "shistory/nsIHistoryEntry.h"
19
#include "shistory/nsISHistory.h"
20
#include "EmbedEventListener.h"
21
#include "gecko-html.h"
22
#include "content/nsPIDOMEventTarget.h"
23
#include "nsEmbedString.h"
24
#include "fastfind/nsITypeAheadFind.h"
25
#include "dom/nsPIDOMWindow.h"
26
#include "nsIContextMenuListener.h"
28
#include "main/module_dialogs.h"
30
typedef void(*focusCallback)(PRBool forward, void* data);
31
typedef int(*uriCallback)(char* uri, void* data);
32
typedef void(*networkCallback)(PRBool is_start, void* data);
34
class EmbedEventListener;
36
class BrowserEmbed : public nsIWebBrowserChrome,
37
public nsIWebBrowserChromeFocus,
38
public nsIEmbeddingSiteWindow,
39
public nsIInterfaceRequestor,
40
public nsIURIContentListener,
41
public nsIWebProgressListener,
42
public nsSupportsWeakReference,
43
public nsIContextMenuListener
48
virtual ~BrowserEmbed();
51
* Methods from the XPCOM interfaces we implement. These are proiveded
56
NS_DECL_NSIWEBBROWSERCHROME
57
NS_DECL_NSIEMBEDDINGSITEWINDOW
58
NS_DECL_NSIINTERFACEREQUESTOR
59
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
60
NS_DECL_NSIURICONTENTLISTENER
61
NS_DECL_NSIWEBPROGRESSLISTENER
62
NS_DECL_NSICONTEXTMENULISTENER
65
* Methods to interact with the MiroBrowserEmbed from Cython. These are
69
// Create a WebBrowser object and place it inside parentWindow. This must
70
// be called before any other methods.
71
nsresult init(unsigned long parentWindow, int x, int y, int width,
72
int height, GeckoHtml *owner);
73
// Stop the browser from painting to the screen or handling input
75
// Startup the browser again after a call to disable()
77
// Load a URI into the browser
78
nsresult loadURI(const char* uri);
79
// Gets the current uri from mWebNavigator
80
nsresult getCurrentURI(char ** uri);
81
// Gets the current title from a long chain of things
82
nsresult getCurrentTitle(wchar_t ** aTitle);
83
// Call when the parent window changes size
84
nsresult resize(int x, int y, int width, int height);
85
// Give the browser keyboard focus
87
// Browser Navigation buttons. Their functionality corresponds to the
88
// nsIWebNavigation interface
95
// Set the focus callback. This will be called when the user tabs through
96
// all the elements in the browser and the next Widget should be given
98
void SetFocusCallback(focusCallback callback, void* data);
99
// Set the URI callback. This well be called when we are about to load a
100
// new URI. It should return 0 if the URI shouldn't be loaded.
101
void SetURICallback(uriCallback callback, void* data);
102
// Set the Network callback. This is called when we start loading a
103
// document and when all network activity for a document is finished
104
// new URI. It should return 0 if the URI shouldn't be loaded.
105
void SetNetworkCallback(networkCallback callback, void* data);
106
// Destroy the broswer
109
char * GetLinkMessage();
110
gint ProcessMouseDblClickEvent(void *aEvent);
111
gint ProcessMouseEvent(void *aEvent);
112
gint ProcessMouseUpEvent(void *aEvent);
113
gint ProcessMouseOver(void *aEvent, int pane,
114
gboolean is_dialog, DIALOG_DATA *dialog);
116
gint ProcessKeyDownEvent(void *aEvent);
117
gint ProcessKeyReleaseEvent(void *aEvent);
119
void DoCommand (const char *aAcommand);
121
nsresult OpenStream (const char *aBaseURI, const char *aContentType);
122
nsresult AppendToStream (const PRUint8 *aData, PRUint32 aLen);
123
nsresult CloseStream (void);
124
void ContentStateChange(void);
126
PRBool Find(const char* aSearchString);
127
PRBool FindAgain(PRBool aForward);
128
void SetSelectionAttention (PRBool aAttention);
129
void JumpToAnchor (const char *anchor);
130
void GetListener (void);
131
void SetFindProperties (PRBool aCaseSensitive);
133
void ChildFocusIn(void);
134
void ChildFocusOut(void);
136
EmbedEventListener *mEventListener;
137
nsCOMPtr<nsISupports> mEventListenerGuard;
138
PRBool mListenersAttached;
139
nsCOMPtr<nsIDOMEventTarget> mEventTarget;
141
nsString mLinkMessage;
145
nativeWindow mWindow;
146
PRUint32 mChromeFlags;
147
PRBool mContinueModalLoop;
148
focusCallback mFocusCallback;
149
uriCallback mURICallback;
150
networkCallback mNetworkCallback;
151
void* mFocusCallbackData;
152
void* mURICallbackData;
153
void* mNetworkCallbackData;
154
PRPackedBool mInitialised;
155
PRPackedBool mSelectionAttention;
156
nsCOMPtr<nsITypeAheadFind> mFinder;
158
nsCOMPtr<nsIWebBrowser> mWebBrowser;
159
nsCOMPtr<nsIWebNavigation> mWebNavigation;
160
nsCOMPtr<nsIURIContentListener> mParentContentListener;
161
void log(int level, char* string);
164
void AttachListeners (void);
165
void DetachListeners (void);
166
nsresult GetPIDOMWindow(nsPIDOMWindow **aPIWin);
170
/* Couple of utility functions, since the XPCOM Macros don't seem to work from
173
void addref(BrowserEmbed* browser);
174
void release(BrowserEmbed* browser);
176
#endif /* __PCF_MIRO_BROWSER_EMBED_H__ */