UCefView
Loading...
Searching...
No Matches
UCefView

UCefView is a UMG widget that embeds a Chromium Embedded Framework (CEF) browser view within Unreal Engine UI. It provides a rich set of browser features, event hooks, and resource mapping capabilities, allowing seamless integration of web content into Unreal Engine applications. The widget supports navigation, JavaScript execution, event broadcasting, and advanced customization through settings and resource mappings. It is suitable for both in-game and editor use, and exposes a comprehensive set of Blueprint-callable methods and events for interaction. More...

#include <CefView.h>

Public Types

using FOnLoadStateChangedEvent = (*)( const int64& InBrowserId , bool bInIsLoading , bool bInCanGoBack , bool bInCanGoForward )
 Event triggered when the browser's loading state changes (e.g., starts or finishes loading).
 
using FOnLoadStartEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , bool bInIsMainFrame , int InTransitionType )
 Event triggered when the browser starts loading a new document in any frame.
 
using FOnLoadEndEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , bool bInIsMainFrame , int InHttpStatusCode )
 Event triggered when the browser finishes loading a document in any frame.
 
using FOnLoadErrorEvent = void(*)( const int64& InBrowserId , const FCefFrameId& InFrameId , bool bInIsMainFrame , int InErrorCode , const FString& InErrorMsg , const FString& InFailedUrl )
 Event triggered when the browser fails to load a document due to an error.
 
using FOnDraggableRegionChangedEvent = void(*)( const FVector4& InDraggableRegion , const FVector4& InNonDraggableRegion )
 Event triggered when the draggable or non-draggable regions of the browser change. Used for implementing custom window dragging in frameless windows.
 
using FOnAddressChangedEvent = void(*)( const FCefFrameId& InFrameId , const FString& InNewAddress )
 Event triggered when the address (URL) of a frame changes.
 
using FOnTitleChangedEvent = void(*)( const FString& InTitle )
 Event triggered when the document title changes.
 
using FOnFaviconUrlChangedEvent = void(*)( const TArray<FString>& InUrls )
 Event triggered when the favicon URLs for the current page change.
 
using FOnFullscreenModeChangedEvent = void(*)( bool bInFullscreen )
 Event triggered when the browser enters or exits fullscreen mode.
 
using FOnStatusMessageEvent = void(*)( const FString& InMessage )
 Event triggered when the browser's status message changes (e.g., link hover, loading status).
 
using FOnConsoleMessageEvent = void(*)( const FString& InMessage , int32 InLevel )
 Event triggered when a console message is emitted from web content (e.g., via console.log).
 
using FOnLoadingProgressChangedEvent = void(*)( double InProgress )
 Event triggered when the loading progress of the current page changes.
 
using FOnUrlRequestEvent = void(*)( const int64& InBrowserId , const FCefFrameId& InFrameId , const FString& InRequestUrl )
 Event triggered when a built-in scheme URL is accessed by the browser. Useful for handling custom resource requests.
 
using FOnQueryRequestEvent = void(*)( const int64& InBrowserId , const FCefFrameId& InFrameId , UCefViewQuery* InQuery )
 Event triggered when a new UCefQuery request is received from web content. Used for asynchronous communication between JavaScript and native code.
 
using FOnInvokeMethodEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , const FString& InMethod , const FString& InArguments )
 Event triggered when a method is invoked from web content (JavaScript) via the bridge object. Allows native code to handle custom method calls from JavaScript.
 
using FOnReportJavascriptResultEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , const FString& InContext , const FString& InResult )
 Event triggered when the result of a JavaScript execution (via ExecuteJavascriptWithResult) is returned.
 
using FOnNativeBrowserCreatedEvent = void(*)()
 Event triggered when the native browser window is created. Note: This event does not fire in OSR (Off-Screen Rendering) mode.
 

Public Member Functions

 UCefView ()
 Default constructor. Initializes the UCefView widget and its properties.
 
virtual ~UCefView ()
 Destructor. Cleans up resources associated with the CEF browser view.
 
virtual void SynchronizeProperties () override
 Synchronizes UPROPERTY values with the underlying Slate widget. Called automatically by the engine when properties are changed in the editor or at runtime.
 
virtual void ReleaseSlateResources (bool bInReleaseChildren) override
 Releases resources held by the Slate widget, optionally releasing child widgets as well. Called when the UMG widget is destroyed or removed from the UI hierarchy.
 
void AddLocalFolderResource (const FString &InFolderPath, const FString &InTargetUrl, int32 InPriority=0)
 Adds a URL mapping for a local web resource directory, making its contents accessible via a virtual URL. This is useful for serving local HTML, JS, or other assets to the browser.
 
void AddArchiveFileResource (const FString &InArchivePath, const FString &InTargetUrl, const FString &InPassword="", int32 InPriority=0)
 Adds a URL mapping for a local archive (.zip) file, making its contents accessible via a virtual URL. This is useful for serving packaged web assets to the browser.
 
int64 GetBrowserId ()
 Gets the unique browser ID for this CEF view instance.
 
void NavigateToUrl (const FString &InTargetUrl)
 Navigates the browser to the specified URL.
 
