1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Update to CEF 120.1.8

This commit is contained in:
salvadordf
2023-12-15 18:06:46 +01:00
parent 03100e5841
commit fbe8c6c208
138 changed files with 420 additions and 277 deletions

View File

@ -91,6 +91,7 @@ type
FCookieableSchemesList : ustring;
FCookieableSchemesExcludeDefaults : boolean;
FChromePolicyId : ustring;
FChromeAppIconId : integer;
// Fields used to set command line switches
FSingleProcess : boolean;
@ -201,6 +202,7 @@ type
FOnRegisterCustomPreferences : TOnRegisterCustomPreferencesEvent;
FOnContextInitialized : TOnContextInitializedEvent;
FOnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent;
FOnAlreadyRunningAppRelaunch : TOnAlreadyRunningAppRelaunchEvent;
FOnScheduleMessagePumpWork : TOnScheduleMessagePumpWorkEvent;
FOnGetDefaultClient : TOnGetDefaultClientEvent;
@ -326,6 +328,7 @@ type
procedure doOnRegisterCustomPreferences(type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); virtual;
procedure doOnContextInitialized; virtual;
procedure doOnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual;
procedure doOnAlreadyRunningAppRelaunch(const commandLine: ICefCommandLine; const current_directory: ustring; var aResult: boolean); virtual;
procedure doOnScheduleMessagePumpWork(const delayMs: Int64); virtual;
procedure doGetDefaultClient(var aClient : ICefClient); virtual;
@ -531,30 +534,43 @@ type
/// </summary>
property CommandLineArgsDisabled : Boolean read FCommandLineArgsDisabled write FCommandLineArgsDisabled;
/// <summary>
/// The location where data for the global browser cache will be stored on
/// The directory where data for the global browser cache will be stored on
/// disk. If this value is non-empty then it must be an absolute path that is
/// either equal to or a child directory of TCefSettings.root_cache_path. If
/// this value is empty then browsers will be created in "incognito mode"
/// where in-memory caches are used for storage and no data is persisted to
/// disk. HTML5 databases such as localStorage will only persist across
/// sessions if a cache path is specified. Can be overridden for individual
/// CefRequestContext instances via the TCefRequestContextSettings.cache_path
/// value. When using the Chrome runtime the "default" profile will be used if
/// |cache_path| and |root_cache_path| have the same value.
/// where in-memory caches are used for storage and no profile-specific data
/// is persisted to disk (installation-specific data will still be persisted
/// in root_cache_path). HTML5 databases such as localStorage will only
/// persist across sessions if a cache path is specified. Can be overridden
/// for individual ICefRequestContext instances via the
/// ICefRequestContextSettings.cache_path value. When using the Chrome runtime
/// any child directory value will be ignored and the "default" profile (also
/// a child directory) will be used instead.
/// </summary>
property Cache : ustring read FCache write SetCache;
/// <summary>
/// The root directory that all TCefSettings.cache_path and
/// TCefRequestContextSettings.cache_path values must have in common. If this
/// value is empty and TCefSettings.cache_path is non-empty then it will
/// default to the TCefSettings.cache_path value. If both values are empty
/// then the default platform-specific directory will be used
/// <para>The root directory for installation-specific data and the parent directory
/// for profile-specific data. All TCefSettings.cache_path and
/// ICefRequestContextSettings.cache_path values must have this parent
/// directory in common. If this value is empty and TCefSettings.cache_path is
/// non-empty then it will default to the TCefSettings.cache_path value. Any
/// non-empty value must be an absolute path. If both values are empty then
/// the default platform-specific directory will be used
/// ("~/.config/cef_user_data" directory on Linux, "~/Library/Application
/// Support/CEF/User Data" directory on MacOS, "AppData\Local\CEF\User Data"
/// directory under the user profile directory on Windows). If this value is
/// non-empty then it must be an absolute path. Failure to set this value
/// correctly may result in the sandbox blocking read/write access to certain
/// files.
/// directory under the user profile directory on Windows). Use of the default
/// directory is not recommended in production applications (see below).</para>
/// <para>Multiple application instances writing to the same root_cache_path
/// directory could result in data corruption. A process singleton lock based
/// on the root_cache_path value is therefore used to protect against this.
/// This singleton behavior applies to all CEF-based applications using
/// version 120 or newer. You should customize root_cache_path for your
/// application and implement ICefBrowserProcessHandler.OnAlreadyRunningAppRelaunch,
/// which will then be called on any app relaunch
/// with the same root_cache_path value.</para>
/// <para>Failure to set the root_cache_path value correctly may result in startup
/// crashes or other unexpected behaviors (for example, the sandbox blocking
/// read/write access to certain files).</para>
/// </summary>
property RootCache : ustring read FRootCache write SetRootCache;
/// <summary>
@ -720,6 +736,14 @@ type
/// </summary>
property ChromePolicyId : ustring read FChromePolicyId write FChromePolicyId;
/// <summary>
/// Specify an ID for an ICON resource that can be loaded from the main
/// executable and used when creating default Chrome windows such as DevTools
/// and Task Manager. If unspecified the default Chromium ICON (IDR_MAINFRAME
/// [101]) will be loaded from libcef.dll. Only supported with the Chrome
/// runtime on Windows.
/// </summary>
property ChromeAppIconId : integer read FChromeAppIconId write FChromeAppIconId;
/// <summary>
/// Runs the renderer and plugins in the same process as the browser.
/// </summary>
/// <remarks>
@ -1441,6 +1465,26 @@ type
/// </remarks>
property OnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent read FOnBeforeChildProcessLaunch write FOnBeforeChildProcessLaunch;
/// <summary>
/// <para>Implement this function to provide app-specific behavior when an already
/// running app is relaunched with the same TCefSettings.root_cache_path value.
/// For example, activate an existing app window or create a new app window.
/// |command_line| will be read-only. Do not keep a reference to
/// |command_line| outside of this function. Return true (1) if the relaunch
/// is handled or false (0) for default relaunch behavior. Default behavior
/// will create a new default styled Chrome window.</para>
/// <para>To avoid cache corruption only a single app instance is allowed to run for
/// a given TCefSettings.root_cache_path value. On relaunch the app checks a
/// process singleton lock and then forwards the new launch arguments to the
/// already running app process before exiting early. Client apps should
/// therefore check the cef_initialize() return value for early exit before
/// proceeding.</para>
/// <para>This function will be called on the browser process UI thread.</para>
/// </summary>
/// <remarks>
/// <para><see href="https://bitbucket.org/chromiumembedded/cef/src/master/include/capi/cef_browser_process_handler_capi.h">CEF source file: /include/capi/cef_browser_process_handler_capi.h (cef_browser_process_handler_t)</see></para>
/// </remarks>
property OnAlreadyRunningAppRelaunch : TOnAlreadyRunningAppRelaunchEvent read FOnAlreadyRunningAppRelaunch write FOnAlreadyRunningAppRelaunch;
/// <summary>
/// Called from any thread when work has been scheduled for the browser
/// process main (UI) thread. This callback is used in combination with
/// TCefSettings.external_message_pump and GlobalCEFApp.DoMessageLoopWork in
@ -1755,6 +1799,7 @@ begin
FCookieableSchemesList := '';
FCookieableSchemesExcludeDefaults := False;
FChromePolicyId := '';
FChromeAppIconId := 0;
// Fields used to set command line switches
FSingleProcess := False;
@ -1882,6 +1927,7 @@ begin
FOnRegisterCustomPreferences := nil;
FOnContextInitialized := nil;
FOnBeforeChildProcessLaunch := nil;
FOnAlreadyRunningAppRelaunch := nil;
FOnScheduleMessagePumpWork := nil;
FOnGetDefaultClient := nil;
@ -2011,6 +2057,12 @@ begin
FOnBeforeChildProcessLaunch(commandLine);
end;
procedure TCefApplicationCore.doOnAlreadyRunningAppRelaunch(const commandLine: ICefCommandLine; const current_directory: ustring; var aResult: boolean);
begin
if assigned(FOnAlreadyRunningAppRelaunch) then
FOnAlreadyRunningAppRelaunch(commandLine, current_directory, aResult);
end;
procedure TCefApplicationCore.doOnScheduleMessagePumpWork(const delayMs: Int64);
begin
if assigned(FOnScheduleMessagePumpWork) then
@ -2721,6 +2773,7 @@ begin
aSettings.cookieable_schemes_list := CefString(FCookieableSchemesList);
aSettings.cookieable_schemes_exclude_defaults := Ord(FCookieableSchemesExcludeDefaults);
aSettings.chrome_policy_id := CefString(FChromePolicyId);
aSettings.chrome_app_icon_id := FChromeAppIconId;
end;
function TCefApplicationCore.InitializeLibrary(const aApp : ICefApp) : boolean;
@ -3348,6 +3401,7 @@ begin
(FMustCreateBrowserProcessHandler or
assigned(FOnContextInitialized) or
assigned(FOnBeforeChildProcessLaunch) or
assigned(FOnAlreadyRunningAppRelaunch) or
assigned(FOnScheduleMessagePumpWork)) or
assigned(FOnGetDefaultClient));
end;