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

Update to CEF 113.3.1

This commit is contained in:
salvadordf
2023-05-29 17:20:32 +02:00
parent 42d8ba4f85
commit 9e7da7a03e
11 changed files with 101 additions and 40 deletions

View File

@@ -64,6 +64,7 @@ type
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
function GetChromeToolbarType: TCefChromeToolbarType;
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
public
class function UnWrap(data: Pointer): ICefBrowserViewDelegate;
@@ -76,6 +77,7 @@ type
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); virtual;
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); virtual;
function GetChromeToolbarType: TCefChromeToolbarType; virtual;
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); virtual;
procedure InitializeCEFMethods; override;
@@ -105,6 +107,7 @@ type
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); override;
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); override;
function GetChromeToolbarType: TCefChromeToolbarType; override;
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); override;
public
constructor Create(const events: ICefBrowserViewDelegateEvents); reintroduce;
@@ -165,6 +168,15 @@ begin
Result := PCefBrowserViewDelegate(FData)^.get_chrome_toolbar_type(PCefBrowserViewDelegate(FData));
end;
procedure TCefBrowserViewDelegateRef.OnGestureCommand(const browser_view : ICefBrowserView;
gesture_command : TCefGestureCommand;
var aResult : boolean);
begin
aResult := (PCefBrowserViewDelegate(FData)^.on_gesture_command(PCefBrowserViewDelegate(FData),
CefGetData(browser_view),
gesture_command) <> 0);
end;
class function TCefBrowserViewDelegateRef.UnWrap(data: Pointer): ICefBrowserViewDelegate;
begin
if (data <> nil) then
@@ -257,6 +269,24 @@ begin
Result := TCefBrowserViewDelegateOwn(TempObject).GetChromeToolbarType();
end;
function cef_browserview_delegate_on_gesture_command(self : PCefBrowserViewDelegate;
browser_view : PCefBrowserView;
gesture_command : TCefGestureCommand): Integer; stdcall;
var
TempObject : TObject;
TempResult : boolean;
begin
TempObject := CefGetObject(self);
TempResult := False;
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
TCefBrowserViewDelegateOwn(TempObject).OnGestureCommand(TCefBrowserViewRef.UnWrap(browser_view),
gesture_command,
TempResult);
Result := ord(TempResult);
end;
constructor TCefBrowserViewDelegateOwn.Create;
begin
inherited CreateData(SizeOf(TCefBrowserViewDelegate));
@@ -275,6 +305,7 @@ begin
get_delegate_for_popup_browser_view := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_delegate_for_popup_browser_view;
on_popup_browser_view_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_popup_browser_view_created;
get_chrome_toolbar_type := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_chrome_toolbar_type;
on_gesture_command := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_gesture_command;
end;
end;
@@ -303,6 +334,11 @@ begin
Result := CEF_CTT_NONE;
end;
procedure TCefBrowserViewDelegateOwn.OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
begin
//
end;
// **************************************************************
// **************** TCustomBrowserViewDelegate ******************
@@ -482,5 +518,18 @@ begin
end;
end;
procedure TCustomBrowserViewDelegate.OnGestureCommand(const browser_view : ICefBrowserView;
gesture_command : TCefGestureCommand;
var aResult : boolean);
begin
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGestureCommand(browser_view, gesture_command, aResult);
except
on e : exception do
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGestureCommand', e) then raise;
end;
end;
end.