Update to CEF 84.3.8

Improvements in the command line switches to avoid repetitions and make it easier to remove or modify default switches.
This commit is contained in:
Salvador Díaz Fau 2020-07-30 10:45:12 +02:00
parent 0f0c827b5d
commit b3b9bf809e
6 changed files with 326 additions and 206 deletions

View File

@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file. CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 84.3.7 which includes Chromium 84.0.4147.89. CEF4Delphi uses CEF 84.3.8 which includes Chromium 84.0.4147.105.
The CEF binaries used by CEF4Delphi are available for download at spotify : The CEF binaries used by CEF4Delphi are available for download at spotify :
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.7%2Bg97011bc%2Bchromium-84.0.4147.89_windows32.tar.bz2) * [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.8%2Bgc8a556f%2Bchromium-84.0.4147.105_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.7%2Bg97011bc%2Bchromium-84.0.4147.89_windows64.tar.bz2) * [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.8%2Bgc8a556f%2Bchromium-84.0.4147.105_windows64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.4 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. CEF4Delphi was developed and tested on Delphi 10.4 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -21,7 +21,7 @@
</CompilerOptions> </CompilerOptions>
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/> <Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
<License Value="MPL 1.1"/> <License Value="MPL 1.1"/>
<Version Major="84" Minor="3" Release="7"/> <Version Major="84" Minor="3" Release="8"/>
<Files Count="189"> <Files Count="189">
<Item1> <Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -62,13 +62,13 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 84; CEF_SUPPORTED_VERSION_MAJOR = 84;
CEF_SUPPORTED_VERSION_MINOR = 3; CEF_SUPPORTED_VERSION_MINOR = 3;
CEF_SUPPORTED_VERSION_RELEASE = 7; CEF_SUPPORTED_VERSION_RELEASE = 8;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 84; CEF_CHROMEELF_VERSION_MAJOR = 84;
CEF_CHROMEELF_VERSION_MINOR = 0; CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 4147; CEF_CHROMEELF_VERSION_RELEASE = 4147;
CEF_CHROMEELF_VERSION_BUILD = 89; CEF_CHROMEELF_VERSION_BUILD = 105;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll'; LIBCEF_DLL = 'libcef.dll';
@ -323,6 +323,9 @@ type
procedure ShowErrorMessageDlg(const aError : string); virtual; procedure ShowErrorMessageDlg(const aError : string); virtual;
procedure UpdateSupportedSchemes(aIncludeDefaults : boolean = True); virtual; procedure UpdateSupportedSchemes(aIncludeDefaults : boolean = True); virtual;
function ParseProcessType : TCefProcessType; function ParseProcessType : TCefProcessType;
procedure AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); virtual;
procedure AppendSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
procedure ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
public public
constructor Create; constructor Create;
@ -1615,8 +1618,49 @@ begin
FOnLoadError(browser, frame, errorCode, errorText, failedUrl); FOnLoadError(browser, frame, errorCode, errorText, failedUrl);
end; end;
procedure TCefApplicationCore.Internal_OnBeforeCommandLineProcessing(const processType : ustring; procedure TCefApplicationCore.AppendSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
const commandLine : ICefCommandLine); var
TempKey : ustring;
i : integer;
begin
if (copy(aNewKey, 1, 2) = '--') then
TempKey := copy(aNewKey, 3, length(aNewKey))
else
TempKey := aNewKey;
i := aKeys.IndexOf(TempKey);
if (i < 0) then
begin
aKeys.Add(aNewKey);
aValues.Add(aNewValue);
end
else
aValues[i] := aValues[i] + ',' + aNewValue;
end;
procedure TCefApplicationCore.ReplaceSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
var
TempKey : ustring;
i : integer;
begin
if (copy(aNewKey, 1, 2) = '--') then
TempKey := copy(aNewKey, 3, length(aNewKey))
else
TempKey := aNewKey;
i := aKeys.IndexOf(TempKey);
if (i < 0) then
begin
aKeys.Add(aNewKey);
aValues.Add(aNewValue);
end
else
aValues[i] := aNewValue;
end;
procedure TCefApplicationCore.AddCustomCommandLineSwitches(var aKeys, aValues : TStringList);
var var
i : integer; i : integer;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
@ -1624,218 +1668,253 @@ var
TempFileName : ustring; TempFileName : ustring;
{$ENDIF} {$ENDIF}
begin begin
if (commandLine <> nil) and (FProcessType = ptBrowser) and (processType = '') then {$IFDEF MSWINDOWS}
if FindFlashDLL(TempFileName) and
GetDLLVersion(TempFileName, TempVersionInfo) then
begin begin
{$IFDEF MSWINDOWS} if FEnableGPU then ReplaceSwitch(aKeys, aValues, '--enable-gpu-plugin');
if FindFlashDLL(TempFileName) and
GetDLLVersion(TempFileName, TempVersionInfo) then
begin
if FEnableGPU then commandLine.AppendSwitch('--enable-gpu-plugin');
commandLine.AppendSwitch('--enable-accelerated-plugins'); ReplaceSwitch(aKeys, aValues, '--enable-accelerated-plugins');
commandLine.AppendSwitchWithValue('--ppapi-flash-path', TempFileName); ReplaceSwitch(aKeys, aValues, '--ppapi-flash-path', TempFileName);
commandLine.AppendSwitchWithValue('--ppapi-flash-version', FileVersionInfoToString(TempVersionInfo)); ReplaceSwitch(aKeys, aValues, '--ppapi-flash-version', FileVersionInfoToString(TempVersionInfo));
end end
else else
{$ENDIF} {$ENDIF}
if FFlashEnabled then if FFlashEnabled then
begin begin
if FEnableGPU then commandLine.AppendSwitch('--enable-gpu-plugin'); if FEnableGPU then ReplaceSwitch(aKeys, aValues, '--enable-gpu-plugin');
commandLine.AppendSwitch('--enable-accelerated-plugins'); ReplaceSwitch(aKeys, aValues, '--enable-accelerated-plugins');
commandLine.AppendSwitch('--enable-system-flash'); ReplaceSwitch(aKeys, aValues, '--enable-system-flash');
end;
commandLine.AppendSwitchWithValue('--enable-media-stream', IntToStr(Ord(FEnableMediaStream)));
commandLine.AppendSwitchWithValue('--enable-speech-input', IntToStr(Ord(FEnableSpeechInput)));
if FUseFakeUIForMediaStream then
commandLine.AppendSwitch('--use-fake-ui-for-media-stream');
if not(FEnableGPU) then
begin
commandLine.AppendSwitch('--disable-gpu');
commandLine.AppendSwitch('--disable-gpu-compositing');
end;
if FSingleProcess then
commandLine.AppendSwitch('--single-process');
case FSmoothScrolling of
STATE_ENABLED : commandLine.AppendSwitch('--enable-smooth-scrolling');
STATE_DISABLED : commandLine.AppendSwitch('--disable-smooth-scrolling');
end; end;
case FTouchEvents of ReplaceSwitch(aKeys, aValues, '--enable-media-stream', IntToStr(Ord(FEnableMediaStream)));
STATE_ENABLED : commandLine.AppendSwitchWithValue('--touch-events', 'enabled'); ReplaceSwitch(aKeys, aValues, '--enable-speech-input', IntToStr(Ord(FEnableSpeechInput)));
STATE_DISABLED : commandLine.AppendSwitchWithValue('--touch-events', 'disabled');
end;
if FDisableReadingFromCanvas then if FUseFakeUIForMediaStream then
commandLine.AppendSwitch('--disable-reading-from-canvas'); ReplaceSwitch(aKeys, aValues, '--use-fake-ui-for-media-stream');
if not(FHyperlinkAuditing) then if not(FEnableGPU) then
commandLine.AppendSwitch('--no-pings'); begin
ReplaceSwitch(aKeys, aValues, '--disable-gpu');
ReplaceSwitch(aKeys, aValues, '--disable-gpu-compositing');
end;
case FAutoplayPolicy of if FSingleProcess then
appDocumentUserActivationRequired : ReplaceSwitch(aKeys, aValues, '--single-process');
commandLine.AppendSwitchWithValue('--autoplay-policy', 'document-user-activation-required');
appNoUserGestureRequired : case FSmoothScrolling of
commandLine.AppendSwitchWithValue('--autoplay-policy', 'no-user-gesture-required'); STATE_ENABLED : ReplaceSwitch(aKeys, aValues, '--enable-smooth-scrolling');
STATE_DISABLED : ReplaceSwitch(aKeys, aValues, '--disable-smooth-scrolling');
end;
appUserGestureRequired : case FTouchEvents of
commandLine.AppendSwitchWithValue('--autoplay-policy', 'user-gesture-required'); STATE_ENABLED : ReplaceSwitch(aKeys, aValues, '--touch-events', 'enabled');
end; STATE_DISABLED : ReplaceSwitch(aKeys, aValues, '--touch-events', 'disabled');
end;
if FFastUnload then if FDisableReadingFromCanvas then
commandLine.AppendSwitch('--enable-fast-unload'); ReplaceSwitch(aKeys, aValues, '--disable-reading-from-canvas');
if FDisableGPUCache then if not(FHyperlinkAuditing) then
commandLine.AppendSwitch('--disable-gpu-shader-disk-cache'); ReplaceSwitch(aKeys, aValues, '--no-pings');
if FDisableSafeBrowsing then case FAutoplayPolicy of
appDocumentUserActivationRequired :
ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'document-user-activation-required');
appNoUserGestureRequired :
ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'no-user-gesture-required');
appUserGestureRequired :
ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'user-gesture-required');
end;
if FFastUnload then
ReplaceSwitch(aKeys, aValues, '--enable-fast-unload');
if FDisableGPUCache then
ReplaceSwitch(aKeys, aValues, '--disable-gpu-shader-disk-cache');
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;
if FMuteAudio then
ReplaceSwitch(aKeys, aValues, '--mute-audio');
if FDisableWebSecurity then
ReplaceSwitch(aKeys, aValues, '--disable-web-security');
if FDisablePDFExtension then
ReplaceSwitch(aKeys, aValues, '--disable-pdf-extension');
if FDisableSiteIsolationTrials then
ReplaceSwitch(aKeys, aValues, '--disable-site-isolation-trials');
if FSitePerProcess then
ReplaceSwitch(aKeys, aValues, '--site-per-process');
if FDisableExtensions then
ReplaceSwitch(aKeys, aValues, '--disable-extensions');
if FDisableBackgroundNetworking then
ReplaceSwitch(aKeys, aValues, '--disable-background-networking');
if FMetricsRecordingOnly then
ReplaceSwitch(aKeys, aValues, '--metrics-recording-only');
if FAllowFileAccessFromFiles then
ReplaceSwitch(aKeys, aValues, '--allow-file-access-from-files');
if FAllowRunningInsecureContent then
ReplaceSwitch(aKeys, aValues, '--allow-running-insecure-content');
if FEnablePrintPreview then
ReplaceSwitch(aKeys, aValues, '--enable-print-preview');
if FDisableNewBrowserInfoTimeout then
ReplaceSwitch(aKeys, aValues, '--disable-new-browser-info-timeout');
if (length(FDevToolsProtocolLogFile) > 0) then
ReplaceSwitch(aKeys, aValues, '--devtools-protocol-log-file', FDevToolsProtocolLogFile);
case FPluginPolicy of
PLUGIN_POLICY_SWITCH_DETECT : ReplaceSwitch(aKeys, aValues, '--plugin-policy', 'detect');
PLUGIN_POLICY_SWITCH_BLOCK : ReplaceSwitch(aKeys, aValues, '--plugin-policy', 'block');
end;
if (length(FDefaultEncoding) > 0) then
ReplaceSwitch(aKeys, aValues, '--default-encoding', FDefaultEncoding);
if FDisableJavascript then
ReplaceSwitch(aKeys, aValues, '--disable-javascript');
if FDisableJavascriptCloseWindows then
ReplaceSwitch(aKeys, aValues, '--disable-javascript-close-windows');
if FDisableJavascriptAccessClipboard then
ReplaceSwitch(aKeys, aValues, '--disable-javascript-access-clipboard');
if FDisableJavascriptDomPaste then
ReplaceSwitch(aKeys, aValues, '--disable-javascript-dom-paste');
if FAllowUniversalAccessFromFileUrls then
ReplaceSwitch(aKeys, aValues, '--allow-universal-access-from-files');
if FDisableImageLoading then
ReplaceSwitch(aKeys, aValues, '--disable-image-loading');
if FImageShrinkStandaloneToFit then
ReplaceSwitch(aKeys, aValues, '--image-shrink-standalone-to-fit');
if FDisableTextAreaResize then
ReplaceSwitch(aKeys, aValues, '--disable-text-area-resize');
if FDisableTabToLinks then
ReplaceSwitch(aKeys, aValues, '--disable-tab-to-links');
if FDisablePlugins then
ReplaceSwitch(aKeys, aValues, '--disable-plugins');
if FEnableProfanityFilter then
ReplaceSwitch(aKeys, aValues, '--enable-profanity-filter');
if FDisableSpellChecking then
ReplaceSwitch(aKeys, aValues, '--disable-spell-checking');
if (length(FOverrideSpellCheckLang) > 0) then
ReplaceSwitch(aKeys, aValues, '--override-spell-check-lang', FOverrideSpellCheckLang);
// The list of features you can enable is here :
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
if (length(FEnableFeatures) > 0) then
AppendSwitch(aKeys, aValues, '--enable-features', FEnableFeatures);
// The list of features you can disable is here :
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
if (length(FDisableFeatures) > 0) then
AppendSwitch(aKeys, aValues, '--disable-features', FDisableFeatures);
// 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);
// 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);
// https://source.chromium.org/chromium/chromium/src/+/master:base/base_switches.cc
if (length(FForceFieldTrials) > 0) then
ReplaceSwitch(aKeys, aValues, '--force-fieldtrials', FForceFieldTrials);
// 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);
if (FCustomCommandLines <> nil) and
(FCustomCommandLineValues <> nil) and
(FCustomCommandLines.Count = FCustomCommandLineValues.Count) then
begin
i := 0;
while (i < FCustomCommandLines.Count) do
begin begin
commandLine.AppendSwitch('--disable-client-side-phishing-detection'); if (length(FCustomCommandLines[i]) > 0) then
commandLine.AppendSwitch('--safebrowsing-disable-auto-update'); ReplaceSwitch(aKeys, aValues, FCustomCommandLines[i], FCustomCommandLineValues[i]);
commandLine.AppendSwitch('--safebrowsing-disable-download-protection');
end;
if FMuteAudio then inc(i);
commandLine.AppendSwitch('--mute-audio');
if FDisableWebSecurity then
commandLine.AppendSwitch('--disable-web-security');
if FDisablePDFExtension then
commandLine.AppendSwitch('--disable-pdf-extension');
if FDisableSiteIsolationTrials then
commandLine.AppendSwitch('--disable-site-isolation-trials');
if FSitePerProcess then
commandLine.AppendSwitch('--site-per-process');
if FDisableExtensions then
commandLine.AppendSwitch('--disable-extensions');
if FDisableBackgroundNetworking then
commandLine.AppendSwitch('--disable-background-networking');
if FMetricsRecordingOnly then
commandLine.AppendSwitch('--metrics-recording-only');
if FAllowFileAccessFromFiles then
commandLine.AppendSwitch('--allow-file-access-from-files');
if FAllowRunningInsecureContent then
commandLine.AppendSwitch('--allow-running-insecure-content');
if FEnablePrintPreview then
commandLine.AppendSwitch('--enable-print-preview');
if FDisableNewBrowserInfoTimeout then
commandLine.AppendSwitch('--disable-new-browser-info-timeout');
if (length(FDevToolsProtocolLogFile) > 0) then
commandLine.AppendSwitchWithValue('--devtools-protocol-log-file', FDevToolsProtocolLogFile);
case FPluginPolicy of
PLUGIN_POLICY_SWITCH_DETECT : commandLine.AppendSwitchWithValue('--plugin-policy', 'detect');
PLUGIN_POLICY_SWITCH_BLOCK : commandLine.AppendSwitchWithValue('--plugin-policy', 'block');
end;
if (length(FDefaultEncoding) > 0) then
commandLine.AppendSwitchWithValue('--default-encoding', FDefaultEncoding);
if FDisableJavascript then
commandLine.AppendSwitch('--disable-javascript');
if FDisableJavascriptCloseWindows then
commandLine.AppendSwitch('--disable-javascript-close-windows');
if FDisableJavascriptAccessClipboard then
commandLine.AppendSwitch('--disable-javascript-access-clipboard');
if FDisableJavascriptDomPaste then
commandLine.AppendSwitch('--disable-javascript-dom-paste');
if FAllowUniversalAccessFromFileUrls then
commandLine.AppendSwitch('--allow-universal-access-from-files');
if FDisableImageLoading then
commandLine.AppendSwitch('--disable-image-loading');
if FImageShrinkStandaloneToFit then
commandLine.AppendSwitch('--image-shrink-standalone-to-fit');
if FDisableTextAreaResize then
commandLine.AppendSwitch('--disable-text-area-resize');
if FDisableTabToLinks then
commandLine.AppendSwitch('--disable-tab-to-links');
if FDisablePlugins then
commandLine.AppendSwitch('--disable-plugins');
if FEnableProfanityFilter then
commandLine.AppendSwitch('--enable-profanity-filter');
if FDisableSpellChecking then
commandLine.AppendSwitch('--disable-spell-checking');
if (length(FOverrideSpellCheckLang) > 0) then
commandLine.AppendSwitchWithValue('--override-spell-check-lang', FOverrideSpellCheckLang);
// The list of features you can enable is here :
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
if (length(FEnableFeatures) > 0) then
commandLine.AppendSwitchWithValue('--enable-features', FEnableFeatures);
// The list of features you can disable is here :
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
if (length(FDisableFeatures) > 0) then
commandLine.AppendSwitchWithValue('--disable-features', FDisableFeatures);
// 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
commandLine.AppendSwitchWithValue('--enable-blink-features', FEnableBlinkFeatures);
// 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
commandLine.AppendSwitchWithValue('--disable-blink-features', FDisableBlinkFeatures);
if (length(FForceFieldTrials) > 0) then
commandLine.AppendSwitchWithValue('--force-fieldtrials', FForceFieldTrials);
if (length(FForceFieldTrialParams) > 0) then
commandLine.AppendSwitchWithValue('--force-fieldtrial-params', FForceFieldTrialParams);
if (FCustomCommandLines <> nil) and
(FCustomCommandLineValues <> nil) and
(FCustomCommandLines.Count = FCustomCommandLineValues.Count) then
begin
i := 0;
while (i < FCustomCommandLines.Count) do
begin
if (length(FCustomCommandLines[i]) > 0) then
begin
if (length(FCustomCommandLineValues[i]) > 0) then
commandLine.AppendSwitchWithValue(FCustomCommandLines[i], FCustomCommandLineValues[i])
else
commandLine.AppendSwitch(FCustomCommandLines[i]);
end;
inc(i);
end;
end; end;
end; end;
end; end;
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;
procedure TCefApplicationCore.Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); procedure TCefApplicationCore.Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
begin begin
if assigned(FOnRegisterCustomSchemes) then if assigned(FOnRegisterCustomSchemes) then