bool BrowserCanGoBack ()
 Checks whether the browser can navigate back in its history.
 
bool BrowserCanGoForward ()
 Checks whether the browser can navigate forward in its history.
 
void BrowserGoBack ()
 Navigates the browser back to the previous page in its history, if possible.
 
void BrowserGoForward ()
 Navigates the browser forward to the next page in its history, if possible.
 
bool IsBrowserLoading ()
 Checks whether the browser is currently loading a page or resource.
 
void BrowserReload ()
 Reloads the current page in the browser.
 
void BrowserStopLoad ()
 Stops the current page load operation in the browser.
 
bool TriggerEventForFrame (const UCefViewEvent *InCefViewEvent, const FCefFrameId &InFrameId)
 Triggers a custom event for a specific frame in the CEF view. Allows sending user-defined events to the browser for advanced interaction.
 
bool TriggerEventForMainFrame (const UCefViewEvent *InCefViewEvent)
 Triggers a custom event for the main frame in the CEF view.
 
bool BroadcastEvent (const UCefViewEvent *InCefViewEvent)
 Broadcasts a custom event to all frames in the CEF view.
 
bool ResponseUCefQuery (const UCefViewQuery *InCefQuery)
 Responds to a CEF query with the provided result. Used for asynchronous communication between JavaScript and native code.
 
bool ExecuteJavascript (const FCefFrameId &InFrameId, const FString &InJavascriptCode, const FString &InTargetUrl)
 Executes JavaScript code in a specific frame of the CEF view.
 
bool ExecuteJavascriptWithResult (const FCefFrameId &InFrameId, const FString &InJavascriptCode, const FString &InTargetUrl, const FString &InExecuteContext)
 Executes JavaScript code in a specific frame and returns the result asynchronously.
 
bool SetPreference (const FString &InPreferenceName, const FString &InPreferenceValue, FString &InError)
 Sets a browser preference to a specified value. Preferences control browser behavior such as cache, cookies, and rendering options.
 
void SetDisablePopupContextMenu (bool bInIsDisable)
 Sets whether to disable the context menu for pop-up browser windows.
 
bool IsPopupContextMenuDisabled ()
 Gets whether the context menu is disabled for pop-up browser windows.
 
bool HasDevTools ()
 Detects whether the browser currently has a DevTools window open.
 
void ShowDevTools ()
 Opens the DevTools dialog for the browser, allowing inspection and debugging of web content.
 
void CloseDevTools ()
 Closes the DevTools dialog if it is currently open.
 
void SetEnableDragAndDrop (bool bInIsEnable)
 Sets whether to enable drag and drop functionality for the browser. Note: This function does not work for OSR (Off-Screen Rendering) mode. In OSR, dragging a file to a non-dragging area may display the file's content.
 
bool IsDragAndDropEnabled () const
 Gets whether drag and drop functionality is enabled for the browser.
 

Public Attributes

FString Url
 The initial URL to be loaded in the CEF browser when the widget is created. Can be changed at runtime to navigate to a different page.
 
int32 FrameRate = 60
 The frame rate (in frames per second) at which the CEF browser will render. Higher values provide smoother updates but may increase CPU/GPU usage. Default: 60.
 
bool bEnableContextMenu = true
 Enables or disables the context menu in the CEF browser. If true, right-click context menus are shown; if false, they are suppressed. Default: true.
 
bool bAcceptDrops = true
 Enables or disables accepting drag-and-drop operations from external sources (e.g., files from OS). If true, the browser can accept drops; if false, drops are ignored. Default: false.
 
bool bAllowDrag = true
 Enables or disables allowing the browser content to be dragged (initiating drag operations). If true, users can drag content from the browser; if false, dragging is disabled. Default: false.
 
TArray< FLocalFolderResourceMappingLocalFolderResroucesMapping
 Mappings for local folders to be used as web resources. Each mapping allows content in the specified folder to be accessed via a virtual URL in the browser.
 
TArray< FArchiveFileResourceMappingArchiveFileResourceMapping
 Mappings for archive files (e.g., .zip) to be used as web resources. Each mapping allows content in the specified archive to be accessed via a virtual URL in the browser.
 
FCefViewSettings Settings
 Settings for the CEF view, including browser features, font preferences, and other options. These settings are applied when the browser is created and cannot be changed at runtime.
 
FOnLoadStateChangedEvent OnLoadStateChanged
 
FOnLoadStartEvent OnLoadStart
 
FOnLoadEndEvent OnLoadEnd
 
FOnLoadErrorEvent OnLoadError
 
FOnDraggableRegionChangedEvent OnDraggableRegionChanged
 
FOnAddressChangedEvent OnAddressChanged
 
FOnTitleChangedEvent OnTitleChanged
 
FOnFaviconUrlChangedEvent OnFaviconUrlChanged
 
FOnFullscreenModeChangedEvent OnFullscreenModeChanged
 
FOnStatusMessageEvent OnStatusMessage
 
FOnConsoleMessageEvent OnConsoleMessage
 
FOnLoadingProgressChangedEvent OnLoadingProgressChanged
 
FOnUrlRequestEvent OnUrlRequest
 
FOnQueryRequestEvent OnQueryRequest
 
