1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-08-14 21:42:50 +02:00

Update to CEF 90.5.7

Modified the VCL version of the TinyBrowser2 demo to use the experimental "ChromeRuntime" mode.
This commit is contained in:
Salvador Díaz Fau
2021-04-23 14:52:53 +02:00
parent 46f8fde8f9
commit edbfe8775b
7 changed files with 111 additions and 35 deletions

View File

@@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 90.5.5 which includes Chromium 90.0.4430.72.
CEF4Delphi uses CEF 90.5.7 which includes Chromium 90.0.4430.85.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.5%2Bgf718c89%2Bchromium-90.0.4430.72_macosx64.tar.bz2)
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.7%2Bgcd9342c%2Bchromium-90.0.4430.85_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.4.2 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.12/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@@ -43,9 +43,9 @@ interface
uses
{$IFDEF DELPHI16_UP}
System.Classes,
System.Classes, System.Types, System.SysUtils,
{$ELSE}
Classes,
Classes, Types, SysUtils,
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFApplication, uCEFChromium,
uCEFWindowComponent, uCEFBrowserViewComponent;
@@ -67,6 +67,8 @@ type
FCEFBrowserViewComponent : TCEFBrowserViewComponent;
FHomepage : string;
function GetClient : ICefClient;
procedure Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess, Result: Boolean);
procedure Chromium_OnTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
@@ -81,6 +83,7 @@ type
procedure CreateTopLevelWindow;
property Homepage : string read FHomepage write FHomepage;
property Client : ICefClient read GetClient;
end;
var
@@ -246,6 +249,14 @@ begin
aResult.height := DEFAULT_WINDOW_VIEW_HEIGHT;
end;
function TTinyBrowser.GetClient : ICefClient;
begin
if (FChromium <> nil) then
Result := FChromium.CefClient
else
Result := nil;
end;
procedure GlobalCEFApp_OnContextInitialized;
begin
TinyBrowser := TTinyBrowser.Create(nil);
@@ -253,18 +264,25 @@ begin
TinyBrowser.CreateTopLevelWindow;
end;
procedure GlobalCEFApp_OnGetDefaultClient(var aClient : ICefClient);
begin
aClient := TinyBrowser.Client;
end;
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.MultiThreadedMessageLoop := False;
GlobalCEFApp.ExternalMessagePump := False;
//GlobalCEFApp.ChromeRuntime := True; // Enable this line to test the new "ChromeRuntime" mode. It's in experimental state.
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient; // This event is only used in "ChromeRuntime" mode
end;
procedure DestroyTinyBrowser;
begin
if (TinyBrowser <> nil) then
TinyBrowser.Free;
FreeAndNil(TinyBrowser);
end;
end.

View File

@@ -37,10 +37,16 @@
unit uTinyBrowser2;
{$I cef.inc}
interface
uses
Types,
{$IFDEF DELPHI16_UP}
System.Types, System.SysUtils,
{$ELSE}
Types, SysUtils,
{$ENDIF}
uCEFInterfaces, uCEFTypes, uCEFChromiumCore;
type
@@ -48,6 +54,8 @@ type
private
FChromium : TChromiumCore;
function GetClient : ICefClient;
procedure Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure Chromium_OnOpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
@@ -56,6 +64,8 @@ type
constructor Create;
destructor Destroy; override;
procedure AfterConstruction; override;
property Client : ICefClient read GetClient;
end;
procedure CreateGlobalCEFApp;
@@ -89,12 +99,20 @@ begin
TinyBrowser := TTinyBrowser2.Create;
end;
procedure GlobalCEFApp_OnGetDefaultClient(var aClient : ICefClient);
begin
aClient := TinyBrowser.Client;
end;
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.MultiThreadedMessageLoop := False;
GlobalCEFApp.ExternalMessagePump := False;
GlobalCEFApp.ChromeRuntime := True; // Enable this line to enable the "ChromeRuntime" mode. It's in experimental state.
GlobalCEFApp.cache := 'cache';
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient; // This event is only used in "ChromeRuntime" mode
// This is a workaround for the CEF4Delphi issue #324 :
// https://github.com/salvadordf/CEF4Delphi/issues/324
@@ -104,10 +122,7 @@ end;
procedure DestroyTinyBrowser;
begin
if (TinyBrowser <> nil) then
begin
TinyBrowser.Free;
TinyBrowser := nil;
end;
FreeAndNil(TinyBrowser);
end;
constructor TTinyBrowser2.Create;
@@ -120,10 +135,7 @@ end;
destructor TTinyBrowser2.Destroy;
begin
if (FChromium <> nil) then
begin
FChromium.Free;
FChromium := nil;
end;
FreeAndNil(FChromium);
inherited Destroy;
end;
@@ -145,6 +157,14 @@ begin
FChromium.CreateBrowser(TempHandle, TempRect, 'Tiny Browser 2', nil, nil, True);
end;
function TTinyBrowser2.GetClient : ICefClient;
begin
if (FChromium <> nil) then
Result := FChromium.CefClient
else
Result := nil;
end;
procedure TTinyBrowser2.Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
begin
GlobalCEFApp.QuitMessageLoop;

