Files
UnrealEngineUWP/Engine/Source/Runtime/WebBrowser/Private/Native/NativeJSScripting.h
josh adams 019c12863e - Merging Dev-Kairos/Engine/... to Main/Engine/...
- Brings over the necessary engine changes for embedding UE4 mobile as a dylib/so in native mobile app
- Various changes for facial animation, screen recording, others
- ARKit and ARCore plugins were removed, as deemed "not ready"
#rb many people

#ROBOMERGE-OWNER: ryan.vance
#ROBOMERGE-AUTHOR: josh.adams
#ROBOMERGE-SOURCE: CL 5201138 via CL 5203024 via CL 5226277
#ROBOMERGE-BOT: DEVVR (Main -> Dev-VR)

[CL 5244512 by josh adams in Dev-VR branch]
2019-02-28 17:06:02 -05:00

53 lines
1.6 KiB
C++

// Copyright 1998-2018 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "WebJSFunction.h"
#include "WebJSScripting.h"
typedef TSharedRef<class FNativeJSScripting> FNativeJSScriptingRef;
typedef TSharedPtr<class FNativeJSScripting> FNativeJSScriptingPtr;
class FNativeWebBrowserProxy;
/**
* Implements handling of bridging UObjects client side with JavaScript renderer side.
*/
class FNativeJSScripting
: public FWebJSScripting
, public TSharedFromThis<FNativeJSScripting>
{
public:
//static const FString JSMessageTag;
FNativeJSScripting(bool bJSBindingToLoweringEnabled, TSharedRef<FNativeWebBrowserProxy> Window);
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;
bool OnJsMessageReceived(const FString& Message);
FString ConvertStruct(UStruct* TypeInfo, const void* StructPtr);
FString ConvertObject(UObject* Object);
virtual void InvokeJSFunction(FGuid FunctionId, int32 ArgCount, FWebJSParam Arguments[], bool bIsError=false) override;
virtual void InvokeJSErrorResult(FGuid FunctionId, const FString& Error) override;
void PageLoaded();
private:
FString GetInitializeScript();
void InvokeJSFunctionRaw(FGuid FunctionId, const FString& JSValue, bool bIsError=false);
bool IsValid()
{
return WindowPtr.Pin().IsValid();
}
/** Message handling helpers */
bool HandleExecuteUObjectMethodMessage(const TArray<FString>& Params);
void ExecuteJavascript(const FString& Javascript);
TWeakPtr<FNativeWebBrowserProxy> WindowPtr;
bool bLoaded;
};