NativeWebInterfaceBrowserProxy.h
8.7 KB
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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// Engine/Source/Runtime/WebBrowser/Private/Native/NativeWebBrowserProxy.h
#pragma once
#include "CoreMinimal.h"
#include "IWebInterfaceBrowserWindow.h"
#include "NativeInterfaceJSScripting.h"
class FNativeWebInterfaceBrowserProxy
: public IWebInterfaceBrowserWindow
, public TSharedFromThis<FNativeWebInterfaceBrowserProxy>
{
// For creating instances of this class
friend class FWebInterfaceBrowserSingleton;
private:
FNativeWebInterfaceBrowserProxy(bool bJSBindingToLoweringEnabled);
void Initialize();
void HandleEmbeddedCommunication(const struct FEmbeddedCallParamsHelper& Params);
bool OnJsMessageReceived(const FString& Message);
public:
virtual ~FNativeWebInterfaceBrowserProxy();
public:
// IWebBrowserWindow Interface
virtual void LoadURL(FString NewURL) override;
virtual void LoadString(FString Contents, FString DummyURL) override;
virtual void SetViewportSize(FIntPoint WindowSize, FIntPoint WindowPos) override;
virtual FIntPoint GetViewportSize() const override;
virtual class FSlateShaderResource* GetTexture(bool bIsPopup = false) override;
virtual bool IsValid() const override;
virtual bool IsInitialized() const override;
virtual bool IsClosing() const override;
virtual EWebInterfaceBrowserDocumentState GetDocumentLoadingState() const override;
virtual FString GetTitle() const override;
virtual FString GetUrl() const override;
virtual void GetSource(TFunction<void(const FString&)> Callback) const override;
virtual bool OnKeyDown(const FKeyEvent& InKeyEvent) override;
virtual bool OnKeyUp(const FKeyEvent& InKeyEvent) override;
virtual bool OnKeyChar(const FCharacterEvent& InCharacterEvent) override;
virtual void SetSupportsMouseWheel(bool bValue) override;
virtual bool GetSupportsMouseWheel() const override;
virtual FReply OnMouseButtonDown(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) override;
virtual FReply OnMouseButtonUp(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) override;
virtual FReply OnMouseButtonDoubleClick(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) override;
virtual FReply OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) override;
virtual void OnMouseLeave(const FPointerEvent& MouseEvent) override;
virtual FReply OnMouseWheel(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent, bool bIsPopup) override;
virtual FOnDragWindow& OnDragWindow() override
{
return DragWindowDelegate;
}
virtual void OnFocus(bool SetFocus, bool bIsPopup) override;
virtual void OnCaptureLost() override;
virtual bool CanGoBack() const override;
virtual void GoBack() override;
virtual bool CanGoForward() const override;
virtual void GoForward() override;
virtual bool IsLoading() const override;
virtual void Reload() override;
virtual void StopLoad() override;
virtual void ExecuteJavascript(const FString& Script) override;
virtual void CloseBrowser(bool bForce) override;
virtual void BindUObject(const FString& Name, UObject* Object, bool bIsPermanent = true) override;
virtual void UnbindUObject(const FString& Name, UObject* Object = nullptr, bool bIsPermanent = true) override;
virtual int GetLoadError() override;
virtual void SetIsDisabled(bool bValue) override;
virtual TSharedPtr<SWindow> GetParentWindow() const override;
virtual void SetParentWindow(TSharedPtr<SWindow> Window) override;
// @todo: None of these are actually called at the moment.
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnDocumentStateChanged, FOnDocumentStateChanged);
virtual FOnDocumentStateChanged& OnDocumentStateChanged() override
{
return DocumentStateChangedEvent;
}
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnTitleChanged, FOnTitleChanged);
virtual FOnTitleChanged& OnTitleChanged() override
{
return TitleChangedEvent;
}
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnUrlChanged, FOnUrlChanged);
virtual FOnUrlChanged& OnUrlChanged() override
{
return UrlChangedEvent;
}
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnToolTip, FOnToolTip);
virtual FOnToolTip& OnToolTip() override
{
return ToolTipEvent;
}
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnNeedsRedraw, FOnNeedsRedraw);
virtual FOnNeedsRedraw& OnNeedsRedraw() override
{
return NeedsRedrawEvent;
}
virtual FOnBeforeBrowse& OnBeforeBrowse() override
{
return BeforeBrowseDelegate;
}
virtual FOnLoadUrl& OnLoadUrl() override
{
return LoadUrlDelegate;
}
virtual FOnCreateWindow& OnCreateWindow() override
{
return CreateWindowDelegate;
}
virtual FOnCloseWindow& OnCloseWindow() override
{
return CloseWindowDelegate;
}
virtual FCursorReply OnCursorQuery(const FGeometry& MyGeometry, const FPointerEvent& CursorEvent) override
{
return FCursorReply::Unhandled();
}
virtual FOnBeforePopupDelegate& OnBeforePopup() override
{
return BeforePopupDelegate;
}
virtual FOnBeforeResourceLoadDelegate& OnBeforeResourceLoad() override
{
return BeforeResourceLoadDelegate;
}
virtual FOnResourceLoadCompleteDelegate& OnResourceLoadComplete() override
{
return ResourceLoadCompleteDelegate;
}
virtual FOnConsoleMessageDelegate& OnConsoleMessage() override
{
return ConsoleMessageDelegate;
}
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnShowPopup, FOnShowPopup);
virtual FOnShowPopup& OnShowPopup() override
{
return ShowPopupEvent;
}
DECLARE_DERIVED_EVENT(FNativeWebInterfaceBrowserProxy, IWebInterfaceBrowserWindow::FOnDismissPopup, FOnDismissPopup);
virtual FOnDismissPopup& OnDismissPopup() override
{
return DismissPopupEvent;
}
virtual FOnShowDialog& OnShowDialog() override
{
return ShowDialogDelegate;
}
virtual FOnDismissAllDialogs& OnDismissAllDialogs() override
{
return DismissAllDialogsDelegate;
}
virtual FOnSuppressContextMenu& OnSuppressContextMenu() override
{
return SuppressContextMenuDelgate;
}
virtual FOnUnhandledKeyDown& OnUnhandledKeyDown() override
{
return UnhandledKeyDownDelegate;
}
virtual FOnUnhandledKeyUp& OnUnhandledKeyUp() override
{
return UnhandledKeyUpDelegate;
}
virtual FOnUnhandledKeyChar& OnUnhandledKeyChar() override
{
return UnhandledKeyCharDelegate;
}
private:
/** Delegate for broadcasting load state changes. */
FOnDocumentStateChanged DocumentStateChangedEvent;
/** Delegate for broadcasting title changes. */
FOnTitleChanged TitleChangedEvent;
/** Delegate for broadcasting address changes. */
FOnUrlChanged UrlChangedEvent;
/** Delegate for broadcasting when the browser wants to show a tool tip. */
FOnToolTip ToolTipEvent;
/** Delegate for notifying that the window needs refreshing. */
FOnNeedsRedraw NeedsRedrawEvent;
/** Delegate that is executed prior to browser navigation. */
FOnBeforeBrowse BeforeBrowseDelegate;
/** Delegate for overriding Url contents. */
FOnLoadUrl LoadUrlDelegate;
/** Delegate for notifying that a popup window is attempting to open. */
FOnBeforePopupDelegate BeforePopupDelegate;
/** Delegate that is invoked before the browser loads a resource. Its primary purpose is to inject headers into the request. */
FOnBeforeResourceLoadDelegate BeforeResourceLoadDelegate;
/** Delegate that is invoked on completion of browser resource loads. Its primary purpose is to allow response to failures. */
FOnResourceLoadCompleteDelegate ResourceLoadCompleteDelegate;
/** Delegate that is invoked for each console message */
FOnConsoleMessageDelegate ConsoleMessageDelegate;
/** Delegate for handling requests to create new windows. */
FOnCreateWindow CreateWindowDelegate;
/** Delegate for handling requests to close new windows that were created. */
FOnCloseWindow CloseWindowDelegate;
/** Delegate for handling requests to show the popup menu. */
FOnShowPopup ShowPopupEvent;
/** Delegate for handling requests to dismiss the current popup menu. */
FOnDismissPopup DismissPopupEvent;
/** Delegate for showing dialogs. */
FOnShowDialog ShowDialogDelegate;
/** Delegate for dismissing all dialogs. */
FOnDismissAllDialogs DismissAllDialogsDelegate;
/** Delegate for suppressing context menu */
FOnSuppressContextMenu SuppressContextMenuDelgate;
/** Delegate for handling key down events not handled by the browser. */
FOnUnhandledKeyDown UnhandledKeyDownDelegate;
/** Delegate for handling key up events not handled by the browser. */
FOnUnhandledKeyUp UnhandledKeyUpDelegate;
/** Delegate for handling key char events not handled by the browser. */
FOnUnhandledKeyChar UnhandledKeyCharDelegate;
FOnDragWindow DragWindowDelegate;
bool bJSBindingToLoweringEnabled;
FNativeInterfaceJSScriptingPtr Scripting;
};