You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
Update to CEF 98.1.19
This commit is contained in:
@ -60,19 +60,21 @@ uses
|
||||
{$ELSE}
|
||||
{$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, {$IFDEF FPC}dynlibs,{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$IFDEF LINUX}{$IFDEF FPC}xlib,{$ENDIF}{$ENDIF}
|
||||
{$IFDEF LINUX}
|
||||
{$IFDEF FPC}xlib,{$ENDIF} uCEFArgCopy,
|
||||
{$ENDIF}
|
||||
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
|
||||
|
||||
const
|
||||
CEF_SUPPORTED_VERSION_MAJOR = 98;
|
||||
CEF_SUPPORTED_VERSION_MINOR = 1;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 16;
|
||||
CEF_SUPPORTED_VERSION_RELEASE = 19;
|
||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||
|
||||
CEF_CHROMEELF_VERSION_MAJOR = 98;
|
||||
CEF_CHROMEELF_VERSION_MINOR = 0;
|
||||
CEF_CHROMEELF_VERSION_RELEASE = 4758;
|
||||
CEF_CHROMEELF_VERSION_BUILD = 55;
|
||||
CEF_CHROMEELF_VERSION_BUILD = 80;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
LIBCEF_DLL = 'libcef.dll';
|
||||
@ -194,6 +196,9 @@ type
|
||||
// Fields used during the CEF initialization
|
||||
FWindowsSandboxInfo : pointer;
|
||||
FEnableHighDPISupport : boolean;
|
||||
{$IFDEF LINUX}
|
||||
FArgCopy : TCEFArgCopy;
|
||||
{$ENDIF}
|
||||
|
||||
// Fields used by custom properties
|
||||
FDeleteCache : boolean;
|
||||
@ -287,6 +292,8 @@ type
|
||||
function GetApiHashCommit : ustring;
|
||||
{$IFDEF LINUX}
|
||||
function GetXDisplay : PXDisplay;
|
||||
function GetArgc : longint;
|
||||
function GetArgv : PPChar;
|
||||
{$ENDIF}
|
||||
|
||||
function LoadCEFlibrary : boolean; virtual;
|
||||
@ -506,6 +513,10 @@ type
|
||||
// Properties used during the CEF initialization
|
||||
property WindowsSandboxInfo : Pointer read FWindowsSandboxInfo write FWindowsSandboxInfo;
|
||||
property EnableHighDPISupport : boolean read FEnableHighDPISupport write FEnableHighDPISupport;
|
||||
{$IFDEF LINUX}
|
||||
property argc : longint read GetArgc;
|
||||
property argv : PPChar read GetArgv;
|
||||
{$ENDIF}
|
||||
|
||||
// Custom properties
|
||||
property DeleteCache : boolean read FDeleteCache write FDeleteCache;
|
||||
@ -752,6 +763,9 @@ begin
|
||||
// Fields used during the CEF initialization
|
||||
FWindowsSandboxInfo := nil;
|
||||
FEnableHighDPISupport := False;
|
||||
{$IFDEF LINUX}
|
||||
FArgCopy := TCEFArgCopy.Create;
|
||||
{$ENDIF}
|
||||
|
||||
// Fields used by custom properties
|
||||
FDeleteCache := False;
|
||||
@ -850,6 +864,9 @@ begin
|
||||
|
||||
FreeLibcefLibrary;
|
||||
|
||||
{$IFDEF LINUX}
|
||||
if (FArgCopy <> nil) then FreeAndNil(FArgCopy);
|
||||
{$ENDIF}
|
||||
if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines);
|
||||
if (FCustomCommandLineValues <> nil) then FreeAndNil(FCustomCommandLineValues);
|
||||
finally
|
||||
@ -1341,8 +1358,11 @@ begin
|
||||
TempArgs.instance := HINSTANCE{$IFDEF FPC}(){$ENDIF};
|
||||
{$ELSE}
|
||||
{$IFDEF FPC}
|
||||
TempArgs.argc := argc;
|
||||
TempArgs.argv := argv;
|
||||
{$IFDEF LINUX}
|
||||
FArgCopy.CopyFromArgs(argc, argv);
|
||||
{$ENDIF}
|
||||
TempArgs.argc := argc;
|
||||
TempArgs.argv := argv;
|
||||
{$ELSE}
|
||||
TempArgs.argc := ArgCount;
|
||||
TempArgs.argv := PPWideChar(ArgValues);
|
||||
@ -2081,12 +2101,14 @@ begin
|
||||
// The list of features you can enable is here :
|
||||
// https://chromium.googlesource.com/chromium/src/+/master/chrome/common/chrome_features.cc
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_features.cc
|
||||
// https://source.chromium.org/search?q=base::Feature
|
||||
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
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:content/public/common/content_features.cc
|
||||
// https://source.chromium.org/search?q=base::Feature
|
||||
if (length(FDisableFeatures) > 0) then
|
||||
AppendSwitch(aKeys, aValues, '--disable-features', FDisableFeatures);
|
||||
|
||||
@ -2307,13 +2329,13 @@ begin
|
||||
TempProcHWND := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, TempProcess.th32ProcessID);
|
||||
|
||||
if (TempProcHWND <> 0) then
|
||||
begin
|
||||
try
|
||||
ZeroMemory(@TempMemCtrs, SizeOf(TProcessMemoryCounters));
|
||||
TempMemCtrs.cb := SizeOf(TProcessMemoryCounters);
|
||||
|
||||
if GetProcessMemoryInfo(TempProcHWND, {$IFNDEF FPC}@{$ENDIF}TempMemCtrs, TempMemCtrs.cb) then
|
||||
inc(Result, TempMemCtrs.WorkingSetSize);
|
||||
|
||||
finally
|
||||
CloseHandle(TempProcHWND);
|
||||
end;
|
||||
end;
|
||||
@ -2418,6 +2440,22 @@ begin
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
function TCefApplicationCore.GetArgc : longint;
|
||||
begin
|
||||
if (FArgCopy <> nil) then
|
||||
Result := FArgCopy.argc
|
||||
else
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TCefApplicationCore.GetArgv : PPChar;
|
||||
begin
|
||||
if (FArgCopy <> nil) then
|
||||
Result := FArgCopy.argv
|
||||
else
|
||||
Result := nil;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function TCefApplicationCore.LoadCEFlibrary : boolean;
|
||||
|
148
source/uCEFArgCopy.pas
Normal file
148
source/uCEFArgCopy.pas
Normal file
@ -0,0 +1,148 @@
|
||||
// ************************************************************************
|
||||
// ***************************** 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
|
||||
//
|
||||
// Copyright � 2022 Salvador Diaz Fau. All rights reserved.
|
||||
//
|
||||
// ************************************************************************
|
||||
// ************ 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 uCEFArgCopy;
|
||||
|
||||
{$IFDEF FPC}
|
||||
{$MODE OBJFPC}{$H+}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
||||
{$MINENUMSIZE 4}
|
||||
|
||||
{$I cef.inc}
|
||||
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
System.Classes, System.SysUtils;
|
||||
{$ELSE}
|
||||
Classes, SysUtils;
|
||||
{$ENDIF}
|
||||
|
||||
type
|
||||
TCEFArgCopy = class
|
||||
protected
|
||||
FArgCCopy : longint;
|
||||
FArgVCopy : PPChar;
|
||||
|
||||
procedure InitializeFields;
|
||||
procedure DestroyFields;
|
||||
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure CopyFromArgs(aArgc : longint; aArgv : PPChar);
|
||||
|
||||
property argc : longint read FArgCCopy;
|
||||
property argv : PPChar read FArgVCopy;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{$POINTERMATH ON}
|
||||
|
||||
constructor TCEFArgCopy.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
InitializeFields;
|
||||
end;
|
||||
|
||||
destructor TCEFArgCopy.Destroy;
|
||||
begin
|
||||
DestroyFields;
|
||||
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TCEFArgCopy.InitializeFields;
|
||||
begin
|
||||
FArgCCopy := 0;
|
||||
FArgVCopy := nil;
|
||||
end;
|
||||
|
||||
procedure TCEFArgCopy.DestroyFields;
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
if (FArgVCopy <> nil) then
|
||||
begin
|
||||
i := pred(FArgCCopy);
|
||||
|
||||
while (i >= 0) do
|
||||
begin
|
||||
if (FArgVCopy[i] <> nil) then
|
||||
StrDispose(FArgVCopy[i]);
|
||||
|
||||
dec(i);
|
||||
end;
|
||||
|
||||
FreeMem(FArgVCopy);
|
||||
end;
|
||||
|
||||
InitializeFields;
|
||||
end;
|
||||
|
||||
procedure TCEFArgCopy.CopyFromArgs(aArgc : longint; aArgv : PPChar);
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
DestroyFields;
|
||||
|
||||
if (aArgc > 0) and (aArgv <> nil) then
|
||||
begin
|
||||
i := 0;
|
||||
FArgCCopy := aArgc;
|
||||
|
||||
GetMem(FArgVCopy, (FArgCCopy + 1) * SizeOf(Pointer));
|
||||
|
||||
while (i < aArgc) do
|
||||
begin
|
||||
FArgVCopy[i] := StrAlloc(length(aArgv[i]) + 1);
|
||||
StrCopy(FArgVCopy[i], aArgv[i]);
|
||||
|
||||
inc(i);
|
||||
end;
|
||||
|
||||
FArgVCopy[i] := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
Reference in New Issue
Block a user