FOnInvokeMethodEvent OnInvokeMethod
 
FOnReportJavascriptResultEvent OnReportJavascriptResult
 
FOnNativeBrowserCreatedEvent OnNativeBrowserCreated
 

Static Public Attributes

static const FCefFrameId MainFrameID
 The main frame identity, representing the primary document frame in the browser. Used for targeting main-frame-specific operations and events.
 
static const FCefFrameId AllFrameID
 The identifier representing all frames in the browser. Used for broadcasting events or actions to every frame.
 

Protected Member Functions

virtual TSharedRef< SWidget > RebuildWidget () override
 Rebuilds the underlying Slate widget for this UMG widget. Called by the engine when the widget needs to be constructed or updated.
 
void OnNewBrowser (const FCefFrameId &InSourceFrameId, const FString &InUrl, const FString &InName, ECefWindowOpenDisposition InTargetDisposition, FIntRect &InRect)
 Called before a new browser is created (for browsers created by non-JavaScript means). Allows customization of the new browser's properties and window.
 
bool OnNewPopup (const FCefFrameId &InFrameId, const FString &InTargetUrl, FString &InTargetFrameName, ECefWindowOpenDisposition InTargetDisposition, FIntRect &InRect, FSlateCefViewSettings &InSettings, bool &bInDisableJavascriptAccess)
 Called before a pop-up browser is created (for browsers created by JavaScript). Allows customization or cancellation of the popup.
 
bool OnRequestCloseFromWeb ()
 Called when a close request is received from the web content (e.g., window.close()).
 
void OnSlateLoadStateChangedEvent (const int64 &InBrowserId, bool bInIsLoading, bool bInCanGoBack, bool bInCanGoForward)
 Handles the load state changed event from the underlying Slate CEF view. Updates internal state and broadcasts the OnLoadStateChanged event.
 
void OnSlateLoadStartEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, bool bInIsMainFrame, int InTransitionType)
 Handles the load start event from the underlying Slate CEF view.
 
void OnSlateLoadEndEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, bool bInIsMainFrame, int InHttpStatusCode)
 Handles the load end event from the underlying Slate CEF view.
 
void OnSlateLoadErrorEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, bool bInIsMainFrame, int InErrorCode, const FString &InErrorMsg, const FString &InFailedUrl, bool &bInHandled)
 Handles the load error event from the underlying Slate CEF view.
 
void OnSlateDraggableRegionChangedEvent (const FVector4 &InDraggableRegion, const FVector4 &InNonDraggableRegion)
 Handles the draggable region changed event from the underlying Slate CEF view. Used for updating window drag regions in custom window chrome scenarios.
 
void OnSlateAddressChangedEvent (const FCefFrameId &InFrameId, const FString &InNewAddress)
 Handles the address changed event from the underlying Slate CEF view.
 
void OnSlateTitleChangedEvent (const FString &InTitle)
 Handles the title changed event from the underlying Slate CEF view.
 
void OnSlateFaviconUrlChangedEvent (const TArray< FString > &InUrls)
 Handles the favicon URL changed event from the underlying Slate CEF view.
 
void OnSlateFullscreenModeChangedEvent (bool bInFullscreen)
 Handles the fullscreen mode changed event from the underlying Slate CEF view.
 
void OnSlateStatusMessageEvent (const FString &InMessage)
 Handles the status message event from the underlying Slate CEF view.
 
void OnSlateConsoleMessageEvent (const FString &InMessage, int32 InLevel)
 Handles the console message event from the underlying Slate CEF view.
 
void OnSlateLoadingProgressChangedEvent (double InProgress)
 Handles the loading progress changed event from the underlying Slate CEF view.
 
void OnSlateUrlRequestEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, const FString &InRequestUrl)
 Handles the URL request event from the underlying Slate CEF view.
 
void OnSlateQueryRequestEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, const int64 &InQueryId, const FString &InRequest)
 Handles the query request event from the underlying Slate CEF view.
 
void OnSlateInvokeMethodEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, const FString &InMethod, const TArray< TSharedPtr< FJsonValue > > &InArguments)
 Handles the invoke method event from the underlying Slate CEF view.
 
void OnSlateReportJavascriptResultEvent (const int64 &InBrowserId, const FCefFrameId &InFrameId, const FString &InContext, const TSharedPtr< FJsonValue > &InResult)
 Handles the report JavaScript result event from the underlying Slate CEF view.
 
void OnSlateNativeBrowserCreatedEvent ()
 Handles the native browser created event from the underlying Slate CEF view. Used to perform additional initialization after the browser window is available.
 

Protected Attributes

TSharedPtr< SCefViewSlateCefView
 

Detailed Description

UCefView is a UMG widget that embeds a Chromium Embedded Framework (CEF) browser view within Unreal Engine UI. It provides a rich set of browser features, event hooks, and resource mapping capabilities, allowing seamless integration of web content into Unreal Engine applications. The widget supports navigation, JavaScript execution, event broadcasting, and advanced customization through settings and resource mappings. It is suitable for both in-game and editor use, and exposes a comprehensive set of Blueprint-callable methods and events for interaction.

Member Typedef Documentation

◆ FOnAddressChangedEvent

