// 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 InContext, CefRefPtr InObject, CefRefPtr InFunction, CefRefPtr InOnError, bool bInOneShot) : Context(InContext) , Object(InObject) , Function(InFunction) , OnError(InOnError) , bOneShot(bInOneShot) {} CefRefPtr Context; CefRefPtr Object; CefRefPtr Function; CefRefPtr OnError; bool bOneShot; }; class FEpicWebHelperCallbackRegistry : public TMap { 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 Context, CefRefPtr Object, CefRefPtr Function, CefRefPtr OnError=nullptr, bool bOneShot=false); /** * Deletes all entries that have a matching context. */ void RemoveByContext(CefRefPtr Context); }; #endif