Files
UnrealEngineUWP/Engine/Source/Runtime/WebBrowser/Private/Android/AndroidWebBrowserDialog.h
Sorin Gradinaru 1d89a48b13 UEMOB-185 Implement the equivalent of FAndroidJSScripting for iOS
UE-59488 FWebBrowserWindow::UnbindUObject of IOSPlatformWebBrowser.cpp is not implemented yet

#jira UEMOB-185
#jira UE-59488
#4.21
#iOS
#rb Jack.Porter

New methods (using WebKit, matching the Android implementation):
- Go back/forward
- HandlePageLoading (loading/didCommitNavigation, loaded/didFinishNavigation)
- HandleReceivedError (didFailNavigation)
- execute JS code
- controlling the client using JS commands (WKWebViewConfiguration & WKUserContentController):
	- in Android we using shouldInterceptRequest to intercept a custom resource URL (JS: XMLHttpRequest.send, document.location)
	- iOS will register handlers (JS: window.webkit.messageHandlers.<FMobileJSScripting::JSMessageHandler>.postMessage)

[CL 4343824 by Sorin Gradinaru in Dev-Mobile branch]
2018-09-05 04:55:55 -04:00

67 lines
1.5 KiB
C++

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#if USE_ANDROID_JNI
#include "IWebBrowserDialog.h"
#include <jni.h>
class SAndroidWebBrowserWidget;
class FAndroidWebBrowserDialog
: public IWebBrowserDialog
{
public:
virtual ~FAndroidWebBrowserDialog()
{}
// IWebBrowserDialog interface:
virtual EWebBrowserDialogType GetType() override
{
return Type;
}
virtual const FText& GetMessageText() override
{
return MessageText;
}
virtual const FText& GetDefaultPrompt() override
{
return DefaultPrompt;
}
virtual bool IsReload() override
{
check(Type == EWebBrowserDialogType::Unload);
return false; // The android webkit browser does not provide this infomation
}
virtual void Continue(bool Success = true, const FText& UserResponse = FText::GetEmpty()) override;
private:
EWebBrowserDialogType Type;
FText MessageText;
FText DefaultPrompt;
jobject Callback; // Either a reference to a JsResult or a JsPromptResult object depending on Type
// Create a dialog from OnJSPrompt arguments
FAndroidWebBrowserDialog(jstring InMessageText, jstring InDefaultPrompt, jobject InCallback);
// Create a dialog from OnJSAlert|Confirm|BeforeUnload arguments
FAndroidWebBrowserDialog(EWebBrowserDialogType InDialogType, jstring InMessageText, jobject InCallback);
friend class FAndroidWebBrowserWindow;
friend class SAndroidWebBrowserWidget;
};
typedef FAndroidWebBrowserDialog FWebBrowserDialog;
#endif // USE_ANDROID_JNI