2020-04-29 19:14:44 +02:00
|
|
|
unit uCEFBrowserViewDelegate;
|
|
|
|
|
|
|
|
{$IFDEF FPC}
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
{$I cef.inc}
|
|
|
|
|
2022-02-19 18:56:41 +01:00
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
|
|
{$MINENUMSIZE 4}
|
|
|
|
|
2020-04-29 19:14:44 +02:00
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
{$IFDEF DELPHI16_UP}
|
|
|
|
System.Classes, System.SysUtils,
|
|
|
|
{$ELSE}
|
|
|
|
Classes, SysUtils,
|
|
|
|
{$ENDIF}
|
|
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFViewDelegate;
|
|
|
|
|
|
|
|
type
|
|
|
|
TCefBrowserViewDelegateRef = class(TCefViewDelegateRef, ICefBrowserViewDelegate)
|
|
|
|
protected
|
|
|
|
procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser);
|
|
|
|
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
|
2020-05-05 18:10:33 +02:00
|
|
|
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);
|
2023-09-24 11:21:05 +02:00
|
|
|
procedure OnGetChromeToolbarType(var aResult: TCefChromeToolbarType);
|
|
|
|
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
|
2023-05-29 17:20:32 +02:00
|
|
|
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
|
2020-04-29 19:14:44 +02:00
|
|
|
|
|
|
|
public
|
|
|
|
class function UnWrap(data: Pointer): ICefBrowserViewDelegate;
|
|
|
|
end;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
TCefBrowserViewDelegateOwn = class(TCefViewDelegateOwn, ICefBrowserViewDelegate)
|
|
|
|
protected
|
|
|
|
procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual;
|
|
|
|
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual;
|
|
|
|
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;
|
2023-09-24 11:21:05 +02:00
|
|
|
procedure OnGetChromeToolbarType(var aResult: TCefChromeToolbarType); virtual;
|
|
|
|
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean); virtual;
|
2023-05-29 17:20:32 +02:00
|
|
|
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); virtual;
|
2020-05-05 18:10:33 +02:00
|
|
|
|
|
|
|
procedure InitializeCEFMethods; override;
|
|
|
|
|
|
|
|
public
|
|
|
|
constructor Create; override;
|
|
|
|
end;
|
|
|
|
|
|
|
|
TCustomBrowserViewDelegate = class(TCefBrowserViewDelegateOwn)
|
|
|
|
protected
|
|
|
|
FEvents : Pointer;
|
|
|
|
|
|
|
|
// ICefViewDelegate
|
|
|
|
procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize); override;
|
|
|
|
procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize); override;
|
|
|
|
procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize); override;
|
|
|
|
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
|
|
|
|
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
|
|
|
|
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
|
2021-04-18 19:36:20 +02:00
|
|
|
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
|
2021-09-27 12:04:33 +02:00
|
|
|
procedure OnLayoutChanged(const view: ICefView; new_bounds: TCefRect); override;
|
2020-05-05 18:10:33 +02:00
|
|
|
procedure OnFocus(const view: ICefView); override;
|
|
|
|
procedure OnBlur(const view: ICefView); override;
|
|
|
|
|
|
|
|
// ICefBrowserViewDelegate
|
|
|
|
procedure OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser); override;
|
|
|
|
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); override;
|
|
|
|
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;
|
2023-09-24 11:21:05 +02:00
|
|
|
procedure OnGetChromeToolbarType(var aResult: TCefChromeToolbarType); override;
|
|
|
|
procedure OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean); override;
|
2023-05-29 17:20:32 +02:00
|
|
|
procedure OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean); override;
|
2020-05-05 18:10:33 +02:00
|
|
|
|
|
|
|
public
|
|
|
|
constructor Create(const events: ICefBrowserViewDelegateEvents); reintroduce;
|
|
|
|
end;
|
|
|
|
|
2020-04-29 19:14:44 +02:00
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
2021-04-18 19:36:20 +02:00
|
|
|
uCEFLibFunctions, uCEFMiscFunctions, uCEFBrowserView, uCEFBrowser, uCEFClient, uCEFConstants;
|
2020-05-05 18:10:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
// **************************************************************
|
|
|
|
// **************** TCefBrowserViewDelegateRef ******************
|
|
|
|
// **************************************************************
|
2020-04-29 19:14:44 +02:00
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateRef.OnBrowserCreated(const browser_view : ICefBrowserView;
|
|
|
|
const browser : ICefBrowser);
|
|
|
|
begin
|
|
|
|
PCefBrowserViewDelegate(FData)^.on_browser_created(PCefBrowserViewDelegate(FData),
|
|
|
|
CefGetData(browser_view),
|
|
|
|
CefGetData(browser));
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateRef.OnBrowserDestroyed(const browser_view : ICefBrowserView;
|
|
|
|
const browser : ICefBrowser);
|
|
|
|
begin
|
|
|
|
PCefBrowserViewDelegate(FData)^.on_browser_destroyed(PCefBrowserViewDelegate(FData),
|
|
|
|
CefGetData(browser_view),
|
|
|
|
CefGetData(browser));
|
|
|
|
end;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
procedure TCefBrowserViewDelegateRef.OnGetDelegateForPopupBrowserView(const browser_view : ICefBrowserView;
|
|
|
|
const settings : TCefBrowserSettings;
|
|
|
|
const client : ICefClient;
|
|
|
|
is_devtools : boolean;
|
|
|
|
var aResult : ICefBrowserViewDelegate);
|
2020-04-29 19:14:44 +02:00
|
|
|
begin
|
2020-05-05 18:10:33 +02:00
|
|
|
aResult := UnWrap((PCefBrowserViewDelegate(FData)^.get_delegate_for_popup_browser_view(PCefBrowserViewDelegate(FData),
|
|
|
|
CefGetData(browser_view),
|
|
|
|
@settings,
|
|
|
|
CefGetData(client),
|
|
|
|
ord(is_devtools))));
|
2020-04-29 19:14:44 +02:00
|
|
|
end;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
procedure TCefBrowserViewDelegateRef.OnPopupBrowserViewCreated(const browser_view : ICefBrowserView;
|
|
|
|
const popup_browser_view : ICefBrowserView;
|
|
|
|
is_devtools : boolean;
|
|
|
|
var aResult : boolean);
|
2020-04-29 19:14:44 +02:00
|
|
|
begin
|
2020-05-05 18:10:33 +02:00
|
|
|
aResult := (PCefBrowserViewDelegate(FData)^.on_popup_browser_view_created(PCefBrowserViewDelegate(FData),
|
|
|
|
CefGetData(browser_view),
|
|
|
|
CefGetData(popup_browser_view),
|
|
|
|
ord(is_devtools)) <> 0);
|
2020-04-29 19:14:44 +02:00
|
|
|
end;
|
|
|
|
|
2023-09-24 11:21:05 +02:00
|
|
|
procedure TCefBrowserViewDelegateRef.OnGetChromeToolbarType(var aResult : TCefChromeToolbarType);
|
2021-04-18 19:36:20 +02:00
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
aResult := PCefBrowserViewDelegate(FData)^.get_chrome_toolbar_type(PCefBrowserViewDelegate(FData));
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateRef.OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
|
|
|
|
begin
|
|
|
|
aResult := (PCefBrowserViewDelegate(FData)^.use_frameless_window_for_picture_in_picture(PCefBrowserViewDelegate(FData),
|
|
|
|
CefGetData(browser_view)) <> 0);
|
2021-04-18 19:36:20 +02:00
|
|
|
end;
|
|
|
|
|
2023-05-29 17:20:32 +02:00
|
|
|
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;
|
|
|
|
|
2020-04-29 19:14:44 +02:00
|
|
|
class function TCefBrowserViewDelegateRef.UnWrap(data: Pointer): ICefBrowserViewDelegate;
|
|
|
|
begin
|
|
|
|
if (data <> nil) then
|
|
|
|
Result := Create(data) as ICefBrowserViewDelegate
|
|
|
|
else
|
|
|
|
Result := nil;
|
|
|
|
end;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
|
|
|
|
// **************************************************************
|
|
|
|
// **************** TCefBrowserViewDelegateOwn ******************
|
|
|
|
// **************************************************************
|
|
|
|
|
|
|
|
procedure cef_browserview_delegate_on_browser_created(self : PCefBrowserViewDelegate;
|
|
|
|
browser_view : PCefBrowserView;
|
|
|
|
browser : PCefBrowser); stdcall;
|
|
|
|
var
|
|
|
|
TempObject : TObject;
|
|
|
|
begin
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
|
|
|
|
TCefBrowserViewDelegateOwn(TempObject).OnBrowserCreated(TCefBrowserViewRef.UnWrap(browser_view),
|
|
|
|
TCefBrowserRef.UnWrap(browser));
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure cef_browserview_delegate_on_browser_destroyed(self : PCefBrowserViewDelegate;
|
|
|
|
browser_view : PCefBrowserView;
|
|
|
|
browser : PCefBrowser); stdcall;
|
|
|
|
var
|
|
|
|
TempObject : TObject;
|
|
|
|
begin
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
|
|
|
|
TCefBrowserViewDelegateOwn(TempObject).OnBrowserDestroyed(TCefBrowserViewRef.UnWrap(browser_view),
|
|
|
|
TCefBrowserRef.UnWrap(browser));
|
|
|
|
end;
|
|
|
|
|
|
|
|
function cef_browserview_delegate_get_delegate_for_popup_browser_view( self : PCefBrowserViewDelegate;
|
|
|
|
browser_view : PCefBrowserView;
|
|
|
|
const settings : PCefBrowserSettings;
|
|
|
|
client : PCefClient;
|
|
|
|
is_devtools : Integer): PCefBrowserViewDelegate; stdcall;
|
|
|
|
var
|
|
|
|
TempObject : TObject;
|
|
|
|
TempDelegate : ICefBrowserViewDelegate;
|
|
|
|
begin
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
TempDelegate := nil;
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
|
|
|
|
TCefBrowserViewDelegateOwn(TempObject).OnGetDelegateForPopupBrowserView(TCefBrowserViewRef.UnWrap(browser_view),
|
|
|
|
settings^,
|
|
|
|
TCefClientRef.UnWrap(client),
|
|
|
|
is_devtools <> 0,
|
|
|
|
TempDelegate);
|
|
|
|
|
|
|
|
Result := CefGetData(TempDelegate);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function cef_browserview_delegate_on_popup_browser_view_created(self : PCefBrowserViewDelegate;
|
|
|
|
browser_view : PCefBrowserView;
|
|
|
|
popup_browser_view : PCefBrowserView;
|
|
|
|
is_devtools : Integer): Integer; stdcall;
|
|
|
|
var
|
|
|
|
TempObject : TObject;
|
|
|
|
TempResult : boolean;
|
|
|
|
begin
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
TempResult := False;
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
|
|
|
|
TCefBrowserViewDelegateOwn(TempObject).OnPopupBrowserViewCreated(TCefBrowserViewRef.UnWrap(browser_view),
|
|
|
|
TCefBrowserViewRef.UnWrap(popup_browser_view),
|
|
|
|
is_devtools <> 0,
|
|
|
|
TempResult);
|
|
|
|
|
|
|
|
Result := ord(TempResult);
|
|
|
|
end;
|
|
|
|
|
2021-04-18 19:36:20 +02:00
|
|
|
function cef_browserview_delegate_get_chrome_toolbar_type(self : PCefBrowserViewDelegate): TCefChromeToolbarType; stdcall;
|
|
|
|
var
|
|
|
|
TempObject : TObject;
|
|
|
|
begin
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
Result := CEF_CTT_NONE;
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
|
2023-09-24 11:21:05 +02:00
|
|
|
TCefBrowserViewDelegateOwn(TempObject).OnGetChromeToolbarType(Result);
|
|
|
|
end;
|
|
|
|
|
|
|
|
function cef_browserview_delegate_use_frameless_window_for_picture_in_picture(self : PCefBrowserViewDelegate;
|
|
|
|
browser_view : PCefBrowserView): integer; stdcall;
|
|
|
|
var
|
|
|
|
TempObject : TObject;
|
|
|
|
TempResult : boolean;
|
|
|
|
begin
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
TempResult := False;
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
|
|
|
|
TCefBrowserViewDelegateOwn(TempObject).OnUseFramelessWindowForPictureInPicture(TCefBrowserViewRef.UnWrap(browser_view),
|
|
|
|
TempResult);
|
|
|
|
|
|
|
|
Result := ord(TempResult);
|
2021-04-18 19:36:20 +02:00
|
|
|
end;
|
|
|
|
|
2023-05-29 17:20:32 +02:00
|
|
|
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;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
constructor TCefBrowserViewDelegateOwn.Create;
|
|
|
|
begin
|
|
|
|
inherited CreateData(SizeOf(TCefBrowserViewDelegate));
|
|
|
|
|
|
|
|
InitializeCEFMethods;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateOwn.InitializeCEFMethods;
|
|
|
|
begin
|
|
|
|
inherited InitializeCEFMethods;
|
|
|
|
|
|
|
|
with PCefBrowserViewDelegate(FData)^ do
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
on_browser_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_created;
|
|
|
|
on_browser_destroyed := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_destroyed;
|
|
|
|
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;
|
|
|
|
use_frameless_window_for_picture_in_picture := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_use_frameless_window_for_picture_in_picture;
|
|
|
|
on_gesture_command := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_gesture_command;
|
2020-05-05 18:10:33 +02:00
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateOwn.OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser);
|
|
|
|
begin
|
|
|
|
//
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateOwn.OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
|
|
|
|
begin
|
|
|
|
//
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateOwn.OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
aResult := nil;
|
2020-05-05 18:10:33 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateOwn.OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
aResult := False;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCefBrowserViewDelegateOwn.OnGetChromeToolbarType(var aResult: TCefChromeToolbarType);
|
|
|
|
begin
|
|
|
|
aResult := CEF_CTT_NONE;
|
2020-05-05 18:10:33 +02:00
|
|
|
end;
|
|
|
|
|
2023-09-24 11:21:05 +02:00
|
|
|
procedure TCefBrowserViewDelegateOwn.OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
|
2021-04-18 19:36:20 +02:00
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
aResult := False;
|
2021-04-18 19:36:20 +02:00
|
|
|
end;
|
|
|
|
|
2023-05-29 17:20:32 +02:00
|
|
|
procedure TCefBrowserViewDelegateOwn.OnGestureCommand(const browser_view: ICefBrowserView; gesture_command: TCefGestureCommand; var aResult : boolean);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
aResult := False;
|
2023-05-29 17:20:32 +02:00
|
|
|
end;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
|
|
|
|
// **************************************************************
|
|
|
|
// **************** TCustomBrowserViewDelegate ******************
|
|
|
|
// **************************************************************
|
|
|
|
|
|
|
|
constructor TCustomBrowserViewDelegate.Create(const events: ICefBrowserViewDelegateEvents);
|
|
|
|
begin
|
|
|
|
inherited Create;
|
|
|
|
|
|
|
|
FEvents := Pointer(events);
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnGetPreferredSize(view, aResult);
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnGetPreferredSize(view, aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetPreferredSize', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnGetMinimumSize(view, aResult);
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnGetMinimumSize(view, aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetMinimumSize', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnGetMaximumSize(view, aResult);
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnGetMaximumSize(view, aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetMaximumSize', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnGetHeightForWidth(view, width, aResult);
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnGetHeightForWidth(view, width, aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetHeightForWidth', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnParentViewChanged(view, added, parent);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnParentViewChanged', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnChildViewChanged(view, added, child);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnChildViewChanged', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2021-04-18 19:36:20 +02:00
|
|
|
procedure TCustomBrowserViewDelegate.OnWindowChanged(const view: ICefView; added: boolean);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnWindowChanged(view, added);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnWindowChanged', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2021-09-27 12:04:33 +02:00
|
|
|
procedure TCustomBrowserViewDelegate.OnLayoutChanged(const view: ICefView; new_bounds: TCefRect);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnLayoutChanged(view, new_bounds);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnLayoutChanged', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
procedure TCustomBrowserViewDelegate.OnFocus(const view: ICefView);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnFocus(view);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnFocus', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnBlur(const view: ICefView);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnBlur(view);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnBlur', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnBrowserCreated(const browser_view: ICefBrowserView; const browser: ICefBrowser);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnBrowserCreated(browser_view, browser);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnBrowserCreated', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
|
|
|
|
begin
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnBrowserDestroyed(browser_view, browser);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnBrowserDestroyed', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnGetDelegateForPopupBrowserView(browser_view, settings, client, is_devtools, aResult);
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnGetDelegateForPopupBrowserView(browser_view, settings, client, is_devtools, aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetDelegateForPopupBrowserView', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
|
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnPopupBrowserViewCreated(browser_view, popup_browser_view, is_devtools, aResult);
|
|
|
|
|
2020-05-05 18:10:33 +02:00
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnPopupBrowserViewCreated(browser_view, popup_browser_view, is_devtools, aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnPopupBrowserViewCreated', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
2023-09-24 11:21:05 +02:00
|
|
|
procedure TCustomBrowserViewDelegate.OnGetChromeToolbarType(var aResult: TCefChromeToolbarType);
|
|
|
|
begin
|
|
|
|
inherited OnGetChromeToolbarType(aResult);
|
|
|
|
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnGetChromeToolbarType(aResult);
|
|
|
|
except
|
|
|
|
on e : exception do
|
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnGetChromeToolbarType', e) then raise;
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
|
|
procedure TCustomBrowserViewDelegate.OnUseFramelessWindowForPictureInPicture(const browser_view: ICefBrowserView; var aResult: boolean);
|
2021-04-18 19:36:20 +02:00
|
|
|
begin
|
2023-09-24 11:21:05 +02:00
|
|
|
inherited OnUseFramelessWindowForPictureInPicture(browser_view, aResult);
|
2021-04-18 19:36:20 +02:00
|
|
|
|
|
|
|
try
|
|
|
|
if (FEvents <> nil) then
|
2023-09-24 11:21:05 +02:00
|
|
|
ICefBrowserViewDelegateEvents(FEvents).doOnUseFramelessWindowForPictureInPicture(browser_view, aResult);
|
2021-04-18 19:36:20 +02:00
|
|
|
except
|
|
|
|
on e : exception do
|
2023-09-24 11:21:05 +02:00
|
|
|
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnUseFramelessWindowForPictureInPicture', e) then raise;
|
2021-04-18 19:36:20 +02:00
|
|
|
end;
|
|
|
|
end;
|
2020-05-05 18:10:33 +02:00
|
|
|
|
2023-05-29 17:20:32 +02:00
|
|
|
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;
|
|
|
|
|
2020-04-29 19:14:44 +02:00
|
|
|
end.
|
|
|
|
|