using UCefView::FOnAddressChangedEvent = void(*)( const FCefFrameId& InFrameId , const FString& InNewAddress )

Event triggered when the address (URL) of a frame changes.

Parameters
InFrameIdThe frame ID whose address changed.
InNewAddressThe new address (URL).

◆ FOnConsoleMessageEvent

using UCefView::FOnConsoleMessageEvent = void(*)( const FString& InMessage , int32 InLevel )

Event triggered when a console message is emitted from web content (e.g., via console.log).

Parameters
InMessageThe console message text.
InLevelThe log level (e.g., info, warning, error).

◆ FOnDraggableRegionChangedEvent

using UCefView::FOnDraggableRegionChangedEvent = void(*)( const FVector4& InDraggableRegion , const FVector4& InNonDraggableRegion )

Event triggered when the draggable or non-draggable regions of the browser change. Used for implementing custom window dragging in frameless windows.

Parameters
InDraggableRegionThe new draggable region (as a vector or rectangle).
InNonDraggableRegionThe new non-draggable region.

◆ FOnFaviconUrlChangedEvent

using UCefView::FOnFaviconUrlChangedEvent = void(*)( const TArray<FString>& InUrls )

Event triggered when the favicon URLs for the current page change.

Parameters
InUrlsThe new list of favicon URLs.

◆ FOnFullscreenModeChangedEvent

using UCefView::FOnFullscreenModeChangedEvent = void(*)( bool bInFullscreen )

Event triggered when the browser enters or exits fullscreen mode.

Parameters
bInFullscreenTrue if the browser is now in fullscreen mode; otherwise, false.

◆ FOnInvokeMethodEvent

using UCefView::FOnInvokeMethodEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , const FString& InMethod , const FString& InArguments )

Event triggered when a method is invoked from web content (JavaScript) via the bridge object. Allows native code to handle custom method calls from JavaScript.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID making the call.
InMethodThe name of the method being invoked.
InArgumentsThe arguments list as a JSON string.

◆ FOnLoadEndEvent

using UCefView::FOnLoadEndEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , bool bInIsMainFrame , int InHttpStatusCode )

Event triggered when the browser finishes loading a document in any frame.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID where loading ended.
bInIsMainFrameTrue if this is the main frame; otherwise, false.
InHttpStatusCodeThe HTTP status code of the loaded document.

◆ FOnLoadErrorEvent

using UCefView::FOnLoadErrorEvent = void(*)( const int64& InBrowserId , const FCefFrameId& InFrameId , bool bInIsMainFrame , int InErrorCode , const FString& InErrorMsg , const FString& InFailedUrl )

Event triggered when the browser fails to load a document due to an error.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID where the error occurred.
bInIsMainFrameTrue if this is the main frame; otherwise, false.
InErrorCodeThe error code (see CEF error codes).
InErrorMsgA descriptive error message.
InFailedUrlThe URL that failed to load.

◆ FOnLoadingProgressChangedEvent

using UCefView::FOnLoadingProgressChangedEvent = void(*)( double InProgress )

Event triggered when the loading progress of the current page changes.

Parameters
InProgressThe current loading progress (0.0 to 1.0).

◆ FOnLoadStartEvent

using UCefView::FOnLoadStartEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , bool bInIsMainFrame , int InTransitionType )

Event triggered when the browser starts loading a new document in any frame.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID where loading started.
bInIsMainFrameTrue if this is the main frame; otherwise, false.
InTransitionTypeThe transition type (navigation reason).

◆ FOnLoadStateChangedEvent

using UCefView::FOnLoadStateChangedEvent = (*)( const int64& InBrowserId , bool bInIsLoading , bool bInCanGoBack , bool bInCanGoForward )

Event triggered when the browser's loading state changes (e.g., starts or finishes loading).

Parameters
InBrowserIdThe unique browser ID.
bInIsLoadingTrue if the browser is currently loading; otherwise, false.
bInCanGoBackTrue if the browser can navigate back; otherwise, false.
bInCanGoForwardTrue if the browser can navigate forward; otherwise, false.

◆ FOnNativeBrowserCreatedEvent

Event triggered when the native browser window is created. Note: This event does not fire in OSR (Off-Screen Rendering) mode.

◆ FOnQueryRequestEvent

using UCefView::FOnQueryRequestEvent = void(*)( const int64& InBrowserId , const FCefFrameId& InFrameId , UCefViewQuery* InQuery )

Event triggered when a new UCefQuery request is received from web content. Used for asynchronous communication between JavaScript and native code.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID making the query.
InQueryThe query request object.

◆ FOnReportJavascriptResultEvent

using UCefView::FOnReportJavascriptResultEvent = (*)( const int64& InBrowserId , const FCefFrameId& InFrameId , const FString& InContext , const FString& InResult )

Event triggered when the result of a JavaScript execution (via ExecuteJavascriptWithResult) is returned.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID where the script was executed.
InContextThe execution context identifier.
InResultThe result of the JavaScript execution as a string.

◆ FOnStatusMessageEvent

using UCefView::FOnStatusMessageEvent = void(*)( const FString& InMessage )

