unit uCEFApplicationCore; {$IFDEF FPC} {$MODE OBJFPC}{$H+} {$ENDIF} {$I cef.inc} {$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF} {$MINENUMSIZE 4} {$IFNDEF FPC}{$IFNDEF DELPHI12_UP} // Workaround for "Internal error" in old Delphi versions caused by uint64 handling {$R-} {$ENDIF}{$ENDIF} interface uses {$IFDEF DELPHI16_UP} {$IFDEF MSWINDOWS}WinApi.Windows,{$ENDIF} System.Classes, System.UITypes, System.SyncObjs, {$IFDEF FMX}uCEFLinuxTypes,{$ENDIF} {$ELSE} {$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, {$IFDEF FPC}dynlibs,{$ENDIF} SyncObjs, {$ENDIF} {$IFDEF LINUX} {$IFDEF FPC}xlib,{$ENDIF} uCEFArgCopy, {$ENDIF} uCEFTypes, uCEFInterfaces, uCEFApplicationEvents, uCEFBaseRefCounted, uCEFSchemeRegistrar, uCEFPreferenceRegistrar, uCEFComponentIdList; const {$I uCEFVersion.inc} {$IFDEF MSWINDOWS} LIBCEF_DLL = 'libcef.dll'; CHROMEELF_DLL = 'chrome_elf.dll'; {$ENDIF} {$IFDEF MACOSX} LIBCEF_DLL = 'Chromium Embedded Framework'; LIBCEF_PREFIX = 'Contents/Frameworks/Chromium Embedded Framework.framework/'; CHROMEELF_DLL = ''; {$ENDIF} {$IFDEF LINUX} LIBCEF_DLL = 'libcef.so'; CHROMEELF_DLL = ''; {$ENDIF} {$IFDEF ANDROID} LIBCEF_DLL = ''; CHROMEELF_DLL = ''; {$ENDIF} // for InitLibLocationFromArgs LIBCEF_PAK = 'cef.pak'; LIBCEF_LOCALE_DIR = 'locales'; LIBCEF_LOCALE_ENUS = 'en-US.pak'; type /// /// Parent class of TCefApplication used to simplify the CEF initialization and destruction. /// TCefApplicationCore = class(TInterfacedObject, IApplicationCoreEvents) protected // Fields used to populate TCefSettings FNoSandbox : boolean; FBrowserSubprocessPath : ustring; FFrameworkDirPath : ustring; FMainBundlePath : ustring; // Only used in macOS FChromeRuntime : boolean; FMultiThreadedMessageLoop : boolean; FExternalMessagePump : boolean; FWindowlessRenderingEnabled : boolean; FCommandLineArgsDisabled : boolean; FCache : ustring; FRootCache : ustring; FPersistSessionCookies : boolean; FPersistUserPreferences : boolean; FUserAgent : ustring; FUserAgentProduct : ustring; FLocale : ustring; FLogFile : ustring; FLogSeverity : TCefLogSeverity; FLogItems : TCefLogItems; FJavaScriptFlags : ustring; FResourcesDirPath : ustring; FLocalesDirPath : ustring; FPackLoadingDisabled : boolean; FRemoteDebuggingPort : integer; FUncaughtExceptionStackSize : integer; FIgnoreCertificateErrors : boolean; FBackgroundColor : TCefColor; FAcceptLanguageList : ustring; FCookieableSchemesList : ustring; FCookieableSchemesExcludeDefaults : boolean; FChromePolicyId : ustring; FChromeAppIconId : integer; // Fields used to set command line switches FSingleProcess : boolean; FEnableMediaStream : boolean; FEnableSpeechInput : boolean; FUseFakeUIForMediaStream : boolean; FEnableUsermediaScreenCapturing : boolean; FEnableGPU : boolean; FEnableFeatures : ustring; FDisableFeatures : ustring; FEnableBlinkFeatures : ustring; FDisableBlinkFeatures : ustring; FBlinkSettings : ustring; FForceFieldTrials : ustring; FForceFieldTrialParams : ustring; FSmoothScrolling : TCefState; FMuteAudio : boolean; FSitePerProcess : boolean; FDisableWebSecurity : boolean; FDisablePDFExtension : boolean; FDisableSiteIsolationTrials : boolean; FDisableChromeLoginPrompt : boolean; FDisableExtensions : boolean; FAutoplayPolicy : TCefAutoplayPolicy; FDisableBackgroundNetworking : boolean; FMetricsRecordingOnly : boolean; FAllowFileAccessFromFiles : boolean; FAllowRunningInsecureContent : boolean; FEnablePrintPreview : boolean; FDefaultEncoding : ustring; FDisableJavascript : boolean; FDisableJavascriptCloseWindows : boolean; FDisableJavascriptAccessClipboard : boolean; FDisableJavascriptDomPaste : boolean; FAllowUniversalAccessFromFileUrls : boolean; FDisableImageLoading : boolean; FImageShrinkStandaloneToFit : boolean; FDisableTextAreaResize : boolean; FDisableTabToLinks : boolean; FEnableProfanityFilter : boolean; FDisableSpellChecking : boolean; FOverrideSpellCheckLang : ustring; FTouchEvents : TCefState; FDisableReadingFromCanvas : boolean; FHyperlinkAuditing : boolean; FDisableNewBrowserInfoTimeout : boolean; FDevToolsProtocolLogFile : ustring; FForcedDeviceScaleFactor : single; FDisableZygote : boolean; // Only used in Linux FUseMockKeyChain : boolean; // Only used in macOS FDisableRequestHandlingForTesting : boolean; FDisablePopupBlocking : boolean; FDisableBackForwardCache : boolean; FDisableComponentUpdate : boolean; FAllowInsecureLocalhost : boolean; FKioskPrinting : boolean; FTreatInsecureOriginAsSecure : ustring; FNetLogEnabled : boolean; FNetLogFile : ustring; FNetLogCaptureMode : TCefNetLogCaptureMode; FRemoteAllowOrigins : ustring; FAutoAcceptCamAndMicCapture : boolean; FUIColorMode : TCefUIColorMode; FDisableHangMonitor : boolean; // Fields used during the CEF initialization FWindowsSandboxInfo : pointer; {$IFDEF LINUX} FArgCopy : TCEFArgCopy; {$ENDIF} // Fields used by custom properties FDeleteCache : boolean; FDeleteCookies : boolean; FCheckCEFFiles : boolean; FShowMessageDlg : boolean; FMissingBinariesException : boolean; FSetCurrentDir : boolean; FGlobalContextInitialized : boolean; FChromeVersionInfo : TFileVersionInfo; FLibLoaded : boolean; FLogProcessInfo : boolean; FReRaiseExceptions : boolean; FDeviceScaleFactor : single; FLocalesRequired : ustring; FProcessType : TCefProcessType; FMustCreateResourceBundleHandler : boolean; FMustCreateBrowserProcessHandler : boolean; FMustCreateRenderProcessHandler : boolean; FMustCreateLoadHandler : boolean; FStatus : TCefAplicationStatus; FMissingLibFiles : string; FMustFreeLibrary : boolean; FLastErrorMessage : ustring; // Internal fields FLibHandle : {$IFDEF FPC}TLibHandle{$ELSE}THandle{$ENDIF}; FCustomCommandLines : TStringList; FCustomCommandLineValues : TStringList; FAppSettings : TCefSettings; FDisableGPUCache : boolean; FComponentIDList : TCEFComponentIdList; // ICefApp FOnRegisterCustomSchemes : TOnRegisterCustomSchemesEvent; // ICefBrowserProcessHandler FOnRegisterCustomPreferences : TOnRegisterCustomPreferencesEvent; FOnContextInitialized : TOnContextInitializedEvent; FOnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent; FOnAlreadyRunningAppRelaunch : TOnAlreadyRunningAppRelaunchEvent; FOnScheduleMessagePumpWork : TOnScheduleMessagePumpWorkEvent; FOnGetDefaultClient : TOnGetDefaultClientEvent; FOnGetDefaultRequestContextHandler : TOnGetDefaultRequestContextHandlerEvent; // ICefResourceBundleHandler FOnGetLocalizedString : TOnGetLocalizedStringEvent; FOnGetDataResource : TOnGetDataResourceEvent; FOnGetDataResourceForScale : TOnGetDataResourceForScaleEvent; // ICefRenderProcessHandler FOnWebKitInitialized : TOnWebKitInitializedEvent; FOnBrowserCreated : TOnBrowserCreatedEvent; FOnBrowserDestroyed : TOnBrowserDestroyedEvent; FOnContextCreated : TOnContextCreatedEvent; FOnContextReleased : TOnContextReleasedEvent; FOnUncaughtException : TOnUncaughtExceptionEvent; FOnFocusedNodeChanged : TOnFocusedNodeChangedEvent; FOnProcessMessageReceived : TOnProcessMessageReceivedEvent; // ICefLoadHandler FOnLoadingStateChange : TOnRenderLoadingStateChange; FOnLoadStart : TOnRenderLoadStart; FOnLoadEnd : TOnRenderLoadEnd; FOnLoadError : TOnRenderLoadError; procedure SetCache(const aValue : ustring); procedure SetRootCache(const aValue : ustring); procedure SetBrowserSubprocessPath(const aValue : ustring); procedure SetFrameworkDirPath(const aValue : ustring); procedure SetResourcesDirPath(const aValue : ustring); procedure SetLocalesDirPath(const aValue : ustring); {$IFDEF MSWINDOWS} procedure SetOsmodalLoop(aValue : boolean); {$ENDIF} procedure SetKioskPrinting(aValue : boolean); function GetChromeVersion : ustring; function GetLibCefVersion : ustring; function GetLibCefPath : ustring; function GetChromeElfPath : ustring; function GetLocalesDirPath: ustring; function GetResourcesDirPath: ustring; function GetMustCreateResourceBundleHandler : boolean; virtual; function GetMustCreateBrowserProcessHandler : boolean; virtual; function GetMustCreateRenderProcessHandler : boolean; virtual; function GetMustCreateLoadHandler : boolean; virtual; function GetGlobalContextInitialized : boolean; function GetChildProcessesCount : integer; function GetUsedMemory : uint64; function GetTotalSystemMemory : uint64; function GetAvailableSystemMemory : uint64; function GetSystemMemoryLoad : cardinal; function GetApiHashUniversal : ustring; function GetApiHashPlatform : ustring; function GetApiHashCommit : ustring; function GetExitCode : TCefResultCode; {$IFDEF LINUX} function GetXDisplay : PXDisplay; function GetArgc : longint; function GetArgv : PPAnsiChar; {$ENDIF} function LoadCEFlibrary : boolean; virtual; function Load_cef_api_hash_h : boolean; function Load_cef_app_capi_h : boolean; function Load_cef_app_win_h : boolean; function Load_cef_browser_capi_h : boolean; function Load_cef_command_line_capi_h : boolean; function Load_cef_cookie_capi_h : boolean; function Load_cef_crash_util_h : boolean; function Load_cef_drag_data_capi_h : boolean; function Load_cef_file_util_capi_h : boolean; function Load_cef_i18n_util_capi_h : boolean; function Load_cef_image_capi_h : boolean; function Load_cef_menu_model_capi_h : boolean; function Load_cef_media_router_capi_h : boolean; function Load_cef_origin_whitelist_capi_h : boolean; function Load_cef_parser_capi_h : boolean; function Load_cef_path_util_capi_h : boolean; function Load_cef_preference_capi_h : boolean; function Load_cef_print_settings_capi_h : boolean; function Load_cef_process_message_capi_h : boolean; function Load_cef_process_util_capi_h : boolean; function Load_cef_request_capi_h : boolean; function Load_cef_request_context_capi_h : boolean; function Load_cef_resource_bundle_capi_h : boolean; function Load_cef_response_capi_h : boolean; function Load_cef_scheme_capi_h : boolean; function Load_cef_server_capi_h : boolean; function Load_cef_shared_process_message_builder_capi_h : boolean; function Load_cef_ssl_info_capi_h : boolean; function Load_cef_stream_capi_h : boolean; function Load_cef_task_capi_h : boolean; function Load_cef_thread_capi_h : boolean; function Load_cef_trace_capi_h : boolean; function Load_cef_urlrequest_capi_h : boolean; function Load_cef_v8_capi_h : boolean; function Load_cef_values_capi_h : boolean; function Load_cef_waitable_event_capi_h : boolean; function Load_cef_xml_reader_capi_h : boolean; function Load_cef_zip_reader_capi_h : boolean; function Load_cef_logging_internal_h : boolean; function Load_cef_string_list_h : boolean; function Load_cef_string_map_h : boolean; function Load_cef_string_multimap_h : boolean; function Load_cef_string_types_h : boolean; function Load_cef_thread_internal_h : boolean; function Load_cef_trace_event_internal_h : boolean; function Load_cef_browser_view_capi_h : boolean; function Load_cef_display_capi_h : boolean; function Load_cef_label_button_capi_h : boolean; function Load_cef_menu_button_capi_h : boolean; function Load_cef_panel_capi_h : boolean; function Load_cef_scroll_view_capi_h : boolean; function Load_cef_textfield_capi_h : boolean; function Load_cef_window_capi_h : boolean; function Load_cef_types_linux_h : boolean; function Load_cef_time_h : boolean; // ICefApp procedure doOnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine); virtual; procedure doOnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); virtual; // ICefBrowserProcessHandler procedure doOnRegisterCustomPreferences(type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); virtual; procedure doOnContextInitialized; virtual; procedure doOnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual; procedure doOnAlreadyRunningAppRelaunch(const commandLine: ICefCommandLine; const current_directory: ustring; var aResult: boolean); virtual; procedure doOnScheduleMessagePumpWork(const delayMs: Int64); virtual; procedure doGetDefaultClient(var aClient : ICefClient); virtual; procedure doGetDefaultRequestContextHandler(var aRequestContextHandler : ICefRequestContextHandler); virtual; // ICefResourceBundleHandler function doGetLocalizedString(stringid: Integer; var stringVal: ustring): Boolean; virtual; function doGetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt): Boolean; virtual; function doGetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt): Boolean; virtual; // ICefRenderProcessHandler procedure doOnWebKitInitialized; virtual; procedure doOnBrowserCreated(const browser: ICefBrowser; const extra_info: ICefDictionaryValue); virtual; procedure doOnBrowserDestroyed(const browser: ICefBrowser); virtual; procedure doOnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); virtual; procedure doOnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); virtual; procedure doOnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const V8Exception: ICefV8Exception; const stackTrace: ICefV8StackTrace); virtual; procedure doOnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode); virtual; procedure doOnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage; var aHandled : boolean); virtual; // ICefLoadHandler procedure doOnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); virtual; procedure doOnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType); virtual; procedure doOnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); virtual; procedure doOnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring); virtual; procedure ShutDown; procedure FreeLibcefLibrary; function ExecuteProcess(const aApp : ICefApp) : integer; procedure InitializeCefMainArgs(var aCefMainArgs : TCefMainArgs); procedure InitializeSettings(var aSettings : TCefSettings); function InitializeLibrary(const aApp : ICefApp) : boolean; procedure RenameAndDeleteDir(const aDirectory : string; aKeepCookies : boolean = False); procedure DeleteCacheContents(const aDirectory : string); procedure DeleteCookiesDB(const aDirectory : string); procedure MoveCookiesDB(const aSrcDirectory, aDstDirectory : string); function MultiExeProcessing : boolean; function SingleExeProcessing : boolean; procedure BeforeInitSubProcess; virtual; function CheckCEFResources : boolean; virtual; {$IFDEF MSWINDOWS} function CheckCEFDLL : boolean; virtual; function CheckWindowsVersion: boolean; virtual; {$ENDIF} procedure ShowErrorMessageDlg(const aError : string); virtual; function ParseProcessType : TCefProcessType; procedure AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); virtual; procedure AppendSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = ''); procedure ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = ''); procedure CleanupFeatures(var aKeys, aValues : TStringList; const aEnableKey, aDisableKey : string); procedure ClearSchemeHandlerFactories; public constructor Create; destructor Destroy; override; procedure AfterConstruction; override; /// /// Used to add any command line switch that is not available as a /// TCEFApplicationCore property. /// procedure AddCustomCommandLine(const aCommandLine : string; const aValue : string = ''); /// /// Used to check the CEF binaries manually. /// function CheckCEFLibrary : boolean; /// /// Used to initialize CEF in the main browser process. In case CEF is /// configured to used the same executable for all processes then all /// processes must call this function. CEF can only be initialized once /// per process. This is a CEF feature and there's no workaround. This /// function returns immediately in when called in the main process and /// it blocks the execution when it's called from a CEF subprocess until /// that process ends. /// function StartMainProcess : boolean; /// /// Used to initialize CEF in the subprocesses. This function can only be /// used when CEF is configured to use a different executable for the /// subprocesses. This function blocks the execution until the process ends. /// function StartSubProcess : boolean; /// /// Perform a single iteration of CEF message loop processing. This function is /// provided for cases where the CEF message loop must be integrated into an /// existing application message loop. Use of this function is not recommended /// for most users; use either the RunMessageLoop function or /// TCefSettings.multi_threaded_message_loop if possible. When using this /// function care must be taken to balance performance against excessive CPU /// usage. It is recommended to enable the TCefSettings.external_message_pump /// option when using this function so that /// ICefBrowserProcessHandler.OnScheduleMessagePumpWork callbacks can /// facilitate the scheduling process. This function should only be called on /// the main application thread and only if cef_initialize() is called with a /// TCefSettings.multi_threaded_message_loop value of false (0). This function /// will not block. /// procedure DoMessageLoopWork; /// /// Run the CEF message loop. Use this function instead of an application- /// provided message loop to get the best balance between performance and CPU /// usage. This function should only be called on the main application thread /// and only if cef_initialize() is called with a /// TCefSettings.multi_threaded_message_loop value of false (0). This function /// will block until a quit message is received by the system. /// procedure RunMessageLoop; /// /// Quit the CEF message loop that was started by calling /// RunMessageLoop. This function should only be called on the main /// application thread and only if RunMessageLoop was used. /// procedure QuitMessageLoop; /// /// Update the DeviceScaleFactor value with the current monitor scale. /// procedure UpdateDeviceScaleFactor; virtual; {$IFDEF MACOSX} /// /// This procedure is only available in MacOS to read some configuration /// settings from the command line arguments. /// procedure InitLibLocationFromArgs; {$ENDIF} /// /// Returns true if a custom component ID is valid before executing a CEF task. /// function ValidComponentID(aComponentID : integer) : boolean; /// /// Returns the next component ID and adds this value to the valid ID list. /// function NextComponentID : integer; /// /// Removes a component ID from the valid ID list when a component is destroyed. /// procedure RemoveComponentID(aComponentID : integer); /// /// Set to true (1) to disable the sandbox for sub-processes. See /// cef_sandbox_win.h for requirements to enable the sandbox on Windows. Also /// configurable using the "no-sandbox" command-line switch. /// property NoSandbox : Boolean read FNoSandbox write FNoSandbox; /// /// The path to a separate executable that will be launched for sub-processes. /// If this value is empty on Windows or Linux then the main process /// executable will be used. If this value is empty on macOS then a helper /// executable must exist at "Contents/Frameworks/ /// Helper.app/Contents/MacOS/ Helper" in the top-level app bundle. See /// the comments on CefExecuteProcess() for details. If this value is /// non-empty then it must be an absolute path. Also configurable using the /// "browser-subprocess-path" command-line switch. /// property BrowserSubprocessPath : ustring read FBrowserSubprocessPath write SetBrowserSubprocessPath; /// /// The path to the CEF framework directory on macOS. If this value is empty /// then the framework must exist at "Contents/Frameworks/Chromium Embedded /// Framework.framework" in the top-level app bundle. If this value is /// non-empty then it must be an absolute path. Also configurable using the /// "framework-dir-path" command-line switch. /// property FrameworkDirPath : ustring read FFrameworkDirPath write SetFrameworkDirPath; /// /// The path to the main bundle on macOS. If this value is empty then it /// defaults to the top-level app bundle. If this value is non-empty then it /// must be an absolute path. Also configurable using the "main-bundle-path" /// command-line switch. /// property MainBundlePath : ustring read FMainBundlePath write FMainBundlePath; /// /// Set to true (1) to enable use of the Chrome runtime in CEF. This feature /// is considered experimental and is not recommended for most users at this /// time. See issue #2969 for details. /// property ChromeRuntime : boolean read FChromeRuntime write FChromeRuntime; /// /// Set to true (1) to have the browser process message loop run in a separate /// thread. If false (0) then the CefDoMessageLoopWork() function must be /// called from your application message loop. This option is only supported /// on Windows and Linux. /// property MultiThreadedMessageLoop : boolean read FMultiThreadedMessageLoop write FMultiThreadedMessageLoop; /// /// Set to true (1) to control browser process main (UI) thread message pump /// scheduling via the ICefBrowserProcessHandler.OnScheduleMessagePumpWork() /// callback. This option is recommended for use in combination with the /// CefDoMessageLoopWork() function in cases where the CEF message loop must /// be integrated into an existing application message loop (see additional /// comments and warnings on CefDoMessageLoopWork). Enabling this option is /// not recommended for most users; leave this option disabled and use either /// the CefRunMessageLoop() function or multi_threaded_message_loop if /// possible. /// property ExternalMessagePump : boolean read FExternalMessagePump write FExternalMessagePump; /// /// Set to true (1) to enable windowless (off-screen) rendering support. Do /// not enable this value if the application does not use windowless rendering /// as it may reduce rendering performance on some systems. /// property WindowlessRenderingEnabled : Boolean read FWindowlessRenderingEnabled write FWindowlessRenderingEnabled; /// /// Set to true (1) to disable configuration of browser process features using /// standard CEF and Chromium command-line arguments. Configuration can still /// be specified using CEF data structures or via the /// ICefApp.OnBeforeCommandLineProcessing() method. /// property CommandLineArgsDisabled : Boolean read FCommandLineArgsDisabled write FCommandLineArgsDisabled; /// /// The directory where data for the global browser cache will be stored on /// disk. If this value is non-empty then it must be an absolute path that is /// either equal to or a child directory of TCefSettings.root_cache_path. If /// this value is empty then browsers will be created in "incognito mode" /// where in-memory caches are used for storage and no profile-specific data /// is persisted to disk (installation-specific data will still be persisted /// in root_cache_path). HTML5 databases such as localStorage will only /// persist across sessions if a cache path is specified. Can be overridden /// for individual ICefRequestContext instances via the /// ICefRequestContextSettings.cache_path value. When using the Chrome runtime /// any child directory value will be ignored and the "default" profile (also /// a child directory) will be used instead. /// property Cache : ustring read FCache write SetCache; /// /// The root directory for installation-specific data and the parent directory /// for profile-specific data. All TCefSettings.cache_path and /// ICefRequestContextSettings.cache_path values must have this parent /// directory in common. If this value is empty and TCefSettings.cache_path is /// non-empty then it will default to the TCefSettings.cache_path value. Any /// non-empty value must be an absolute path. If both values are empty then /// the default platform-specific directory will be used /// ("~/.config/cef_user_data" directory on Linux, "~/Library/Application /// Support/CEF/User Data" directory on MacOS, "AppData\Local\CEF\User Data" /// directory under the user profile directory on Windows). Use of the default /// directory is not recommended in production applications (see below). /// Multiple application instances writing to the same root_cache_path /// directory could result in data corruption. A process singleton lock based /// on the root_cache_path value is therefore used to protect against this. /// This singleton behavior applies to all CEF-based applications using /// version 120 or newer. You should customize root_cache_path for your /// application and implement ICefBrowserProcessHandler.OnAlreadyRunningAppRelaunch, /// which will then be called on any app relaunch /// with the same root_cache_path value. /// Failure to set the root_cache_path value correctly may result in startup /// crashes or other unexpected behaviors (for example, the sandbox blocking /// read/write access to certain files). /// property RootCache : ustring read FRootCache write SetRootCache; /// /// To persist session cookies (cookies without an expiry date or validity /// interval) by default when using the global cookie manager set this value /// to true (1). Session cookies are generally intended to be transient and /// most Web browsers do not persist them. A |cache_path| value must also be /// specified to enable this feature. Also configurable using the /// "persist-session-cookies" command-line switch. Can be overridden for /// individual CefRequestContext instances via the /// TCefRequestContextSettings.persist_session_cookies value. /// property PersistSessionCookies : Boolean read FPersistSessionCookies write FPersistSessionCookies; /// /// To persist user preferences as a JSON file in the cache path directory set /// this value to true (1). A |cache_path| value must also be specified /// to enable this feature. Also configurable using the /// "persist-user-preferences" command-line switch. Can be overridden for /// individual CefRequestContext instances via the /// TCefRequestContextSettings.persist_user_preferences value. /// property PersistUserPreferences : Boolean read FPersistUserPreferences write FPersistUserPreferences; /// /// Value that will be returned as the User-Agent HTTP header. If empty the /// default User-Agent string will be used. Also configurable using the /// "user-agent" command-line switch. /// property UserAgent : ustring read FUserAgent write FUserAgent; /// /// Value that will be inserted as the product portion of the default /// User-Agent string. If empty the Chromium product version will be used. If /// |userAgent| is specified this value will be ignored. Also configurable /// using the "user-agent-product" command-line switch. /// property UserAgentProduct : ustring read FUserAgentProduct write FUserAgentProduct; /// /// The locale string that will be passed to WebKit. If empty the default /// locale of "en-US" will be used. This value is ignored on Linux where /// locale is determined using environment variable parsing with the /// precedence order: LANGUAGE, LC_ALL, LC_MESSAGES and LANG. Also /// configurable using the "lang" command-line switch. /// property Locale : ustring read FLocale write FLocale; /// /// The directory and file name to use for the debug log. If empty a default /// log file name and location will be used. On Windows and Linux a /// "debug.log" file will be written in the main executable directory. On /// MacOS a "~/Library/Logs/[app name]_debug.log" file will be written where /// [app name] is the name of the main app executable. Also configurable using /// the "log-file" command-line switch. /// property LogFile : ustring read FLogFile write FLogFile; /// /// The log severity. Only messages of this severity level or higher will be /// logged. When set to DISABLE no messages will be written to the log file, /// but FATAL messages will still be output to stderr. Also configurable using /// the "log-severity" command-line switch with a value of "verbose", "info", /// "warning", "error", "fatal" or "disable". /// property LogSeverity : TCefLogSeverity read FLogSeverity write FLogSeverity; /// /// The log items prepended to each log line. If not set the default log items /// will be used. Also configurable using the "log-items" command-line switch /// with a value of "none" for no log items, or a comma-delimited list of /// values "pid", "tid", "timestamp" or "tickcount" for custom log items. /// property LogItems : TCefLogItems read FLogItems write FLogItems; /// /// Custom flags that will be used when initializing the V8 JavaScript engine. /// The consequences of using custom flags may not be well tested. Also /// configurable using the "js-flags" command-line switch. /// property JavaScriptFlags : ustring read FJavaScriptFlags write FJavaScriptFlags; /// /// The fully qualified path for the resources directory. If this value is /// empty the *.pak files must be located in the module directory on /// Windows/Linux or the app bundle Resources directory on MacOS. If this /// value is non-empty then it must be an absolute path. Also configurable /// using the "resources-dir-path" command-line switch. /// property ResourcesDirPath : ustring read GetResourcesDirPath write SetResourcesDirPath; /// /// The fully qualified path for the locales directory. If this value is empty /// the locales directory must be located in the module directory. If this /// value is non-empty then it must be an absolute path. This value is ignored /// on MacOS where pack files are always loaded from the app bundle Resources /// directory. Also configurable using the "locales-dir-path" command-line /// switch. /// property LocalesDirPath : ustring read GetLocalesDirPath write SetLocalesDirPath; /// /// Set to true (1) to disable loading of pack files for resources and /// locales. A resource bundle handler must be provided for the browser and /// render processes via ICefApp.GetResourceBundleHandler() if loading of pack /// files is disabled. Also configurable using the "disable-pack-loading" /// command- line switch. /// property PackLoadingDisabled : Boolean read FPackLoadingDisabled write FPackLoadingDisabled; /// /// Set to a value between 1024 and 65535 to enable remote debugging on the /// specified port. Also configurable using the "remote-debugging-port" /// command-line switch. Specifying 0 via the command-line switch will result /// in the selection of an ephemeral port and the port number will be printed /// as part of the WebSocket endpoint URL to stderr. If a cache directory path /// is provided the port will also be written to the /// /DevToolsActivePort file. Remote debugging can be accessed by /// loading the chrome://inspect page in Google Chrome. Port numbers 9222 and /// 9229 are discoverable by default. Other port numbers may need to be /// configured via "Discover network targets" on the Devices tab. /// property RemoteDebuggingPort : Integer read FRemoteDebuggingPort write FRemoteDebuggingPort; /// /// The number of stack trace frames to capture for uncaught exceptions. /// Specify a positive value to enable the /// ICefRenderProcessHandler.OnUncaughtException() callback. Specify 0 /// (default value) and OnUncaughtException() will not be called. Also /// configurable using the "uncaught-exception-stack-size" command-line /// switch. /// property UncaughtExceptionStackSize : Integer read FUncaughtExceptionStackSize write FUncaughtExceptionStackSize; /// /// 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 /// default value of opaque white 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; /// /// Comma delimited ordered list of language codes without any whitespace that /// will be used in the "Accept-Language" HTTP request header and /// "navigator.language" JS attribute. Can be overridden for individual /// ICefRequestContext instances via the /// TCefRequestContextSettingsCefRequestContextSettings.accept_language_list value. /// property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList; /// /// Comma delimited list of schemes supported by the associated /// ICefCookieManager. If |cookieable_schemes_exclude_defaults| is false (0) /// the default schemes ("http", "https", "ws" and "wss") will also be /// supported. Not specifying a |cookieable_schemes_list| value and setting /// |cookieable_schemes_exclude_defaults| to true (1) will disable all loading /// and saving of cookies. These settings will only impact the global /// ICefRequestContext. Individual ICefRequestContext instances can be /// configured via the TCefRequestContextSettings.cookieable_schemes_list and /// TCefRequestContextSettings.cookieable_schemes_exclude_defaults values. /// property CookieableSchemesList : ustring read FCookieableSchemesList write FCookieableSchemesList; /// /// See the CookieableSchemesList property. /// property CookieableSchemesExcludeDefaults : boolean read FCookieableSchemesExcludeDefaults write FCookieableSchemesExcludeDefaults; /// /// Specify an ID to enable Chrome policy management via Platform and OS-user /// policies. On Windows, this is a registry key like /// "SOFTWARE\\Policies\\Google\\Chrome". On MacOS, this is a bundle ID like /// "com.google.Chrome". On Linux, this is an absolute directory path like /// "/etc/opt/chrome/policies". Only supported with the Chrome runtime. See /// https://support.google.com/chrome/a/answer/9037717 for details. /// Chrome Browser Cloud Management integration, when enabled via the /// "enable-chrome-browser-cloud-management" command-line flag, will also use /// the specified ID. See https://support.google.com/chrome/a/answer/9116814 /// for details. /// property ChromePolicyId : ustring read FChromePolicyId write FChromePolicyId; /// /// Specify an ID for an ICON resource that can be loaded from the main /// executable and used when creating default Chrome windows such as DevTools /// and Task Manager. If unspecified the default Chromium ICON (IDR_MAINFRAME /// [101]) will be loaded from libcef.dll. Only supported with the Chrome /// runtime on Windows. /// property ChromeAppIconId : integer read FChromeAppIconId write FChromeAppIconId; /// /// Runs the renderer and plugins in the same process as the browser. /// /// /// Uses the following command line switch: --single-process /// property SingleProcess : Boolean read FSingleProcess write FSingleProcess; /// /// Enable media (WebRTC audio/video) streaming. /// /// /// Uses the following command line switch: --enable-media-stream /// property EnableMediaStream : boolean read FEnableMediaStream write FEnableMediaStream; /// /// Enable speech input (x-webkit-speech). /// /// /// Uses the following command line switch: --enable-speech-input /// property EnableSpeechInput : boolean read FEnableSpeechInput write FEnableSpeechInput; /// /// Bypass the media stream infobar by selecting the default device for media streams (e.g. WebRTC). Works with --use-fake-device-for-media-stream. /// /// /// Uses the following command line switch: --single-process /// property UseFakeUIForMediaStream : boolean read FUseFakeUIForMediaStream write FUseFakeUIForMediaStream; /// /// Enable screen capturing support for MediaStream API. /// /// /// Uses the following command line switch: --enable-usermedia-screen-capturing /// property EnableUsermediaScreenCapturing : boolean read FEnableUsermediaScreenCapturing write FEnableUsermediaScreenCapturing; /// /// Enable GPU hardware acceleration. /// /// /// Uses the following command line switch: --disable-gpu /// Uses the following command line switch: --disable-gpu-compositing /// property EnableGPU : boolean read FEnableGPU write FEnableGPU; /// /// List of feature names to enable. /// /// /// Uses the following command line switch: --enable-features /// The list of features you can enable is here: /// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc /// https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_features.cc /// https://source.chromium.org/search?q=base::Feature /// property EnableFeatures : ustring read FEnableFeatures write FEnableFeatures; /// /// List of feature names to disable. /// /// /// Uses the following command line switch: --disable-features /// The list of features you can disable is here: /// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc /// https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_features.cc /// https://source.chromium.org/search?q=base::Feature /// property DisableFeatures : ustring read FDisableFeatures write FDisableFeatures; /// /// Enable one or more Blink runtime-enabled features. /// /// /// Uses the following command line switch: --enable-blink-features /// The list of Blink features you can enable is here: /// https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 /// property EnableBlinkFeatures : ustring read FEnableBlinkFeatures write FEnableBlinkFeatures; /// /// Disable one or more Blink runtime-enabled features. /// /// /// Uses the following command line switch: --disable-blink-features /// The list of Blink features you can disable is here: /// https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5 /// property DisableBlinkFeatures : ustring read FDisableBlinkFeatures write FDisableBlinkFeatures; /// /// Set blink settings. Format is [=[=],... /// The names are declared in Settings.json5. For boolean type, use "true", "false", /// or omit '=' part to set to true. For enum type, use the int value of the /// enum value. Applied after other command line flags and prefs. /// /// /// Uses the following command line switch: --blink-settings /// The list of Blink settings you can disable is here: /// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/settings.json5 /// property BlinkSettings : ustring read FBlinkSettings write FBlinkSettings; /// /// This option can be used to force field trials when testing changes locally. /// The argument is a list of name and value pairs, separated by slashes. /// If a trial name is prefixed with an asterisk, that trial will start activated. /// For example, the following argument defines two trials, with the second one /// activated: "GoogleNow/Enable/*MaterialDesignNTP/Default/" This option can also /// be used by the browser process to send the list of trials to a non-browser /// process, using the same format. See FieldTrialList::CreateTrialsFromString() /// in field_trial.h for details. /// /// /// Uses the following command line switch: --force-fieldtrials /// https://source.chromium.org/chromium/chromium/src/+/master:base/base_switches.cc /// property ForceFieldTrials : ustring read FForceFieldTrials write FForceFieldTrials; /// /// This option can be used to force parameters of field trials when testing /// changes locally. The argument is a param list of (key, value) pairs prefixed /// by an associated (trial, group) pair. You specify the param list for multiple /// (trial, group) pairs with a comma separator. /// Example: "Trial1.Group1:k1/v1/k2/v2,Trial2.Group2:k3/v3/k4/v4" /// Trial names, groups names, parameter names, and value should all be URL /// escaped for all non-alphanumeric characters. /// /// /// Uses the following command line switch: --force-fieldtrial-params /// https://source.chromium.org/chromium/chromium/src/+/master:components/variations/variations_switches.cc /// property ForceFieldTrialParams : ustring read FForceFieldTrialParams write FForceFieldTrialParams; /// /// On platforms that support it, enables smooth scroll animation. /// /// /// Uses the following command line switch: --enable-smooth-scrolling /// property SmoothScrolling : TCefState read FSmoothScrolling write FSmoothScrolling; /// /// Mutes audio sent to the audio device so it is not audible during automated testing. /// /// /// Uses the following command line switch: --mute-audio /// property MuteAudio : boolean read FMuteAudio write FMuteAudio; /// /// Enforces a one-site-per-process security policy: Each renderer process, for its /// whole lifetime, is dedicated to rendering pages for just one site. Thus, pages /// from different sites are never in the same process. A renderer process's access /// rights are restricted based on its site.All cross-site navigations force process /// swaps.