1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-11-23 21:34:53 +02:00

Update to CEF 93.1.11

Fixed issue #378  in the VCL demos
This commit is contained in:
Salvador Díaz Fau
2021-09-05 10:49:20 +02:00
parent b3f388709a
commit 83a75c985a
26 changed files with 396 additions and 624 deletions

View File

@@ -64,15 +64,15 @@ uses
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
const
CEF_SUPPORTED_VERSION_MAJOR = 92;
CEF_SUPPORTED_VERSION_MINOR = 0;
CEF_SUPPORTED_VERSION_RELEASE = 27;
CEF_SUPPORTED_VERSION_MAJOR = 93;
CEF_SUPPORTED_VERSION_MINOR = 1;
CEF_SUPPORTED_VERSION_RELEASE = 11;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 92;
CEF_CHROMEELF_VERSION_MAJOR = 93;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 4515;
CEF_CHROMEELF_VERSION_BUILD = 159;
CEF_CHROMEELF_VERSION_RELEASE = 4577;
CEF_CHROMEELF_VERSION_BUILD = 63;
{$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll';
@@ -187,6 +187,7 @@ type
FDisableRequestHandlingForTesting : boolean;
FDisablePopupBlocking : boolean;
FDisableBackForwardCache : boolean;
FDisableComponentUpdate : boolean;
// Fields used during the CEF initialization
FWindowsSandboxInfo : pointer;
@@ -213,7 +214,6 @@ type
FMustCreateLoadHandler : boolean;
FStatus : TCefAplicationStatus;
FMissingLibFiles : string;
FWidevinePath : ustring;
FMustFreeLibrary : boolean;
FLastErrorMessage : ustring;
@@ -248,9 +248,6 @@ type
FOnFocusedNodeChanged : TOnFocusedNodeChangedEvent;
FOnProcessMessageReceived : TOnProcessMessageReceivedEvent;
// ICefRegisterCDMCallback
FOnCDMRegistrationComplete : TOnCDMRegistrationCompleteEvent;
// ICefLoadHandler
FOnLoadingStateChange : TOnRenderLoadingStateChange;
FOnLoadStart : TOnRenderLoadStart;
@@ -359,7 +356,6 @@ type
function CheckCEFDLL : boolean;
{$ENDIF}
function CheckCEFLibrary : boolean;
procedure RegisterWidevineCDM;
procedure ShowErrorMessageDlg(const aError : string); virtual;
function ParseProcessType : TCefProcessType;
procedure AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); virtual;
@@ -403,7 +399,6 @@ type
procedure Internal_OnUncaughtException(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace);
procedure Internal_OnFocusedNodeChanged(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode);
procedure Internal_OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const aMessage: ICefProcessMessage; var aHandled : boolean);
procedure Internal_OnCDMRegistrationComplete(result : TCefCDMRegistrationError; const error_message : ustring);
procedure Internal_OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
procedure Internal_OnLoadStart(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType);
procedure Internal_OnLoadEnd(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer);
@@ -499,6 +494,7 @@ type
property DisableRequestHandlingForTesting : boolean read FDisableRequestHandlingForTesting write FDisableRequestHandlingForTesting; // --disable-request-handling-for-testing
property DisablePopupBlocking : boolean read FDisablePopupBlocking write FDisablePopupBlocking; // --disable-popup-blocking
property DisableBackForwardCache : boolean read FDisableBackForwardCache write FDisableBackForwardCache; // --disable-back-forward-cache
property DisableComponentUpdate : boolean read FDisableComponentUpdate write FDisableComponentUpdate; // --disable-component-update
// Properties used during the CEF initialization
property WindowsSandboxInfo : Pointer read FWindowsSandboxInfo write FWindowsSandboxInfo;
@@ -533,7 +529,6 @@ type
property OsmodalLoop : boolean write SetOsmodalLoop;
property Status : TCefAplicationStatus read FStatus;
property MissingLibFiles : string read FMissingLibFiles;
property WidevinePath : ustring read FWidevinePath write FWidevinePath;
property MustFreeLibrary : boolean read FMustFreeLibrary write FMustFreeLibrary;
property ChildProcessesCount : integer read GetChildProcessesCount;
property UsedMemory : uint64 read GetUsedMemory;
@@ -572,9 +567,6 @@ type
property OnFocusedNodeChanged : TOnFocusedNodeChangedEvent read FOnFocusedNodeChanged write FOnFocusedNodeChanged;
property OnProcessMessageReceived : TOnProcessMessageReceivedEvent read FOnProcessMessageReceived write FOnProcessMessageReceived;
// ICefRegisterCDMCallback
property OnCDMRegistrationComplete : TOnCDMRegistrationCompleteEvent read FOnCDMRegistrationComplete write FOnCDMRegistrationComplete;
// ICefLoadHandler
property OnLoadingStateChange : TOnRenderLoadingStateChange read FOnLoadingStateChange write FOnLoadingStateChange;
property OnLoadStart : TOnRenderLoadStart read FOnLoadStart write FOnLoadStart;
@@ -642,8 +634,8 @@ uses
{$ENDIF}
{$ENDIF}
uCEFLibFunctions, uCEFMiscFunctions, uCEFCommandLine, uCEFConstants,
uCEFSchemeHandlerFactory, uCEFCookieManager, uCEFApp, uCEFRegisterCDMCallback,
uCEFCompletionCallback, uCEFWaitableEvent;
uCEFSchemeHandlerFactory, uCEFCookieManager, uCEFApp, uCEFCompletionCallback,
uCEFWaitableEvent;
procedure DestroyGlobalCEFApp;
begin
@@ -746,6 +738,7 @@ begin
FDisableRequestHandlingForTesting := False;
FDisablePopupBlocking := False;
FDisableBackForwardCache := False;
FDisableComponentUpdate := False;
// Fields used during the CEF initialization
FWindowsSandboxInfo := nil;
@@ -775,7 +768,6 @@ begin
FMustCreateLoadHandler := False;
FStatus := asLoading;
FMissingLibFiles := '';
FWidevinePath := '';
FMustFreeLibrary := False;
FLastErrorMessage := '';
{$IFDEF MSWINDOWS}
@@ -815,9 +807,6 @@ begin
FOnFocusedNodeChanged := nil;
FOnProcessMessageReceived := nil;
// ICefRegisterCDMCallback
FOnCDMRegistrationComplete := nil;
// ICefLoadHandler
FOnLoadingStateChange := nil;
FOnLoadStart := nil;
@@ -1382,8 +1371,6 @@ begin
if FDeleteCache then
RenameAndDeleteDir(FCache, True);
RegisterWidevineCDM;
InitializeSettings(FAppSettings);
{$IFDEF MSWINDOWS}
@@ -1517,29 +1504,6 @@ begin
end;
end;
procedure TCefApplicationCore.RegisterWidevineCDM;
var
TempPath : TCefString;
TempCallback : ICefRegisterCDMCallback;
begin
try
try
if FLibLoaded and (length(FWidevinePath) > 0) and DirectoryExists(FWidevinePath) then
begin
TempPath := CefString(FWidevinePath);
TempCallback := TCefCustomRegisterCDMCallback.Create(self);
cef_register_widevine_cdm(@TempPath, TempCallback.Wrap);
end;
except
on e : exception do
if CustomExceptionHandler('TCefApplicationCore.RegisterWidevineCDM', e) then raise;
end;
finally
TempCallback := nil;
end;
end;
procedure TCefApplicationCore.ShowErrorMessageDlg(const aError : string);
begin
OutputDebugMessage(aError);
@@ -1704,12 +1668,6 @@ begin
aHandled := False;
end;
procedure TCefApplicationCore.Internal_OnCDMRegistrationComplete(result : TCefCDMRegistrationError; const error_message : ustring);
begin
if assigned(FOnCDMRegistrationComplete) then
FOnCDMRegistrationComplete(result, error_message);
end;
procedure TCefApplicationCore.Internal_OnLoadingStateChange(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
begin
if assigned(FOnLoadingStateChange) then
@@ -2067,6 +2025,9 @@ begin
if FDisableBackForwardCache then
ReplaceSwitch(aKeys, aValues, '--disable-back-forward-cache');
if FDisableComponentUpdate then
ReplaceSwitch(aKeys, aValues, '--disable-component-update');
// 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
@@ -2892,14 +2853,12 @@ begin
{$IFDEF FPC}Pointer({$ENDIF}cef_unregister_internal_web_plugin{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_unregister_internal_web_plugin');
{$IFDEF FPC}Pointer({$ENDIF}cef_register_web_plugin_crash{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_web_plugin_crash');
{$IFDEF FPC}Pointer({$ENDIF}cef_is_web_plugin_unstable{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_is_web_plugin_unstable');
{$IFDEF FPC}Pointer({$ENDIF}cef_register_widevine_cdm{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_widevine_cdm');
Result := assigned(cef_visit_web_plugin_info) and
assigned(cef_refresh_web_plugins) and
assigned(cef_unregister_internal_web_plugin) and
assigned(cef_register_web_plugin_crash) and
assigned(cef_is_web_plugin_unstable) and
assigned(cef_register_widevine_cdm);
assigned(cef_is_web_plugin_unstable);
end;
function TCefApplicationCore.Load_cef_xml_reader_capi_h : boolean;

View File

@@ -399,6 +399,7 @@ const
EVENTFLAG_IS_LEFT = 1 shl 10;
EVENTFLAG_IS_RIGHT = 1 shl 11;
EVENTFLAG_ALTGR_DOWN = 1 shl 12;
EVENTFLAG_IS_REPEAT = 1 shl 13;
// /include/internal/cef_types.h (cef_drag_operations_mask_t)
DRAG_OPERATION_NONE = 0;

View File

@@ -215,7 +215,6 @@ type
TOnGetDataResourceEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnGetLocalizedStringEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(stringId: Integer; out stringVal: ustring; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnGetDataResourceForScaleEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; scaleFactor: TCefScaleFactor; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnCDMRegistrationCompleteEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(result : TCefCDMRegistrationError; const error_message : ustring) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnRenderLoadStart = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnRenderLoadEnd = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnRenderLoadError = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
@@ -229,7 +228,6 @@ type
TCefEndTracingCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const tracingFile: ustring);
TCefRegisterCDMProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(result: TCefCDMRegistrationError; const error_message: ustring);
TCefFastTaskProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure();
TCefv8ArrayBufferReleaseCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(buffer : Pointer);
TCefWebPluginInfoVisitorProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} function(const info: ICefWebPluginInfo; count, total: Integer): Boolean;
@@ -2164,13 +2162,6 @@ type
procedure IsUnstable(const path: ustring; unstable: Boolean);
end;
// TCefRegisterCDMCallback
// /include/capi/cef_web_plugin_capi.h (cef_register_cdm_callback_t)
ICefRegisterCDMCallback = interface(ICefBaseRefCounted)
['{6C39AB3B-F724-483F-ABA0-37F6E0AECF35}']
procedure OnCDMRegistrationComplete(result: TCefCDMRegistrationError; const error_message: ustring);
end;
// TCefEndTracingCallback
// /include/capi/cef_trace_capi.h (cef_end_tracing_callback_t)
ICefEndTracingCallback = interface(ICefBaseRefCounted)

View File

@@ -237,7 +237,6 @@ var
cef_unregister_internal_web_plugin : procedure(const path: PCefString); cdecl;
cef_register_web_plugin_crash : procedure(const path: PCefString); cdecl;
cef_is_web_plugin_unstable : procedure(const path: PCefString; callback: PCefWebPluginUnstableCallback); cdecl;
cef_register_widevine_cdm : procedure(const path: PCefString; callback: PCefRegisterCDMCallback); cdecl;
// /include/capi/cef_xml_reader_capi.h
cef_xml_reader_create : function(stream: PCefStreamReader; encodingType: TCefXmlEncodingType; const URI: PCefString): PCefXmlReader; cdecl;

View File

@@ -74,8 +74,7 @@ uses
{$IFDEF LCLGTK2}gtk2, glib2, gdk2, gtk2proc, gtk2int, Gtk2Def, gdk2x, Gtk2Extra,{$ENDIF}
{$ENDIF}{$ENDIF}
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
uCEFRegisterCDMCallback, uCEFConstants;
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler, uCEFConstants;
const
Kernel32DLL = 'kernel32.dll';
@@ -1921,7 +1920,8 @@ begin
case aWparam of
VK_RETURN:
if (((aLparam shr 16) and KF_EXTENDED) <> 0) then Result := Result or EVENTFLAG_IS_KEY_PAD;
if (((aLparam shr 16) and KF_EXTENDED) <> 0) then
Result := Result or EVENTFLAG_IS_KEY_PAD;
VK_INSERT,
VK_DELETE,
@@ -1933,7 +1933,8 @@ begin
VK_DOWN,
VK_LEFT,
VK_RIGHT :
if (((aLparam shr 16) and KF_EXTENDED) = 0) then Result := Result or EVENTFLAG_IS_KEY_PAD;
if (((aLparam shr 16) and KF_EXTENDED) = 0) then
Result := Result or EVENTFLAG_IS_KEY_PAD;
VK_NUMLOCK,
VK_NUMPAD0,

View File

@@ -1,176 +0,0 @@
// ************************************************************************
// ***************************** 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 � 2021 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 uCEFRegisterCDMCallback;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
{$I cef.inc}
interface
uses
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFApplicationCore;
type
TCefRegisterCDMCallbackOwn = class(TCefBaseRefCountedOwn, ICefRegisterCDMCallback)
protected
procedure OnCDMRegistrationComplete(result: TCefCDMRegistrationError; const error_message: ustring); virtual;
public
constructor Create; virtual;
end;
TCefFastRegisterCDMCallback = class(TCefRegisterCDMCallbackOwn)
protected
FCallback: TCefRegisterCDMProc;
procedure OnCDMRegistrationComplete(result: TCefCDMRegistrationError; const error_message: ustring); override;
public
constructor Create(const callback: TCefRegisterCDMProc); reintroduce;
end;
TCefCustomRegisterCDMCallback = class(TCefRegisterCDMCallbackOwn)
protected
FCefApp : TCefApplicationCore;
procedure OnCDMRegistrationComplete(result: TCefCDMRegistrationError; const error_message: ustring); override;
public
constructor Create(const aCefApp : TCefApplicationCore); reintroduce;
destructor Destroy; override;
end;
implementation
uses
{$IFDEF DELPHI16_UP}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF}
uCEFMiscFunctions, uCEFLibFunctions;
// ************************************************
// ********** TCefRegisterCDMCallbackOwn **********
// ************************************************
procedure cef_register_cdm_callback_on_cdm_registration_complete( self : PCefRegisterCDMCallback;
result : TCefCDMRegistrationError;
const error_message : PCefString); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefRegisterCDMCallbackOwn) then
TCefRegisterCDMCallbackOwn(TempObject).OnCDMRegistrationComplete(result,
CefString(error_message));
end;
constructor TCefRegisterCDMCallbackOwn.Create;
begin
inherited CreateData(SizeOf(TCefRegisterCDMCallback));
with PCefRegisterCDMCallback(FData)^ do
on_cdm_registration_complete := {$IFDEF FPC}@{$ENDIF}cef_register_cdm_callback_on_cdm_registration_complete;
end;
procedure TCefRegisterCDMCallbackOwn.OnCDMRegistrationComplete(result: TCefCDMRegistrationError;
const error_message: ustring);
begin
//
end;
// ************************************************
// ********** TCefFastRegisterCDMCallback *********
// ************************************************
constructor TCefFastRegisterCDMCallback.Create(const callback: TCefRegisterCDMProc);
begin
FCallback := callback;
end;
procedure TCefFastRegisterCDMCallback.OnCDMRegistrationComplete(result: TCefCDMRegistrationError;
const error_message: ustring);
begin
FCallback(result, error_message);
end;
// ************************************************
// ******** TCefCustomRegisterCDMCallback *********
// ************************************************
constructor TCefCustomRegisterCDMCallback.Create(const aCefApp : TCefApplicationCore);
begin
inherited Create;
FCefApp := aCefApp;
end;
destructor TCefCustomRegisterCDMCallback.Destroy;
begin
FCefApp := nil;
inherited Destroy;
end;
procedure TCefCustomRegisterCDMCallback.OnCDMRegistrationComplete( result : TCefCDMRegistrationError;
const error_message : ustring);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnCDMRegistrationComplete(result, error_message);
except
on e : exception do
if CustomExceptionHandler('TCefCustomRegisterCDMCallback.OnCDMRegistrationComplete', e) then raise;
end;
end;
end.

View File

@@ -203,7 +203,6 @@ type
PCefUrlRequest = ^TCefUrlRequest;
PCefWebPluginInfoVisitor = ^TCefWebPluginInfoVisitor;
PCefWebPluginUnstableCallback = ^TCefWebPluginUnstableCallback;
PCefRegisterCDMCallback = ^TCefRegisterCDMCallback;
PCefTaskRunner = ^TCefTaskRunner;
PCefEndTracingCallback = ^TCefEndTracingCallback;
PCefRequestContextSettings = ^TCefRequestContextSettings;
@@ -1146,14 +1145,6 @@ type
CEF_MENU_COLOR_COUNT
);
// /include/internal/cef_types.h (cef_cdm_registration_error_t)
TCefCDMRegistrationError = (
CEF_CDM_REGISTRATION_ERROR_NONE,
CEF_CDM_REGISTRATION_ERROR_INCORRECT_CONTENTS,
CEF_CDM_REGISTRATION_ERROR_INCOMPATIBLE,
CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED
);
// Values for browser preference "net.network_prediction_options"
// https://source.chromium.org/chromium/chromium/src/+/master:chrome/browser/net/prediction_options.h
TCefNetworkPredictionOptions = (
@@ -1920,12 +1911,6 @@ type
is_unstable : procedure(self: PCefWebPluginUnstableCallback; const path: PCefString; unstable: Integer); stdcall;
end;
// /include/capi/cef_web_plugin_capi.h (cef_register_cdm_callback_t)
TCefRegisterCDMCallback = record
base : TCefBaseRefCounted;
on_cdm_registration_complete : procedure(self:PCefRegisterCDMCallback; result: TCefCDMRegistrationError; const error_message: PCefString); stdcall;
end;
// /include/capi/cef_thread_capi.h (cef_thread_t)
TCefThread = record
base : TCefBaseRefCounted;