Files
UnrealEngineUWP/Engine/Source/Runtime/WebBrowser/Private/WebBrowserSingleton.h
Keli Hlodversson 82074ffed1 [INTEGRATE] SWebBrowser refactor and cleanups:
* Untangle mutual dependencies between objects and constructor order (OPP-3858):
	* FWebBrowserWindow no longer keeps a reference to FWebBrowserHandler.
	* CefBrowserWindow is created before creating FWebBrowserWindow and passed to its constructor.
	* FWebBrowserViewport no longer has a reference back to the viewport widget.
* Cleaned how some platform specific paths were defined during module initialization.
* Sets current thread name (back) to GameThread after initializing CEF (UE-5165)
* Adopted changes from UT (with some modifications):
	* Enable on-disk caching and persisting cookies when requested by server.
	* Added product name and engine version to user agent request header.
* Ensure UStruct parameters passed by value to FWebJSFunctions are copied when constructing the argument list and not just their address.
*SWebBrowser scripting: Add support for passing TMap<FString, T> to FWebJSFunction objects.
	Note: since the struct serializer does not yet support maps, this only works for arguments passed directly to the function object and not UStruct members nor function return values. OPP-3861
* Add support for passing a reference to the JS promise object implicitly created when calling UFunctions to provide for a way to report runtime errors back to it instead of just passing the return value.
	* This also allows for implementing async functionality as the promise object can be saved and used after the UFunction has returned.

Merging CL#2633955, CL#2634077, CL#2634226, CL#2635540, CL#2636167, and CL#2636262 using UE4-To-UE4-LauncherDev

[CL 2636308 by Keli Hlodversson in Main branch]
2015-07-28 18:59:27 -04:00

84 lines
2.0 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "IWebBrowserSingleton.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/internal/cef_ptr.h"
#pragma pop_macro("OVERRIDE")
#if PLATFORM_WINDOWS
#include "HideWindowsPlatformTypes.h"
#endif
class CefListValue;
#endif
class FWebBrowserApp;
class FWebBrowserHandler;
class FWebBrowserWindow;
/**
* Implementation of singleton class that takes care of general web browser tasks
*/
class FWebBrowserSingleton
: public IWebBrowserSingleton
, public FTickerObjectBase
{
public:
/** Default constructor. */
FWebBrowserSingleton();
/** Virtual destructor. */
virtual ~FWebBrowserSingleton();
/**
* Gets the Current Locale Code in the format CEF expects
*
* @return Locale code as either "xx" or "xx-YY"
*/
static FString GetCurrentLocaleCode();
public:
// IWebBrowserSingleton Interface
TSharedPtr<IWebBrowserWindow> CreateBrowserWindow(
TSharedPtr<FWebBrowserWindow>& BrowserWindowParent,
TSharedPtr<FWebBrowserWindowInfo>& BrowserWindowInfo) override;
TSharedPtr<IWebBrowserWindow> CreateBrowserWindow(
void* OSWindowHandle,
FString InitialURL,
bool bUseTransparency,
bool bThumbMouseButtonNavigation,
TOptional<FString> ContentsToLoad = TOptional<FString>(),
bool ShowErrorMessage = true,
FColor BackgroundColor = FColor(255, 255, 255, 255)) override;
public:
// FTickerObjectBase Interface
virtual bool Tick(float DeltaTime) override;
private:
#if WITH_CEF3
/** When new render processes are created, send all permanent variable bindings to them. */
void HandleRenderProcessCreated(CefRefPtr<CefListValue> ExtraInfo);
/** Pointer to the CEF App implementation */
CefRefPtr<FWebBrowserApp> WebBrowserApp;
/** List of currently existing browser windows */
TArray<TWeakPtr<FWebBrowserWindow>> WindowInterfaces;
#endif
};