You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#rnx #rb none #ROBOMERGE-OWNER: ryan.durand #ROBOMERGE-AUTHOR: ryan.durand #ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900 #ROBOMERGE-BOT: (v613-10869866) [CL 10870549 by ryan durand in Main branch]
100 lines
2.5 KiB
C++
100 lines
2.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Misc/AssertionMacros.h"
|
|
#include "Internationalization/Text.h"
|
|
|
|
#if WITH_CEF3
|
|
|
|
#if PLATFORM_WINDOWS
|
|
# include "Windows/AllowWindowsPlatformTypes.h"
|
|
#endif
|
|
#pragma push_macro("OVERRIDE")
|
|
# undef OVERRIDE // cef headers provide their own OVERRIDE macro
|
|
#if PLATFORM_APPLE
|
|
PRAGMA_DISABLE_DEPRECATION_WARNINGS
|
|
#endif
|
|
# include "include/cef_jsdialog_handler.h"
|
|
#if PLATFORM_APPLE
|
|
PRAGMA_ENABLE_DEPRECATION_WARNINGS
|
|
#endif
|
|
#pragma pop_macro("OVERRIDE")
|
|
#if PLATFORM_WINDOWS
|
|
# include "Windows/HideWindowsPlatformTypes.h"
|
|
#endif
|
|
|
|
#include "IWebBrowserDialog.h"
|
|
|
|
class FCEFWebBrowserDialog
|
|
: public IWebBrowserDialog
|
|
{
|
|
public:
|
|
virtual ~FCEFWebBrowserDialog()
|
|
{}
|
|
|
|
// 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 bIsReload;
|
|
}
|
|
|
|
virtual void Continue(bool Success = true, const FText& UserResponse = FText::GetEmpty()) override
|
|
{
|
|
check(Type == EWebBrowserDialogType::Prompt || UserResponse.IsEmpty());
|
|
Callback->Continue(Success, TCHAR_TO_WCHAR(*UserResponse.ToString()));
|
|
}
|
|
|
|
private:
|
|
|
|
|
|
EWebBrowserDialogType Type;
|
|
FText MessageText;
|
|
FText DefaultPrompt;
|
|
bool bIsReload;
|
|
|
|
CefRefPtr<CefJSDialogCallback> Callback;
|
|
|
|
// Create a dialog from OnJSDialog arguments
|
|
FCEFWebBrowserDialog(CefJSDialogHandler::JSDialogType InDialogType, const CefString& InMessageText, const CefString& InDefaultPrompt, CefRefPtr<CefJSDialogCallback> InCallback)
|
|
: Type((EWebBrowserDialogType)InDialogType)
|
|
, MessageText(FText::FromString(WCHAR_TO_TCHAR(InMessageText.ToWString().c_str())))
|
|
, DefaultPrompt(FText::FromString(WCHAR_TO_TCHAR(InDefaultPrompt.ToWString().c_str())))
|
|
, bIsReload(false)
|
|
, Callback(InCallback)
|
|
{}
|
|
|
|
// Create a dialog from OnBeforeUnloadDialog arguments
|
|
FCEFWebBrowserDialog(const CefString& InMessageText, bool InIsReload, CefRefPtr<CefJSDialogCallback> InCallback)
|
|
: Type(EWebBrowserDialogType::Unload)
|
|
, MessageText(FText::FromString(WCHAR_TO_TCHAR(InMessageText.ToWString().c_str())))
|
|
, DefaultPrompt(FText::GetEmpty())
|
|
, bIsReload(InIsReload)
|
|
, Callback(InCallback)
|
|
{};
|
|
|
|
friend class FCEFWebBrowserWindow;
|
|
};
|
|
|
|
typedef FCEFWebBrowserDialog FWebBrowserDialog;
|
|
|
|
#endif
|