Event triggered when the browser's status message changes (e.g., link hover, loading status).

Parameters
InMessageThe new status message.

◆ FOnTitleChangedEvent

using UCefView::FOnTitleChangedEvent = void(*)( const FString& InTitle )

Event triggered when the document title changes.

Parameters
InTitleThe new document title.

◆ FOnUrlRequestEvent

using UCefView::FOnUrlRequestEvent = void(*)( const int64& InBrowserId , const FCefFrameId& InFrameId , const FString& InRequestUrl )

Event triggered when a built-in scheme URL is accessed by the browser. Useful for handling custom resource requests.

Parameters
InBrowserIdThe unique browser ID.
InFrameIdThe frame ID making the request.
InRequestUrlThe full requested URL.

Constructor & Destructor Documentation

◆ UCefView()

UCefView::UCefView ( )

Default constructor. Initializes the UCefView widget and its properties.

◆ ~UCefView()

virtual UCefView::~UCefView ( )
virtual

Destructor. Cleans up resources associated with the CEF browser view.

Member Function Documentation

◆ AddArchiveFileResource()

void UCefView::AddArchiveFileResource ( const FString & InArchivePath,
const FString & InTargetUrl,
const FString & InPassword = "",
int32 InPriority = 0 )

Adds a URL mapping for a local archive (.zip) file, making its contents accessible via a virtual URL. This is useful for serving packaged web assets to the browser.

Parameters
InArchivePathThe absolute or relative path to the local archive file.
InTargetUrlThe virtual URL to map to the archive (e.g., "http://archive/").
InPasswordThe password required to access the archive, if any. Default is empty.
InPriorityThe priority of the mapping. Higher values take precedence. Default is 0.

◆ AddLocalFolderResource()

void UCefView::AddLocalFolderResource ( const FString & InFolderPath,
const FString & InTargetUrl,
int32 InPriority = 0 )

Adds a URL mapping for a local web resource directory, making its contents accessible via a virtual URL. This is useful for serving local HTML, JS, or other assets to the browser.

Parameters
InFolderPathThe absolute or relative path to the local resource directory.
InTargetUrlThe virtual URL to map to the directory (e.g., "http://local/").
InPriorityThe priority of the mapping. Higher values take precedence. Default is 0.

◆ BroadcastEvent()

bool UCefView::BroadcastEvent ( const UCefViewEvent * InCefViewEvent)

Broadcasts a custom event to all frames in the CEF view.

Parameters
InCefViewEventThe event object to broadcast.
Returns
True if the event was successfully broadcast; otherwise, false.

◆ BrowserCanGoBack()

bool UCefView::BrowserCanGoBack ( )

Checks whether the browser can navigate back in its history.

Returns
True if the browser can go back; otherwise, false.

◆ BrowserCanGoForward()

bool UCefView::BrowserCanGoForward ( )

Checks whether the browser can navigate forward in its history.

Returns
True if the browser can go forward; otherwise, false.

◆ BrowserGoBack()

void UCefView::BrowserGoBack ( )

Navigates the browser back to the previous page in its history, if possible.

◆ BrowserGoForward()

void UCefView::BrowserGoForward ( )

Navigates the browser forward to the next page in its history, if possible.

◆ BrowserReload()

void UCefView::BrowserReload ( )

Reloads the current page in the browser.

◆ BrowserStopLoad()

void UCefView::BrowserStopLoad ( )

Stops the current page load operation in the browser.

◆ CloseDevTools()

void UCefView::CloseDevTools ( )

Closes the DevTools dialog if it is currently open.

◆ ExecuteJavascript()

bool UCefView::ExecuteJavascript ( const FCefFrameId & InFrameId,
const FString & InJavascriptCode,
const FString & InTargetUrl )

Executes JavaScript code in a specific frame of the CEF view.

Parameters
InFrameIdThe ID of the frame in which to execute the JavaScript.
InJavascriptCodeThe JavaScript code to execute.
InTargetUrlThe URL to associate with the script (used for debugging and stack traces).
Returns
True if the JavaScript was successfully executed; otherwise, false.

◆ ExecuteJavascriptWithResult()

bool UCefView::ExecuteJavascriptWithResult ( const FCefFrameId & InFrameId,
const FString & InJavascriptCode,
const FString & InTargetUrl,
const FString & InExecuteContext )

Executes JavaScript code in a specific frame and returns the result asynchronously.

Parameters
InFrameIdThe ID of the frame in which to execute the JavaScript.
InJavascriptCodeThe JavaScript code to execute.
InTargetUrlThe URL to associate with the script (used for debugging and stack traces).
InExecuteContextThe context in which the script is executed (e.g., "default", "isolated").
Returns
True if the JavaScript was successfully executed; otherwise, false.

◆ GetBrowserId()

int64 UCefView::GetBrowserId ( )

Gets the unique browser ID for this CEF view instance.

Returns
The browser ID as a 64-bit integer.

◆ HasDevTools()

bool UCefView::HasDevTools ( )

Detects whether the browser currently has a DevTools window open.

Returns
True if DevTools is open; otherwise, false.

◆ IsBrowserLoading()

bool UCefView::IsBrowserLoading ( )

