1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +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

@@ -72,7 +72,8 @@ type
function HasSwitches: Boolean;
function HasSwitch(const name: ustring): Boolean;
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 AppendSwitchWithValue(const name, value: ustring);
function HasArguments: Boolean;
@@ -155,12 +156,13 @@ begin
Result := CefStringFreeAndGet(PCefCommandLine(FData)^.get_program(PCefCommandLine(FData)));
end;
procedure TCefCommandLineRef.GetSwitches(var switches: TStrings);
function TCefCommandLineRef.GetSwitches(var switches: TStrings): boolean;
var
TempStrMap : ICefStringMap;
i, j : NativeUInt;
TempKey, TempValue : ustring;
begin
Result := False;
TempStrMap := nil;
try
@@ -189,6 +191,44 @@ begin
inc(i);
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;
except
on e : exception do