Files
UnrealEngineUWP/Engine/Source/Programs/EpicWebHelper/Private/EpicWebHelperCallbackRegistry.h
alfred reynolds 00ff2ce5ad - Update copyright header in CEF files to match the requirements in the UE5 branch
#jira UE-110192
#jira UE-110195
#jira UE-110196
[FYI] wes.fudala
[FYI] JeanFrancois.Dube
#horde 47017
#horde 47016

#ROBOMERGE-SOURCE: CL 15657948 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v779-15635321)

[CL 15657981 by alfred reynolds in ue5-main branch]
2021-03-09 15:32:23 -04:00

47 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Misc/Guid.h"
#include "EpicWebHelper.h"
#if WITH_CEF3
/** Represents information about a JS function that can be called from the browser process.
*/
struct FEpicWebHelperCallbackRegistryEntry
{
FEpicWebHelperCallbackRegistryEntry(CefRefPtr<CefV8Context> InContext, CefRefPtr<CefV8Value> InObject, CefRefPtr<CefV8Value> InFunction, CefRefPtr<CefV8Value> InOnError, bool bInOneShot)
: Context(InContext)
, Object(InObject)
, Function(InFunction)
, OnError(InOnError)
, bOneShot(bInOneShot)
{}
CefRefPtr<CefV8Context> Context;
CefRefPtr<CefV8Value> Object;
CefRefPtr<CefV8Value> Function;
CefRefPtr<CefV8Value> OnError;
bool bOneShot;
};
class FEpicWebHelperCallbackRegistry : public TMap<FGuid, FEpicWebHelperCallbackRegistryEntry>
{
public:
/**
* Looks for a matching entry in the registry or adds a new one, returning its Id.
* A matching entry must have the same Context, Object, Function and OnError object. One-shot callbacks will always result in a new entry , even if there is an exact match.
*/
FGuid FindOrAdd(CefRefPtr<CefV8Context> Context, CefRefPtr<CefV8Value> Object, CefRefPtr<CefV8Value> Function, CefRefPtr<CefV8Value> OnError=nullptr, bool bOneShot=false);
/**
* Deletes all entries that have a matching context.
*/
void RemoveByContext(CefRefPtr<CefV8Context> Context);
};
#endif