Checks whether the browser is currently loading a page or resource.

Returns
True if the browser is loading; otherwise, false.

◆ IsDragAndDropEnabled()

bool UCefView::IsDragAndDropEnabled ( ) const

Gets whether drag and drop functionality is enabled for the browser.

Returns
True if drag and drop is enabled; otherwise, false.

◆ IsPopupContextMenuDisabled()

bool UCefView::IsPopupContextMenuDisabled ( )

Gets whether the context menu is disabled for pop-up browser windows.

Returns
True if the context menu is disabled; otherwise, false.

◆ NavigateToUrl()

void UCefView::NavigateToUrl ( const FString & InTargetUrl)

Navigates the browser to the specified URL.

Parameters
InTargetUrlThe URL to navigate to.

◆ OnNewBrowser()

void UCefView::OnNewBrowser ( const FCefFrameId & InSourceFrameId,
const FString & InUrl,
const FString & InName,
ECefWindowOpenDisposition InTargetDisposition,
FIntRect & InRect )
protected

Called before a new browser is created (for browsers created by non-JavaScript means). Allows customization of the new browser's properties and window.

Parameters
InSourceFrameIdThe source frame ID initiating the new browser.
InUrlThe target URL to be loaded in the new browser.
InNameThe target window name.
InTargetDispositionThe method by which the window should be opened (e.g., new tab, new window).
InRectThe rectangle specifying the popup window's position and size.

◆ OnNewPopup()

bool UCefView::OnNewPopup ( const FCefFrameId & InFrameId,
const FString & InTargetUrl,
FString & InTargetFrameName,
ECefWindowOpenDisposition InTargetDisposition,
FIntRect & InRect,
FSlateCefViewSettings & InSettings,
bool & bInDisableJavascriptAccess )
protected

Called before a pop-up browser is created (for browsers created by JavaScript). Allows customization or cancellation of the popup.

Parameters
InFrameIdThe source frame ID.
InTargetUrlThe target URL for the popup.
InTargetFrameNameThe target frame name (modifiable).
InTargetDispositionThe method by which the window should be opened.
InRectThe rectangle specifying the popup window's position and size.
InSettingsSettings to be applied to the popup browser.
bInDisableJavascriptAccessSet to true to disable JavaScript access in the popup.
Returns
True to cancel the popup; false to allow it.

◆ OnRequestCloseFromWeb()

bool UCefView::OnRequestCloseFromWeb ( )
protected

Called when a close request is received from the web content (e.g., window.close()).

Returns
True to allow the browser to close; false to cancel the close operation.

◆ OnSlateAddressChangedEvent()

void UCefView::OnSlateAddressChangedEvent ( const FCefFrameId & InFrameId,
const FString & InNewAddress )
protected

Handles the address changed event from the underlying Slate CEF view.

Parameters
InFrameIdThe frame ID whose address changed.
InNewAddressThe new address (URL).

◆ OnSlateConsoleMessageEvent()

void UCefView::OnSlateConsoleMessageEvent ( const FString & InMessage,
int32 InLevel )
protected

Handles the console message event from the underlying Slate CEF view.

Parameters
InMessageThe console message.
InLevelThe log level.

◆ OnSlateDraggableRegionChangedEvent()

void UCefView::OnSlateDraggableRegionChangedEvent ( const FVector4 & InDraggableRegion,
const FVector4 & InNonDraggableRegion )
protected

Handles the draggable region changed event from the underlying Slate CEF view. Used for updating window drag regions in custom window chrome scenarios.

Parameters
InDraggableRegionThe new draggable region.
InNonDraggableRegionThe new non-draggable region.

◆ OnSlateFaviconUrlChangedEvent()

void UCefView::OnSlateFaviconUrlChangedEvent ( const TArray< FString > & InUrls)
protected

Handles the favicon URL changed event from the underlying Slate CEF view.

Parameters
InUrlsThe new favicon URLs.

◆ OnSlateFullscreenModeChangedEvent()

void UCefView::OnSlateFullscreenModeChangedEvent ( bool bInFullscreen)
protected

Handles the fullscreen mode changed event from the underlying Slate CEF view.

Parameters
bInFullscreenTrue if fullscreen; otherwise, false.

◆ OnSlateInvokeMethodEvent()

void UCefView::OnSlateInvokeMethodEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
const FString & InMethod,
const TArray< TSharedPtr< FJsonValue > > & InArguments )
protected

Handles the invoke method event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
InMethodThe method name to invoke.
InArgumentsThe arguments as a JSON value array.

◆ OnSlateLoadEndEvent()

void UCefView::OnSlateLoadEndEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
bool bInIsMainFrame,
int InHttpStatusCode )
protected

Handles the load end event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
bInIsMainFrameTrue if main frame; otherwise, false.
InHttpStatusCodeThe HTTP status code.

◆ OnSlateLoadErrorEvent()

void UCefView::OnSlateLoadErrorEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
bool bInIsMainFrame,
int InErrorCode,
const FString & InErrorMsg,
const FString & InFailedUrl,
bool & bInHandled )
protected