View File

@@ -50,6 +50,8 @@ type
private
FChromium : TChromiumCore;
function GetClient : ICefClient;
procedure Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure Chromium_OnOpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
@@ -58,6 +60,8 @@ type
constructor Create;
destructor Destroy; override;
procedure AfterConstruction; override;
property Client : ICefClient read GetClient;
end;
procedure CreateGlobalCEFApp;
@@ -83,35 +87,61 @@ implementation
// message loop.
uses
xlib,
uCEFApplication, uCEFConstants, uCEFMiscFunctions;
var
TinyBrowser : TTinyBrowser2 = nil;
function CustomX11ErrorHandler(Display:PDisplay; ErrorEv:PXErrorEvent):longint;cdecl;
begin
{$IFDEF DEBUG}
XError := ErrorEv^.error_code;
WriteLn('Error: ' + IntToStr(XError));
{$ENDIF}
Result := 0;
end;
function CustomXIOErrorHandler(Display:PDisplay):longint;cdecl;
begin
Result := 0;
end;
procedure GlobalCEFApp_OnContextInitialized;
begin
TinyBrowser := TTinyBrowser2.Create;
end;
procedure GlobalCEFApp_OnGetDefaultClient(var aClient : ICefClient);
begin
aClient := TinyBrowser.Client;
end;
procedure CreateGlobalCEFApp;
begin
// Install xlib error handlers so that the application won't be terminated
// on non-fatal errors. Must be done after initializing GTK.
XSetErrorHandler(@CustomX11ErrorHandler);
XSetIOErrorHandler(@CustomXIOErrorHandler);
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.MultiThreadedMessageLoop := False;
GlobalCEFApp.ExternalMessagePump := False;
//GlobalCEFApp.ChromeRuntime := True; // Enable this line to enable the "ChromeRuntime" mode. It's in experimental state.
GlobalCEFApp.cache := 'cache';
GlobalCEFApp.DisableZygote := True;
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
GlobalCEFApp.OnGetDefaultClient := GlobalCEFApp_OnGetDefaultClient; // This event is only used in "ChromeRuntime" mode
// Add a debug log in the BIN directory
GlobalCEFApp.LogFile := 'cef.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
//GlobalCEFApp.LogFile := 'cef.log';
//GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
end;
procedure DestroyTinyBrowser;
begin
if (TinyBrowser <> nil) then
begin
TinyBrowser.Free;
TinyBrowser := nil;
end;
FreeAndNil(TinyBrowser);
end;
constructor TTinyBrowser2.Create;
@@ -146,6 +176,14 @@ begin
FChromium.CreateBrowser(TempHandle, TempRect, 'Tiny Browser 2', nil, nil, True);
end;
function TTinyBrowser2.GetClient : ICefClient;
begin
if (FChromium <> nil) then
Result := FChromium.CefClient
else
Result := nil;
end;
procedure TTinyBrowser2.Chromium_OnBeforeClose(Sender: TObject;
const browser: ICefBrowser);
begin

View File

@@ -21,7 +21,7 @@
</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."/>
<License Value="MPL 1.1"/>
<Version Major="90" Minor="5" Release="5"/>
<Version Major="90" Minor="5" Release="7"/>
<Files Count="201">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@@ -66,13 +66,13 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 90;
CEF_SUPPORTED_VERSION_MINOR = 5;
CEF_SUPPORTED_VERSION_RELEASE = 5;
CEF_SUPPORTED_VERSION_RELEASE = 7;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 90;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 4430;
CEF_CHROMEELF_VERSION_BUILD = 72;
CEF_CHROMEELF_VERSION_BUILD = 85;
{$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll';

View File

@@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 281,
"InternalVersion" : 282,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "90.5.5.0"
"Version" : "90.5.7.0"
}
],
"UpdatePackageData" : {