View File

@ -72,7 +72,8 @@ type
function HasSwitches: Boolean; function HasSwitches: Boolean;
function HasSwitch(const name: ustring): Boolean; function HasSwitch(const name: ustring): Boolean;
function GetSwitchValue(const name: ustring): ustring; function GetSwitchValue(const name: ustring): ustring;
procedure GetSwitches(var switches: TStrings); function GetSwitches(var switches: TStrings): boolean; overload;
function GetSwitches(var SwitchKeys, SwitchValues: TStringList): boolean; overload;
procedure AppendSwitch(const name: ustring); procedure AppendSwitch(const name: ustring);
procedure AppendSwitchWithValue(const name, value: ustring); procedure AppendSwitchWithValue(const name, value: ustring);
function HasArguments: Boolean; function HasArguments: Boolean;
@ -155,12 +156,13 @@ begin
Result := CefStringFreeAndGet(PCefCommandLine(FData)^.get_program(PCefCommandLine(FData))); Result := CefStringFreeAndGet(PCefCommandLine(FData)^.get_program(PCefCommandLine(FData)));
end; end;
procedure TCefCommandLineRef.GetSwitches(var switches: TStrings); function TCefCommandLineRef.GetSwitches(var switches: TStrings): boolean;
var var
TempStrMap : ICefStringMap; TempStrMap : ICefStringMap;
i, j : NativeUInt; i, j : NativeUInt;
TempKey, TempValue : ustring; TempKey, TempValue : ustring;
begin begin
Result := False;
TempStrMap := nil; TempStrMap := nil;
try try
@ -189,6 +191,44 @@ begin
inc(i); inc(i);
end; end;
Result := (j > 0);
end;
except
on e : exception do
if CustomExceptionHandler('TCefCommandLineRef.GetSwitches', e) then raise;
end;
finally
TempStrMap := nil;
end;
end;
function TCefCommandLineRef.GetSwitches(var SwitchKeys, SwitchValues: TStringList): boolean;
var
TempStrMap : ICefStringMap;
i, j : NativeUInt;
begin
Result := False;
TempStrMap := nil;
try
try
if (SwitchKeys <> nil) and (SwitchValues <> nil) then
begin
TempStrMap := TCefStringMapOwn.Create;
PCefCommandLine(FData)^.get_switches(PCefCommandLine(FData), TempStrMap.Handle);
i := 0;
j := TempStrMap.Size;
while (i < j) do
begin
SwitchKeys.Add(TempStrMap.Key[i]);
SwitchValues.Add(TempStrMap.Value[i]);
inc(i);
end;
Result := (j > 0);
end; end;
except except
on e : exception do on e : exception do

View File

@ -1289,7 +1289,8 @@ type
function HasSwitches: Boolean; function HasSwitches: Boolean;
function HasSwitch(const name: ustring): Boolean; function HasSwitch(const name: ustring): Boolean;
function GetSwitchValue(const name: ustring): ustring; function GetSwitchValue(const name: ustring): ustring;
procedure GetSwitches(var switches: TStrings); function GetSwitches(var switches: TStrings): boolean; overload;
function GetSwitches(var SwitchKeys, SwitchValues: TStringList): boolean; overload;
procedure AppendSwitch(const name: ustring); procedure AppendSwitch(const name: ustring);
procedure AppendSwitchWithValue(const name, value: ustring); procedure AppendSwitchWithValue(const name, value: ustring);
function HasArguments: Boolean; function HasArguments: Boolean;

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [ "UpdateLazPackages" : [
{ {
"ForceNotify" : true, "ForceNotify" : true,
"InternalVersion" : 170, "InternalVersion" : 171,
"Name" : "cef4delphi_lazarus.lpk", "Name" : "cef4delphi_lazarus.lpk",
"Version" : "84.3.7.0" "Version" : "84.3.8.0"
} }
], ],
"UpdatePackageData" : { "UpdatePackageData" : {