Handles the load error event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
bInIsMainFrameTrue if main frame; otherwise, false.
InErrorCodeThe error code.
InErrorMsgThe error message.
InFailedUrlThe URL that failed to load.
bInHandledSet to true if the error was handled; otherwise, false.

◆ OnSlateLoadingProgressChangedEvent()

void UCefView::OnSlateLoadingProgressChangedEvent ( double InProgress)
protected

Handles the loading progress changed event from the underlying Slate CEF view.

Parameters
InProgressThe loading progress (0.0 to 1.0).

◆ OnSlateLoadStartEvent()

void UCefView::OnSlateLoadStartEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
bool bInIsMainFrame,
int InTransitionType )
protected

Handles the load start event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
bInIsMainFrameTrue if main frame; otherwise, false.
InTransitionTypeThe navigation transition type.

◆ OnSlateLoadStateChangedEvent()

void UCefView::OnSlateLoadStateChangedEvent ( const int64 & InBrowserId,
bool bInIsLoading,
bool bInCanGoBack,
bool bInCanGoForward )
protected

Handles the load state changed event from the underlying Slate CEF view. Updates internal state and broadcasts the OnLoadStateChanged event.

Parameters
InBrowserIdThe browser ID.
bInIsLoadingTrue if loading; otherwise, false.
bInCanGoBackTrue if can go back; otherwise, false.
bInCanGoForwardTrue if can go forward; otherwise, false.

◆ OnSlateNativeBrowserCreatedEvent()

void UCefView::OnSlateNativeBrowserCreatedEvent ( )
protected

Handles the native browser created event from the underlying Slate CEF view. Used to perform additional initialization after the browser window is available.

◆ OnSlateQueryRequestEvent()

void UCefView::OnSlateQueryRequestEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
const int64 & InQueryId,
const FString & InRequest )
protected

Handles the query request event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
InQueryIdThe query ID.
InRequestThe query request string.

◆ OnSlateReportJavascriptResultEvent()

void UCefView::OnSlateReportJavascriptResultEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
const FString & InContext,
const TSharedPtr< FJsonValue > & InResult )
protected

Handles the report JavaScript result event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
InContextThe JavaScript execution context.
InResultThe result as a JSON value.

◆ OnSlateStatusMessageEvent()

void UCefView::OnSlateStatusMessageEvent ( const FString & InMessage)
protected

Handles the status message event from the underlying Slate CEF view.

Parameters
InMessageThe status message.

◆ OnSlateTitleChangedEvent()

void UCefView::OnSlateTitleChangedEvent ( const FString & InTitle)
protected

Handles the title changed event from the underlying Slate CEF view.

Parameters
InTitleThe new document title.

◆ OnSlateUrlRequestEvent()

void UCefView::OnSlateUrlRequestEvent ( const int64 & InBrowserId,
const FCefFrameId & InFrameId,
const FString & InRequestUrl )
protected

Handles the URL request event from the underlying Slate CEF view.

Parameters
InBrowserIdThe browser ID.
InFrameIdThe frame ID.
InRequestUrlThe requested URL.

◆ RebuildWidget()

virtual TSharedRef< SWidget > UCefView::RebuildWidget ( )
overrideprotectedvirtual

Rebuilds the underlying Slate widget for this UMG widget. Called by the engine when the widget needs to be constructed or updated.

Returns
A shared reference to the constructed Slate widget.

◆ ReleaseSlateResources()

virtual void UCefView::ReleaseSlateResources ( bool bInReleaseChildren)
overridevirtual

Releases resources held by the Slate widget, optionally releasing child widgets as well. Called when the UMG widget is destroyed or removed from the UI hierarchy.

Parameters
bInReleaseChildrenIf true, releases child widgets as well.

◆ ResponseUCefQuery()

bool UCefView::ResponseUCefQuery ( const UCefViewQuery * InCefQuery)

Responds to a CEF query with the provided result. Used for asynchronous communication between JavaScript and native code.

Parameters
InCefQueryThe CEF query object to respond to.
Returns
True if the query was successfully responded to; otherwise, false.

◆ SetDisablePopupContextMenu()

void UCefView::SetDisablePopupContextMenu ( bool bInIsDisable)

Sets whether to disable the context menu for pop-up browser windows.

Parameters
bInIsDisableTrue to disable the context menu; false to enable it.

◆ SetEnableDragAndDrop()

void UCefView::SetEnableDragAndDrop ( bool bInIsEnable)

Sets whether to enable drag and drop functionality for the browser. Note: This function does not work for OSR (Off-Screen Rendering) mode. In OSR, dragging a file to a non-dragging area may display the file's content.

Parameters
bInIsEnableTrue to enable drag and drop; false to disable.

In OSR mode, additional handling may be required to prevent unwanted file display.

◆ SetPreference()

bool UCefView::SetPreference ( const FString & InPreferenceName,
const FString & InPreferenceValue,
FString & InError )

Sets a browser preference to a specified value. Preferences control browser behavior such as cache, cookies, and rendering options.

Parameters
InPreferenceNameThe name of the preference to set (e.g., "webkit.webprefs.javascript_enabled").
InPreferenceValueThe value to set the preference to (as a string).
InErrorAn output parameter that will contain an error message if the preference could not be set.
Returns
True if the preference was successfully set; otherwise, false.

