You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Implement JS integration via a subset of UObject scripting functionality and custom CEF Messages JIRA: OPP-3240 rb: Justin.Sargent [CL 2601283 by Keli Hlodversson in Main branch]
67 lines
1.5 KiB
C++
67 lines
1.5 KiB
C++
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "WebBrowserPrivatePCH.h"
|
|
#include "WebJSFunction.h"
|
|
#include "WebJSScripting.h"
|
|
|
|
#if WITH_CEF3
|
|
#if PLATFORM_WINDOWS
|
|
#include "AllowWindowsPlatformTypes.h"
|
|
#endif
|
|
#pragma push_macro("OVERRIDE")
|
|
#undef OVERRIDE // cef headers provide their own OVERRIDE macro
|
|
#include "include/cef_values.h"
|
|
#pragma pop_macro("OVERRIDE")
|
|
#if PLATFORM_WINDOWS
|
|
#include "HideWindowsPlatformTypes.h"
|
|
#endif
|
|
#endif
|
|
|
|
FWebJSParam::~FWebJSParam()
|
|
{
|
|
// Since the FString member is in a union, it may or may not be valid, so we have to call its destructor manually.
|
|
if (Tag == PTYPE_STRING)
|
|
{
|
|
delete StringValue;
|
|
}
|
|
}
|
|
|
|
FWebJSParam::FWebJSParam(const FWebJSParam& Other)
|
|
: Tag(Other.Tag)
|
|
{
|
|
switch (Other.Tag)
|
|
{
|
|
case PTYPE_BOOL:
|
|
BoolValue = Other.BoolValue;
|
|
break;
|
|
case PTYPE_DOUBLE:
|
|
DoubleValue = Other.DoubleValue;
|
|
break;
|
|
case PTYPE_INT:
|
|
IntValue = Other.IntValue;
|
|
break;
|
|
case PTYPE_STRING:
|
|
StringValue = new FString(*Other.StringValue);
|
|
break;
|
|
case PTYPE_NULL:
|
|
break;
|
|
case PTYPE_OBJECT:
|
|
ObjectValue = Other.ObjectValue;
|
|
break;
|
|
case PTYPE_STRUCT:
|
|
StructValue.TypeInfo = Other.StructValue.TypeInfo;
|
|
StructValue.StructPtr = Other.StructValue.StructPtr;
|
|
break;
|
|
}
|
|
}
|
|
|
|
void FWebJSFunction::Invoke(int32 ArgCount, FWebJSParam Arguments[]) const
|
|
{
|
|
#if WITH_CEF3
|
|
TSharedPtr<FWebJSScripting> Scripting = ScriptingPtr.Pin();
|
|
if (Scripting.IsValid())
|
|
{
|
|
Scripting->InvokeJSFunction(FunctionId, ArgCount, Arguments);
|
|
}
|
|
#endif
|
|
} |