Files
UnrealEngineUWP/Engine/Source/Runtime/WebBrowser/Public/WebBrowserViewport.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

61 lines
2.6 KiB
C++

// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "SlateCore.h"
// Forward Declarations
class IWebBrowserWindow;
/**
* A Slate viewport to display a Web Browser Window
*/
class WEBBROWSER_API FWebBrowserViewport : public ISlateViewport
{
public:
/**
* Default Constructor
*
* @param InWebBrowserWindow The Web Browser Window this viewport will display
* @param InViewportWidget The Widget displaying this viewport (needed to capture mouse)
* @param InIsPopup Used to initialize a viewport for showing browser popup menus instead of the main window.
*/
FWebBrowserViewport(TSharedPtr<IWebBrowserWindow> InWebBrowserWindow, bool InIsPopup = false)
: WebBrowserWindow(InWebBrowserWindow)
, bIsPopup(InIsPopup)
{ }
/**
* Destructor.
*/
~FWebBrowserViewport( )
{
}
// ISlateViewport interface
virtual FIntPoint GetSize() const override;
virtual FSlateShaderResource* GetViewportRenderTargetTexture() const override;
virtual void Tick( const FGeometry& AllottedGeometry, double InCurrentTime, float DeltaTime ) override;
virtual bool RequiresVsync() const override;
virtual bool AllowScaling() const override;
virtual FCursorReply OnCursorQuery( const FGeometry& MyGeometry, const FPointerEvent& CursorEvent ) override;
virtual FReply OnMouseButtonDown( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseButtonUp( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual void OnMouseEnter( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual void OnMouseLeave( const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseMove( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseWheel( const FGeometry& MyGeometry, const FPointerEvent& MouseEvent ) override;
virtual FReply OnMouseButtonDoubleClick( const FGeometry& InMyGeometry, const FPointerEvent& InMouseEvent ) override;
virtual FReply OnKeyDown( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent ) override;
virtual FReply OnKeyUp( const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent ) override;
virtual FReply OnKeyChar( const FGeometry& MyGeometry, const FCharacterEvent& InCharacterEvent ) override;
virtual FReply OnFocusReceived( const FFocusEvent& InFocusEvent ) override;
virtual void OnFocusLost( const FFocusEvent& InFocusEvent ) override;
private:
/** The web browser this viewport will display */
TSharedPtr<IWebBrowserWindow> WebBrowserWindow;
/** Whether this viewport is showing the browser window or a popup menu widget */
bool const bIsPopup;
};