2017-01-27 17:29:37 +01:00
|
|
|
unit uCEFChromiumOptions;
|
|
|
|
|
2018-05-12 14:50:54 +02:00
|
|
|
{$IFDEF FPC}
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
{$ENDIF}
|
|
|
|
|
2017-02-05 20:56:46 +01:00
|
|
|
{$I cef.inc}
|
|
|
|
|
2022-02-19 18:56:41 +01:00
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
|
|
{$MINENUMSIZE 4}
|
|
|
|
|
2017-01-27 17:29:37 +01:00
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2017-02-05 20:56:46 +01:00
|
|
|
{$IFDEF DELPHI16_UP}
|
2017-01-27 17:29:37 +01:00
|
|
|
System.Classes,
|
2017-02-05 20:56:46 +01:00
|
|
|
{$ELSE}
|
|
|
|
Classes,
|
|
|
|
{$ENDIF}
|
2021-04-18 19:36:20 +02:00
|
|
|
uCEFTypes, uCEFConstants;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
|
|
type
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// The TChromiumOptions properties used to fill the TCefBrowserSettings record which is used during the browser creation.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
TChromiumOptions = class(TPersistent)
|
|
|
|
protected
|
|
|
|
FWindowlessFrameRate : Integer;
|
|
|
|
FJavascript : TCefState;
|
|
|
|
FJavascriptCloseWindows : TCefState;
|
|
|
|
FJavascriptAccessClipboard : TCefState;
|
|
|
|
FJavascriptDomPaste : TCefState;
|
|
|
|
FImageLoading : TCefState;
|
|
|
|
FImageShrinkStandaloneToFit : TCefState;
|
|
|
|
FTextAreaResize : TCefState;
|
|
|
|
FTabToLinks : TCefState;
|
|
|
|
FLocalStorage : TCefState;
|
|
|
|
FDatabases : TCefState;
|
|
|
|
FWebgl : TCefState;
|
|
|
|
FBackgroundColor : TCefColor;
|
2022-05-03 12:43:16 +02:00
|
|
|
FChromeStatusBubble : TCefState;
|
2023-10-22 19:09:51 +02:00
|
|
|
FChromeZoomBubble : TCefState;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
|
|
public
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Constructor of TChromiumOptions
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
constructor Create; virtual;
|
|
|
|
|
|
|
|
published
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether JavaScript can be executed. Also configurable using the
|
|
|
|
/// "disable-javascript" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property Javascript : TCefState read FJavascript write FJavascript default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether JavaScript can be used to close windows that were not
|
|
|
|
/// opened via JavaScript. JavaScript can still be used to close windows that
|
|
|
|
/// were opened via JavaScript or that have no back/forward history. Also
|
|
|
|
/// configurable using the "disable-javascript-close-windows" command-line
|
|
|
|
/// switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property JavascriptCloseWindows : TCefState read FJavascriptCloseWindows write FJavascriptCloseWindows default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether JavaScript can access the clipboard. Also configurable
|
|
|
|
/// using the "disable-javascript-access-clipboard" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property JavascriptAccessClipboard : TCefState read FJavascriptAccessClipboard write FJavascriptAccessClipboard default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether DOM pasting is supported in the editor via
|
|
|
|
/// execCommand("paste"). The |javascript_access_clipboard| setting must also
|
|
|
|
/// be enabled. Also configurable using the "disable-javascript-dom-paste"
|
|
|
|
/// command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property JavascriptDomPaste : TCefState read FJavascriptDomPaste write FJavascriptDomPaste default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether image URLs will be loaded from the network. A cached
|
|
|
|
/// image will still be rendered if requested. Also configurable using the
|
|
|
|
/// "disable-image-loading" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property ImageLoading : TCefState read FImageLoading write FImageLoading default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether standalone images will be shrunk to fit the page. Also
|
|
|
|
/// configurable using the "image-shrink-standalone-to-fit" command-line
|
|
|
|
/// switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property ImageShrinkStandaloneToFit : TCefState read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether text areas can be resized. Also configurable using the
|
|
|
|
/// "disable-text-area-resize" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property TextAreaResize : TCefState read FTextAreaResize write FTextAreaResize default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether the tab key can advance focus to links. Also configurable
|
|
|
|
/// using the "disable-tab-to-links" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property TabToLinks : TCefState read FTabToLinks write FTabToLinks default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether local storage can be used. Also configurable using the
|
|
|
|
/// "disable-local-storage" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property LocalStorage : TCefState read FLocalStorage write FLocalStorage default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether databases can be used. Also configurable using the
|
|
|
|
/// "disable-databases" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property Databases : TCefState read FDatabases write FDatabases default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether WebGL can be used. Note that WebGL requires hardware
|
|
|
|
/// support and may not work on all systems even when enabled. Also
|
|
|
|
/// configurable using the "disable-webgl" command-line switch.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property Webgl : TCefState read FWebgl write FWebgl default STATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Background color used for the browser before a document is loaded and when
|
|
|
|
/// no document color is specified. The alpha component must be either fully
|
|
|
|
/// opaque (0xFF) or fully transparent (0x00). If the alpha component is fully
|
|
|
|
/// opaque then the RGB components will be used as the background color. If
|
|
|
|
/// the alpha component is fully transparent for a windowed browser then the
|
|
|
|
/// TCefSettings.background_color value will be used. If the alpha component is
|
|
|
|
/// fully transparent for a windowless (off-screen) browser then transparent
|
|
|
|
/// painting will be enabled.
|
|
|
|
/// </summary>
|
2017-01-27 17:29:37 +01:00
|
|
|
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor default 0;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// The maximum rate in frames per second (fps) that ICefRenderHandler.OnPaint
|
|
|
|
/// will be called for a windowless browser. The actual fps may be lower if
|
|
|
|
/// the browser cannot generate frames at the requested rate. The minimum
|
|
|
|
/// value is 1 and the maximum value is 60 (default 30). This value can also
|
|
|
|
/// be changed dynamically via ICefBrowserHost.SetWindowlessFrameRate.
|
|
|
|
/// </summary>
|
|
|
|
/// <remarks>
|
|
|
|
/// <para>Use CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT as default value if the shared textures are enabled.</para>
|
|
|
|
/// <para>Use CEF_OSR_FRAMERATE_DEFAULT as default value if the shared textures are disabled.</para>
|
|
|
|
/// </remarks>
|
2021-04-18 19:36:20 +02:00
|
|
|
property WindowlessFrameRate : Integer read FWindowlessFrameRate write FWindowlessFrameRate default CEF_OSR_FRAMERATE_DEFAULT;
|
2023-09-24 11:21:05 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether the Chrome status bubble will be used. Only supported
|
2024-09-03 17:26:03 +02:00
|
|
|
/// with Chrome style. For details about the status bubble see
|
2023-09-24 11:21:05 +02:00
|
|
|
/// https://www.chromium.org/user-experience/status-bubble/
|
|
|
|
/// </summary>
|
2022-05-03 12:43:16 +02:00
|
|
|
property ChromeStatusBubble : TCefState read FChromeStatusBubble write FChromeStatusBubble default STATE_DEFAULT;
|
2023-10-22 19:09:51 +02:00
|
|
|
/// <summary>
|
|
|
|
/// Controls whether the Chrome zoom bubble will be shown when zooming. Only
|
2024-09-03 17:26:03 +02:00
|
|
|
/// supported with Chrome style.
|
2023-10-22 19:09:51 +02:00
|
|
|
/// </summary>
|
|
|
|
property ChromeZoomBubble : TCefState read FChromeZoomBubble write FChromeZoomBubble default STATE_DEFAULT;
|
2017-01-27 17:29:37 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
constructor TChromiumOptions.Create;
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
FWindowlessFrameRate := CEF_OSR_FRAMERATE_DEFAULT;
|
2017-01-27 17:29:37 +01:00
|
|
|
FJavascript := STATE_DEFAULT;
|
|
|
|
FJavascriptCloseWindows := STATE_DEFAULT;
|
|
|
|
FJavascriptAccessClipboard := STATE_DEFAULT;
|
|
|
|
FJavascriptDomPaste := STATE_DEFAULT;
|
|
|
|
FImageLoading := STATE_DEFAULT;
|
|
|
|
FImageShrinkStandaloneToFit := STATE_DEFAULT;
|
|
|
|
FTextAreaResize := STATE_DEFAULT;
|
|
|
|
FTabToLinks := STATE_DEFAULT;
|
|
|
|
FLocalStorage := STATE_DEFAULT;
|
|
|
|
FDatabases := STATE_DEFAULT;
|
|
|
|
FWebgl := STATE_DEFAULT;
|
|
|
|
FBackgroundColor := 0;
|
2022-05-03 12:43:16 +02:00
|
|
|
FChromeStatusBubble := STATE_DEFAULT;
|
2023-10-22 19:09:51 +02:00
|
|
|
FChromeZoomBubble := STATE_DEFAULT;
|
2017-01-27 17:29:37 +01:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|