unit uCEFChromiumOptions;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$I cef.inc}
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes,
{$ELSE}
Classes,
{$ENDIF}
uCEFTypes, uCEFConstants;
type
///
/// The TChromiumOptions properties used to fill the TCefBrowserSettings record which is used during the browser creation.
///
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;
FChromeStatusBubble : TCefState;
FChromeZoomBubble : TCefState;
public
///
/// Constructor of TChromiumOptions
///
constructor Create; virtual;
published
///
/// Controls whether JavaScript can be executed. Also configurable using the
/// "disable-javascript" command-line switch.
///
property Javascript : TCefState read FJavascript write FJavascript default STATE_DEFAULT;
///
/// 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.
///
property JavascriptCloseWindows : TCefState read FJavascriptCloseWindows write FJavascriptCloseWindows default STATE_DEFAULT;
///
/// Controls whether JavaScript can access the clipboard. Also configurable
/// using the "disable-javascript-access-clipboard" command-line switch.
///
property JavascriptAccessClipboard : TCefState read FJavascriptAccessClipboard write FJavascriptAccessClipboard default STATE_DEFAULT;
///
/// 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.
///
property JavascriptDomPaste : TCefState read FJavascriptDomPaste write FJavascriptDomPaste default STATE_DEFAULT;
///
/// 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.
///
property ImageLoading : TCefState read FImageLoading write FImageLoading default STATE_DEFAULT;
///
/// Controls whether standalone images will be shrunk to fit the page. Also
/// configurable using the "image-shrink-standalone-to-fit" command-line
/// switch.
///
property ImageShrinkStandaloneToFit : TCefState read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit default STATE_DEFAULT;
///
/// Controls whether text areas can be resized. Also configurable using the
/// "disable-text-area-resize" command-line switch.
///
property TextAreaResize : TCefState read FTextAreaResize write FTextAreaResize default STATE_DEFAULT;
///
/// Controls whether the tab key can advance focus to links. Also configurable
/// using the "disable-tab-to-links" command-line switch.
///
property TabToLinks : TCefState read FTabToLinks write FTabToLinks default STATE_DEFAULT;
///
/// Controls whether local storage can be used. Also configurable using the
/// "disable-local-storage" command-line switch.
///
property LocalStorage : TCefState read FLocalStorage write FLocalStorage default STATE_DEFAULT;
///
/// Controls whether databases can be used. Also configurable using the
/// "disable-databases" command-line switch.
///
property Databases : TCefState read FDatabases write FDatabases default STATE_DEFAULT;
///
/// 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.
///
property Webgl : TCefState read FWebgl write FWebgl default STATE_DEFAULT;
///
/// 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.
///
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor default 0;
///
/// 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.
///
///
/// Use CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT as default value if the shared textures are enabled.
/// Use CEF_OSR_FRAMERATE_DEFAULT as default value if the shared textures are disabled.
///
property WindowlessFrameRate : Integer read FWindowlessFrameRate write FWindowlessFrameRate default CEF_OSR_FRAMERATE_DEFAULT;
///
/// Controls whether the Chrome status bubble will be used. Only supported
/// with the Chrome runtime. For details about the status bubble see
/// https://www.chromium.org/user-experience/status-bubble/
///
property ChromeStatusBubble : TCefState read FChromeStatusBubble write FChromeStatusBubble default STATE_DEFAULT;
///
/// Controls whether the Chrome zoom bubble will be shown when zooming. Only
/// supported with the Chrome runtime.
///
property ChromeZoomBubble : TCefState read FChromeZoomBubble write FChromeZoomBubble default STATE_DEFAULT;
end;
implementation
constructor TChromiumOptions.Create;
begin
FWindowlessFrameRate := CEF_OSR_FRAMERATE_DEFAULT;
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;
FChromeStatusBubble := STATE_DEFAULT;
FChromeZoomBubble := STATE_DEFAULT;
end;
end.