1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-02 21:57:37 +02:00

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,224 +1618,300 @@ 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}
TempVersionInfo : TFileVersionInfo; TempVersionInfo : TFileVersionInfo;
TempFileName : ustring; TempFileName : ustring;
{$ENDIF} {$ENDIF}
begin
if (commandLine <> nil) and (FProcessType = ptBrowser) and (processType = '') then
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
if FindFlashDLL(TempFileName) and if FindFlashDLL(TempFileName) and
GetDLLVersion(TempFileName, TempVersionInfo) then GetDLLVersion(TempFileName, TempVersionInfo) 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.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; end;
commandLine.AppendSwitchWithValue('--enable-media-stream', IntToStr(Ord(FEnableMediaStream))); ReplaceSwitch(aKeys, aValues, '--enable-media-stream', IntToStr(Ord(FEnableMediaStream)));
commandLine.AppendSwitchWithValue('--enable-speech-input', IntToStr(Ord(FEnableSpeechInput))); ReplaceSwitch(aKeys, aValues, '--enable-speech-input', IntToStr(Ord(FEnableSpeechInput)));
if FUseFakeUIForMediaStream then if FUseFakeUIForMediaStream then
commandLine.AppendSwitch('--use-fake-ui-for-media-stream'); ReplaceSwitch(aKeys, aValues, '--use-fake-ui-for-media-stream');
if not(FEnableGPU) then if not(FEnableGPU) then
begin begin
commandLine.AppendSwitch('--disable-gpu'); ReplaceSwitch(aKeys, aValues, '--disable-gpu');
commandLine.AppendSwitch('--disable-gpu-compositing'); ReplaceSwitch(aKeys, aValues, '--disable-gpu-compositing');
end; end;
if FSingleProcess then if FSingleProcess then
commandLine.AppendSwitch('--single-process'); ReplaceSwitch(aKeys, aValues, '--single-process');
case FSmoothScrolling of case FSmoothScrolling of
STATE_ENABLED : commandLine.AppendSwitch('--enable-smooth-scrolling'); STATE_ENABLED : ReplaceSwitch(aKeys, aValues, '--enable-smooth-scrolling');
STATE_DISABLED : commandLine.AppendSwitch('--disable-smooth-scrolling'); STATE_DISABLED : ReplaceSwitch(aKeys, aValues, '--disable-smooth-scrolling');
end; end;
case FTouchEvents of case FTouchEvents of
STATE_ENABLED : commandLine.AppendSwitchWithValue('--touch-events', 'enabled'); STATE_ENABLED : ReplaceSwitch(aKeys, aValues, '--touch-events', 'enabled');
STATE_DISABLED : commandLine.AppendSwitchWithValue('--touch-events', 'disabled'); STATE_DISABLED : ReplaceSwitch(aKeys, aValues, '--touch-events', 'disabled');
end; end;
if FDisableReadingFromCanvas then if FDisableReadingFromCanvas then
commandLine.AppendSwitch('--disable-reading-from-canvas'); ReplaceSwitch(aKeys, aValues, '--disable-reading-from-canvas');
if not(FHyperlinkAuditing) then if not(FHyperlinkAuditing) then
commandLine.AppendSwitch('--no-pings'); ReplaceSwitch(aKeys, aValues, '--no-pings');
case FAutoplayPolicy of case FAutoplayPolicy of
appDocumentUserActivationRequired : appDocumentUserActivationRequired :
commandLine.AppendSwitchWithValue('--autoplay-policy', 'document-user-activation-required'); ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'document-user-activation-required');
appNoUserGestureRequired : appNoUserGestureRequired :
commandLine.AppendSwitchWithValue('--autoplay-policy', 'no-user-gesture-required'); ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'no-user-gesture-required');
appUserGestureRequired : appUserGestureRequired :
commandLine.AppendSwitchWithValue('--autoplay-policy', 'user-gesture-required'); ReplaceSwitch(aKeys, aValues, '--autoplay-policy', 'user-gesture-required');
end; end;
if FFastUnload then if FFastUnload then
commandLine.AppendSwitch('--enable-fast-unload'); ReplaceSwitch(aKeys, aValues, '--enable-fast-unload');
if FDisableGPUCache then if FDisableGPUCache then
commandLine.AppendSwitch('--disable-gpu-shader-disk-cache'); ReplaceSwitch(aKeys, aValues, '--disable-gpu-shader-disk-cache');
if FDisableSafeBrowsing then if FDisableSafeBrowsing then
begin begin
commandLine.AppendSwitch('--disable-client-side-phishing-detection'); ReplaceSwitch(aKeys, aValues, '--disable-client-side-phishing-detection');
commandLine.AppendSwitch('--safebrowsing-disable-auto-update'); ReplaceSwitch(aKeys, aValues, '--safebrowsing-disable-auto-update');
commandLine.AppendSwitch('--safebrowsing-disable-download-protection'); ReplaceSwitch(aKeys, aValues, '--safebrowsing-disable-download-protection');
end; end;
if FMuteAudio then if FMuteAudio then
commandLine.AppendSwitch('--mute-audio'); ReplaceSwitch(aKeys, aValues, '--mute-audio');
if FDisableWebSecurity then if FDisableWebSecurity then
commandLine.AppendSwitch('--disable-web-security'); ReplaceSwitch(aKeys, aValues, '--disable-web-security');
if FDisablePDFExtension then if FDisablePDFExtension then
commandLine.AppendSwitch('--disable-pdf-extension'); ReplaceSwitch(aKeys, aValues, '--disable-pdf-extension');
if FDisableSiteIsolationTrials then if FDisableSiteIsolationTrials then
commandLine.AppendSwitch('--disable-site-isolation-trials'); ReplaceSwitch(aKeys, aValues, '--disable-site-isolation-trials');
if FSitePerProcess then if FSitePerProcess then
commandLine.AppendSwitch('--site-per-process'); ReplaceSwitch(aKeys, aValues, '--site-per-process');
if FDisableExtensions then if FDisableExtensions then
commandLine.AppendSwitch('--disable-extensions'); ReplaceSwitch(aKeys, aValues, '--disable-extensions');
if FDisableBackgroundNetworking then if FDisableBackgroundNetworking then
commandLine.AppendSwitch('--disable-background-networking'); ReplaceSwitch(aKeys, aValues, '--disable-background-networking');
if FMetricsRecordingOnly then if FMetricsRecordingOnly then
commandLine.AppendSwitch('--metrics-recording-only'); ReplaceSwitch(aKeys, aValues, '--metrics-recording-only');
if FAllowFileAccessFromFiles then if FAllowFileAccessFromFiles then
commandLine.AppendSwitch('--allow-file-access-from-files'); ReplaceSwitch(aKeys, aValues, '--allow-file-access-from-files');
if FAllowRunningInsecureContent then if FAllowRunningInsecureContent then
commandLine.AppendSwitch('--allow-running-insecure-content'); ReplaceSwitch(aKeys, aValues, '--allow-running-insecure-content');
if FEnablePrintPreview then if FEnablePrintPreview then
commandLine.AppendSwitch('--enable-print-preview'); ReplaceSwitch(aKeys, aValues, '--enable-print-preview');
if FDisableNewBrowserInfoTimeout then if FDisableNewBrowserInfoTimeout then
commandLine.AppendSwitch('--disable-new-browser-info-timeout'); ReplaceSwitch(aKeys, aValues, '--disable-new-browser-info-timeout');
if (length(FDevToolsProtocolLogFile) > 0) then if (length(FDevToolsProtocolLogFile) > 0) then
commandLine.AppendSwitchWithValue('--devtools-protocol-log-file', FDevToolsProtocolLogFile); ReplaceSwitch(aKeys, aValues, '--devtools-protocol-log-file', FDevToolsProtocolLogFile);
case FPluginPolicy of case FPluginPolicy of
PLUGIN_POLICY_SWITCH_DETECT : commandLine.AppendSwitchWithValue('--plugin-policy', 'detect'); PLUGIN_POLICY_SWITCH_DETECT : ReplaceSwitch(aKeys, aValues, '--plugin-policy', 'detect');
PLUGIN_POLICY_SWITCH_BLOCK : commandLine.AppendSwitchWithValue('--plugin-policy', 'block'); PLUGIN_POLICY_SWITCH_BLOCK : ReplaceSwitch(aKeys, aValues, '--plugin-policy', 'block');
end; end;
if (length(FDefaultEncoding) > 0) then if (length(FDefaultEncoding) > 0) then
commandLine.AppendSwitchWithValue('--default-encoding', FDefaultEncoding); ReplaceSwitch(aKeys, aValues, '--default-encoding', FDefaultEncoding);
if FDisableJavascript then if FDisableJavascript then
commandLine.AppendSwitch('--disable-javascript'); ReplaceSwitch(aKeys, aValues, '--disable-javascript');
if FDisableJavascriptCloseWindows then if FDisableJavascriptCloseWindows then
commandLine.AppendSwitch('--disable-javascript-close-windows'); ReplaceSwitch(aKeys, aValues, '--disable-javascript-close-windows');
if FDisableJavascriptAccessClipboard then if FDisableJavascriptAccessClipboard then
commandLine.AppendSwitch('--disable-javascript-access-clipboard'); ReplaceSwitch(aKeys, aValues, '--disable-javascript-access-clipboard');
if FDisableJavascriptDomPaste then if FDisableJavascriptDomPaste then
commandLine.AppendSwitch('--disable-javascript-dom-paste'); ReplaceSwitch(aKeys, aValues, '--disable-javascript-dom-paste');
if FAllowUniversalAccessFromFileUrls then if FAllowUniversalAccessFromFileUrls then
commandLine.AppendSwitch('--allow-universal-access-from-files'); ReplaceSwitch(aKeys, aValues, '--allow-universal-access-from-files');
if FDisableImageLoading then if FDisableImageLoading then
commandLine.AppendSwitch('--disable-image-loading'); ReplaceSwitch(aKeys, aValues, '--disable-image-loading');
if FImageShrinkStandaloneToFit then if FImageShrinkStandaloneToFit then
commandLine.AppendSwitch('--image-shrink-standalone-to-fit'); ReplaceSwitch(aKeys, aValues, '--image-shrink-standalone-to-fit');
if FDisableTextAreaResize then if FDisableTextAreaResize then
commandLine.AppendSwitch('--disable-text-area-resize'); ReplaceSwitch(aKeys, aValues, '--disable-text-area-resize');
if FDisableTabToLinks then if FDisableTabToLinks then
commandLine.AppendSwitch('--disable-tab-to-links'); ReplaceSwitch(aKeys, aValues, '--disable-tab-to-links');
if FDisablePlugins then if FDisablePlugins then
commandLine.AppendSwitch('--disable-plugins'); ReplaceSwitch(aKeys, aValues, '--disable-plugins');
if FEnableProfanityFilter then if FEnableProfanityFilter then
commandLine.AppendSwitch('--enable-profanity-filter'); ReplaceSwitch(aKeys, aValues, '--enable-profanity-filter');
if FDisableSpellChecking then if FDisableSpellChecking then
commandLine.AppendSwitch('--disable-spell-checking'); ReplaceSwitch(aKeys, aValues, '--disable-spell-checking');
if (length(FOverrideSpellCheckLang) > 0) then if (length(FOverrideSpellCheckLang) > 0) then
commandLine.AppendSwitchWithValue('--override-spell-check-lang', FOverrideSpellCheckLang); ReplaceSwitch(aKeys, aValues, '--override-spell-check-lang', FOverrideSpellCheckLang);
// The list of features you can enable is here : // The list of features you can enable is here :
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc // https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
if (length(FEnableFeatures) > 0) then if (length(FEnableFeatures) > 0) then
commandLine.AppendSwitchWithValue('--enable-features', FEnableFeatures); AppendSwitch(aKeys, aValues, '--enable-features', FEnableFeatures);
// The list of features you can disable is here : // The list of features you can disable is here :
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc // https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
if (length(FDisableFeatures) > 0) then if (length(FDisableFeatures) > 0) then
commandLine.AppendSwitchWithValue('--disable-features', FDisableFeatures); AppendSwitch(aKeys, aValues, '--disable-features', FDisableFeatures);
// The list of Blink features you can enable is here : // 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 // https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5
if (length(FEnableBlinkFeatures) > 0) then if (length(FEnableBlinkFeatures) > 0) then
commandLine.AppendSwitchWithValue('--enable-blink-features', FEnableBlinkFeatures); AppendSwitch(aKeys, aValues, '--enable-blink-features', FEnableBlinkFeatures);
// The list of Blink features you can disable is here : // 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 // https://cs.chromium.org/chromium/src/third_party/blink/renderer/platform/runtime_enabled_features.json5
if (length(FDisableBlinkFeatures) > 0) then if (length(FDisableBlinkFeatures) > 0) then
commandLine.AppendSwitchWithValue('--disable-blink-features', FDisableBlinkFeatures); AppendSwitch(aKeys, aValues, '--disable-blink-features', FDisableBlinkFeatures);
// https://source.chromium.org/chromium/chromium/src/+/master:base/base_switches.cc
if (length(FForceFieldTrials) > 0) then if (length(FForceFieldTrials) > 0) then
commandLine.AppendSwitchWithValue('--force-fieldtrials', FForceFieldTrials); ReplaceSwitch(aKeys, aValues, '--force-fieldtrials', FForceFieldTrials);
// https://source.chromium.org/chromium/chromium/src/+/master:components/variations/variations_switches.cc
if (length(FForceFieldTrialParams) > 0) then if (length(FForceFieldTrialParams) > 0) then
commandLine.AppendSwitchWithValue('--force-fieldtrial-params', FForceFieldTrialParams); ReplaceSwitch(aKeys, aValues, '--force-fieldtrial-params', FForceFieldTrialParams);
if (FCustomCommandLines <> nil) and if (FCustomCommandLines <> nil) and
(FCustomCommandLineValues <> nil) and (FCustomCommandLineValues <> nil) and
(FCustomCommandLines.Count = FCustomCommandLineValues.Count) then (FCustomCommandLines.Count = FCustomCommandLineValues.Count) then
begin begin
i := 0; i := 0;
while (i < FCustomCommandLines.Count) do while (i < FCustomCommandLines.Count) do
begin begin
if (length(FCustomCommandLines[i]) > 0) then if (length(FCustomCommandLines[i]) > 0) then
ReplaceSwitch(aKeys, aValues, FCustomCommandLines[i], FCustomCommandLineValues[i]);
inc(i);
end;
end;
end;
procedure TCefApplicationCore.Internal_OnBeforeCommandLineProcessing(const processType : ustring;
const commandLine : ICefCommandLine);
var
i : integer;
TempKeys, TempValues : TStringList;
begin begin
if (length(FCustomCommandLineValues[i]) > 0) then TempKeys := nil;
commandLine.AppendSwitchWithValue(FCustomCommandLines[i], FCustomCommandLineValues[i]) 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 else
commandLine.AppendSwitch(FCustomCommandLines[i]); commandLine.AppendSwitch(TempKeys[i]);
end; end;
inc(i); inc(i);
end; end;
end; end;
finally
if (TempKeys <> nil) then FreeAndNil(TempKeys);
if (TempValues <> nil) then FreeAndNil(TempValues);
end; end;
end; end;

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" : {