2019-11-08 23:15:53 +01:00
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ***************************** CEF4Delphi *******************************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
//
|
|
|
|
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
|
|
|
|
// browser in Delphi applications.
|
|
|
|
|
//
|
|
|
|
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
|
|
|
|
//
|
|
|
|
|
// For more information about CEF4Delphi visit :
|
|
|
|
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
|
|
|
|
//
|
2022-01-01 10:41:21 +01:00
|
|
|
|
// Copyright <20> 2022 Salvador Diaz Fau. All rights reserved.
|
2019-11-08 23:15:53 +01:00
|
|
|
|
//
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ************ vvvv Original license and comments below vvvv *************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
(*
|
|
|
|
|
* Delphi Chromium Embedded 3
|
|
|
|
|
*
|
|
|
|
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
|
|
|
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
|
|
|
|
*
|
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
|
|
|
* the specific language governing rights and limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
|
|
|
|
* Web site : http://www.progdigy.com
|
|
|
|
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
|
|
|
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
|
|
|
|
*
|
|
|
|
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
|
|
|
|
* this source code without explicit permission.
|
|
|
|
|
*
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
unit uCEFApplicationCore;
|
|
|
|
|
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
{$I cef.inc}
|
|
|
|
|
|
2022-02-19 18:56:41 +01:00
|
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
|
|
|
{$MINENUMSIZE 4}
|
|
|
|
|
|
2021-01-05 11:44:41 +01:00
|
|
|
|
{$IFNDEF FPC}{$IFNDEF DELPHI12_UP}
|
|
|
|
|
// Workaround for "Internal error" in old Delphi versions caused by uint64 handling
|
|
|
|
|
{$R-}
|
|
|
|
|
{$ENDIF}{$ENDIF}
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
{$IFDEF DELPHI16_UP}
|
2020-08-15 12:15:10 +02:00
|
|
|
|
{$IFDEF MSWINDOWS}WinApi.Windows,{$ENDIF} System.Classes, System.UITypes,
|
2021-01-31 16:53:07 +01:00
|
|
|
|
{$IFDEF FMX}uCEFLinuxTypes,{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ELSE}
|
2020-07-22 18:01:03 +02:00
|
|
|
|
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, {$IFDEF FPC}dynlibs,{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
2022-02-14 21:57:27 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
{$IFDEF FPC}xlib,{$ENDIF} uCEFArgCopy,
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
|
|
|
|
|
|
|
|
|
|
const
|
2022-11-08 16:15:13 +01:00
|
|
|
|
CEF_SUPPORTED_VERSION_MAJOR = 107;
|
2022-10-14 16:35:50 +02:00
|
|
|
|
CEF_SUPPORTED_VERSION_MINOR = 1;
|
2022-11-17 18:58:09 +01:00
|
|
|
|
CEF_SUPPORTED_VERSION_RELEASE = 11;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
CEF_SUPPORTED_VERSION_BUILD = 0;
|
|
|
|
|
|
2022-10-07 11:23:33 +02:00
|
|
|
|
CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
CEF_CHROMEELF_VERSION_MINOR = 0;
|
2022-11-08 16:15:13 +01:00
|
|
|
|
CEF_CHROMEELF_VERSION_RELEASE = 5304;
|
2022-11-10 12:37:19 +01:00
|
|
|
|
CEF_CHROMEELF_VERSION_BUILD = 110;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
2021-01-31 16:53:07 +01:00
|
|
|
|
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 = '';
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
2021-02-07 16:45:55 +01:00
|
|
|
|
// for InitLibLocationFromArgs
|
|
|
|
|
LIBCEF_PAK = 'cef.pak';
|
|
|
|
|
LIBCEF_LOCALE_DIR = 'locales';
|
|
|
|
|
LIBCEF_LOCALE_ENUS = 'en-US.pak';
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
type
|
|
|
|
|
TCefApplicationCore = class
|
|
|
|
|
protected
|
2021-07-31 17:24:54 +02:00
|
|
|
|
// 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;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FCache : ustring;
|
|
|
|
|
FRootCache : ustring;
|
|
|
|
|
FUserDataPath : ustring;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FPersistSessionCookies : boolean;
|
|
|
|
|
FPersistUserPreferences : boolean;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FUserAgent : ustring;
|
2021-04-28 14:38:07 +02:00
|
|
|
|
FUserAgentProduct : ustring;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FLocale : ustring;
|
|
|
|
|
FLogFile : ustring;
|
|
|
|
|
FLogSeverity : TCefLogSeverity;
|
|
|
|
|
FJavaScriptFlags : ustring;
|
|
|
|
|
FResourcesDirPath : ustring;
|
|
|
|
|
FLocalesDirPath : ustring;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FPackLoadingDisabled : boolean;
|
|
|
|
|
FRemoteDebuggingPort : integer;
|
|
|
|
|
FUncaughtExceptionStackSize : integer;
|
|
|
|
|
FIgnoreCertificateErrors : boolean;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FBackgroundColor : TCefColor;
|
|
|
|
|
FAcceptLanguageList : ustring;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
FCookieableSchemesList : ustring;
|
|
|
|
|
FCookieableSchemesExcludeDefaults : boolean;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
|
|
|
|
|
// Fields used to set command line switches
|
|
|
|
|
FSingleProcess : boolean;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FEnableMediaStream : boolean;
|
|
|
|
|
FEnableSpeechInput : boolean;
|
|
|
|
|
FUseFakeUIForMediaStream : boolean;
|
|
|
|
|
FEnableUsermediaScreenCapturing : boolean;
|
|
|
|
|
FEnableGPU : boolean;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FEnableFeatures : ustring;
|
|
|
|
|
FDisableFeatures : ustring;
|
|
|
|
|
FEnableBlinkFeatures : ustring;
|
|
|
|
|
FDisableBlinkFeatures : ustring;
|
|
|
|
|
FBlinkSettings : ustring;
|
|
|
|
|
FForceFieldTrials : ustring;
|
|
|
|
|
FForceFieldTrialParams : ustring;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FSmoothScrolling : TCefState;
|
|
|
|
|
FFastUnload : boolean;
|
|
|
|
|
FDisableSafeBrowsing : boolean;
|
|
|
|
|
FMuteAudio : boolean;
|
|
|
|
|
FSitePerProcess : boolean;
|
|
|
|
|
FDisableWebSecurity : boolean;
|
|
|
|
|
FDisablePDFExtension : boolean;
|
|
|
|
|
FDisableSiteIsolationTrials : boolean;
|
2021-01-21 15:46:35 +01:00
|
|
|
|
FDisableChromeLoginPrompt : boolean;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FDisableExtensions : boolean;
|
|
|
|
|
FAutoplayPolicy : TCefAutoplayPolicy;
|
|
|
|
|
FDisableBackgroundNetworking : boolean;
|
|
|
|
|
FMetricsRecordingOnly : boolean;
|
|
|
|
|
FAllowFileAccessFromFiles : boolean;
|
|
|
|
|
FAllowRunningInsecureContent : boolean;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FEnablePrintPreview : boolean;
|
2020-12-28 18:11:27 +01:00
|
|
|
|
FDefaultEncoding : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
FDisableJavascript : boolean;
|
|
|
|
|
FDisableJavascriptCloseWindows : boolean;
|
|
|
|
|
FDisableJavascriptAccessClipboard : boolean;
|
|
|
|
|
FDisableJavascriptDomPaste : boolean;
|
|
|
|
|
FAllowUniversalAccessFromFileUrls : boolean;
|
|
|
|
|
FDisableImageLoading : boolean;
|
|
|
|
|
FImageShrinkStandaloneToFit : boolean;
|
|
|
|
|
FDisableTextAreaResize : boolean;
|
|
|
|
|
FDisableTabToLinks : boolean;
|
|
|
|
|
FEnableProfanityFilter : boolean;
|
|
|
|
|
FDisableSpellChecking : boolean;
|
2020-12-28 18:11:27 +01:00
|
|
|
|
FOverrideSpellCheckLang : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
FTouchEvents : TCefState;
|
|
|
|
|
FDisableReadingFromCanvas : boolean;
|
|
|
|
|
FHyperlinkAuditing : boolean;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FDisableNewBrowserInfoTimeout : boolean;
|
|
|
|
|
FDevToolsProtocolLogFile : ustring;
|
|
|
|
|
FForcedDeviceScaleFactor : single;
|
|
|
|
|
FDisableZygote : boolean; // Only used in Linux
|
|
|
|
|
FUseMockKeyChain : boolean; // Only used in macOS
|
|
|
|
|
FDisableRequestHandlingForTesting : boolean;
|
|
|
|
|
FDisablePopupBlocking : boolean;
|
|
|
|
|
FDisableBackForwardCache : boolean;
|
2021-09-05 10:49:20 +02:00
|
|
|
|
FDisableComponentUpdate : boolean;
|
2021-11-25 11:16:38 +01:00
|
|
|
|
FAllowInsecureLocalhost : boolean;
|
|
|
|
|
FKioskPrinting : boolean;
|
2022-06-30 09:03:56 +02:00
|
|
|
|
FTreatInsecureOriginAsSecure : ustring;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
|
|
|
|
|
// Fields used during the CEF initialization
|
|
|
|
|
FWindowsSandboxInfo : pointer;
|
|
|
|
|
FEnableHighDPISupport : boolean;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
FArgCopy : TCEFArgCopy;
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-07-31 17:24:54 +02:00
|
|
|
|
// 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;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
FMustCreateResourceBundleHandler : boolean;
|
|
|
|
|
FMustCreateBrowserProcessHandler : boolean;
|
|
|
|
|
FMustCreateRenderProcessHandler : boolean;
|
|
|
|
|
FMustCreateLoadHandler : boolean;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
// ICefApp
|
|
|
|
|
FOnRegisterCustomSchemes : TOnRegisterCustomSchemesEvent;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefBrowserProcessHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnContextInitialized : TOnContextInitializedEvent;
|
|
|
|
|
FOnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent;
|
|
|
|
|
FOnScheduleMessagePumpWork : TOnScheduleMessagePumpWorkEvent;
|
2020-11-19 18:55:17 +01:00
|
|
|
|
FOnGetDefaultClient : TOnGetDefaultClientEvent;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefResourceBundleHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnGetLocalizedString : TOnGetLocalizedStringEvent;
|
|
|
|
|
FOnGetDataResource : TOnGetDataResourceEvent;
|
|
|
|
|
FOnGetDataResourceForScale : TOnGetDataResourceForScaleEvent;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefRenderProcessHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnWebKitInitialized : TOnWebKitInitializedEvent;
|
|
|
|
|
FOnBrowserCreated : TOnBrowserCreatedEvent;
|
|
|
|
|
FOnBrowserDestroyed : TOnBrowserDestroyedEvent;
|
|
|
|
|
FOnContextCreated : TOnContextCreatedEvent;
|
|
|
|
|
FOnContextReleased : TOnContextReleasedEvent;
|
|
|
|
|
FOnUncaughtException : TOnUncaughtExceptionEvent;
|
|
|
|
|
FOnFocusedNodeChanged : TOnFocusedNodeChangedEvent;
|
|
|
|
|
FOnProcessMessageReceived : TOnProcessMessageReceivedEvent;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefLoadHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnLoadingStateChange : TOnRenderLoadingStateChange;
|
|
|
|
|
FOnLoadStart : TOnRenderLoadStart;
|
|
|
|
|
FOnLoadEnd : TOnRenderLoadEnd;
|
|
|
|
|
FOnLoadError : TOnRenderLoadError;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
procedure SetCache(const aValue : ustring);
|
|
|
|
|
procedure SetRootCache(const aValue : ustring);
|
|
|
|
|
procedure SetUserDataPath(const aValue : ustring);
|
|
|
|
|
procedure SetBrowserSubprocessPath(const aValue : ustring);
|
|
|
|
|
procedure SetFrameworkDirPath(const aValue : ustring);
|
|
|
|
|
procedure SetResourcesDirPath(const aValue : ustring);
|
|
|
|
|
procedure SetLocalesDirPath(const aValue : ustring);
|
|
|
|
|
procedure SetOsmodalLoop(aValue : boolean);
|
2021-11-25 11:16:38 +01:00
|
|
|
|
procedure SetKioskPrinting(aValue : boolean);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-06-13 17:24:22 +02:00
|
|
|
|
function GetChromeVersion : ustring;
|
|
|
|
|
function GetLibCefVersion : ustring;
|
|
|
|
|
function GetLibCefPath : ustring;
|
|
|
|
|
function GetChromeElfPath : ustring;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
function GetLocalesDirPath: ustring;
|
|
|
|
|
function GetResourcesDirPath: ustring;
|
2019-12-18 15:10:30 +01:00
|
|
|
|
function GetMustCreateResourceBundleHandler : boolean; virtual;
|
|
|
|
|
function GetMustCreateBrowserProcessHandler : boolean; virtual;
|
|
|
|
|
function GetMustCreateRenderProcessHandler : boolean; virtual;
|
|
|
|
|
function GetMustCreateLoadHandler : boolean; virtual;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function GetGlobalContextInitialized : boolean;
|
|
|
|
|
function GetChildProcessesCount : integer;
|
2020-03-29 17:31:42 +02:00
|
|
|
|
function GetUsedMemory : uint64;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function GetTotalSystemMemory : uint64;
|
|
|
|
|
function GetAvailableSystemMemory : uint64;
|
|
|
|
|
function GetSystemMemoryLoad : cardinal;
|
2021-03-06 12:24:28 +01:00
|
|
|
|
function GetApiHashUniversal : ustring;
|
|
|
|
|
function GetApiHashPlatform : ustring;
|
|
|
|
|
function GetApiHashCommit : ustring;
|
2020-12-30 19:40:07 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
function GetXDisplay : PXDisplay;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
function GetArgc : longint;
|
2022-03-26 20:05:29 +01:00
|
|
|
|
function GetArgv : PPAnsiChar;
|
2020-12-30 19:40:07 +01:00
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
function LoadCEFlibrary : boolean; virtual;
|
2021-03-06 12:24:28 +01:00
|
|
|
|
function Load_cef_api_hash_h : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function Load_cef_app_capi_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;
|
2021-09-27 12:04:33 +02:00
|
|
|
|
function Load_cef_i18n_util_capi_h : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function Load_cef_image_capi_h : boolean;
|
|
|
|
|
function Load_cef_menu_model_capi_h : boolean;
|
2020-03-29 17:31:42 +02:00
|
|
|
|
function Load_cef_media_router_capi_h : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
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_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;
|
2022-08-06 12:00:28 +02:00
|
|
|
|
function Load_cef_server_capi_h : boolean;
|
|
|
|
|
function Load_cef_shared_process_message_builder_capi_h : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
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;
|
2022-06-14 11:27:45 +02:00
|
|
|
|
function Load_cef_time_h : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
procedure ShutDown;
|
|
|
|
|
procedure FreeLibcefLibrary;
|
|
|
|
|
function ExecuteProcess(const aApp : ICefApp) : integer;
|
2022-02-19 18:56:41 +01:00
|
|
|
|
procedure InitializeCefMainArgs(var aCefMainArgs : TCefMainArgs);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
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;
|
2022-03-31 21:21:18 +02:00
|
|
|
|
function CheckCEFResources : boolean; virtual;
|
2021-02-21 18:41:25 +01:00
|
|
|
|
{$IFDEF MSWINDOWS}
|
2022-03-31 21:21:18 +02:00
|
|
|
|
function CheckCEFDLL : boolean; virtual;
|
2021-02-21 18:41:25 +01:00
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure ShowErrorMessageDlg(const aError : string); virtual;
|
|
|
|
|
function ParseProcessType : TCefProcessType;
|
2020-07-30 10:45:12 +02:00
|
|
|
|
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 = '');
|
2021-01-21 19:32:43 +01:00
|
|
|
|
procedure CleanupFeatures(var aKeys, aValues : TStringList; const aEnableKey, aDisableKey : string);
|
2021-10-22 19:19:57 +02:00
|
|
|
|
procedure ClearSchemeHandlerFactories;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
constructor Create;
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
procedure AfterConstruction; override;
|
|
|
|
|
procedure AddCustomCommandLine(const aCommandLine : string; const aValue : string = '');
|
2022-03-31 21:21:18 +02:00
|
|
|
|
function CheckCEFLibrary : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function StartMainProcess : boolean;
|
|
|
|
|
function StartSubProcess : boolean;
|
|
|
|
|
|
|
|
|
|
procedure DoMessageLoopWork;
|
|
|
|
|
procedure RunMessageLoop;
|
|
|
|
|
procedure QuitMessageLoop;
|
2020-10-31 14:23:06 +01:00
|
|
|
|
procedure UpdateDeviceScaleFactor; virtual;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-05-16 19:42:25 +02:00
|
|
|
|
{$IFDEF MACOSX}
|
|
|
|
|
procedure InitLibLocationFromArgs;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
2021-01-01 17:51:09 +01:00
|
|
|
|
// Internal procedures. Only ICefApp, ICefBrowserProcessHandler,
|
2021-04-18 19:36:20 +02:00
|
|
|
|
// ICefResourceBundleHandler, ICefRenderProcessHandler, ICefRegisterCDMCallback and
|
|
|
|
|
// ICefLoadHandler should use them.
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure Internal_OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
|
|
|
|
|
procedure Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
2021-03-01 20:04:33 +01:00
|
|
|
|
procedure Internal_OnContextInitialized; virtual;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure Internal_OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
|
|
|
|
procedure Internal_OnScheduleMessagePumpWork(const delayMs: Int64);
|
|
|
|
|
function Internal_GetLocalizedString(stringId: Integer; var stringVal: ustring) : boolean;
|
|
|
|
|
function Internal_GetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt) : boolean;
|
|
|
|
|
function Internal_GetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt) : boolean;
|
|
|
|
|
procedure Internal_OnWebKitInitialized;
|
|
|
|
|
procedure Internal_OnBrowserCreated(const browser: ICefBrowser; const extra_info: ICefDictionaryValue);
|
|
|
|
|
procedure Internal_OnBrowserDestroyed(const browser: ICefBrowser);
|
|
|
|
|
procedure Internal_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
|
|
|
procedure Internal_OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
|
|
|
procedure Internal_OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace);
|
|
|
|
|
procedure Internal_OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
|
|
|
|
|
procedure Internal_OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage; var aHandled : boolean);
|
|
|
|
|
procedure Internal_OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
|
|
|
|
procedure Internal_OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType);
|
|
|
|
|
procedure Internal_OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
|
|
|
|
|
procedure Internal_OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
|
2020-11-19 18:55:17 +01:00
|
|
|
|
procedure Internal_GetDefaultClient(var aClient : ICefClient);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// Properties used to populate TCefSettings (cef_settings_t)
|
|
|
|
|
property NoSandbox : Boolean read FNoSandbox write FNoSandbox;
|
|
|
|
|
property BrowserSubprocessPath : ustring read FBrowserSubprocessPath write SetBrowserSubprocessPath;
|
|
|
|
|
property FrameworkDirPath : ustring read FFrameworkDirPath write SetFrameworkDirPath;
|
2021-05-18 16:40:37 +02:00
|
|
|
|
property MainBundlePath : ustring read FMainBundlePath write FMainBundlePath; // Only used in macOS
|
2020-08-29 11:48:12 +02:00
|
|
|
|
property ChromeRuntime : boolean read FChromeRuntime write FChromeRuntime;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property MultiThreadedMessageLoop : boolean read FMultiThreadedMessageLoop write FMultiThreadedMessageLoop;
|
|
|
|
|
property ExternalMessagePump : boolean read FExternalMessagePump write FExternalMessagePump;
|
|
|
|
|
property WindowlessRenderingEnabled : Boolean read FWindowlessRenderingEnabled write FWindowlessRenderingEnabled;
|
|
|
|
|
property CommandLineArgsDisabled : Boolean read FCommandLineArgsDisabled write FCommandLineArgsDisabled;
|
|
|
|
|
property Cache : ustring read FCache write SetCache;
|
|
|
|
|
property RootCache : ustring read FRootCache write SetRootCache;
|
|
|
|
|
property UserDataPath : ustring read FUserDataPath write SetUserDataPath;
|
|
|
|
|
property PersistSessionCookies : Boolean read FPersistSessionCookies write FPersistSessionCookies;
|
|
|
|
|
property PersistUserPreferences : Boolean read FPersistUserPreferences write FPersistUserPreferences;
|
|
|
|
|
property UserAgent : ustring read FUserAgent write FUserAgent;
|
2021-04-28 14:38:07 +02:00
|
|
|
|
property UserAgentProduct : ustring read FUserAgentProduct write FUserAgentProduct;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property Locale : ustring read FLocale write FLocale;
|
|
|
|
|
property LogFile : ustring read FLogFile write FLogFile;
|
|
|
|
|
property LogSeverity : TCefLogSeverity read FLogSeverity write FLogSeverity;
|
|
|
|
|
property JavaScriptFlags : ustring read FJavaScriptFlags write FJavaScriptFlags;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
property ResourcesDirPath : ustring read GetResourcesDirPath write SetResourcesDirPath;
|
|
|
|
|
property LocalesDirPath : ustring read GetLocalesDirPath write SetLocalesDirPath;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property PackLoadingDisabled : Boolean read FPackLoadingDisabled write FPackLoadingDisabled;
|
|
|
|
|
property RemoteDebuggingPort : Integer read FRemoteDebuggingPort write FRemoteDebuggingPort;
|
|
|
|
|
property UncaughtExceptionStackSize : Integer read FUncaughtExceptionStackSize write FUncaughtExceptionStackSize;
|
|
|
|
|
property IgnoreCertificateErrors : Boolean read FIgnoreCertificateErrors write FIgnoreCertificateErrors;
|
|
|
|
|
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor;
|
|
|
|
|
property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
property CookieableSchemesList : ustring read FCookieableSchemesList write FCookieableSchemesList;
|
|
|
|
|
property CookieableSchemesExcludeDefaults : boolean read FCookieableSchemesExcludeDefaults write FCookieableSchemesExcludeDefaults;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// Properties used to set command line switches
|
|
|
|
|
property SingleProcess : Boolean read FSingleProcess write FSingleProcess; // --single-process
|
|
|
|
|
property EnableMediaStream : boolean read FEnableMediaStream write FEnableMediaStream; // --enable-media-stream
|
|
|
|
|
property EnableSpeechInput : boolean read FEnableSpeechInput write FEnableSpeechInput; // --enable-speech-input
|
|
|
|
|
property UseFakeUIForMediaStream : boolean read FUseFakeUIForMediaStream write FUseFakeUIForMediaStream; // --use-fake-ui-for-media-stream
|
2020-10-08 16:41:27 +02:00
|
|
|
|
property EnableUsermediaScreenCapturing : boolean read FEnableUsermediaScreenCapturing write FEnableUsermediaScreenCapturing; // --enable-usermedia-screen-capturing
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property EnableGPU : boolean read FEnableGPU write FEnableGPU; // --enable-gpu-plugin
|
2020-03-10 11:59:58 +01:00
|
|
|
|
property EnableFeatures : ustring read FEnableFeatures write FEnableFeatures; // --enable-features
|
|
|
|
|
property DisableFeatures : ustring read FDisableFeatures write FDisableFeatures; // --disable-features
|
|
|
|
|
property EnableBlinkFeatures : ustring read FEnableBlinkFeatures write FEnableBlinkFeatures; // --enable-blink-features
|
|
|
|
|
property DisableBlinkFeatures : ustring read FDisableBlinkFeatures write FDisableBlinkFeatures; // --disable-blink-features
|
2020-10-25 18:59:09 +01:00
|
|
|
|
property BlinkSettings : ustring read FBlinkSettings write FBlinkSettings; // --blink-settings
|
2020-03-10 11:59:58 +01:00
|
|
|
|
property ForceFieldTrials : ustring read FForceFieldTrials write FForceFieldTrials; // --force-fieldtrials
|
|
|
|
|
property ForceFieldTrialParams : ustring read FForceFieldTrialParams write FForceFieldTrialParams; // --force-fieldtrial-params
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property SmoothScrolling : TCefState read FSmoothScrolling write FSmoothScrolling; // --enable-smooth-scrolling
|
|
|
|
|
property FastUnload : boolean read FFastUnload write FFastUnload; // --enable-fast-unload
|
|
|
|
|
property DisableSafeBrowsing : boolean read FDisableSafeBrowsing write FDisableSafeBrowsing; // --safebrowsing-disable-auto-update
|
|
|
|
|
property MuteAudio : boolean read FMuteAudio write FMuteAudio; // --mute-audio
|
|
|
|
|
property SitePerProcess : boolean read FSitePerProcess write FSitePerProcess; // --site-per-process
|
|
|
|
|
property DisableWebSecurity : boolean read FDisableWebSecurity write FDisableWebSecurity; // --disable-web-security
|
|
|
|
|
property DisablePDFExtension : boolean read FDisablePDFExtension write FDisablePDFExtension; // --disable-pdf-extension
|
2019-12-10 16:49:07 +01:00
|
|
|
|
property DisableSiteIsolationTrials : boolean read FDisableSiteIsolationTrials write FDisableSiteIsolationTrials; // --disable-site-isolation-trials
|
2021-01-21 15:46:35 +01:00
|
|
|
|
property DisableChromeLoginPrompt : boolean read FDisableChromeLoginPrompt write FDisableChromeLoginPrompt; // --disable-chrome-login-prompt
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property DisableExtensions : boolean read FDisableExtensions write FDisableExtensions; // --disable-extensions
|
|
|
|
|
property AutoplayPolicy : TCefAutoplayPolicy read FAutoplayPolicy write FAutoplayPolicy; // --autoplay-policy
|
|
|
|
|
property DisableBackgroundNetworking : boolean read FDisableBackgroundNetworking write FDisableBackgroundNetworking; // --disable-background-networking
|
|
|
|
|
property MetricsRecordingOnly : boolean read FMetricsRecordingOnly write FMetricsRecordingOnly; // --metrics-recording-only
|
|
|
|
|
property AllowFileAccessFromFiles : boolean read FAllowFileAccessFromFiles write FAllowFileAccessFromFiles; // --allow-file-access-from-files
|
|
|
|
|
property AllowRunningInsecureContent : boolean read FAllowRunningInsecureContent write FAllowRunningInsecureContent; // --allow-running-insecure-content
|
|
|
|
|
property EnablePrintPreview : boolean read FEnablePrintPreview write FEnablePrintPreview; // --enable-print-preview
|
2020-12-28 18:11:27 +01:00
|
|
|
|
property DefaultEncoding : ustring read FDefaultEncoding write FDefaultEncoding; // --default-encoding
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property DisableJavascript : boolean read FDisableJavascript write FDisableJavascript; // --disable-javascript
|
|
|
|
|
property DisableJavascriptCloseWindows : boolean read FDisableJavascriptCloseWindows write FDisableJavascriptCloseWindows; // --disable-javascript-close-windows
|
|
|
|
|
property DisableJavascriptAccessClipboard : boolean read FDisableJavascriptAccessClipboard write FDisableJavascriptAccessClipboard; // --disable-javascript-access-clipboard
|
|
|
|
|
property DisableJavascriptDomPaste : boolean read FDisableJavascriptDomPaste write FDisableJavascriptDomPaste; // --disable-javascript-dom-paste
|
|
|
|
|
property AllowUniversalAccessFromFileUrls : boolean read FAllowUniversalAccessFromFileUrls write FAllowUniversalAccessFromFileUrls; // --allow-universal-access-from-files
|
|
|
|
|
property DisableImageLoading : boolean read FDisableImageLoading write FDisableImageLoading; // --disable-image-loading
|
|
|
|
|
property ImageShrinkStandaloneToFit : boolean read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit; // --image-shrink-standalone-to-fit
|
|
|
|
|
property DisableTextAreaResize : boolean read FDisableTextAreaResize write FDisableTextAreaResize; // --disable-text-area-resize
|
|
|
|
|
property DisableTabToLinks : boolean read FDisableTabToLinks write FDisableTabToLinks; // --disable-tab-to-links
|
|
|
|
|
property EnableProfanityFilter : boolean read FEnableProfanityFilter write FEnableProfanityFilter; // --enable-profanity-filter
|
|
|
|
|
property DisableSpellChecking : boolean read FDisableSpellChecking write FDisableSpellChecking; // --disable-spell-checking
|
2020-12-28 18:11:27 +01:00
|
|
|
|
property OverrideSpellCheckLang : ustring read FOverrideSpellCheckLang write FOverrideSpellCheckLang; // --override-spell-check-lang
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property TouchEvents : TCefState read FTouchEvents write FTouchEvents; // --touch-events
|
|
|
|
|
property DisableReadingFromCanvas : boolean read FDisableReadingFromCanvas write FDisableReadingFromCanvas; // --disable-reading-from-canvas
|
|
|
|
|
property HyperlinkAuditing : boolean read FHyperlinkAuditing write FHyperlinkAuditing; // --no-pings
|
2020-02-26 13:28:29 +01:00
|
|
|
|
property DisableNewBrowserInfoTimeout : boolean read FDisableNewBrowserInfoTimeout write FDisableNewBrowserInfoTimeout; // --disable-new-browser-info-timeout
|
2020-06-21 21:27:55 +02:00
|
|
|
|
property DevToolsProtocolLogFile : ustring read FDevToolsProtocolLogFile write FDevToolsProtocolLogFile; // --devtools-protocol-log-file
|
2021-12-08 17:45:03 +01:00
|
|
|
|
property ForcedDeviceScaleFactor : single read FForcedDeviceScaleFactor write FForcedDeviceScaleFactor; // --force-device-scale-factor
|
2021-01-01 17:51:09 +01:00
|
|
|
|
property DisableZygote : boolean read FDisableZygote write FDisableZygote; // --no-zygote
|
2021-02-16 22:04:16 +01:00
|
|
|
|
property UseMockKeyChain : boolean read FUseMockKeyChain write FUseMockKeyChain; // --use-mock-keychain
|
2021-06-12 11:19:56 +02:00
|
|
|
|
property DisableRequestHandlingForTesting : boolean read FDisableRequestHandlingForTesting write FDisableRequestHandlingForTesting; // --disable-request-handling-for-testing
|
2021-07-31 17:24:54 +02:00
|
|
|
|
property DisablePopupBlocking : boolean read FDisablePopupBlocking write FDisablePopupBlocking; // --disable-popup-blocking
|
|
|
|
|
property DisableBackForwardCache : boolean read FDisableBackForwardCache write FDisableBackForwardCache; // --disable-back-forward-cache
|
2021-09-05 10:49:20 +02:00
|
|
|
|
property DisableComponentUpdate : boolean read FDisableComponentUpdate write FDisableComponentUpdate; // --disable-component-update
|
2021-11-25 11:16:38 +01:00
|
|
|
|
property AllowInsecureLocalhost : boolean read FAllowInsecureLocalhost write FAllowInsecureLocalhost; // --allow-insecure-localhost
|
|
|
|
|
property KioskPrinting : boolean read FKioskPrinting write SetKioskPrinting; // --kiosk-printing
|
2022-06-30 09:03:56 +02:00
|
|
|
|
property TreatInsecureOriginAsSecure : ustring read FTreatInsecureOriginAsSecure write FTreatInsecureOriginAsSecure; // --unsafely-treat-insecure-origin-as-secure
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// Properties used during the CEF initialization
|
|
|
|
|
property WindowsSandboxInfo : Pointer read FWindowsSandboxInfo write FWindowsSandboxInfo;
|
|
|
|
|
property EnableHighDPISupport : boolean read FEnableHighDPISupport write FEnableHighDPISupport;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
{$IFDEF LINUX}
|
2022-02-17 10:46:20 +01:00
|
|
|
|
property argcCopy : longint read GetArgc;
|
2022-03-26 20:05:29 +01:00
|
|
|
|
property argvCopy : PPAnsiChar read GetArgv;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// Custom properties
|
|
|
|
|
property DeleteCache : boolean read FDeleteCache write FDeleteCache;
|
|
|
|
|
property DeleteCookies : boolean read FDeleteCookies write FDeleteCookies;
|
|
|
|
|
property CheckCEFFiles : boolean read FCheckCEFFiles write FCheckCEFFiles;
|
|
|
|
|
property ShowMessageDlg : boolean read FShowMessageDlg write FShowMessageDlg;
|
2020-05-26 16:57:37 +02:00
|
|
|
|
property MissingBinariesException : boolean read FMissingBinariesException write FMissingBinariesException;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property SetCurrentDir : boolean read FSetCurrentDir write FSetCurrentDir;
|
|
|
|
|
property GlobalContextInitialized : boolean read GetGlobalContextInitialized;
|
|
|
|
|
property ChromeMajorVer : uint16 read FChromeVersionInfo.MajorVer;
|
|
|
|
|
property ChromeMinorVer : uint16 read FChromeVersionInfo.MinorVer;
|
|
|
|
|
property ChromeRelease : uint16 read FChromeVersionInfo.Release;
|
|
|
|
|
property ChromeBuild : uint16 read FChromeVersionInfo.Build;
|
2020-06-13 17:24:22 +02:00
|
|
|
|
property ChromeVersion : ustring read GetChromeVersion;
|
|
|
|
|
property LibCefVersion : ustring read GetLibCefVersion;
|
|
|
|
|
property LibCefPath : ustring read GetLibCefPath;
|
|
|
|
|
property ChromeElfPath : ustring read GetChromeElfPath;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property LibLoaded : boolean read FLibLoaded;
|
|
|
|
|
property LogProcessInfo : boolean read FLogProcessInfo write FLogProcessInfo;
|
|
|
|
|
property ReRaiseExceptions : boolean read FReRaiseExceptions write FReRaiseExceptions;
|
|
|
|
|
property DeviceScaleFactor : single read FDeviceScaleFactor;
|
|
|
|
|
property LocalesRequired : ustring read FLocalesRequired write FLocalesRequired;
|
|
|
|
|
property ProcessType : TCefProcessType read FProcessType;
|
|
|
|
|
property MustCreateResourceBundleHandler : boolean read GetMustCreateResourceBundleHandler write FMustCreateResourceBundleHandler;
|
|
|
|
|
property MustCreateBrowserProcessHandler : boolean read GetMustCreateBrowserProcessHandler write FMustCreateBrowserProcessHandler;
|
|
|
|
|
property MustCreateRenderProcessHandler : boolean read GetMustCreateRenderProcessHandler write FMustCreateRenderProcessHandler;
|
|
|
|
|
property MustCreateLoadHandler : boolean read GetMustCreateLoadHandler write FMustCreateLoadHandler;
|
|
|
|
|
property OsmodalLoop : boolean write SetOsmodalLoop;
|
|
|
|
|
property Status : TCefAplicationStatus read FStatus;
|
|
|
|
|
property MissingLibFiles : string read FMissingLibFiles;
|
|
|
|
|
property MustFreeLibrary : boolean read FMustFreeLibrary write FMustFreeLibrary;
|
|
|
|
|
property ChildProcessesCount : integer read GetChildProcessesCount;
|
2020-03-29 17:31:42 +02:00
|
|
|
|
property UsedMemory : uint64 read GetUsedMemory;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
property TotalSystemMemory : uint64 read GetTotalSystemMemory;
|
|
|
|
|
property AvailableSystemMemory : uint64 read GetAvailableSystemMemory;
|
|
|
|
|
property SystemMemoryLoad : cardinal read GetSystemMemoryLoad;
|
2021-03-06 12:24:28 +01:00
|
|
|
|
property ApiHashUniversal : ustring read GetApiHashUniversal;
|
|
|
|
|
property ApiHashPlatform : ustring read GetApiHashPlatform;
|
|
|
|
|
property ApiHashCommit : ustring read GetApiHashCommit;
|
2021-03-25 13:00:37 +01:00
|
|
|
|
property LastErrorMessage : ustring read FLastErrorMessage;
|
2020-12-30 19:40:07 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
property XDisplay : PXDisplay read GetXDisplay;
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefApp
|
|
|
|
|
property OnRegCustomSchemes : TOnRegisterCustomSchemesEvent read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes;
|
|
|
|
|
|
|
|
|
|
// ICefBrowserProcessHandler
|
|
|
|
|
property OnContextInitialized : TOnContextInitializedEvent read FOnContextInitialized write FOnContextInitialized;
|
|
|
|
|
property OnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent read FOnBeforeChildProcessLaunch write FOnBeforeChildProcessLaunch;
|
|
|
|
|
property OnScheduleMessagePumpWork : TOnScheduleMessagePumpWorkEvent read FOnScheduleMessagePumpWork write FOnScheduleMessagePumpWork;
|
2020-11-19 18:55:17 +01:00
|
|
|
|
property OnGetDefaultClient : TOnGetDefaultClientEvent read FOnGetDefaultClient write FOnGetDefaultClient;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefResourceBundleHandler
|
|
|
|
|
property OnGetLocalizedString : TOnGetLocalizedStringEvent read FOnGetLocalizedString write FOnGetLocalizedString;
|
|
|
|
|
property OnGetDataResource : TOnGetDataResourceEvent read FOnGetDataResource write FOnGetDataResource;
|
|
|
|
|
property OnGetDataResourceForScale : TOnGetDataResourceForScaleEvent read FOnGetDataResourceForScale write FOnGetDataResourceForScale;
|
|
|
|
|
|
|
|
|
|
// ICefRenderProcessHandler
|
|
|
|
|
property OnWebKitInitialized : TOnWebKitInitializedEvent read FOnWebKitInitialized write FOnWebKitInitialized;
|
|
|
|
|
property OnBrowserCreated : TOnBrowserCreatedEvent read FOnBrowserCreated write FOnBrowserCreated;
|
|
|
|
|
property OnBrowserDestroyed : TOnBrowserDestroyedEvent read FOnBrowserDestroyed write FOnBrowserDestroyed;
|
|
|
|
|
property OnContextCreated : TOnContextCreatedEvent read FOnContextCreated write FOnContextCreated;
|
|
|
|
|
property OnContextReleased : TOnContextReleasedEvent read FOnContextReleased write FOnContextReleased;
|
|
|
|
|
property OnUncaughtException : TOnUncaughtExceptionEvent read FOnUncaughtException write FOnUncaughtException;
|
|
|
|
|
property OnFocusedNodeChanged : TOnFocusedNodeChangedEvent read FOnFocusedNodeChanged write FOnFocusedNodeChanged;
|
|
|
|
|
property OnProcessMessageReceived : TOnProcessMessageReceivedEvent read FOnProcessMessageReceived write FOnProcessMessageReceived;
|
|
|
|
|
|
|
|
|
|
// ICefLoadHandler
|
|
|
|
|
property OnLoadingStateChange : TOnRenderLoadingStateChange read FOnLoadingStateChange write FOnLoadingStateChange;
|
|
|
|
|
property OnLoadStart : TOnRenderLoadStart read FOnLoadStart write FOnLoadStart;
|
|
|
|
|
property OnLoadEnd : TOnRenderLoadEnd read FOnLoadEnd write FOnLoadEnd;
|
|
|
|
|
property OnLoadError : TOnRenderLoadError read FOnLoadError write FOnLoadError;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
TCEFDirectoryDeleterThread = class(TThread)
|
|
|
|
|
protected
|
|
|
|
|
FDirectory : string;
|
|
|
|
|
|
|
|
|
|
procedure Execute; override;
|
|
|
|
|
|
|
|
|
|
public
|
|
|
|
|
constructor Create(const aDirectory : string);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
GlobalCEFApp : TCefApplicationCore = nil;
|
|
|
|
|
|
|
|
|
|
procedure DestroyGlobalCEFApp;
|
|
|
|
|
|
|
|
|
|
// *********************************************************
|
|
|
|
|
// ********************** ATTENTION ! **********************
|
|
|
|
|
// *********************************************************
|
|
|
|
|
// ** **
|
|
|
|
|
// ** MANY OF THE EVENTS IN CEF4DELPHI COMPONENTS LIKE **
|
|
|
|
|
// ** TCHROMIUM, TFMXCHROMIUM OR TCEFAPPLICATION ARE **
|
|
|
|
|
// ** EXECUTED IN A CEF THREAD BY DEFAULT. **
|
|
|
|
|
// ** **
|
|
|
|
|
// ** WINDOWS CONTROLS MUST BE CREATED AND DESTROYED IN **
|
|
|
|
|
// ** THE SAME THREAD TO AVOID ERRORS. **
|
|
|
|
|
// ** SOME OF THEM RECREATE THE HANDLERS IF THEY ARE **
|
|
|
|
|
// ** MODIFIED AND CAN CAUSE THE SAME ERRORS. **
|
|
|
|
|
// ** **
|
|
|
|
|
// ** DON'T CREATE, MODIFY OR DESTROY WINDOWS CONTROLS **
|
|
|
|
|
// ** INSIDE THE CEF4DELPHI EVENTS AND USE **
|
|
|
|
|
// ** SYNCHRONIZATION OBJECTS TO PROTECT VARIABLES AND **
|
|
|
|
|
// ** FIELDS IF THEY ARE ALSO USED IN THE MAIN THREAD. **
|
|
|
|
|
// ** **
|
|
|
|
|
// ** READ THIS FOR MORE INFORMATION : **
|
|
|
|
|
// ** https://www.briskbard.com/index.php?pageid=cef **
|
|
|
|
|
// ** **
|
|
|
|
|
// ** USE OUR FORUMS FOR MORE QUESTIONS : **
|
|
|
|
|
// ** https://www.briskbard.com/forum/ **
|
|
|
|
|
// ** **
|
|
|
|
|
// *********************************************************
|
|
|
|
|
// *********************************************************
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
{$IFDEF DELPHI16_UP}
|
2021-01-14 16:03:04 +01:00
|
|
|
|
System.Math, System.IOUtils, System.SysUtils,
|
|
|
|
|
{$IFDEF MSWINDOWS}WinApi.TlHelp32, WinApi.PSAPI,{$ENDIF}
|
|
|
|
|
{$IFDEF LINUX}{$IFDEF FMX}Posix.Unistd, Posix.Stdio,{$ENDIF}{$ENDIF}
|
2021-05-27 14:29:30 +02:00
|
|
|
|
{$IFDEF MACOS}Posix.Stdio, uCEFMacOSFunctions,{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ELSE}
|
|
|
|
|
Math, {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} SysUtils,
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
{$IFDEF MSWINDOWS}jwatlhelp32, jwapsapi,{$ENDIF}
|
2021-01-28 19:29:04 +01:00
|
|
|
|
{$IFDEF LINUX}lcltype, Forms, InterfaceBase, uCEFLinuxFunctions,{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ELSE}
|
|
|
|
|
TlHelp32, {$IFDEF MSWINDOWS}PSAPI,{$ENDIF}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
uCEFLibFunctions, uCEFMiscFunctions, uCEFCommandLine, uCEFConstants,
|
2021-09-05 10:49:20 +02:00
|
|
|
|
uCEFSchemeHandlerFactory, uCEFCookieManager, uCEFApp, uCEFCompletionCallback,
|
|
|
|
|
uCEFWaitableEvent;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
procedure DestroyGlobalCEFApp;
|
|
|
|
|
begin
|
|
|
|
|
if (GlobalCEFApp <> nil) then FreeAndNil(GlobalCEFApp);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor TCefApplicationCore.Create;
|
|
|
|
|
begin
|
|
|
|
|
inherited Create;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
|
|
|
|
|
if (GlobalCEFApp = nil) then
|
2019-11-08 23:15:53 +01:00
|
|
|
|
GlobalCEFApp := Self;
|
|
|
|
|
|
2021-07-31 17:24:54 +02:00
|
|
|
|
// Fields used to populate TCefSettings
|
|
|
|
|
FNoSandbox := True;
|
|
|
|
|
FBrowserSubprocessPath := '';
|
|
|
|
|
FFrameworkDirPath := '';
|
|
|
|
|
FMainBundlePath := {$IFDEF MACOSX}GetModulePath{$ELSE}''{$ENDIF};
|
|
|
|
|
FChromeRuntime := False;
|
|
|
|
|
FMultiThreadedMessageLoop := True;
|
|
|
|
|
FExternalMessagePump := False;
|
|
|
|
|
FWindowlessRenderingEnabled := False;
|
|
|
|
|
FCommandLineArgsDisabled := False;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FCache := '';
|
|
|
|
|
FRootCache := '';
|
|
|
|
|
FUserDataPath := '';
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FPersistSessionCookies := False;
|
|
|
|
|
FPersistUserPreferences := False;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FUserAgent := '';
|
2021-04-28 14:38:07 +02:00
|
|
|
|
FUserAgentProduct := '';
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FLocale := '';
|
|
|
|
|
FLogFile := '';
|
|
|
|
|
FLogSeverity := LOGSEVERITY_DISABLE;
|
|
|
|
|
FJavaScriptFlags := '';
|
|
|
|
|
FResourcesDirPath := '';
|
|
|
|
|
FLocalesDirPath := '';
|
|
|
|
|
FPackLoadingDisabled := False;
|
|
|
|
|
FRemoteDebuggingPort := 0;
|
|
|
|
|
FUncaughtExceptionStackSize := 0;
|
|
|
|
|
FIgnoreCertificateErrors := False;
|
|
|
|
|
FBackgroundColor := 0;
|
|
|
|
|
FAcceptLanguageList := '';
|
2021-04-18 19:36:20 +02:00
|
|
|
|
FCookieableSchemesList := '';
|
|
|
|
|
FCookieableSchemesExcludeDefaults := False;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
|
|
|
|
|
// Fields used to set command line switches
|
|
|
|
|
FSingleProcess := False;
|
2022-08-06 12:00:28 +02:00
|
|
|
|
FEnableMediaStream := False;
|
2021-01-24 15:28:38 +01:00
|
|
|
|
FEnableSpeechInput := False;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FUseFakeUIForMediaStream := False;
|
|
|
|
|
FEnableUsermediaScreenCapturing := False;
|
|
|
|
|
FEnableGPU := False;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FEnableFeatures := '';
|
|
|
|
|
FDisableFeatures := '';
|
|
|
|
|
FEnableBlinkFeatures := '';
|
|
|
|
|
FDisableBlinkFeatures := '';
|
|
|
|
|
FBlinkSettings := '';
|
|
|
|
|
FForceFieldTrials := '';
|
|
|
|
|
FForceFieldTrialParams := '';
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FSmoothScrolling := STATE_DEFAULT;
|
|
|
|
|
FFastUnload := False;
|
|
|
|
|
FDisableSafeBrowsing := False;
|
|
|
|
|
FMuteAudio := False;
|
|
|
|
|
FSitePerProcess := False;
|
|
|
|
|
FDisableWebSecurity := False;
|
|
|
|
|
FDisablePDFExtension := False;
|
|
|
|
|
FDisableSiteIsolationTrials := False;
|
2021-01-21 15:46:35 +01:00
|
|
|
|
FDisableChromeLoginPrompt := False;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FDisableExtensions := False;
|
|
|
|
|
FAutoplayPolicy := appDefault;
|
|
|
|
|
FDisableBackgroundNetworking := False;
|
|
|
|
|
FMetricsRecordingOnly := False;
|
|
|
|
|
FAllowFileAccessFromFiles := False;
|
|
|
|
|
FAllowRunningInsecureContent := False;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FEnablePrintPreview := False;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FDefaultEncoding := '';
|
|
|
|
|
FDisableJavascript := False;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
FDisableJavascriptCloseWindows := False;
|
|
|
|
|
FDisableJavascriptAccessClipboard := False;
|
|
|
|
|
FDisableJavascriptDomPaste := False;
|
|
|
|
|
FAllowUniversalAccessFromFileUrls := False;
|
|
|
|
|
FDisableImageLoading := False;
|
|
|
|
|
FImageShrinkStandaloneToFit := False;
|
|
|
|
|
FDisableTextAreaResize := False;
|
|
|
|
|
FDisableTabToLinks := False;
|
|
|
|
|
FEnableProfanityFilter := False;
|
|
|
|
|
FDisableSpellChecking := False;
|
|
|
|
|
FOverrideSpellCheckLang := '';
|
|
|
|
|
FTouchEvents := STATE_DEFAULT;
|
|
|
|
|
FDisableReadingFromCanvas := False;
|
|
|
|
|
FHyperlinkAuditing := True;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FDisableNewBrowserInfoTimeout := False;
|
|
|
|
|
FDevToolsProtocolLogFile := '';
|
|
|
|
|
FForcedDeviceScaleFactor := 0;
|
|
|
|
|
FDisableZygote := False;
|
|
|
|
|
FUseMockKeyChain := False;
|
|
|
|
|
FDisableRequestHandlingForTesting := False;
|
|
|
|
|
FDisablePopupBlocking := False;
|
|
|
|
|
FDisableBackForwardCache := False;
|
2021-09-05 10:49:20 +02:00
|
|
|
|
FDisableComponentUpdate := False;
|
2021-11-25 11:16:38 +01:00
|
|
|
|
FAllowInsecureLocalhost := False;
|
|
|
|
|
FKioskPrinting := False;
|
2022-06-30 09:03:56 +02:00
|
|
|
|
FTreatInsecureOriginAsSecure := '';
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-07-31 17:24:54 +02:00
|
|
|
|
// Fields used during the CEF initialization
|
|
|
|
|
FWindowsSandboxInfo := nil;
|
|
|
|
|
FEnableHighDPISupport := False;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
FArgCopy := TCEFArgCopy.Create;
|
|
|
|
|
{$ENDIF}
|
2021-07-31 17:24:54 +02:00
|
|
|
|
|
|
|
|
|
// Fields used by custom properties
|
|
|
|
|
FDeleteCache := False;
|
|
|
|
|
FDeleteCookies := False;
|
|
|
|
|
FCheckCEFFiles := {$IFDEF MACOSX}False{$ELSE}True{$ENDIF};
|
|
|
|
|
FShowMessageDlg := True;
|
|
|
|
|
FMissingBinariesException := False;
|
|
|
|
|
FSetCurrentDir := False;
|
|
|
|
|
FGlobalContextInitialized := False;
|
|
|
|
|
FChromeVersionInfo.MajorVer := CEF_CHROMEELF_VERSION_MAJOR;
|
|
|
|
|
FChromeVersionInfo.MinorVer := CEF_CHROMEELF_VERSION_MINOR;
|
|
|
|
|
FChromeVersionInfo.Release := CEF_CHROMEELF_VERSION_RELEASE;
|
|
|
|
|
FChromeVersionInfo.Build := CEF_CHROMEELF_VERSION_BUILD;
|
|
|
|
|
FLibLoaded := False;
|
|
|
|
|
FLogProcessInfo := False;
|
|
|
|
|
FReRaiseExceptions := False;
|
|
|
|
|
UpdateDeviceScaleFactor;
|
|
|
|
|
FLocalesRequired := '';
|
|
|
|
|
FProcessType := ParseProcessType;
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FMustCreateResourceBundleHandler := False;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FMustCreateBrowserProcessHandler := True; // The official CEF sample application always creates this handler in the browser process
|
|
|
|
|
FMustCreateRenderProcessHandler := True; // The official CEF sample application always creates this handler in the renderer process
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FMustCreateLoadHandler := False;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
FStatus := asLoading;
|
|
|
|
|
FMissingLibFiles := '';
|
|
|
|
|
FMustFreeLibrary := False;
|
|
|
|
|
FLastErrorMessage := '';
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
2021-12-11 11:43:58 +01:00
|
|
|
|
case FProcessType of
|
|
|
|
|
ptBrowser : GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
|
|
|
|
|
ptCrashpad :
|
|
|
|
|
// The crashpad handler process must be the last one to be closed
|
|
|
|
|
SetProcessShutdownParameters($100, SHUTDOWN_NORETRY);
|
|
|
|
|
else
|
|
|
|
|
// Subprocesses will be the last to be notified about the Windows shutdown.
|
|
|
|
|
// The main browser process will receive WM_QUERYENDSESSION before the subprocesses
|
|
|
|
|
// and that allows to close the application in the right order.
|
|
|
|
|
// See the MiniBrowser demo for all the details.
|
|
|
|
|
SetProcessShutdownParameters(CHROMIUM_NONBROWSERSHUTDOWNPRIORITY - 1, SHUTDOWN_NORETRY);
|
|
|
|
|
end;
|
2021-07-31 17:24:54 +02:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
// Internal filelds
|
|
|
|
|
FLibHandle := 0;
|
|
|
|
|
FCustomCommandLines := nil;
|
|
|
|
|
FCustomCommandLineValues := nil;
|
|
|
|
|
FillChar(FAppSettings, SizeOf(TCefSettings), 0);
|
|
|
|
|
FAppSettings.size := SizeOf(TCefSettings);
|
|
|
|
|
FDisableGPUCache := True;
|
|
|
|
|
|
|
|
|
|
// ICefApp
|
|
|
|
|
FOnRegisterCustomSchemes := nil;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefBrowserProcessHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnContextInitialized := nil;
|
|
|
|
|
FOnBeforeChildProcessLaunch := nil;
|
|
|
|
|
FOnScheduleMessagePumpWork := nil;
|
2020-11-19 18:55:17 +01:00
|
|
|
|
FOnGetDefaultClient := nil;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefResourceBundleHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnGetLocalizedString := nil;
|
|
|
|
|
FOnGetDataResource := nil;
|
|
|
|
|
FOnGetDataResourceForScale := nil;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefRenderProcessHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnWebKitInitialized := nil;
|
|
|
|
|
FOnBrowserCreated := nil;
|
|
|
|
|
FOnBrowserDestroyed := nil;
|
|
|
|
|
FOnContextCreated := nil;
|
|
|
|
|
FOnContextReleased := nil;
|
|
|
|
|
FOnUncaughtException := nil;
|
|
|
|
|
FOnFocusedNodeChanged := nil;
|
|
|
|
|
FOnProcessMessageReceived := nil;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// ICefLoadHandler
|
2020-10-08 16:41:27 +02:00
|
|
|
|
FOnLoadingStateChange := nil;
|
|
|
|
|
FOnLoadStart := nil;
|
|
|
|
|
FOnLoadEnd := nil;
|
|
|
|
|
FOnLoadError := nil;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
IsMultiThread := True;
|
|
|
|
|
|
|
|
|
|
SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
destructor TCefApplicationCore.Destroy;
|
|
|
|
|
begin
|
|
|
|
|
try
|
2021-10-22 19:19:57 +02:00
|
|
|
|
ClearSchemeHandlerFactories;
|
2021-09-11 12:00:09 +02:00
|
|
|
|
|
|
|
|
|
if (GlobalCEFApp = Self) then
|
|
|
|
|
GlobalCEFApp := nil;
|
|
|
|
|
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if (FProcessType = ptBrowser) then
|
|
|
|
|
ShutDown;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
FreeLibcefLibrary;
|
|
|
|
|
|
2022-02-14 21:57:27 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
if (FArgCopy <> nil) then FreeAndNil(FArgCopy);
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines);
|
|
|
|
|
if (FCustomCommandLineValues <> nil) then FreeAndNil(FCustomCommandLineValues);
|
|
|
|
|
finally
|
|
|
|
|
inherited Destroy;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2021-10-22 19:19:57 +02:00
|
|
|
|
procedure TCefApplicationCore.ClearSchemeHandlerFactories;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
if FLibLoaded then
|
|
|
|
|
cef_clear_scheme_handler_factories();
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.ClearSchemeHandlerFactories', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure TCefApplicationCore.AfterConstruction;
|
|
|
|
|
begin
|
|
|
|
|
inherited AfterConstruction;
|
|
|
|
|
|
|
|
|
|
FCustomCommandLines := TStringList.Create;
|
|
|
|
|
FCustomCommandLineValues := TStringList.Create;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.AddCustomCommandLine(const aCommandLine, aValue : string);
|
|
|
|
|
begin
|
|
|
|
|
if (FCustomCommandLines <> nil) then FCustomCommandLines.Add(aCommandLine);
|
|
|
|
|
if (FCustomCommandLineValues <> nil) then FCustomCommandLineValues.Add(aValue);
|
|
|
|
|
end;
|
|
|
|
|
|
2021-02-08 10:28:36 +01:00
|
|
|
|
{$IFDEF MACOSX}
|
2021-05-16 19:42:25 +02:00
|
|
|
|
// This function is used by the CEF subprocesses in MacOS to read the framework
|
|
|
|
|
// and bundle settings from the command line switches.
|
2021-02-07 16:45:55 +01:00
|
|
|
|
procedure TCefApplicationCore.InitLibLocationFromArgs;
|
|
|
|
|
var
|
2021-05-16 19:42:25 +02:00
|
|
|
|
TempFrameworkPath, TempBundlePath : ustring;
|
2021-02-07 16:45:55 +01:00
|
|
|
|
begin
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if GetCommandLineSwitchValue('framework-dir-path', TempFrameworkPath) then
|
|
|
|
|
FrameworkDirPath := TempFrameworkPath;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if GetCommandLineSwitchValue('main-bundle-path', TempBundlePath) then
|
|
|
|
|
MainBundlePath := TempBundlePath;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if (TempBundlePath <> '') and (FrameworkDirPath = '') then
|
2021-02-08 10:28:36 +01:00
|
|
|
|
begin
|
2021-05-16 19:42:25 +02:00
|
|
|
|
TempBundlePath := IncludeTrailingPathDelimiter(TempBundlePath) + LIBCEF_PREFIX;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if FileExists(TempBundlePath + LIBCEF_DLL) then
|
|
|
|
|
FrameworkDirPath := TempBundlePath;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
end;
|
2021-02-07 16:45:55 +01:00
|
|
|
|
end;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
{$ENDIF}
|
2021-02-07 16:45:55 +01:00
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
// This function must only be called by the main executable when the application
|
|
|
|
|
// is configured to use a different executable for the subprocesses.
|
|
|
|
|
// The process calling ths function must be the browser process.
|
|
|
|
|
function TCefApplicationCore.MultiExeProcessing : boolean;
|
|
|
|
|
var
|
|
|
|
|
TempApp : ICefApp;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
TempApp := nil;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
try
|
|
|
|
|
if (ProcessType = ptBrowser) and
|
|
|
|
|
CheckCEFLibrary and
|
|
|
|
|
LoadCEFlibrary then
|
|
|
|
|
begin
|
|
|
|
|
TempApp := TCustomCefApp.Create(self);
|
2020-11-10 15:02:49 +01:00
|
|
|
|
|
|
|
|
|
if InitializeLibrary(TempApp) then
|
|
|
|
|
Result := True
|
|
|
|
|
else
|
|
|
|
|
TempApp.RemoveReferences;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.MultiExeProcessing', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
TempApp := nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
// This function will be called by all processes when the application is configured
|
|
|
|
|
// to use the same executable for all the processes : browser, render, etc.
|
|
|
|
|
function TCefApplicationCore.SingleExeProcessing : boolean;
|
|
|
|
|
var
|
|
|
|
|
TempApp : ICefApp;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
TempApp := nil;
|
|
|
|
|
|
|
|
|
|
try
|
2020-11-10 15:02:49 +01:00
|
|
|
|
try
|
|
|
|
|
if CheckCEFLibrary and LoadCEFlibrary then
|
|
|
|
|
begin
|
|
|
|
|
if (FProcessType <> ptBrowser) then
|
|
|
|
|
BeforeInitSubProcess;
|
2020-07-02 10:50:52 +02:00
|
|
|
|
|
2020-11-10 15:02:49 +01:00
|
|
|
|
TempApp := TCustomCefApp.Create(self);
|
|
|
|
|
|
|
|
|
|
if (ExecuteProcess(TempApp) < 0) and
|
|
|
|
|
InitializeLibrary(TempApp) then
|
|
|
|
|
Result := True
|
|
|
|
|
else
|
|
|
|
|
TempApp.RemoveReferences;
|
|
|
|
|
end;
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.SingleExeProcessing', e) then raise;
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
finally
|
|
|
|
|
TempApp := nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.BeforeInitSubProcess;
|
|
|
|
|
begin
|
|
|
|
|
// Is implemented by TCefApplication
|
|
|
|
|
end;
|
|
|
|
|
|
2020-06-13 17:24:22 +02:00
|
|
|
|
function TCefApplicationCore.GetChromeVersion : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
Result := FileVersionInfoToString(FChromeVersionInfo);
|
|
|
|
|
end;
|
|
|
|
|
|
2020-06-13 17:24:22 +02:00
|
|
|
|
function TCefApplicationCore.GetLibCefVersion : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
Result := IntToStr(CEF_SUPPORTED_VERSION_MAJOR) + '.' +
|
|
|
|
|
IntToStr(CEF_SUPPORTED_VERSION_MINOR) + '.' +
|
|
|
|
|
IntToStr(CEF_SUPPORTED_VERSION_RELEASE) + '.' +
|
|
|
|
|
IntToStr(CEF_SUPPORTED_VERSION_BUILD);
|
|
|
|
|
end;
|
|
|
|
|
|
2020-06-13 17:24:22 +02:00
|
|
|
|
function TCefApplicationCore.GetLibCefPath : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
if (length(FFrameworkDirPath) > 0) then
|
|
|
|
|
Result := IncludeTrailingPathDelimiter(FFrameworkDirPath) + LIBCEF_DLL
|
|
|
|
|
else
|
2020-12-28 18:11:27 +01:00
|
|
|
|
begin
|
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
Result := GetModulePath + LIBCEF_DLL;
|
|
|
|
|
{$ELSE}
|
2021-01-31 16:53:07 +01:00
|
|
|
|
{$IFDEF MACOSX}
|
|
|
|
|
Result := GetModulePath + LIBCEF_PREFIX + LIBCEF_DLL;
|
|
|
|
|
{$ELSE}
|
|
|
|
|
Result := LIBCEF_DLL;
|
|
|
|
|
{$ENDIF}
|
2020-12-28 18:11:27 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2020-06-13 17:24:22 +02:00
|
|
|
|
function TCefApplicationCore.GetChromeElfPath : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
if (length(FFrameworkDirPath) > 0) then
|
|
|
|
|
Result := IncludeTrailingPathDelimiter(FFrameworkDirPath) + CHROMEELF_DLL
|
|
|
|
|
else
|
|
|
|
|
Result := CHROMEELF_DLL;
|
|
|
|
|
end;
|
|
|
|
|
|
2021-02-07 16:59:04 +01:00
|
|
|
|
function TCefApplicationCore.GetLocalesDirPath: ustring;
|
|
|
|
|
begin
|
|
|
|
|
Result := FLocalesDirPath;
|
|
|
|
|
{$IFNDEF MACOSX}
|
|
|
|
|
if (Result = '') and (FrameworkDirPath <> '') then
|
|
|
|
|
begin
|
|
|
|
|
if FileExists(IncludeTrailingPathDelimiter(FrameworkDirPath + LIBCEF_LOCALE_DIR) + LIBCEF_LOCALE_ENUS) then
|
|
|
|
|
Result := FrameworkDirPath + LIBCEF_LOCALE_DIR;
|
|
|
|
|
end;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetResourcesDirPath: ustring;
|
|
|
|
|
begin
|
|
|
|
|
Result := FResourcesDirPath;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
{$IFNDEF MACOSX}
|
2021-02-07 16:59:04 +01:00
|
|
|
|
if (Result = '') and (FrameworkDirPath <> '') then
|
|
|
|
|
begin
|
|
|
|
|
if FileExists(IncludeTrailingPathDelimiter(FrameworkDirPath) + LIBCEF_PAK) then
|
|
|
|
|
Result := FrameworkDirPath;
|
|
|
|
|
end;
|
2021-02-08 10:28:36 +01:00
|
|
|
|
{$ENDIF}
|
2021-02-07 16:59:04 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure TCefApplicationCore.SetCache(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FCache := CustomAbsolutePath(aValue);
|
|
|
|
|
FDisableGPUCache := (length(FCache) = 0);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetRootCache(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FRootCache := CustomAbsolutePath(aValue);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetUserDataPath(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FUserDataPath := CustomAbsolutePath(aValue);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetBrowserSubprocessPath(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FBrowserSubprocessPath := CustomAbsolutePath(aValue);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetFrameworkDirPath(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FFrameworkDirPath := CustomAbsolutePath(aValue, True);
|
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
2021-10-05 11:45:21 +02:00
|
|
|
|
if (FProcessType = ptBrowser) then
|
|
|
|
|
GetDLLVersion(ChromeElfPath, FChromeVersionInfo);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetResourcesDirPath(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FResourcesDirPath := CustomAbsolutePath(aValue, True);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetLocalesDirPath(const aValue : ustring);
|
|
|
|
|
begin
|
|
|
|
|
FLocalesDirPath := CustomAbsolutePath(aValue, True);
|
|
|
|
|
end;
|
|
|
|
|
|
2021-02-21 18:41:25 +01:00
|
|
|
|
function TCefApplicationCore.CheckCEFResources : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
var
|
|
|
|
|
TempMissingFrm, TempMissingRsc, TempMissingLoc, TempMissingSubProc : boolean;
|
2021-02-21 18:41:25 +01:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
TempMissingSubProc := not(CheckSubprocessPath(FBrowserSubprocessPath, FMissingLibFiles));
|
|
|
|
|
TempMissingFrm := not(CheckDLLs(FFrameworkDirPath, FMissingLibFiles));
|
2021-04-18 19:36:20 +02:00
|
|
|
|
TempMissingRsc := not(CheckResources(ResourcesDirPath, FMissingLibFiles));
|
2021-02-21 18:41:25 +01:00
|
|
|
|
TempMissingLoc := not(CheckLocales(LocalesDirPath, FMissingLibFiles, FLocalesRequired));
|
|
|
|
|
|
|
|
|
|
if TempMissingFrm or TempMissingRsc or TempMissingLoc or TempMissingSubProc then
|
|
|
|
|
begin
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FStatus := asErrorMissingFiles;
|
|
|
|
|
FLastErrorMessage := 'CEF binaries missing !';
|
2021-02-21 18:41:25 +01:00
|
|
|
|
|
|
|
|
|
if (length(FMissingLibFiles) > 0) then
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FLastErrorMessage := FLastErrorMessage + CRLF + CRLF +
|
|
|
|
|
'The missing files are :' + CRLF +
|
|
|
|
|
trim(FMissingLibFiles);
|
2021-02-21 18:41:25 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2021-02-21 18:41:25 +01:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
Result := True;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
function TCefApplicationCore.CheckCEFDLL : boolean;
|
|
|
|
|
var
|
2019-11-08 23:15:53 +01:00
|
|
|
|
TempMachine : integer;
|
|
|
|
|
TempVersionInfo : TFileVersionInfo;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
2021-02-21 18:41:25 +01:00
|
|
|
|
if CheckDLLVersion(LibCefPath,
|
|
|
|
|
CEF_SUPPORTED_VERSION_MAJOR,
|
|
|
|
|
CEF_SUPPORTED_VERSION_MINOR,
|
|
|
|
|
CEF_SUPPORTED_VERSION_RELEASE,
|
|
|
|
|
CEF_SUPPORTED_VERSION_BUILD) then
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
2021-02-21 18:41:25 +01:00
|
|
|
|
if GetDLLHeaderMachine(LibCefPath, TempMachine) then
|
|
|
|
|
case TempMachine of
|
|
|
|
|
CEF_IMAGE_FILE_MACHINE_I386 :
|
|
|
|
|
if Is32BitProcess then
|
|
|
|
|
Result := True
|
|
|
|
|
else
|
|
|
|
|
begin
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FStatus := asErrorDLLVersion;
|
|
|
|
|
FLastErrorMessage := 'Wrong CEF binaries !' +
|
|
|
|
|
CRLF + CRLF +
|
|
|
|
|
'Use the 32 bit CEF binaries with 32 bits applications only.';
|
2021-02-21 18:41:25 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2021-02-21 18:41:25 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
CEF_IMAGE_FILE_MACHINE_AMD64 :
|
|
|
|
|
if not(Is32BitProcess) then
|
|
|
|
|
Result := True
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
begin
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FStatus := asErrorDLLVersion;
|
|
|
|
|
FLastErrorMessage := 'Wrong CEF binaries !' +
|
|
|
|
|
CRLF + CRLF +
|
|
|
|
|
'Use the 64 bit CEF binaries with 64 bits applications only.';
|
2021-02-21 18:41:25 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2021-02-21 18:41:25 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
else
|
2019-11-10 18:23:39 +01:00
|
|
|
|
begin
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FStatus := asErrorDLLVersion;
|
|
|
|
|
FLastErrorMessage := 'Unknown CEF binaries !' +
|
|
|
|
|
CRLF + CRLF +
|
|
|
|
|
'Use only the CEF binaries specified in the CEF4Delphi Readme.md file at ' +
|
|
|
|
|
CEF4DELPHI_URL;
|
2019-11-10 18:23:39 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2019-11-10 18:23:39 +01:00
|
|
|
|
end;
|
2021-02-21 18:41:25 +01:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
Result := True;
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
FStatus := asErrorDLLVersion;
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FLastErrorMessage := 'Unsupported CEF version !' +
|
|
|
|
|
CRLF + CRLF +
|
|
|
|
|
'Use only the CEF binaries specified in the CEF4Delphi Readme.md file at ' +
|
|
|
|
|
CEF4DELPHI_URL;
|
2021-02-21 18:41:25 +01:00
|
|
|
|
|
|
|
|
|
if GetDLLVersion(LibCefPath, TempVersionInfo) then
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FLastErrorMessage := FLastErrorMessage + CRLF + CRLF +
|
|
|
|
|
'Expected ' + LIBCEF_DLL + ' version : ' + LibCefVersion + CRLF +
|
|
|
|
|
'Found ' + LIBCEF_DLL + ' version : ' + FileVersionInfoToString(TempVersionInfo);
|
2021-02-21 18:41:25 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
end;
|
2021-02-21 18:41:25 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.CheckCEFLibrary : boolean;
|
|
|
|
|
var
|
|
|
|
|
TempOldDir : string;
|
|
|
|
|
begin
|
|
|
|
|
if not(FCheckCEFFiles) or (FProcessType <> ptBrowser) then
|
|
|
|
|
begin
|
|
|
|
|
Result := True;
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if FSetCurrentDir then
|
|
|
|
|
begin
|
|
|
|
|
TempOldDir := GetCurrentDir;
|
|
|
|
|
chdir(GetModulePath);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
Result := CheckCEFResources
|
|
|
|
|
{$IFDEF MSWINDOWS}and CheckCEFDLL{$ENDIF};
|
|
|
|
|
|
|
|
|
|
if FSetCurrentDir then chdir(TempOldDir);
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.StartMainProcess : boolean;
|
|
|
|
|
begin
|
|
|
|
|
if (FStatus <> asLoading) then
|
|
|
|
|
Result := False
|
|
|
|
|
else
|
2021-02-16 17:53:15 +01:00
|
|
|
|
{$IFDEF MACOSX}
|
|
|
|
|
Result := MultiExeProcessing;
|
|
|
|
|
{$ELSE}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
if not(FSingleProcess) and (length(FBrowserSubprocessPath) > 0) then
|
|
|
|
|
Result := MultiExeProcessing
|
|
|
|
|
else
|
|
|
|
|
Result := SingleExeProcessing;
|
2021-02-16 17:53:15 +01:00
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
// This function can only be called by the executable used for the subprocesses.
|
|
|
|
|
// The application must be configured to use different executables for the subprocesses.
|
|
|
|
|
// The process calling this function can't be the browser process.
|
|
|
|
|
function TCefApplicationCore.StartSubProcess : boolean;
|
|
|
|
|
var
|
|
|
|
|
TempApp : ICefApp;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
TempApp := nil;
|
|
|
|
|
|
|
|
|
|
try
|
2020-11-10 15:02:49 +01:00
|
|
|
|
try
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if not(FSingleProcess) and
|
2020-11-10 15:02:49 +01:00
|
|
|
|
(ProcessType <> ptBrowser) and
|
2021-05-16 19:42:25 +02:00
|
|
|
|
LoadCEFlibrary then
|
2020-11-10 15:02:49 +01:00
|
|
|
|
begin
|
|
|
|
|
TempApp := TCustomCefApp.Create(self);
|
|
|
|
|
|
|
|
|
|
if (ExecuteProcess(TempApp) >= 0) then
|
|
|
|
|
Result := True
|
|
|
|
|
else
|
|
|
|
|
TempApp.RemoveReferences;
|
|
|
|
|
end;
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.StartSubProcess', e) then raise;
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
finally
|
|
|
|
|
TempApp := nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.DoMessageLoopWork;
|
|
|
|
|
begin
|
|
|
|
|
if FLibLoaded and
|
|
|
|
|
not(FMultiThreadedMessageLoop) and
|
|
|
|
|
FExternalMessagePump then
|
|
|
|
|
cef_do_message_loop_work();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.RunMessageLoop;
|
|
|
|
|
begin
|
|
|
|
|
if FLibLoaded and
|
|
|
|
|
not(FMultiThreadedMessageLoop) and
|
|
|
|
|
not(FExternalMessagePump) then
|
|
|
|
|
cef_run_message_loop();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.QuitMessageLoop;
|
|
|
|
|
begin
|
|
|
|
|
if FLibLoaded and
|
|
|
|
|
not(FMultiThreadedMessageLoop) and
|
|
|
|
|
not(FExternalMessagePump) then
|
|
|
|
|
cef_quit_message_loop();
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.SetOsmodalLoop(aValue : boolean);
|
|
|
|
|
begin
|
|
|
|
|
if (FStatus = asInitialized) then cef_set_osmodal_loop(Ord(aValue));
|
|
|
|
|
end;
|
|
|
|
|
|
2021-11-25 11:16:38 +01:00
|
|
|
|
procedure TCefApplicationCore.SetKioskPrinting(aValue : boolean);
|
|
|
|
|
begin
|
|
|
|
|
if (FKioskPrinting <> aValue) then
|
|
|
|
|
begin
|
|
|
|
|
FKioskPrinting := aValue;
|
|
|
|
|
|
|
|
|
|
if FKioskPrinting then
|
|
|
|
|
FEnablePrintPreview := True;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure TCefApplicationCore.UpdateDeviceScaleFactor;
|
|
|
|
|
begin
|
2020-12-20 12:28:56 +01:00
|
|
|
|
if (FForcedDeviceScaleFactor <> 0) then
|
|
|
|
|
FDeviceScaleFactor := FForcedDeviceScaleFactor
|
|
|
|
|
else
|
|
|
|
|
FDeviceScaleFactor := GetDeviceScaleFactor;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.ShutDown;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
if (FStatus = asInitialized) then
|
|
|
|
|
begin
|
|
|
|
|
FStatus := asShuttingDown;
|
|
|
|
|
cef_shutdown();
|
|
|
|
|
end;
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.ShutDown', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.FreeLibcefLibrary;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
try
|
|
|
|
|
if FMustFreeLibrary and (FLibHandle <> 0) then FreeLibrary(FLibHandle);
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.FreeLibcefLibrary', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
FLibHandle := 0;
|
|
|
|
|
FLibLoaded := False;
|
|
|
|
|
FStatus := asUnloaded;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2022-02-19 18:56:41 +01:00
|
|
|
|
{$WARN SYMBOL_PLATFORM OFF}
|
|
|
|
|
procedure TCefApplicationCore.InitializeCefMainArgs(var aCefMainArgs : TCefMainArgs);
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
aCefMainArgs.instance := HINSTANCE{$IFDEF FPC}(){$ENDIF};
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
// Create a copy of argv on Linux because Chromium mangles the value internally (see CEF issue #620).
|
|
|
|
|
// https://bitbucket.org/chromiumembedded/cef/issues/620/cef3-linux-crash-when-passing-command-line
|
|
|
|
|
if (FArgCopy.argv = nil) then
|
2022-03-26 20:05:29 +01:00
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
FArgCopy.CopyFromArgs(argc, argv);
|
|
|
|
|
{$ELSE}
|
|
|
|
|
FArgCopy.CopyFromArgs(ArgCount, ArgValues);
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
2022-02-19 18:56:41 +01:00
|
|
|
|
|
|
|
|
|
aCefMainArgs.argc := FArgCopy.argc;
|
|
|
|
|
aCefMainArgs.argv := FArgCopy.argv;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
{$IFDEF MACOSX}
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
aCefMainArgs.argc := argc;
|
|
|
|
|
aCefMainArgs.argv := argv;
|
|
|
|
|
{$ELSE}
|
|
|
|
|
aCefMainArgs.argc := ArgCount;
|
2022-03-26 20:05:29 +01:00
|
|
|
|
aCefMainArgs.argv := ArgValues;
|
2022-02-19 18:56:41 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
{$WARN SYMBOL_PLATFORM ON}
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function TCefApplicationCore.ExecuteProcess(const aApp : ICefApp) : integer;
|
|
|
|
|
var
|
|
|
|
|
TempArgs : TCefMainArgs;
|
|
|
|
|
begin
|
|
|
|
|
Result := -1;
|
|
|
|
|
try
|
|
|
|
|
if (aApp <> nil) then
|
|
|
|
|
begin
|
2022-02-19 18:56:41 +01:00
|
|
|
|
InitializeCefMainArgs(TempArgs);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
Result := cef_execute_process(@TempArgs, aApp.Wrap, FWindowsSandboxInfo);
|
|
|
|
|
end;
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
begin
|
|
|
|
|
FStatus := asErrorExecutingProcess;
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.ExecuteProcess', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.InitializeSettings(var aSettings : TCefSettings);
|
|
|
|
|
begin
|
|
|
|
|
aSettings.size := SizeOf(TCefSettings);
|
|
|
|
|
aSettings.no_sandbox := Ord(FNoSandbox);
|
|
|
|
|
aSettings.browser_subprocess_path := CefString(FBrowserSubprocessPath);
|
|
|
|
|
aSettings.framework_dir_path := CefString(FFrameworkDirPath);
|
|
|
|
|
aSettings.main_bundle_path := CefString(FMainBundlePath);
|
2020-08-29 11:48:12 +02:00
|
|
|
|
aSettings.chrome_runtime := Ord(FChromeRuntime);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
aSettings.multi_threaded_message_loop := Ord(FMultiThreadedMessageLoop);
|
|
|
|
|
aSettings.external_message_pump := Ord(FExternalMessagePump);
|
|
|
|
|
aSettings.windowless_rendering_enabled := Ord(FWindowlessRenderingEnabled);
|
|
|
|
|
aSettings.command_line_args_disabled := Ord(FCommandLineArgsDisabled);
|
|
|
|
|
aSettings.cache_path := CefString(FCache);
|
|
|
|
|
aSettings.root_cache_path := CefString(FRootCache);
|
|
|
|
|
aSettings.user_data_path := CefString(FUserDataPath);
|
|
|
|
|
aSettings.persist_session_cookies := Ord(FPersistSessionCookies);
|
|
|
|
|
aSettings.persist_user_preferences := Ord(FPersistUserPreferences);
|
|
|
|
|
aSettings.user_agent := CefString(FUserAgent);
|
2021-04-28 14:38:07 +02:00
|
|
|
|
aSettings.user_agent_product := CefString(FUserAgentProduct);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
aSettings.locale := CefString(FLocale);
|
|
|
|
|
aSettings.log_file := CefString(FLogFile);
|
|
|
|
|
aSettings.log_severity := FLogSeverity;
|
|
|
|
|
aSettings.javascript_flags := CefString(FJavaScriptFlags);
|
2021-02-16 19:06:10 +01:00
|
|
|
|
aSettings.resources_dir_path := CefString(ResourcesDirPath);
|
|
|
|
|
aSettings.locales_dir_path := CefString(LocalesDirPath);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
aSettings.pack_loading_disabled := Ord(FPackLoadingDisabled);
|
|
|
|
|
aSettings.remote_debugging_port := FRemoteDebuggingPort;
|
|
|
|
|
aSettings.uncaught_exception_stack_size := FUncaughtExceptionStackSize;
|
|
|
|
|
aSettings.background_color := FBackgroundColor;
|
|
|
|
|
aSettings.accept_language_list := CefString(FAcceptLanguageList);
|
2021-04-18 19:36:20 +02:00
|
|
|
|
aSettings.cookieable_schemes_list := CefString(FCookieableSchemesList);
|
|
|
|
|
aSettings.cookieable_schemes_exclude_defaults := Ord(FCookieableSchemesExcludeDefaults);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.InitializeLibrary(const aApp : ICefApp) : boolean;
|
|
|
|
|
var
|
|
|
|
|
TempArgs : TCefMainArgs;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
try
|
|
|
|
|
if (aApp <> nil) then
|
|
|
|
|
begin
|
|
|
|
|
if FDeleteCache and FDeleteCookies then
|
|
|
|
|
RenameAndDeleteDir(FCache)
|
|
|
|
|
else
|
|
|
|
|
if FDeleteCookies then
|
2022-07-21 14:11:32 +02:00
|
|
|
|
DeleteCookiesDB(IncludeTrailingPathDelimiter(FCache) + 'Network')
|
2019-11-08 23:15:53 +01:00
|
|
|
|
else
|
|
|
|
|
if FDeleteCache then
|
|
|
|
|
RenameAndDeleteDir(FCache, True);
|
|
|
|
|
|
|
|
|
|
InitializeSettings(FAppSettings);
|
2022-02-19 18:56:41 +01:00
|
|
|
|
InitializeCefMainArgs(TempArgs);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
if (cef_initialize(@TempArgs, @FAppSettings, aApp.Wrap, FWindowsSandboxInfo) <> 0) then
|
|
|
|
|
begin
|
|
|
|
|
Result := True;
|
|
|
|
|
FStatus := asInitialized;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.InitializeLibrary', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
if not(Result) then FStatus := asErrorInitializingLibrary;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.DeleteCacheContents(const aDirectory : string);
|
|
|
|
|
var
|
|
|
|
|
TempFiles : TStringList;
|
|
|
|
|
begin
|
|
|
|
|
TempFiles := TStringList.Create;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
TempFiles.Add('Cookies');
|
|
|
|
|
TempFiles.Add('Cookies-journal');
|
2020-04-30 17:28:41 +02:00
|
|
|
|
TempFiles.Add('LocalPrefs.json');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
DeleteDirContents(aDirectory, TempFiles);
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(TempFiles);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.DeleteCookiesDB(const aDirectory : string);
|
|
|
|
|
var
|
|
|
|
|
TempFiles : TStringList;
|
|
|
|
|
begin
|
|
|
|
|
TempFiles := TStringList.Create;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
TempFiles.Add(IncludeTrailingPathDelimiter(aDirectory) + 'Cookies');
|
|
|
|
|
TempFiles.Add(IncludeTrailingPathDelimiter(aDirectory) + 'Cookies-journal');
|
|
|
|
|
|
|
|
|
|
DeleteFileList(TempFiles);
|
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(TempFiles);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.MoveCookiesDB(const aSrcDirectory, aDstDirectory : string);
|
|
|
|
|
var
|
|
|
|
|
TempFiles : TStringList;
|
2022-07-21 14:11:32 +02:00
|
|
|
|
TempSrc, TempDst : string;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
TempFiles := TStringList.Create;
|
|
|
|
|
|
|
|
|
|
try
|
2022-07-21 14:11:32 +02:00
|
|
|
|
TempFiles.Add('LocalPrefs.json');
|
|
|
|
|
|
|
|
|
|
MoveFileList(TempFiles, aSrcDirectory, aDstDirectory);
|
|
|
|
|
|
|
|
|
|
TempSrc := IncludeTrailingPathDelimiter(aSrcDirectory) + 'Network';
|
|
|
|
|
TempDst := IncludeTrailingPathDelimiter(aDstDirectory) + 'Network';
|
|
|
|
|
|
|
|
|
|
TempFiles.Clear;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
TempFiles.Add('Cookies');
|
|
|
|
|
TempFiles.Add('Cookies-journal');
|
|
|
|
|
|
2022-07-21 14:11:32 +02:00
|
|
|
|
MoveFileList(TempFiles, TempSrc, TempDst);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
finally
|
|
|
|
|
FreeAndNil(TempFiles);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.RenameAndDeleteDir(const aDirectory : string; aKeepCookies : boolean);
|
|
|
|
|
var
|
|
|
|
|
TempOldDir, TempNewDir : string;
|
|
|
|
|
i : integer;
|
|
|
|
|
TempThread : TCEFDirectoryDeleterThread;
|
|
|
|
|
begin
|
|
|
|
|
try
|
|
|
|
|
if (length(aDirectory) = 0) or not(DirectoryExists(aDirectory)) then exit;
|
|
|
|
|
|
|
|
|
|
TempOldDir := ExcludeTrailingPathDelimiter(aDirectory);
|
|
|
|
|
|
|
|
|
|
if (Pos(PathDelim, TempOldDir) > 0) and
|
|
|
|
|
(length(ExtractFileName(TempOldDir)) > 0) then
|
|
|
|
|
begin
|
|
|
|
|
i := 0;
|
|
|
|
|
|
|
|
|
|
repeat
|
|
|
|
|
inc(i);
|
2022-07-21 14:11:32 +02:00
|
|
|
|
TempNewDir := TempOldDir + '_' + inttostr(i);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
until not(DirectoryExists(TempNewDir));
|
|
|
|
|
|
|
|
|
|
if RenameFile(TempOldDir, TempNewDir) then
|
|
|
|
|
begin
|
|
|
|
|
if aKeepCookies then MoveCookiesDB(TempNewDir, TempOldDir);
|
|
|
|
|
|
|
|
|
|
TempThread := TCEFDirectoryDeleterThread.Create(TempNewDir);
|
|
|
|
|
{$IFDEF DELPHI14_UP}
|
2021-05-18 16:40:37 +02:00
|
|
|
|
TempThread.Start;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ELSE}
|
2021-05-18 16:40:37 +02:00
|
|
|
|
{$IFNDEF FPC}
|
|
|
|
|
TempThread.Resume;
|
|
|
|
|
{$ELSE}
|
|
|
|
|
TempThread.Start;
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if aKeepCookies then
|
|
|
|
|
DeleteCacheContents(aDirectory)
|
|
|
|
|
else
|
|
|
|
|
DeleteDirContents(aDirectory);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if aKeepCookies then
|
|
|
|
|
DeleteCacheContents(aDirectory)
|
|
|
|
|
else
|
|
|
|
|
DeleteDirContents(aDirectory);
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCefApplicationCore.RenameAndDeleteDir', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.ShowErrorMessageDlg(const aError : string);
|
|
|
|
|
begin
|
|
|
|
|
OutputDebugMessage(aError);
|
|
|
|
|
|
|
|
|
|
if FShowMessageDlg then
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
MessageBox(0, PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK or MB_TOPMOST);
|
2021-05-18 16:40:37 +02:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
if (WidgetSet <> nil) then
|
|
|
|
|
Application.MessageBox(PChar(aError + #0), PChar('Error' + #0), MB_ICONERROR or MB_OK)
|
|
|
|
|
else
|
|
|
|
|
ShowX11Message(aError);
|
|
|
|
|
{$ELSE}
|
|
|
|
|
// TO-DO: Find a way to show message boxes in FMXLinux
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
{$IFDEF MACOSX}
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
// TO-DO: Find a way to show message boxes in Lazarus/FPC for MacOS
|
|
|
|
|
{$ELSE}
|
2021-05-27 14:29:30 +02:00
|
|
|
|
ShowMessageCF('Error', aError, 10);
|
2020-12-28 18:11:27 +01:00
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
2020-05-26 16:57:37 +02:00
|
|
|
|
|
|
|
|
|
if FMissingBinariesException then
|
|
|
|
|
raise Exception.Create(aError);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.ParseProcessType : TCefProcessType;
|
|
|
|
|
var
|
2021-05-16 19:42:25 +02:00
|
|
|
|
TempValue : ustring;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if GetCommandLineSwitchValue('type', TempValue) then
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if (CompareText(TempValue, 'renderer') = 0) then
|
|
|
|
|
Result := ptRenderer
|
|
|
|
|
else
|
|
|
|
|
if (CompareText(TempValue, 'zygote') = 0) then
|
|
|
|
|
Result := ptZygote
|
|
|
|
|
else
|
|
|
|
|
if (CompareText(TempValue, 'gpu-process') = 0) then
|
|
|
|
|
Result := ptGPU
|
2019-11-08 23:15:53 +01:00
|
|
|
|
else
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if (CompareText(TempValue, 'utility') = 0) then
|
|
|
|
|
Result := ptUtility
|
2019-11-08 23:15:53 +01:00
|
|
|
|
else
|
2021-05-16 19:42:25 +02:00
|
|
|
|
if (CompareText(TempValue, 'broker') = 0) then
|
|
|
|
|
Result := ptBroker
|
2019-11-08 23:15:53 +01:00
|
|
|
|
else
|
2021-12-11 11:43:58 +01:00
|
|
|
|
if (CompareText(TempValue, 'crashpad-handler') = 0) then
|
|
|
|
|
Result := ptCrashpad
|
|
|
|
|
else
|
|
|
|
|
Result := ptOther;
|
2021-05-16 19:42:25 +02:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
Result := ptBrowser;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnContextInitialized;
|
|
|
|
|
begin
|
|
|
|
|
FGlobalContextInitialized := True;
|
|
|
|
|
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnContextInitialized) then
|
|
|
|
|
FOnContextInitialized();
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnBeforeChildProcessLaunch) then
|
|
|
|
|
FOnBeforeChildProcessLaunch(commandLine);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnScheduleMessagePumpWork(const delayMs: Int64);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnScheduleMessagePumpWork) then
|
|
|
|
|
FOnScheduleMessagePumpWork(delayMs);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-02-08 10:28:36 +01:00
|
|
|
|
function TCefApplicationCore.Internal_GetLocalizedString(stringid: Integer; var stringVal: ustring) : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
// The stringId must be one of the values defined in the CEF file :
|
|
|
|
|
// /include/cef_pack_strings.h
|
|
|
|
|
// That file is available in the CEF binaries package.
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnGetLocalizedString) then
|
|
|
|
|
FOnGetLocalizedString(stringId, stringVal, Result);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Internal_GetDataResource(resourceId: Integer; var data: Pointer; var dataSize: NativeUInt) : boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
// The resourceId must be one of the values defined in the CEF file :
|
|
|
|
|
// /include/cef_pack_resources.h
|
|
|
|
|
// That file is available in the CEF binaries package.
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnGetDataResource) then
|
|
|
|
|
FOnGetDataResource(resourceId, data, dataSize, Result);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Internal_GetDataResourceForScale(resourceId: Integer; scaleFactor: TCefScaleFactor; var data: Pointer; var dataSize: NativeUInt) : boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
// The resourceId must be one of the values defined in the CEF file :
|
|
|
|
|
// /include/cef_pack_resources.h
|
|
|
|
|
// That file is available in the CEF binaries package.
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnGetDataResourceForScale) then
|
|
|
|
|
FOnGetDataResourceForScale(resourceId, scaleFactor, data, dataSize, Result);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnWebKitInitialized;
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnWebKitInitialized) then
|
|
|
|
|
FOnWebKitInitialized();
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnBrowserCreated(const browser: ICefBrowser; const extra_info: ICefDictionaryValue);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnBrowserCreated) then
|
|
|
|
|
FOnBrowserCreated(browser, extra_info);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnBrowserDestroyed(const browser: ICefBrowser);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnBrowserDestroyed) then
|
|
|
|
|
FOnBrowserDestroyed(browser);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnContextCreated) then
|
|
|
|
|
FOnContextCreated(browser, frame, context);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnContextReleased(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnContextReleased) then
|
|
|
|
|
FOnContextReleased(browser, frame, context);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnUncaughtException) then
|
|
|
|
|
FOnUncaughtException(browser, frame, context, exception, stackTrace);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnFocusedNodeChanged) then
|
|
|
|
|
FOnFocusedNodeChanged(browser, frame, node);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage; var aHandled : boolean);
|
|
|
|
|
begin
|
|
|
|
|
if assigned(FOnProcessMessageReceived) then
|
|
|
|
|
FOnProcessMessageReceived(browser, frame, sourceProcess, aMessage, aHandled)
|
|
|
|
|
else
|
|
|
|
|
aHandled := False;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnLoadingStateChange) then
|
|
|
|
|
FOnLoadingStateChange(browser, isLoading, canGoBack, canGoForward);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnLoadStart) then
|
|
|
|
|
FOnLoadStart(browser, frame, transitionType);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnLoadEnd) then
|
|
|
|
|
FOnLoadEnd(browser, frame, httpStatusCode);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.Internal_OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnLoadError) then
|
|
|
|
|
FOnLoadError(browser, frame, errorCode, errorText, failedUrl);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2020-11-19 18:55:17 +01:00
|
|
|
|
procedure TCefApplicationCore.Internal_GetDefaultClient(var aClient : ICefClient);
|
|
|
|
|
begin
|
|
|
|
|
if assigned(FOnGetDefaultClient) then
|
|
|
|
|
FOnGetDefaultClient(aClient);
|
|
|
|
|
end;
|
|
|
|
|
|
2021-02-08 10:28:36 +01:00
|
|
|
|
procedure TCefApplicationCore.AppendSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
|
2020-07-30 10:45:12 +02:00
|
|
|
|
var
|
2021-01-21 19:32:43 +01:00
|
|
|
|
TempKey, TempHyphenatedKey : ustring;
|
2020-07-30 10:45:12 +02:00
|
|
|
|
i : integer;
|
|
|
|
|
begin
|
|
|
|
|
if (copy(aNewKey, 1, 2) = '--') then
|
2021-01-21 19:32:43 +01:00
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedKey := aNewKey;
|
|
|
|
|
TempKey := copy(aNewKey, 3, length(aNewKey));
|
|
|
|
|
end
|
2020-07-30 10:45:12 +02:00
|
|
|
|
else
|
2021-01-21 19:32:43 +01:00
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedKey := '--' + aNewKey;
|
|
|
|
|
TempKey := aNewKey;
|
|
|
|
|
end;
|
2020-07-30 10:45:12 +02:00
|
|
|
|
|
|
|
|
|
i := aKeys.IndexOf(TempKey);
|
|
|
|
|
|
|
|
|
|
if (i < 0) then
|
|
|
|
|
begin
|
2021-01-21 19:32:43 +01:00
|
|
|
|
i := aKeys.IndexOf(TempHyphenatedKey);
|
|
|
|
|
|
|
|
|
|
if (i < 0) then
|
|
|
|
|
begin
|
|
|
|
|
aKeys.Add(aNewKey);
|
|
|
|
|
aValues.Add(aNewValue);
|
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if (length(aNewValue) > 0) then
|
|
|
|
|
begin
|
|
|
|
|
if (length(aValues[i]) > 0) then
|
|
|
|
|
aValues[i] := aValues[i] + ',' + aNewValue
|
|
|
|
|
else
|
|
|
|
|
aValues[i] := aNewValue;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.CleanupFeatures(var aKeys, aValues : TStringList; const aEnableKey, aDisableKey : string);
|
|
|
|
|
var
|
|
|
|
|
i, j, k, n : integer;
|
|
|
|
|
TempEnabledValues, TempDisabledValues : TStringList;
|
|
|
|
|
TempEnableKey, TempHyphenatedEnableKey, TempDisableKey, TempHyphenatedDisableKey : ustring;
|
|
|
|
|
begin
|
|
|
|
|
if (copy(aEnableKey, 1, 2) = '--') then
|
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedEnableKey := aEnableKey;
|
|
|
|
|
TempEnableKey := copy(aEnableKey, 3, length(aEnableKey));
|
2020-07-30 10:45:12 +02:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-01-21 19:32:43 +01:00
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedEnableKey := '--' + aEnableKey;
|
|
|
|
|
TempEnableKey := aEnableKey;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if (copy(aDisableKey, 1, 2) = '--') then
|
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedDisableKey := aDisableKey;
|
|
|
|
|
TempDisableKey := copy(aDisableKey, 3, length(aDisableKey));
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedDisableKey := '--' + aDisableKey;
|
|
|
|
|
TempDisableKey := aDisableKey;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
i := aKeys.IndexOf(TempEnableKey);
|
|
|
|
|
if (i < 0) then i := aKeys.IndexOf(TempHyphenatedEnableKey);
|
|
|
|
|
|
|
|
|
|
j := aKeys.IndexOf(TempDisableKey);
|
|
|
|
|
if (j < 0) then j := aKeys.IndexOf(TempHyphenatedDisableKey);
|
|
|
|
|
|
|
|
|
|
if (i < 0) or (j < 0) then exit;
|
|
|
|
|
|
|
|
|
|
TempEnabledValues := TStringList.Create;
|
|
|
|
|
TempDisabledValues := TStringList.Create;
|
|
|
|
|
TempEnabledValues.CommaText := aValues[i];
|
|
|
|
|
TempDisabledValues.CommaText := aValues[j];
|
|
|
|
|
|
|
|
|
|
k := 0;
|
|
|
|
|
while (k < TempDisabledValues.Count) do
|
|
|
|
|
begin
|
|
|
|
|
if (length(TempDisabledValues[k]) > 0) then
|
|
|
|
|
begin
|
|
|
|
|
n := TempEnabledValues.IndexOf(TempDisabledValues[k]);
|
|
|
|
|
if (n >= 0) then TempEnabledValues.Delete(n);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
inc(k);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if (TempEnabledValues.Count > 0) then
|
|
|
|
|
aValues[i] := TempEnabledValues.CommaText
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
aKeys.Delete(i);
|
|
|
|
|
aValues.Delete(i);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
FreeAndNil(TempEnabledValues);
|
|
|
|
|
FreeAndNil(TempDisabledValues);
|
2020-07-30 10:45:12 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2021-02-08 10:28:36 +01:00
|
|
|
|
procedure TCefApplicationCore.ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
|
2020-07-30 10:45:12 +02:00
|
|
|
|
var
|
2021-01-21 19:32:43 +01:00
|
|
|
|
TempKey, TempHyphenatedKey : ustring;
|
2020-07-30 10:45:12 +02:00
|
|
|
|
i : integer;
|
|
|
|
|
begin
|
|
|
|
|
if (copy(aNewKey, 1, 2) = '--') then
|
2021-01-21 19:32:43 +01:00
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedKey := aNewKey;
|
|
|
|
|
TempKey := copy(aNewKey, 3, length(aNewKey));
|
|
|
|
|
end
|
2020-07-30 10:45:12 +02:00
|
|
|
|
else
|
2021-01-21 19:32:43 +01:00
|
|
|
|
begin
|
|
|
|
|
TempHyphenatedKey := '--' + aNewKey;
|
|
|
|
|
TempKey := aNewKey;
|
|
|
|
|
end;
|
2020-07-30 10:45:12 +02:00
|
|
|
|
|
|
|
|
|
i := aKeys.IndexOf(TempKey);
|
|
|
|
|
|
|
|
|
|
if (i < 0) then
|
|
|
|
|
begin
|
2021-01-21 19:32:43 +01:00
|
|
|
|
i := aKeys.IndexOf(TempHyphenatedKey);
|
|
|
|
|
|
|
|
|
|
if (i < 0) then
|
|
|
|
|
begin
|
|
|
|
|
aKeys.Add(aNewKey);
|
|
|
|
|
aValues.Add(aNewValue);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
aValues[i] := aNewValue;
|
2020-07-30 10:45:12 +02:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
aValues[i] := aNewValue;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCefApplicationCore.AddCustomCommandLineSwitches(var aKeys, aValues : TStringList);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
var
|
|
|
|
|
i : integer;
|
2020-12-20 12:28:56 +01:00
|
|
|
|
TempFormatSettings : TFormatSettings;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
2022-08-06 12:00:28 +02:00
|
|
|
|
if FEnableMediaStream then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--enable-media-stream');
|
2021-01-24 15:28:38 +01:00
|
|
|
|
|
|
|
|
|
if FEnableSpeechInput then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--enable-speech-input');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FUseFakeUIForMediaStream then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--use-fake-ui-for-media-stream');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-10-08 16:41:27 +02:00
|
|
|
|
if FEnableUsermediaScreenCapturing then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--enable-usermedia-screen-capturing');
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if not(FEnableGPU) then
|
|
|
|
|
begin
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-gpu');
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-gpu-compositing');
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FSingleProcess then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--single-process');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
case FSmoothScrolling of
|
|
|
|
|
STATE_ENABLED : ReplaceSwitch(aKeys, aValues, '--enable-smooth-scrolling');
|
|
|
|
|
STATE_DISABLED : ReplaceSwitch(aKeys, aValues, '--disable-smooth-scrolling');
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
case FTouchEvents of
|
|
|
|
|
STATE_ENABLED : ReplaceSwitch(aKeys, aValues, '--touch-events', 'enabled');
|
|
|
|
|
STATE_DISABLED : ReplaceSwitch(aKeys, aValues, '--touch-events', 'disabled');
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableReadingFromCanvas then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-reading-from-canvas');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if not(FHyperlinkAuditing) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--no-pings');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
case FAutoplayPolicy of
|
|
|
|
|
appDocumentUserActivationRequired :
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'document-user-activation-required');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
appNoUserGestureRequired :
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'no-user-gesture-required');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
appUserGestureRequired :
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'user-gesture-required');
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FFastUnload then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--enable-fast-unload');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableGPUCache then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-gpu-shader-disk-cache');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableSafeBrowsing then
|
|
|
|
|
begin
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-client-side-phishing-detection');
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--safebrowsing-disable-auto-update');
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--safebrowsing-disable-download-protection');
|
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FMuteAudio then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--mute-audio');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableWebSecurity then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-web-security');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisablePDFExtension then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-pdf-extension');
|
2019-12-04 11:15:14 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableSiteIsolationTrials then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-site-isolation-trials');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-01-21 15:46:35 +01:00
|
|
|
|
if FDisableChromeLoginPrompt then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-chrome-login-prompt');
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FSitePerProcess then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--site-per-process');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableExtensions then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-extensions');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableBackgroundNetworking then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-background-networking');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FMetricsRecordingOnly then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--metrics-recording-only');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FAllowFileAccessFromFiles then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--allow-file-access-from-files');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FAllowRunningInsecureContent then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--allow-running-insecure-content');
|
2020-02-26 13:28:29 +01:00
|
|
|
|
|
2021-11-25 11:16:38 +01:00
|
|
|
|
if FKioskPrinting then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--kiosk-printing');
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FEnablePrintPreview then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--enable-print-preview');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableNewBrowserInfoTimeout then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-new-browser-info-timeout');
|
2020-06-21 21:27:55 +02:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (length(FDevToolsProtocolLogFile) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--devtools-protocol-log-file', FDevToolsProtocolLogFile);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (length(FDefaultEncoding) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--default-encoding', FDefaultEncoding);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableJavascript then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-javascript');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableJavascriptCloseWindows then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-javascript-close-windows');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableJavascriptAccessClipboard then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-javascript-access-clipboard');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableJavascriptDomPaste then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-javascript-dom-paste');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FAllowUniversalAccessFromFileUrls then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--allow-universal-access-from-files');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableImageLoading then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-image-loading');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FImageShrinkStandaloneToFit then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--image-shrink-standalone-to-fit');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableTextAreaResize then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-text-area-resize');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableTabToLinks then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-tab-to-links');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FEnableProfanityFilter then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--enable-profanity-filter');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if FDisableSpellChecking then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-spell-checking');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (length(FOverrideSpellCheckLang) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--override-spell-check-lang', FOverrideSpellCheckLang);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-12-21 19:44:10 +01:00
|
|
|
|
if FIgnoreCertificateErrors then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--ignore-certificate-errors');
|
|
|
|
|
|
2020-12-20 12:28:56 +01:00
|
|
|
|
if (FForcedDeviceScaleFactor <> 0) then
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
TempFormatSettings.DecimalSeparator := '.';
|
|
|
|
|
{$ELSE}
|
2021-03-08 14:24:26 +01:00
|
|
|
|
{$IFDEF DELPHI24_UP}
|
2020-12-20 12:28:56 +01:00
|
|
|
|
TempFormatSettings := TFormatSettings.Create('en-US');
|
|
|
|
|
{$ELSE}
|
|
|
|
|
GetLocaleFormatSettings(GetThreadLocale, TempFormatSettings);
|
|
|
|
|
TempFormatSettings.DecimalSeparator := '.';
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--force-device-scale-factor', FloatToStr(FForcedDeviceScaleFactor, TempFormatSettings));
|
|
|
|
|
end;
|
|
|
|
|
|
2021-01-01 17:51:09 +01:00
|
|
|
|
if FDisableZygote then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--no-zygote');
|
|
|
|
|
|
2021-02-16 22:04:16 +01:00
|
|
|
|
if FUseMockKeyChain then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--use-mock-keychain');
|
2021-06-12 11:19:56 +02:00
|
|
|
|
|
|
|
|
|
if FDisableRequestHandlingForTesting then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-request-handling-for-testing');
|
2021-07-31 17:24:54 +02:00
|
|
|
|
|
|
|
|
|
if FDisablePopupBlocking then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-popup-blocking');
|
|
|
|
|
|
|
|
|
|
if FDisableBackForwardCache then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-back-forward-cache');
|
2021-02-16 22:04:16 +01:00
|
|
|
|
|
2021-09-05 10:49:20 +02:00
|
|
|
|
if FDisableComponentUpdate then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--disable-component-update');
|
|
|
|
|
|
2021-11-25 11:16:38 +01:00
|
|
|
|
if FAllowInsecureLocalhost then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--allow-insecure-localhost');
|
|
|
|
|
|
2022-06-30 09:03:56 +02:00
|
|
|
|
if (length(FTreatInsecureOriginAsSecure) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--unsafely-treat-insecure-origin-as-secure', FTreatInsecureOriginAsSecure);
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
// The list of features you can enable is here :
|
|
|
|
|
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
|
2022-01-29 14:18:55 +01:00
|
|
|
|
// https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_features.cc
|
2022-02-14 21:57:27 +01:00
|
|
|
|
// https://source.chromium.org/search?q=base::Feature
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (length(FEnableFeatures) > 0) then
|
|
|
|
|
AppendSwitch(aKeys, aValues, '--enable-features', FEnableFeatures);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
// The list of features you can disable is here :
|
|
|
|
|
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
|
2022-01-29 14:18:55 +01:00
|
|
|
|
// https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_features.cc
|
2022-02-14 21:57:27 +01:00
|
|
|
|
// https://source.chromium.org/search?q=base::Feature
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (length(FDisableFeatures) > 0) then
|
|
|
|
|
AppendSwitch(aKeys, aValues, '--disable-features', FDisableFeatures);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-01-21 19:32:43 +01:00
|
|
|
|
CleanupFeatures(aKeys, aValues, '--enable-features', '--disable-features');
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
// 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
|
|
|
|
|
if (length(FEnableBlinkFeatures) > 0) then
|
|
|
|
|
AppendSwitch(aKeys, aValues, '--enable-blink-features', FEnableBlinkFeatures);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
// 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
|
|
|
|
|
if (length(FDisableBlinkFeatures) > 0) then
|
|
|
|
|
AppendSwitch(aKeys, aValues, '--disable-blink-features', FDisableBlinkFeatures);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-01-21 19:32:43 +01:00
|
|
|
|
CleanupFeatures(aKeys, aValues, '--enable-blink-features', '--disable-blink-features');
|
|
|
|
|
|
2020-10-25 18:59:09 +01:00
|
|
|
|
// The list of Blink settings you can modify is here :
|
|
|
|
|
// https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/settings.json5
|
|
|
|
|
if (length(FBlinkSettings) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--blink-settings', FBlinkSettings);
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
// https://source.chromium.org/chromium/chromium/src/+/master:base/base_switches.cc
|
|
|
|
|
if (length(FForceFieldTrials) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--force-fieldtrials', FForceFieldTrials);
|
2020-03-10 11:59:58 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
// https://source.chromium.org/chromium/chromium/src/+/master:components/variations/variations_switches.cc
|
|
|
|
|
if (length(FForceFieldTrialParams) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, '--force-fieldtrial-params', FForceFieldTrialParams);
|
2020-03-10 11:59:58 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (FCustomCommandLines <> nil) and
|
|
|
|
|
(FCustomCommandLineValues <> nil) and
|
|
|
|
|
(FCustomCommandLines.Count = FCustomCommandLineValues.Count) then
|
|
|
|
|
begin
|
|
|
|
|
i := 0;
|
|
|
|
|
while (i < FCustomCommandLines.Count) do
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
2020-07-30 10:45:12 +02:00
|
|
|
|
if (length(FCustomCommandLines[i]) > 0) then
|
|
|
|
|
ReplaceSwitch(aKeys, aValues, FCustomCommandLines[i], FCustomCommandLineValues[i]);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
inc(i);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2020-07-30 10:45:12 +02:00
|
|
|
|
procedure TCefApplicationCore.Internal_OnBeforeCommandLineProcessing(const processType : ustring;
|
|
|
|
|
const commandLine : ICefCommandLine);
|
|
|
|
|
var
|
|
|
|
|
i : integer;
|
|
|
|
|
TempKeys, TempValues : TStringList;
|
|
|
|
|
begin
|
|
|
|
|
TempKeys := nil;
|
|
|
|
|
TempValues := nil;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
if (commandLine <> nil) and
|
|
|
|
|
commandLine.IsValid and
|
|
|
|
|
(FProcessType = ptBrowser) and
|
|
|
|
|
(processType = '') then
|
|
|
|
|
begin
|
|
|
|
|
TempKeys := TStringList.Create;
|
|
|
|
|
TempValues := TStringList.Create;
|
|
|
|
|
commandLine.GetSwitches(TempKeys, TempValues);
|
|
|
|
|
|
|
|
|
|
AddCustomCommandLineSwitches(TempKeys, TempValues);
|
|
|
|
|
|
|
|
|
|
commandLine.Reset;
|
|
|
|
|
|
|
|
|
|
i := 0;
|
|
|
|
|
while (i < TempKeys.Count) do
|
|
|
|
|
begin
|
|
|
|
|
if (length(TempKeys[i]) > 0) then
|
|
|
|
|
begin
|
|
|
|
|
if (length(TempValues[i]) > 0) then
|
|
|
|
|
commandLine.AppendSwitchWithValue(TempKeys[i], TempValues[i])
|
|
|
|
|
else
|
|
|
|
|
commandLine.AppendSwitch(TempKeys[i]);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
inc(i);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
finally
|
|
|
|
|
if (TempKeys <> nil) then FreeAndNil(TempKeys);
|
|
|
|
|
if (TempValues <> nil) then FreeAndNil(TempValues);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
procedure TCefApplicationCore.Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
|
|
|
|
|
begin
|
2020-07-02 10:50:52 +02:00
|
|
|
|
if assigned(FOnRegisterCustomSchemes) then
|
|
|
|
|
FOnRegisterCustomSchemes(registrar);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetMustCreateResourceBundleHandler : boolean;
|
|
|
|
|
begin
|
2021-02-04 16:59:08 +01:00
|
|
|
|
Result := ((FSingleProcess or (FProcessType in [ptBrowser, ptRenderer, ptZygote])) and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
(FMustCreateResourceBundleHandler or
|
|
|
|
|
assigned(FOnGetLocalizedString) or
|
|
|
|
|
assigned(FOnGetDataResource) or
|
|
|
|
|
assigned(FOnGetDataResourceForScale)));
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetMustCreateBrowserProcessHandler : boolean;
|
|
|
|
|
begin
|
2020-11-10 15:02:49 +01:00
|
|
|
|
Result := ((FSingleProcess or (FProcessType = ptBrowser)) and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
(FMustCreateBrowserProcessHandler or
|
|
|
|
|
assigned(FOnContextInitialized) or
|
|
|
|
|
assigned(FOnBeforeChildProcessLaunch) or
|
2020-11-19 18:55:17 +01:00
|
|
|
|
assigned(FOnScheduleMessagePumpWork)) or
|
|
|
|
|
assigned(FOnGetDefaultClient));
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetMustCreateRenderProcessHandler : boolean;
|
|
|
|
|
begin
|
2021-02-04 16:59:08 +01:00
|
|
|
|
Result := ((FSingleProcess or (FProcessType in [ptRenderer, ptZygote])) and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
(FMustCreateRenderProcessHandler or
|
|
|
|
|
MustCreateLoadHandler or
|
|
|
|
|
assigned(FOnWebKitInitialized) or
|
|
|
|
|
assigned(FOnBrowserCreated) or
|
|
|
|
|
assigned(FOnBrowserDestroyed) or
|
|
|
|
|
assigned(FOnContextCreated) or
|
|
|
|
|
assigned(FOnContextReleased) or
|
|
|
|
|
assigned(FOnUncaughtException) or
|
|
|
|
|
assigned(FOnFocusedNodeChanged) or
|
|
|
|
|
assigned(FOnProcessMessageReceived)));
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetMustCreateLoadHandler : boolean;
|
|
|
|
|
begin
|
2021-02-04 16:59:08 +01:00
|
|
|
|
Result := ((FSingleProcess or (FProcessType in [ptRenderer, ptZygote])) and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
(FMustCreateLoadHandler or
|
|
|
|
|
assigned(FOnLoadingStateChange) or
|
|
|
|
|
assigned(FOnLoadStart) or
|
|
|
|
|
assigned(FOnLoadEnd) or
|
|
|
|
|
assigned(FOnLoadError)));
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetGlobalContextInitialized : boolean;
|
|
|
|
|
begin
|
|
|
|
|
Result := FGlobalContextInitialized or not(MustCreateBrowserProcessHandler);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetChildProcessesCount : integer;
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
var
|
|
|
|
|
TempHandle : THandle;
|
|
|
|
|
TempProcess : TProcessEntry32;
|
|
|
|
|
TempPID : DWORD;
|
|
|
|
|
TempMain, TempSubProc, TempName : string;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
begin
|
|
|
|
|
Result := 0;
|
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
TempHandle := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
|
|
|
|
|
if (TempHandle = INVALID_HANDLE_VALUE) then exit;
|
|
|
|
|
|
|
|
|
|
ZeroMemory(@TempProcess, SizeOf(TProcessEntry32));
|
|
|
|
|
TempProcess.dwSize := Sizeof(TProcessEntry32);
|
|
|
|
|
TempPID := GetCurrentProcessID;
|
|
|
|
|
TempMain := ExtractFileName(paramstr(0));
|
|
|
|
|
TempSubProc := ExtractFileName(FBrowserSubprocessPath);
|
|
|
|
|
|
|
|
|
|
Process32First(TempHandle, TempProcess);
|
|
|
|
|
|
|
|
|
|
repeat
|
|
|
|
|
if (TempProcess.th32ProcessID <> TempPID) and
|
|
|
|
|
(TempProcess.th32ParentProcessID = TempPID) then
|
|
|
|
|
begin
|
|
|
|
|
TempName := TempProcess.szExeFile;
|
|
|
|
|
TempName := ExtractFileName(TempName);
|
|
|
|
|
|
|
|
|
|
if (CompareText(TempName, TempMain) = 0) or
|
|
|
|
|
((length(TempSubProc) > 0) and (CompareText(TempName, TempSubProc) = 0)) then
|
|
|
|
|
inc(Result);
|
|
|
|
|
end;
|
|
|
|
|
until not(Process32Next(TempHandle, TempProcess));
|
|
|
|
|
|
|
|
|
|
CloseHandle(TempHandle);
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
2020-03-29 17:31:42 +02:00
|
|
|
|
function TCefApplicationCore.GetUsedMemory : uint64;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
var
|
|
|
|
|
TempHandle : THandle;
|
|
|
|
|
TempProcess : TProcessEntry32;
|
|
|
|
|
TempPID : DWORD;
|
|
|
|
|
TempProcHWND : HWND;
|
|
|
|
|
TempMemCtrs : TProcessMemoryCounters;
|
|
|
|
|
TempMain, TempSubProc, TempName : string;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
begin
|
|
|
|
|
Result := 0;
|
2021-01-05 11:44:41 +01:00
|
|
|
|
{$IFDEF MSWINDOWS}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
TempHandle := CreateToolHelp32SnapShot(TH32CS_SNAPPROCESS, 0);
|
|
|
|
|
if (TempHandle = INVALID_HANDLE_VALUE) then exit;
|
|
|
|
|
|
|
|
|
|
ZeroMemory(@TempProcess, SizeOf(TProcessEntry32));
|
|
|
|
|
TempProcess.dwSize := Sizeof(TProcessEntry32);
|
|
|
|
|
TempPID := GetCurrentProcessID;
|
|
|
|
|
TempMain := ExtractFileName(paramstr(0));
|
|
|
|
|
TempSubProc := ExtractFileName(FBrowserSubprocessPath);
|
|
|
|
|
|
|
|
|
|
Process32First(TempHandle, TempProcess);
|
|
|
|
|
|
|
|
|
|
repeat
|
|
|
|
|
if (TempProcess.th32ProcessID = TempPID) or
|
|
|
|
|
(TempProcess.th32ParentProcessID = TempPID) then
|
|
|
|
|
begin
|
|
|
|
|
TempName := TempProcess.szExeFile;
|
|
|
|
|
TempName := ExtractFileName(TempName);
|
|
|
|
|
|
|
|
|
|
if (CompareText(TempName, TempMain) = 0) or
|
|
|
|
|
((length(TempSubProc) > 0) and (CompareText(TempName, TempSubProc) = 0)) then
|
|
|
|
|
begin
|
|
|
|
|
TempProcHWND := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, TempProcess.th32ProcessID);
|
|
|
|
|
|
|
|
|
|
if (TempProcHWND <> 0) then
|
2022-02-14 21:57:27 +01:00
|
|
|
|
try
|
2019-11-08 23:15:53 +01:00
|
|
|
|
ZeroMemory(@TempMemCtrs, SizeOf(TProcessMemoryCounters));
|
|
|
|
|
TempMemCtrs.cb := SizeOf(TProcessMemoryCounters);
|
|
|
|
|
|
2021-01-05 11:44:41 +01:00
|
|
|
|
if GetProcessMemoryInfo(TempProcHWND, {$IFNDEF FPC}@{$ENDIF}TempMemCtrs, TempMemCtrs.cb) then
|
|
|
|
|
inc(Result, TempMemCtrs.WorkingSetSize);
|
2022-02-14 21:57:27 +01:00
|
|
|
|
finally
|
2019-11-08 23:15:53 +01:00
|
|
|
|
CloseHandle(TempProcHWND);
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
until not(Process32Next(TempHandle, TempProcess));
|
|
|
|
|
|
|
|
|
|
CloseHandle(TempHandle);
|
2021-01-05 11:44:41 +01:00
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetTotalSystemMemory : uint64;
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
var
|
|
|
|
|
TempMemStatus : TMyMemoryStatusEx;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
begin
|
|
|
|
|
Result := 0;
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
|
|
|
|
|
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
|
2021-10-27 12:18:33 +02:00
|
|
|
|
if GetGlobalMemoryStatusEx(@TempMemStatus) then
|
2021-01-05 11:44:41 +01:00
|
|
|
|
Result := TempMemStatus.ullTotalPhys;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetAvailableSystemMemory : uint64;
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
var
|
|
|
|
|
TempMemStatus : TMyMemoryStatusEx;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
begin
|
|
|
|
|
Result := 0;
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
|
|
|
|
|
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
|
2021-10-27 12:18:33 +02:00
|
|
|
|
if GetGlobalMemoryStatusEx(@TempMemStatus) then
|
2021-01-05 11:44:41 +01:00
|
|
|
|
Result := TempMemStatus.ullAvailPhys;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetSystemMemoryLoad : cardinal;
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
var
|
|
|
|
|
TempMemStatus : TMyMemoryStatusEx;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
begin
|
|
|
|
|
Result := 0;
|
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
ZeroMemory(@TempMemStatus, SizeOf(TMyMemoryStatusEx));
|
|
|
|
|
TempMemStatus.dwLength := SizeOf(TMyMemoryStatusEx);
|
2021-10-27 12:18:33 +02:00
|
|
|
|
if GetGlobalMemoryStatusEx(@TempMemStatus) then
|
|
|
|
|
Result := TempMemStatus.dwMemoryLoad;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
2021-03-06 12:24:28 +01:00
|
|
|
|
function TCefApplicationCore.GetApiHashUniversal : ustring;
|
|
|
|
|
var
|
|
|
|
|
TempHash : PAnsiChar;
|
|
|
|
|
begin
|
|
|
|
|
Result := '';
|
|
|
|
|
if not(FLibLoaded) then exit;
|
|
|
|
|
|
|
|
|
|
TempHash := cef_api_hash(CEF_API_HASH_UNIVERSAL);
|
|
|
|
|
|
|
|
|
|
if (TempHash <> nil) then
|
|
|
|
|
Result := ustring(AnsiString(TempHash));
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetApiHashPlatform : ustring;
|
|
|
|
|
var
|
|
|
|
|
TempHash : PAnsiChar;
|
|
|
|
|
begin
|
|
|
|
|
Result := '';
|
|
|
|
|
if not(FLibLoaded) then exit;
|
|
|
|
|
|
|
|
|
|
TempHash := cef_api_hash(CEF_API_HASH_PLATFORM);
|
|
|
|
|
|
|
|
|
|
if (TempHash <> nil) then
|
|
|
|
|
Result := ustring(AnsiString(TempHash));
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetApiHashCommit : ustring;
|
|
|
|
|
var
|
|
|
|
|
TempHash : PAnsiChar;
|
|
|
|
|
begin
|
|
|
|
|
Result := '';
|
|
|
|
|
if not(FLibLoaded) then exit;
|
|
|
|
|
|
|
|
|
|
TempHash := cef_api_hash(CEF_COMMIT_HASH);
|
|
|
|
|
|
|
|
|
|
if (TempHash <> nil) then
|
|
|
|
|
Result := ustring(AnsiString(TempHash));
|
|
|
|
|
end;
|
|
|
|
|
|
2020-12-30 19:40:07 +01:00
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
function TCefApplicationCore.GetXDisplay : PXDisplay;
|
|
|
|
|
begin
|
|
|
|
|
// This property can only be called in the CEF UI thread.
|
|
|
|
|
if FLibLoaded then
|
|
|
|
|
Result := cef_get_xdisplay{$IFDEF FPC}(){$ENDIF}
|
|
|
|
|
else
|
|
|
|
|
Result := nil;
|
|
|
|
|
end;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.GetArgc : longint;
|
|
|
|
|
begin
|
|
|
|
|
if (FArgCopy <> nil) then
|
|
|
|
|
Result := FArgCopy.argc
|
|
|
|
|
else
|
|
|
|
|
Result := 0;
|
|
|
|
|
end;
|
|
|
|
|
|
2022-03-26 20:05:29 +01:00
|
|
|
|
function TCefApplicationCore.GetArgv : PPAnsiChar;
|
2022-02-14 21:57:27 +01:00
|
|
|
|
begin
|
|
|
|
|
if (FArgCopy <> nil) then
|
|
|
|
|
Result := FArgCopy.argv
|
|
|
|
|
else
|
|
|
|
|
Result := nil;
|
|
|
|
|
end;
|
2020-12-30 19:40:07 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function TCefApplicationCore.LoadCEFlibrary : boolean;
|
|
|
|
|
var
|
2021-03-25 13:00:37 +01:00
|
|
|
|
TempOldDir : string;
|
2020-06-13 17:24:22 +02:00
|
|
|
|
{$IFDEF MSWINDOWS}
|
|
|
|
|
TempError : DWORD;
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
|
|
|
|
|
if (FStatus <> asLoading) or FLibLoaded or (FLibHandle <> 0) then
|
|
|
|
|
begin
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FStatus := asErrorLoadingLibrary;
|
|
|
|
|
FLastErrorMessage := 'GlobalCEFApp can only be initialized once per process.';
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if FSetCurrentDir then
|
|
|
|
|
begin
|
|
|
|
|
TempOldDir := GetCurrentDir;
|
|
|
|
|
chdir(GetModulePath);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
2020-06-13 17:24:22 +02:00
|
|
|
|
FLibHandle := LoadLibraryExW(PWideChar(LibCefPath), 0, LOAD_WITH_ALTERED_SEARCH_PATH);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ELSE}
|
2020-12-18 16:51:02 +01:00
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
FLibHandle := LoadLibrary(LibCefPath);
|
|
|
|
|
{$ELSE}
|
|
|
|
|
FLibHandle := LoadLibrary(PChar(LibCefPath));
|
|
|
|
|
{$ENDIF}
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
|
|
if (FLibHandle = 0) then
|
|
|
|
|
begin
|
|
|
|
|
FStatus := asErrorLoadingLibrary;
|
|
|
|
|
|
|
|
|
|
{$IFDEF MSWINDOWS}
|
2021-03-25 13:00:37 +01:00
|
|
|
|
TempError := GetLastError;
|
|
|
|
|
FLastErrorMessage := 'Error loading ' + LIBCEF_DLL + CRLF + CRLF +
|
|
|
|
|
'Error code : 0x' + inttohex(TempError, 8) + CRLF +
|
|
|
|
|
SysErrorMessage(TempError);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ELSE}
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FLastErrorMessage := 'Error loading ' + LIBCEF_DLL;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
exit;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
2021-03-06 12:24:28 +01:00
|
|
|
|
if Load_cef_api_hash_h and
|
|
|
|
|
Load_cef_app_capi_h and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
Load_cef_browser_capi_h and
|
|
|
|
|
Load_cef_command_line_capi_h and
|
|
|
|
|
Load_cef_cookie_capi_h and
|
|
|
|
|
Load_cef_crash_util_h and
|
|
|
|
|
Load_cef_drag_data_capi_h and
|
|
|
|
|
Load_cef_file_util_capi_h and
|
2021-09-27 12:04:33 +02:00
|
|
|
|
Load_cef_i18n_util_capi_h and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
Load_cef_image_capi_h and
|
|
|
|
|
Load_cef_menu_model_capi_h and
|
2020-03-29 17:31:42 +02:00
|
|
|
|
Load_cef_media_router_capi_h and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
Load_cef_origin_whitelist_capi_h and
|
|
|
|
|
Load_cef_parser_capi_h and
|
|
|
|
|
Load_cef_path_util_capi_h and
|
|
|
|
|
Load_cef_print_settings_capi_h and
|
|
|
|
|
Load_cef_process_message_capi_h and
|
|
|
|
|
Load_cef_process_util_capi_h and
|
|
|
|
|
Load_cef_request_capi_h and
|
|
|
|
|
Load_cef_request_context_capi_h and
|
|
|
|
|
Load_cef_resource_bundle_capi_h and
|
|
|
|
|
Load_cef_response_capi_h and
|
|
|
|
|
Load_cef_scheme_capi_h and
|
2022-08-06 12:00:28 +02:00
|
|
|
|
Load_cef_server_capi_h and
|
|
|
|
|
Load_cef_shared_process_message_builder_capi_h and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
Load_cef_ssl_info_capi_h and
|
|
|
|
|
Load_cef_stream_capi_h and
|
|
|
|
|
Load_cef_task_capi_h and
|
|
|
|
|
Load_cef_thread_capi_h and
|
|
|
|
|
Load_cef_trace_capi_h and
|
|
|
|
|
Load_cef_urlrequest_capi_h and
|
|
|
|
|
Load_cef_v8_capi_h and
|
|
|
|
|
Load_cef_values_capi_h and
|
|
|
|
|
Load_cef_waitable_event_capi_h and
|
|
|
|
|
Load_cef_xml_reader_capi_h and
|
|
|
|
|
Load_cef_zip_reader_capi_h and
|
|
|
|
|
Load_cef_logging_internal_h and
|
|
|
|
|
Load_cef_string_list_h and
|
|
|
|
|
Load_cef_string_map_h and
|
|
|
|
|
Load_cef_string_multimap_h and
|
|
|
|
|
Load_cef_string_types_h and
|
|
|
|
|
Load_cef_thread_internal_h and
|
|
|
|
|
Load_cef_trace_event_internal_h and
|
|
|
|
|
Load_cef_browser_view_capi_h and
|
|
|
|
|
Load_cef_display_capi_h and
|
|
|
|
|
Load_cef_label_button_capi_h and
|
|
|
|
|
Load_cef_menu_button_capi_h and
|
|
|
|
|
Load_cef_panel_capi_h and
|
|
|
|
|
Load_cef_scroll_view_capi_h and
|
|
|
|
|
Load_cef_textfield_capi_h and
|
|
|
|
|
Load_cef_window_capi_h and
|
2022-06-14 11:27:45 +02:00
|
|
|
|
Load_cef_types_linux_h and
|
|
|
|
|
Load_cef_time_h then
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
|
|
|
|
FStatus := asLoaded;
|
|
|
|
|
FLibLoaded := True;
|
|
|
|
|
Result := True;
|
|
|
|
|
|
|
|
|
|
if FLogProcessInfo then CefDebugLog('Process started', CEF_LOG_SEVERITY_INFO);
|
|
|
|
|
if FEnableHighDPISupport then cef_enable_highdpi_support();
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
2021-03-25 13:00:37 +01:00
|
|
|
|
FStatus := asErrorDLLVersion;
|
|
|
|
|
FLastErrorMessage := 'Unsupported CEF version !' +
|
|
|
|
|
CRLF + CRLF +
|
|
|
|
|
'Use only the CEF binaries specified in the CEF4Delphi Readme.md file at ' +
|
|
|
|
|
CRLF + CEF4DELPHI_URL;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2021-03-25 13:00:37 +01:00
|
|
|
|
ShowErrorMessageDlg(FLastErrorMessage);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
if FSetCurrentDir then chdir(TempOldDir);
|
|
|
|
|
end;
|
|
|
|
|
|
2021-03-06 12:24:28 +01:00
|
|
|
|
function TCefApplicationCore.Load_cef_api_hash_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_api_hash{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_api_hash');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_api_hash);
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function TCefApplicationCore.Load_cef_app_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_initialize{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_initialize');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_shutdown{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_shutdown');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_execute_process{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_execute_process');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_do_message_loop_work{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_do_message_loop_work');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_run_message_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_run_message_loop');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_quit_message_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_quit_message_loop');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_set_osmodal_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_set_osmodal_loop');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_enable_highdpi_support{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_enable_highdpi_support');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_initialize) and
|
|
|
|
|
assigned(cef_shutdown) and
|
|
|
|
|
assigned(cef_execute_process) and
|
|
|
|
|
assigned(cef_do_message_loop_work) and
|
|
|
|
|
assigned(cef_run_message_loop) and
|
|
|
|
|
assigned(cef_quit_message_loop) and
|
|
|
|
|
assigned(cef_set_osmodal_loop) and
|
|
|
|
|
assigned(cef_enable_highdpi_support);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_browser_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_browser_host_create_browser{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_browser_host_create_browser');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_browser_host_create_browser_sync{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_browser_host_create_browser_sync');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_browser_host_create_browser) and
|
|
|
|
|
assigned(cef_browser_host_create_browser_sync);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_command_line_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_command_line_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_command_line_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_command_line_get_global{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_command_line_get_global');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_command_line_create) and
|
|
|
|
|
assigned(cef_command_line_get_global);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_cookie_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_cookie_manager_get_global_manager{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_cookie_manager_get_global_manager');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_cookie_manager_get_global_manager);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_crash_util_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_crash_reporting_enabled{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_crash_reporting_enabled');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_set_crash_key_value{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_set_crash_key_value');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_crash_reporting_enabled) and
|
|
|
|
|
assigned(cef_set_crash_key_value);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_drag_data_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_drag_data_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_drag_data_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_drag_data_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_file_util_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_create_directory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_create_directory');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_temp_directory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_temp_directory');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_create_new_temp_directory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_create_new_temp_directory');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_create_temp_directory_in_directory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_create_temp_directory_in_directory');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_directory_exists{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_directory_exists');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_delete_file{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_delete_file');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_zip_directory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_zip_directory');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_load_crlsets_file{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_load_crlsets_file');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_create_directory) and
|
|
|
|
|
assigned(cef_get_temp_directory) and
|
|
|
|
|
assigned(cef_create_new_temp_directory) and
|
|
|
|
|
assigned(cef_create_temp_directory_in_directory) and
|
|
|
|
|
assigned(cef_directory_exists) and
|
|
|
|
|
assigned(cef_delete_file) and
|
|
|
|
|
assigned(cef_zip_directory) and
|
|
|
|
|
assigned(cef_load_crlsets_file);
|
|
|
|
|
end;
|
|
|
|
|
|
2021-09-27 12:04:33 +02:00
|
|
|
|
function TCefApplicationCore.Load_cef_i18n_util_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_is_rtl{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_is_rtl');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_is_rtl);
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function TCefApplicationCore.Load_cef_image_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_image_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_image_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_image_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_menu_model_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_menu_model_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_menu_model_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_menu_model_create);
|
|
|
|
|
end;
|
|
|
|
|
|
2020-03-29 17:31:42 +02:00
|
|
|
|
function TCefApplicationCore.Load_cef_media_router_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_media_router_get_global{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_media_router_get_global');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_media_router_get_global);
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function TCefApplicationCore.Load_cef_origin_whitelist_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_add_cross_origin_whitelist_entry{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_add_cross_origin_whitelist_entry');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_remove_cross_origin_whitelist_entry{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_remove_cross_origin_whitelist_entry');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_clear_cross_origin_whitelist{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_clear_cross_origin_whitelist');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_add_cross_origin_whitelist_entry) and
|
|
|
|
|
assigned(cef_remove_cross_origin_whitelist_entry) and
|
|
|
|
|
assigned(cef_clear_cross_origin_whitelist);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_parser_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_parse_url{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_parse_url');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_create_url{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_create_url');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_format_url_for_security_display{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_format_url_for_security_display');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_mime_type{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_mime_type');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_extensions_for_mime_type{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_extensions_for_mime_type');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_base64encode{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_base64encode');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_base64decode{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_base64decode');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_uriencode{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_uriencode');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_uridecode{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_uridecode');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_parse_json{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_parse_json');
|
2020-06-21 21:27:55 +02:00
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_parse_json_buffer{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_parse_json_buffer');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_parse_jsonand_return_error{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_parse_jsonand_return_error');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_write_json{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_write_json');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_parse_url) and
|
|
|
|
|
assigned(cef_create_url) and
|
|
|
|
|
assigned(cef_format_url_for_security_display) and
|
|
|
|
|
assigned(cef_get_mime_type) and
|
|
|
|
|
assigned(cef_get_extensions_for_mime_type) and
|
|
|
|
|
assigned(cef_base64encode) and
|
|
|
|
|
assigned(cef_base64decode) and
|
|
|
|
|
assigned(cef_uriencode) and
|
|
|
|
|
assigned(cef_uridecode) and
|
|
|
|
|
assigned(cef_parse_json) and
|
2020-06-21 21:27:55 +02:00
|
|
|
|
assigned(cef_parse_json_buffer) and
|
2019-11-08 23:15:53 +01:00
|
|
|
|
assigned(cef_parse_jsonand_return_error) and
|
|
|
|
|
assigned(cef_write_json);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_path_util_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_path{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_path');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_get_path);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_print_settings_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_print_settings_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_print_settings_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_print_settings_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_process_message_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_process_message_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_process_message_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_process_message_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_process_util_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_launch_process{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_launch_process');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_launch_process);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_request_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_request_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_request_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_post_data_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_post_data_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_post_data_element_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_post_data_element_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_request_create) and
|
|
|
|
|
assigned(cef_post_data_create) and
|
|
|
|
|
assigned(cef_post_data_element_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_request_context_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_request_context_get_global_context{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_request_context_get_global_context');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_request_context_create_context{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_request_context_create_context');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_create_context_shared{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_create_context_shared');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_request_context_get_global_context) and
|
|
|
|
|
assigned(cef_request_context_create_context) and
|
|
|
|
|
assigned(cef_create_context_shared);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_resource_bundle_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_resource_bundle_get_global{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_resource_bundle_get_global');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_resource_bundle_get_global);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_response_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_response_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_response_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_response_create);
|
|
|
|
|
end;
|
|
|
|
|
|
2022-08-06 12:00:28 +02:00
|
|
|
|
function TCefApplicationCore.Load_cef_scheme_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_register_scheme_handler_factory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_scheme_handler_factory');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_clear_scheme_handler_factories{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_clear_scheme_handler_factories');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_register_scheme_handler_factory) and
|
|
|
|
|
assigned(cef_clear_scheme_handler_factories);
|
|
|
|
|
end;
|
|
|
|
|
|
2019-11-08 23:15:53 +01:00
|
|
|
|
function TCefApplicationCore.Load_cef_server_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_server_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_server_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_server_create);
|
|
|
|
|
end;
|
|
|
|
|
|
2022-08-06 12:00:28 +02:00
|
|
|
|
function TCefApplicationCore.Load_cef_shared_process_message_builder_capi_h : boolean;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
begin
|
2022-08-06 12:00:28 +02:00
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_shared_process_message_builder_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_shared_process_message_builder_create');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
2022-08-06 12:00:28 +02:00
|
|
|
|
Result := assigned(cef_shared_process_message_builder_create);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_ssl_info_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_is_cert_status_error{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_is_cert_status_error');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_is_cert_status_error);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_stream_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_stream_reader_create_for_file{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_stream_reader_create_for_file');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_stream_reader_create_for_data{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_stream_reader_create_for_data');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_stream_reader_create_for_handler{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_stream_reader_create_for_handler');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_stream_writer_create_for_file{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_stream_writer_create_for_file');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_stream_writer_create_for_handler{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_stream_writer_create_for_handler');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_stream_reader_create_for_file) and
|
|
|
|
|
assigned(cef_stream_reader_create_for_data) and
|
|
|
|
|
assigned(cef_stream_reader_create_for_handler) and
|
|
|
|
|
assigned(cef_stream_writer_create_for_file) and
|
|
|
|
|
assigned(cef_stream_writer_create_for_handler);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_task_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_task_runner_get_for_current_thread{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_task_runner_get_for_current_thread');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_task_runner_get_for_thread{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_task_runner_get_for_thread');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_currently_on{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_currently_on');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_post_task{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_post_task');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_post_delayed_task{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_post_delayed_task');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_task_runner_get_for_current_thread) and
|
|
|
|
|
assigned(cef_task_runner_get_for_thread) and
|
|
|
|
|
assigned(cef_currently_on) and
|
|
|
|
|
assigned(cef_post_task) and
|
|
|
|
|
assigned(cef_post_delayed_task);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_thread_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_thread_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_thread_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_thread_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_trace_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_begin_tracing{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_begin_tracing');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_end_tracing{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_end_tracing');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_now_from_system_trace_time{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_now_from_system_trace_time');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_begin_tracing) and
|
|
|
|
|
assigned(cef_end_tracing) and
|
|
|
|
|
assigned(cef_now_from_system_trace_time);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_urlrequest_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_urlrequest_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_urlrequest_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_urlrequest_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_v8_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8context_get_current_context{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8context_get_current_context');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8context_get_entered_context{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8context_get_entered_context');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8context_in_context{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8context_in_context');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_undefined{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_undefined');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_null{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_null');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_bool{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_bool');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_int{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_int');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_uint{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_uint');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_double{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_double');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_date{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_date');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_string{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_string');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_object{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_object');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_array{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_array');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_array_buffer{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_array_buffer');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_function{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_function');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_v8stack_trace_get_current{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8stack_trace_get_current');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_register_extension{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_extension');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_v8context_get_current_context) and
|
|
|
|
|
assigned(cef_v8context_get_entered_context) and
|
|
|
|
|
assigned(cef_v8context_in_context) and
|
|
|
|
|
assigned(cef_v8value_create_undefined) and
|
|
|
|
|
assigned(cef_v8value_create_null) and
|
|
|
|
|
assigned(cef_v8value_create_bool) and
|
|
|
|
|
assigned(cef_v8value_create_int) and
|
|
|
|
|
assigned(cef_v8value_create_uint) and
|
|
|
|
|
assigned(cef_v8value_create_double) and
|
|
|
|
|
assigned(cef_v8value_create_date) and
|
|
|
|
|
assigned(cef_v8value_create_string) and
|
|
|
|
|
assigned(cef_v8value_create_object) and
|
|
|
|
|
assigned(cef_v8value_create_array) and
|
|
|
|
|
assigned(cef_v8value_create_array_buffer) and
|
|
|
|
|
assigned(cef_v8value_create_function) and
|
|
|
|
|
assigned(cef_v8stack_trace_get_current) and
|
|
|
|
|
assigned(cef_register_extension);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_values_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_value_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_value_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_binary_value_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_binary_value_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_dictionary_value_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_dictionary_value_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_list_value_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_list_value_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_value_create) and
|
|
|
|
|
assigned(cef_binary_value_create) and
|
|
|
|
|
assigned(cef_v8stack_trace_get_current) and
|
|
|
|
|
assigned(cef_list_value_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_waitable_event_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_waitable_event_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_waitable_event_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_waitable_event_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_xml_reader_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_xml_reader_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_xml_reader_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_xml_reader_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_zip_reader_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_zip_reader_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_zip_reader_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_zip_reader_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_logging_internal_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_min_log_level{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_min_log_level');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_vlog_level{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_vlog_level');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_log{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_log');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_get_min_log_level) and
|
|
|
|
|
assigned(cef_get_vlog_level) and
|
|
|
|
|
assigned(cef_log);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_string_list_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_alloc{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_alloc');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_size{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_size');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_value{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_value');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_append{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_append');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_clear{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_clear');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_free{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_free');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_list_copy{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_list_copy');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_string_list_alloc) and
|
|
|
|
|
assigned(cef_string_list_size) and
|
|
|
|
|
assigned(cef_string_list_value) and
|
|
|
|
|
assigned(cef_string_list_append) and
|
|
|
|
|
assigned(cef_string_list_clear) and
|
|
|
|
|
assigned(cef_string_list_free) and
|
|
|
|
|
assigned(cef_string_list_copy);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_string_map_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_alloc{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_alloc');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_size{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_size');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_find{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_find');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_key{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_key');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_value{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_value');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_append{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_append');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_clear{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_clear');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_map_free{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_map_free');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_string_map_alloc) and
|
|
|
|
|
assigned(cef_string_map_size) and
|
|
|
|
|
assigned(cef_string_map_find) and
|
|
|
|
|
assigned(cef_string_map_key) and
|
|
|
|
|
assigned(cef_string_map_value) and
|
|
|
|
|
assigned(cef_string_map_append) and
|
|
|
|
|
assigned(cef_string_map_clear) and
|
|
|
|
|
assigned(cef_string_map_free);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_string_multimap_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_alloc{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_alloc');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_size{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_size');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_find_count{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_find_count');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_enumerate{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_enumerate');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_key{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_key');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_value{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_value');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_append{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_append');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_clear{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_clear');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_multimap_free{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_multimap_free');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_string_multimap_alloc) and
|
|
|
|
|
assigned(cef_string_multimap_size) and
|
|
|
|
|
assigned(cef_string_multimap_find_count) and
|
|
|
|
|
assigned(cef_string_multimap_enumerate) and
|
|
|
|
|
assigned(cef_string_multimap_key) and
|
|
|
|
|
assigned(cef_string_multimap_value) and
|
|
|
|
|
assigned(cef_string_multimap_append) and
|
|
|
|
|
assigned(cef_string_multimap_clear) and
|
|
|
|
|
assigned(cef_string_multimap_free);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_string_types_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_wide_set{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_wide_set');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf8_set{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf8_set');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_set{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_set');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_wide_clear{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_wide_clear');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf8_clear{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf8_clear');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_clear{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_clear');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_wide_cmp{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_wide_cmp');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf8_cmp{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf8_cmp');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_cmp{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_cmp');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_wide_to_utf8{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_wide_to_utf8');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf8_to_wide{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf8_to_wide');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_wide_to_utf16{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_wide_to_utf16');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_to_wide{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_to_wide');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf8_to_utf16{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf8_to_utf16');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_to_utf8{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_to_utf8');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_ascii_to_wide{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_ascii_to_wide');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_ascii_to_utf16{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_ascii_to_utf16');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_userfree_wide_alloc{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_userfree_wide_alloc');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_userfree_utf8_alloc{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_userfree_utf8_alloc');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_userfree_utf16_alloc{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_userfree_utf16_alloc');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_userfree_wide_free{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_userfree_wide_free');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_userfree_utf8_free{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_userfree_utf8_free');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_userfree_utf16_free{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_userfree_utf16_free');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_to_lower{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_to_lower');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_string_utf16_to_upper{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_string_utf16_to_upper');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_string_wide_set) and
|
|
|
|
|
assigned(cef_string_utf8_set) and
|
|
|
|
|
assigned(cef_string_utf16_set) and
|
|
|
|
|
assigned(cef_string_wide_clear) and
|
|
|
|
|
assigned(cef_string_utf8_clear) and
|
|
|
|
|
assigned(cef_string_utf16_clear) and
|
|
|
|
|
assigned(cef_string_wide_cmp) and
|
|
|
|
|
assigned(cef_string_utf8_cmp) and
|
|
|
|
|
assigned(cef_string_utf16_cmp) and
|
|
|
|
|
assigned(cef_string_wide_to_utf8) and
|
|
|
|
|
assigned(cef_string_utf8_to_wide) and
|
|
|
|
|
assigned(cef_string_wide_to_utf16) and
|
|
|
|
|
assigned(cef_string_utf16_to_wide) and
|
|
|
|
|
assigned(cef_string_utf8_to_utf16) and
|
|
|
|
|
assigned(cef_string_utf16_to_utf8) and
|
|
|
|
|
assigned(cef_string_ascii_to_wide) and
|
|
|
|
|
assigned(cef_string_ascii_to_utf16) and
|
|
|
|
|
assigned(cef_string_userfree_wide_alloc) and
|
|
|
|
|
assigned(cef_string_userfree_utf8_alloc) and
|
|
|
|
|
assigned(cef_string_userfree_utf16_alloc) and
|
|
|
|
|
assigned(cef_string_userfree_wide_free) and
|
|
|
|
|
assigned(cef_string_userfree_utf8_free) and
|
|
|
|
|
assigned(cef_string_userfree_utf16_free) and
|
|
|
|
|
assigned(cef_string_utf16_to_lower) and
|
|
|
|
|
assigned(cef_string_utf16_to_upper);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_thread_internal_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_current_platform_thread_id{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_current_platform_thread_id');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_current_platform_thread_handle{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_current_platform_thread_handle');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_get_current_platform_thread_id) and
|
|
|
|
|
assigned(cef_get_current_platform_thread_handle);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_trace_event_internal_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_instant{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_instant');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_begin{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_begin');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_end{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_end');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_counter{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_counter');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_counter_id{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_counter_id');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_async_begin{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_async_begin');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_async_step_into{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_async_step_into');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_async_step_past{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_async_step_past');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_trace_event_async_end{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_trace_event_async_end');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_trace_event_instant) and
|
|
|
|
|
assigned(cef_trace_event_begin) and
|
|
|
|
|
assigned(cef_trace_event_end) and
|
|
|
|
|
assigned(cef_trace_counter) and
|
|
|
|
|
assigned(cef_trace_counter_id) and
|
|
|
|
|
assigned(cef_trace_event_async_begin) and
|
|
|
|
|
assigned(cef_trace_event_async_step_into) and
|
|
|
|
|
assigned(cef_trace_event_async_step_past) and
|
|
|
|
|
assigned(cef_trace_event_async_end);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_browser_view_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_browser_view_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_browser_view_create');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_browser_view_get_for_browser{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_browser_view_get_for_browser');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_browser_view_create) and
|
|
|
|
|
assigned(cef_browser_view_get_for_browser);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_display_capi_h : boolean;
|
|
|
|
|
begin
|
2022-10-14 16:35:50 +02:00
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_get_primary{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_get_primary');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_get_nearest_point{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_get_nearest_point');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_get_matching_bounds{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_get_matching_bounds');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_get_count{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_get_count');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_get_alls{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_get_alls');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_convert_screen_point_to_pixels{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_convert_screen_point_to_pixels');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_display_convert_screen_point_from_pixels{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_convert_screen_point_from_pixels');
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
Result := assigned(cef_display_get_primary) and
|
|
|
|
|
assigned(cef_display_get_nearest_point) and
|
|
|
|
|
assigned(cef_display_get_matching_bounds) and
|
|
|
|
|
assigned(cef_display_get_count) and
|
2022-10-14 16:35:50 +02:00
|
|
|
|
assigned(cef_display_get_alls) and
|
|
|
|
|
assigned(cef_display_convert_screen_point_to_pixels) and
|
|
|
|
|
assigned(cef_display_convert_screen_point_from_pixels);
|
2019-11-08 23:15:53 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_label_button_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_label_button_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_label_button_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_label_button_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_menu_button_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_menu_button_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_menu_button_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_menu_button_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_panel_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_panel_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_panel_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_panel_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_scroll_view_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_scroll_view_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_scroll_view_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_scroll_view_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_textfield_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_textfield_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_textfield_create');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_textfield_create);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_window_capi_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_window_create_top_level{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_window_create_top_level');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_window_create_top_level);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
function TCefApplicationCore.Load_cef_types_linux_h : boolean;
|
|
|
|
|
begin
|
|
|
|
|
{$IFDEF LINUX}
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_get_xdisplay{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_get_xdisplay');
|
|
|
|
|
|
|
|
|
|
Result := assigned(cef_get_xdisplay);
|
|
|
|
|
{$ELSE}
|
|
|
|
|
Result := True;
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
end;
|
|
|
|
|
|
2022-06-14 11:27:45 +02:00
|
|
|
|
function TCefApplicationCore.Load_cef_time_h : boolean;
|
|
|
|
|
begin
|
2022-09-04 19:18:07 +02:00
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_to_timet{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_to_timet');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_from_timet{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_from_timet');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_to_doublet{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_to_doublet');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_from_doublet{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_from_doublet');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_now{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_now');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_delta{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_delta');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_basetime_now{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_basetime_now');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_to_basetime{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_to_basetime');
|
|
|
|
|
{$IFDEF FPC}Pointer({$ENDIF}cef_time_from_basetime{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_time_from_basetime');
|
|
|
|
|
|
2022-06-14 11:27:45 +02:00
|
|
|
|
|
|
|
|
|
Result := assigned(cef_time_to_timet) and
|
|
|
|
|
assigned(cef_time_from_timet) and
|
|
|
|
|
assigned(cef_time_to_doublet) and
|
|
|
|
|
assigned(cef_time_from_doublet) and
|
|
|
|
|
assigned(cef_time_now) and
|
2022-09-04 19:18:07 +02:00
|
|
|
|
assigned(cef_time_delta) and
|
|
|
|
|
assigned(cef_basetime_now) and
|
|
|
|
|
assigned(cef_time_to_basetime) and
|
|
|
|
|
assigned(cef_time_from_basetime);
|
2022-06-14 11:27:45 +02:00
|
|
|
|
end;
|
2019-11-08 23:15:53 +01:00
|
|
|
|
|
|
|
|
|
// TCEFDirectoryDeleterThread
|
|
|
|
|
|
|
|
|
|
constructor TCEFDirectoryDeleterThread.Create(const aDirectory : string);
|
|
|
|
|
begin
|
|
|
|
|
inherited Create(True);
|
|
|
|
|
|
|
|
|
|
FDirectory := aDirectory;
|
|
|
|
|
FreeOnTerminate := True;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCEFDirectoryDeleterThread.Execute;
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{$IFDEF DELPHI14_UP}
|
|
|
|
|
TDirectory.Delete(FDirectory, True);
|
|
|
|
|
{$ELSE}
|
|
|
|
|
if DeleteDirContents(FDirectory) then RemoveDir(FDirectory);
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
except
|
|
|
|
|
on e : exception do
|
|
|
|
|
if CustomExceptionHandler('TCEFDirectoryDeleterThread.Execute', e) then raise;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|