◆ ShowDevTools()

void UCefView::ShowDevTools ( )

Opens the DevTools dialog for the browser, allowing inspection and debugging of web content.

◆ SynchronizeProperties()

virtual void UCefView::SynchronizeProperties ( )
overridevirtual

Synchronizes UPROPERTY values with the underlying Slate widget. Called automatically by the engine when properties are changed in the editor or at runtime.

◆ TriggerEventForFrame()

bool UCefView::TriggerEventForFrame ( const UCefViewEvent * InCefViewEvent,
const FCefFrameId & InFrameId )

Triggers a custom event for a specific frame in the CEF view. Allows sending user-defined events to the browser for advanced interaction.

Parameters
InCefViewEventThe event object to trigger.
InFrameIdThe ID of the frame to trigger the event on.
Returns
True if the event was successfully triggered; otherwise, false.

◆ TriggerEventForMainFrame()

bool UCefView::TriggerEventForMainFrame ( const UCefViewEvent * InCefViewEvent)

Triggers a custom event for the main frame in the CEF view.

Parameters
InCefViewEventThe event object to trigger.
Returns
True if the event was successfully triggered; otherwise, false.

Member Data Documentation

◆ AllFrameID

const FCefFrameId UCefView::AllFrameID
static

The identifier representing all frames in the browser. Used for broadcasting events or actions to every frame.

◆ ArchiveFileResourceMapping

TArray<FArchiveFileResourceMapping> UCefView::ArchiveFileResourceMapping

Mappings for archive files (e.g., .zip) to be used as web resources. Each mapping allows content in the specified archive to be accessed via a virtual URL in the browser.

◆ bAcceptDrops

bool UCefView::bAcceptDrops = true

Enables or disables accepting drag-and-drop operations from external sources (e.g., files from OS). If true, the browser can accept drops; if false, drops are ignored. Default: false.

◆ bAllowDrag

bool UCefView::bAllowDrag = true

Enables or disables allowing the browser content to be dragged (initiating drag operations). If true, users can drag content from the browser; if false, dragging is disabled. Default: false.

◆ bEnableContextMenu

bool UCefView::bEnableContextMenu = true

Enables or disables the context menu in the CEF browser. If true, right-click context menus are shown; if false, they are suppressed. Default: true.

◆ FrameRate

int32 UCefView::FrameRate = 60

The frame rate (in frames per second) at which the CEF browser will render. Higher values provide smoother updates but may increase CPU/GPU usage. Default: 60.

◆ LocalFolderResroucesMapping

TArray<FLocalFolderResourceMapping> UCefView::LocalFolderResroucesMapping

Mappings for local folders to be used as web resources. Each mapping allows content in the specified folder to be accessed via a virtual URL in the browser.

◆ MainFrameID

const FCefFrameId UCefView::MainFrameID
static

The main frame identity, representing the primary document frame in the browser. Used for targeting main-frame-specific operations and events.

◆ OnAddressChanged

FOnAddressChangedEvent UCefView::OnAddressChanged

◆ OnConsoleMessage

FOnConsoleMessageEvent UCefView::OnConsoleMessage

◆ OnDraggableRegionChanged

FOnDraggableRegionChangedEvent UCefView::OnDraggableRegionChanged

◆ OnFaviconUrlChanged

FOnFaviconUrlChangedEvent UCefView::OnFaviconUrlChanged

◆ OnFullscreenModeChanged

FOnFullscreenModeChangedEvent UCefView::OnFullscreenModeChanged

◆ OnInvokeMethod

FOnInvokeMethodEvent UCefView::OnInvokeMethod

◆ OnLoadEnd

FOnLoadEndEvent UCefView::OnLoadEnd

◆ OnLoadError

FOnLoadErrorEvent UCefView::OnLoadError

◆ OnLoadingProgressChanged

FOnLoadingProgressChangedEvent UCefView::OnLoadingProgressChanged

◆ OnLoadStart

FOnLoadStartEvent UCefView::OnLoadStart

◆ OnLoadStateChanged

FOnLoadStateChangedEvent UCefView::OnLoadStateChanged

◆ OnNativeBrowserCreated

FOnNativeBrowserCreatedEvent UCefView::OnNativeBrowserCreated

◆ OnQueryRequest

FOnQueryRequestEvent UCefView::OnQueryRequest

◆ OnReportJavascriptResult

FOnReportJavascriptResultEvent UCefView::OnReportJavascriptResult

◆ OnStatusMessage

FOnStatusMessageEvent UCefView::OnStatusMessage

◆ OnTitleChanged

FOnTitleChangedEvent UCefView::OnTitleChanged

◆ OnUrlRequest

FOnUrlRequestEvent UCefView::OnUrlRequest

◆ Settings

FCefViewSettings UCefView::Settings

Settings for the CEF view, including browser features, font preferences, and other options. These settings are applied when the browser is created and cannot be changed at runtime.

◆ SlateCefView

TSharedPtr<SCefView> UCefView::SlateCefView
protected

◆ Url

FString UCefView::Url

The initial URL to be loaded in the CEF browser when the widget is created. Can be changed at runtime to navigate to a different page.