1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-01-03 10:15:38 +02:00

Update to CEF 81.3.1

This commit is contained in:
Salvador Díaz Fau 2020-04-30 17:28:41 +02:00
parent ee831e85bd
commit ccdb41b357
14 changed files with 615 additions and 80 deletions

View File

@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D
CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
CEF4Delphi uses CEF 81.2.25 which includes Chromium 81.0.4044.113.
CEF4Delphi uses CEF 81.3.1 which includes Chromium 81.0.4044.113.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.25%2Bg3afea62%2Bchromium-81.0.4044.113_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.2.25%2Bg3afea62%2Bchromium-81.0.4044.113_windows64.tar.bz2)
* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.3.1%2Bgb2b49f1%2Bchromium-81.0.4044.113_windows32.tar.bz2)
* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_81.3.1%2Bgb2b49f1%2Bchromium-81.0.4044.113_windows64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.3.3 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.8/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -125,13 +125,11 @@ object MediaRouterFrm: TMediaRouterFrm
object SourceURNLbl: TLabel
Left = 0
Top = 0
Width = 65
Height = 21
Width = 57
Height = 13
Align = alClient
Caption = 'Source URN'
Layout = tlCenter
ExplicitWidth = 57
ExplicitHeight = 13
end
end
object SourceURNCbx: TComboBox

View File

@ -569,6 +569,7 @@ begin
FSinks[i].ID := aSinks[i].ID;
FSinks[i].Name := aSinks[i].Name;
FSinks[i].Description := aSinks[i].Description;
FSinks[i].IconType := aSinks[i].IconType;
FSinks[i].Valid := aSinks[i].IsValid;
FSinks[i].SinkIntf := aSinks[i];
@ -683,6 +684,7 @@ end;
procedure TMediaRouterFrm.UpdateAvailableSinks;
var
i : integer;
TempItem : string;
begin
try
FMediaCS.Acquire;
@ -693,12 +695,27 @@ begin
i := 0;
while (i < length(FSinks)) do
begin
TempItem := FSinks[i].Name;
case FSinks[i].SinkType of
mtCast : SinksLbx.Items.Add(FSinks[i].Name + ' (CAST)');
mtDial : SinksLbx.Items.Add(FSinks[i].Name + ' (DIAL)');
else SinksLbx.Items.Add(FSinks[i].Name + ' (UNKNOWN)');
mtCast : TempItem := TempItem + ' (CAST';
mtDial : TempItem := TempItem + ' (DIAL';
else TempItem := TempItem + ' (UNKNOWN';
end;
case FSinks[i].IconType of
CEF_MSIT_CAST : TempItem := TempItem + ', CAST)';
CEF_MSIT_CAST_AUDIO_GROUP : TempItem := TempItem + ', CAST_AUDIO_GROUP)';
CEF_MSIT_CAST_AUDIO : TempItem := TempItem + ', CAST_AUDIO)';
CEF_MSIT_MEETING : TempItem := TempItem + ', MEETING)';
CEF_MSIT_HANGOUT : TempItem := TempItem + ', HANGOUT)';
CEF_MSIT_EDUCATION : TempItem := TempItem + ', EDUCATION)';
CEF_MSIT_WIRED_DISPLAY : TempItem := TempItem + ', WIRED_DISPLAY)';
CEF_MSIT_GENERIC : TempItem := TempItem + ', GENERIC)';
else TempItem := TempItem + ', UNKNOWN)';
end;
SinksLbx.Items.Add(TempItem);
inc(i);
end;
end;

View File

@ -22,19 +22,23 @@
<ResourceBaseClass Value="Form"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="553"/>
<CursorPos X="29" Y="49"/>
<TopLine Value="683"/>
<CursorPos X="73" Y="699"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit1>
</Units>
<JumpHistory Count="1">
<JumpHistory Count="2" HistoryIndex="1">
<Position1>
<Filename Value="MediaRouter.lpr"/>
<Caret Line="49" Column="11" TopLine="42"/>
</Position1>
<Position2>
<Filename Value="uMediaRouterFrm.pas"/>
<Caret Line="576" Column="50" TopLine="554"/>
</Position2>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>

View File

@ -565,6 +565,7 @@ begin
FSinks[i].ID := aSinks[i].ID;
FSinks[i].Name := aSinks[i].Name;
FSinks[i].Description := aSinks[i].Description;
FSinks[i].IconType := aSinks[i].IconType;
FSinks[i].Valid := aSinks[i].IsValid;
FSinks[i].SinkIntf := aSinks[i];
@ -679,6 +680,7 @@ end;
procedure TMediaRouterFrm.UpdateAvailableSinks;
var
i : integer;
TempItem : string;
begin
try
FMediaCS.Acquire;
@ -689,12 +691,27 @@ begin
i := 0;
while (i < length(FSinks)) do
begin
TempItem := FSinks[i].Name;
case FSinks[i].SinkType of
mtCast : SinksLbx.Items.Add(FSinks[i].Name + ' (CAST)');
mtDial : SinksLbx.Items.Add(FSinks[i].Name + ' (DIAL)');
else SinksLbx.Items.Add(FSinks[i].Name + ' (UNKNOWN)');
mtCast : TempItem := TempItem + ' (CAST';
mtDial : TempItem := TempItem + ' (DIAL';
else TempItem := TempItem + ' (UNKNOWN';
end;
case FSinks[i].IconType of
CEF_MSIT_CAST : TempItem := TempItem + ', CAST)';
CEF_MSIT_CAST_AUDIO_GROUP : TempItem := TempItem + ', CAST_AUDIO_GROUP)';
CEF_MSIT_CAST_AUDIO : TempItem := TempItem + ', CAST_AUDIO)';
CEF_MSIT_MEETING : TempItem := TempItem + ', MEETING)';
CEF_MSIT_HANGOUT : TempItem := TempItem + ', HANGOUT)';
CEF_MSIT_EDUCATION : TempItem := TempItem + ', EDUCATION)';
CEF_MSIT_WIRED_DISPLAY : TempItem := TempItem + ', WIRED_DISPLAY)';
CEF_MSIT_GENERIC : TempItem := TempItem + ', GENERIC)';
else TempItem := TempItem + ', UNKNOWN)';
end;
SinksLbx.Items.Add(TempItem);
inc(i);
end;
end;

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="81" Minor="2" Release="25"/>
<Version Major="81" Minor="3" Release="1"/>
<Files Count="175">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -61,8 +61,8 @@ uses
const
CEF_SUPPORTED_VERSION_MAJOR = 81;
CEF_SUPPORTED_VERSION_MINOR = 2;
CEF_SUPPORTED_VERSION_RELEASE = 25;
CEF_SUPPORTED_VERSION_MINOR = 3;
CEF_SUPPORTED_VERSION_RELEASE = 1;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 81;
@ -1235,6 +1235,7 @@ begin
try
TempFiles.Add('Cookies');
TempFiles.Add('Cookies-journal');
TempFiles.Add('LocalPrefs.json');
DeleteDirContents(aDirectory, TempFiles);
finally

View File

@ -165,6 +165,7 @@ type
Valid : boolean;
Name : ustring;
Description : ustring;
IconType : TCefMediaSinkIconType;
SinkType : TCefMediaType;
SinkIntf : ICefMediaSink;
end;
@ -1338,13 +1339,15 @@ type
function IsValid: boolean;
function GetName: ustring;
function GetDescription: ustring;
function GetIconType: TCefMediaSinkIconType;
function IsCastSink: boolean;
function IsDialSink: boolean;
function IsCompatibleWith(const source: ICefMediaSource): boolean;
property ID : ustring read GetId;
property Name : ustring read GetName;
property Description : ustring read GetDescription;
property ID : ustring read GetId;
property Name : ustring read GetName;
property Description : ustring read GetDescription;
property IconType : TCefMediaSinkIconType read GetIconType;
end;
// TCefMediaSource
@ -2518,10 +2521,10 @@ type
// /include/capi/views/cef_view_delegate_capi.h (cef_view_delegate_t)
ICefViewDelegate = interface(ICefBaseRefCounted)
['{5F900206-B969-4E51-B56C-0FF38D749C72}']
function GetPreferredSize(const view: ICefView): TCefSize;
function GetMinimumSize(const view: ICefView): TCefSize;
function GetMaximumSize(const view: ICefView): TCefSize;
function GetHeightForWidth(const view: ICefView; width: Integer): Integer;
procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
procedure OnFocus(const view: ICefView);
@ -2759,14 +2762,14 @@ type
['{52D4EE2C-303B-42B6-A35F-30D03834A23F}']
procedure OnWindowCreated(const window: ICefWindow);
procedure OnWindowDestroyed(const window: ICefWindow);
function GetParentWindow(const window: ICefWindow; is_menu, can_activate_menu: boolean): ICefWindow;
function IsFrameless(const window: ICefWindow): boolean;
function CanResize(const window: ICefWindow): boolean;
function CanMaximize(const window: ICefWindow): boolean;
function CanMinimize(const window: ICefWindow): boolean;
function CanClose(const window: ICefWindow): boolean;
function OnAccelerator(const window: ICefWindow; command_id: Integer): boolean;
function OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent): boolean;
procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow);
procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean);
procedure OnCanResize(const window: ICefWindow; var aResult : boolean);
procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean);
procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean);
procedure OnCanClose(const window: ICefWindow; var aResult : boolean);
procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean);
procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean);
end;
implementation

View File

@ -58,6 +58,7 @@ type
function IsValid: boolean;
function GetName: ustring;
function GetDescription: ustring;
function GetIconType: TCefMediaSinkIconType;
function IsCastSink: boolean;
function IsDialSink: boolean;
function IsCompatibleWith(const source: ICefMediaSource): boolean;
@ -90,6 +91,11 @@ begin
Result := CefStringFreeAndGet(PCefMediaSink(FData)^.get_description(PCefMediaSink(FData)));
end;
function TCefMediaSinkRef.GetIconType: TCefMediaSinkIconType;
begin
Result := PCefMediaSink(FData)^.get_icon_type(PCefMediaSink(FData));
end;
function TCefMediaSinkRef.IsCastSink: Boolean;
begin
Result := PCefMediaSink(FData)^.is_cast_sink(PCefMediaSink(FData)) <> 0;

View File

@ -62,8 +62,17 @@ type
class function UnWrap(data: Pointer): ICefPanelDelegate;
end;
TCefPanelDelegateOwn = class(TCefViewDelegateOwn, ICefPanelDelegate)
public
constructor Create; override;
end;
implementation
// **************************************************************
// ******************** TCefPanelDelegateRef ********************
// **************************************************************
class function TCefPanelDelegateRef.UnWrap(data: Pointer): ICefPanelDelegate;
begin
if (data <> nil) then
@ -72,5 +81,16 @@ begin
Result := nil;
end;
// **************************************************************
// ******************** TCefPanelDelegateOwn ********************
// **************************************************************
constructor TCefPanelDelegateOwn.Create;
begin
inherited CreateData(SizeOf(TCefPanelDelegate));
InitializeCEFMethods;
end;
end.

View File

@ -566,6 +566,19 @@ type
CEF_MRCS_TERMINATED
);
// /include/internal/cef_types.h (cef_media_sink_icon_type_t)
TCefMediaSinkIconType = (
CEF_MSIT_CAST,
CEF_MSIT_CAST_AUDIO_GROUP,
CEF_MSIT_CAST_AUDIO,
CEF_MSIT_MEETING,
CEF_MSIT_HANGOUT,
CEF_MSIT_EDUCATION,
CEF_MSIT_WIRED_DISPLAY,
CEF_MSIT_GENERIC,
CEF_MSIT_TOTAL_COUNT
);
// /include/internal/cef_types.h (cef_referrer_policy_t)
TCefReferrerPolicy = (
REFERRER_POLICY_CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE, // same value as REFERRER_POLICY_DEFAULT
@ -1533,6 +1546,7 @@ type
is_valid : function(self: PCefMediaSink): Integer; stdcall;
get_name : function(self: PCefMediaSink): PCefStringUserFree; stdcall;
get_description : function(self: PCefMediaSink): PCefStringUserFree; stdcall;
get_icon_type : function(self: PCefMediaSink): TCefMediaSinkIconType; stdcall;
is_cast_sink : function(self: PCefMediaSink): Integer; stdcall;
is_dial_sink : function(self: PCefMediaSink): Integer; stdcall;
is_compatible_with : function(self: PCefMediaSink; source: PCefMediaSource): Integer; stdcall;

View File

@ -59,10 +59,10 @@ uses
type
TCefViewDelegateRef = class(TCefBaseRefCountedRef, ICefViewDelegate)
protected
function GetPreferredSize(const view: ICefView): TCefSize;
function GetMinimumSize(const view: ICefView): TCefSize;
function GetMaximumSize(const view: ICefView): TCefSize;
function GetHeightForWidth(const view: ICefView; width: Integer): Integer;
procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
procedure OnFocus(const view: ICefView);
@ -72,34 +72,55 @@ type
class function UnWrap(data: Pointer): ICefViewDelegate;
end;
TCefViewDelegateOwn = class(TCefBaseRefCountedOwn, ICefViewDelegate)
protected
procedure OnGetPreferredSize(const view: ICefView; var aResult : TCefSize); virtual;
procedure OnGetMinimumSize(const view: ICefView; var aResult : TCefSize); virtual;
procedure OnGetMaximumSize(const view: ICefView; var aResult : TCefSize); virtual;
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); virtual;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); virtual;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); virtual;
procedure OnFocus(const view: ICefView); virtual;
procedure OnBlur(const view: ICefView); virtual;
procedure InitializeCEFMethods; virtual;
public
constructor Create; virtual;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions;
uCEFLibFunctions, uCEFMiscFunctions, uCEFView;
function TCefViewDelegateRef.GetPreferredSize(const view: ICefView): TCefSize;
// **************************************************************
// ******************** TCefViewDelegateRef *********************
// **************************************************************
procedure TCefViewDelegateRef.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
Result := PCefViewDelegate(FData)^.get_preferred_size(PCefViewDelegate(FData),
CefGetData(view));
aResult := PCefViewDelegate(FData)^.get_preferred_size(PCefViewDelegate(FData),
CefGetData(view));
end;
function TCefViewDelegateRef.GetMinimumSize(const view: ICefView): TCefSize;
procedure TCefViewDelegateRef.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
Result := PCefViewDelegate(FData)^.get_minimum_size(PCefViewDelegate(FData),
CefGetData(view));
aResult := PCefViewDelegate(FData)^.get_minimum_size(PCefViewDelegate(FData),
CefGetData(view));
end;
function TCefViewDelegateRef.GetMaximumSize(const view: ICefView): TCefSize;
procedure TCefViewDelegateRef.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
Result := PCefViewDelegate(FData)^.get_maximum_size(PCefViewDelegate(FData),
CefGetData(view));
aResult := PCefViewDelegate(FData)^.get_maximum_size(PCefViewDelegate(FData),
CefGetData(view));
end;
function TCefViewDelegateRef.GetHeightForWidth(const view: ICefView; width: Integer): Integer;
procedure TCefViewDelegateRef.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
Result := PCefViewDelegate(FData)^.get_height_for_width(PCefViewDelegate(FData),
CefGetData(view),
width);
aResult := PCefViewDelegate(FData)^.get_height_for_width(PCefViewDelegate(FData),
CefGetData(view),
width);
end;
procedure TCefViewDelegateRef.OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
@ -138,5 +159,181 @@ begin
Result := nil;
end;
// **************************************************************
// ******************** TCefViewDelegateOwn *********************
// **************************************************************
function cef_view_delegate_get_preferred_size(self: PCefViewDelegate; view: PCefView): TCefSize; stdcall;
var
TempObject : TObject;
TempSize : TCefSize;
begin
TempObject := CefGetObject(self);
TempSize.width := 50;
TempSize.height := 50;
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnGetPreferredSize(TCefViewRef.UnWrap(view),
TempSize);
Result := TempSize;
end;
function cef_view_delegate_get_minimum_size(self: PCefViewDelegate; view: PCefView): TCefSize; stdcall;
var
TempObject : TObject;
TempSize : TCefSize;
begin
TempObject := CefGetObject(self);
TempSize.width := 10;
TempSize.height := 10;
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnGetMinimumSize(TCefViewRef.UnWrap(view),
TempSize);
Result := TempSize;
end;
function cef_view_delegate_get_maximum_size(self: PCefViewDelegate; view: PCefView): TCefSize; stdcall;
var
TempObject : TObject;
TempSize : TCefSize;
begin
TempObject := CefGetObject(self);
TempSize.width := 1000;
TempSize.height := 1000;
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnGetMaximumSize(TCefViewRef.UnWrap(view),
TempSize);
Result := TempSize;
end;
function cef_view_delegate_get_height_for_width(self: PCefViewDelegate; view: PCefView; width: Integer): Integer; stdcall;
var
TempObject : TObject;
TempHeight : integer;
begin
TempObject := CefGetObject(self);
TempHeight := 0;
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnGetHeightForWidth(TCefViewRef.UnWrap(view),
width,
TempHeight);
Result := TempHeight;
end;
procedure cef_view_delegate_on_parent_view_changed(self: PCefViewDelegate; view: PCefView; added: Integer; parent: PCefView); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnParentViewChanged(TCefViewRef.UnWrap(view),
added <> 0,
TCefViewRef.UnWrap(parent));
end;
procedure cef_view_delegate_on_child_view_changed(self: PCefViewDelegate; view: PCefView; added: Integer; child: PCefView); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnChildViewChanged(TCefViewRef.UnWrap(view),
added <> 0,
TCefViewRef.UnWrap(child));
end;
procedure cef_view_delegate_on_focus(self: PCefViewDelegate; view: PCefView); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnFocus(TCefViewRef.UnWrap(view));
end;
procedure cef_view_delegate_on_blur(self: PCefViewDelegate; view: PCefView); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnBlur(TCefViewRef.UnWrap(view));
end;
constructor TCefViewDelegateOwn.Create;
begin
inherited CreateData(SizeOf(TCefViewDelegate));
InitializeCEFMethods;
end;
procedure TCefViewDelegateOwn.InitializeCEFMethods;
begin
with PCefViewDelegate(FData)^ do
begin
get_preferred_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_preferred_size;
get_minimum_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_minimum_size;
get_maximum_size := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_maximum_size;
get_height_for_width := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_height_for_width;
on_parent_view_changed := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_parent_view_changed;
on_child_view_changed := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_child_view_changed;
on_focus := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_focus;
on_blur := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_blur;
end;
end;
procedure TCefViewDelegateOwn.OnGetPreferredSize(const view: ICefView; var aResult : TCefSize);
begin
//
end;
procedure TCefViewDelegateOwn.OnGetMinimumSize(const view: ICefView; var aResult : TCefSize);
begin
//
end;
procedure TCefViewDelegateOwn.OnGetMaximumSize(const view: ICefView; var aResult : TCefSize);
begin
//
end;
procedure TCefViewDelegateOwn.OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
begin
//
end;
procedure TCefViewDelegateOwn.OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
begin
//
end;
procedure TCefViewDelegateOwn.OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
begin
//
end;
procedure TCefViewDelegateOwn.OnFocus(const view: ICefView);
begin
//
end;
procedure TCefViewDelegateOwn.OnBlur(const view: ICefView);
begin
//
end;
end.

View File

@ -61,24 +61,47 @@ type
protected
procedure OnWindowCreated(const window: ICefWindow);
procedure OnWindowDestroyed(const window: ICefWindow);
function GetParentWindow(const window: ICefWindow; is_menu, can_activate_menu: boolean): ICefWindow;
function IsFrameless(const window: ICefWindow): boolean;
function CanResize(const window: ICefWindow): boolean;
function CanMaximize(const window: ICefWindow): boolean;
function CanMinimize(const window: ICefWindow): boolean;
function CanClose(const window: ICefWindow): boolean;
function OnAccelerator(const window: ICefWindow; command_id: Integer): boolean;
function OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent): boolean;
procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow);
procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean);
procedure OnCanResize(const window: ICefWindow; var aResult : boolean);
procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean);
procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean);
procedure OnCanClose(const window: ICefWindow; var aResult : boolean);
procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean);
procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean);
public
class function UnWrap(data: Pointer): ICefWindowDelegate;
end;
TCefWindowDelegateOwn = class(TCefPanelDelegateOwn, ICefWindowDelegate)
protected
procedure OnWindowCreated(const window: ICefWindow); virtual;
procedure OnWindowDestroyed(const window: ICefWindow); virtual;
procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); virtual;
procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean); virtual;
procedure OnCanResize(const window: ICefWindow; var aResult : boolean); virtual;
procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean); virtual;
procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean); virtual;
procedure OnCanClose(const window: ICefWindow; var aResult : boolean); virtual;
procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); virtual;
procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); virtual;
procedure InitializeCEFMethods; override;
public
constructor Create; override;
end;
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFWindow;
// **************************************************************
// ******************* TCefWindowDelegateRef ********************
// **************************************************************
procedure TCefWindowDelegateRef.OnWindowCreated(const window: ICefWindow);
begin
PCefWindowDelegate(FData)^.on_window_created(PCefWindowDelegate(FData), CefGetData(window));
@ -89,53 +112,56 @@ begin
PCefWindowDelegate(FData)^.on_window_destroyed(PCefWindowDelegate(FData), CefGetData(window));
end;
function TCefWindowDelegateRef.GetParentWindow(const window : ICefWindow;
is_menu : boolean;
can_activate_menu : boolean): ICefWindow;
procedure TCefWindowDelegateRef.OnGetParentWindow(const window : ICefWindow;
var is_menu : boolean;
var can_activate_menu : boolean;
var aResult : ICefWindow);
var
TempIsMenu, TempCanActivateMenu : integer;
begin
TempIsMenu := ord(is_menu);
TempCanActivateMenu := ord(can_activate_menu);
Result := TCefWindowRef.UnWrap(PCefWindowDelegate(FData)^.get_parent_window(PCefWindowDelegate(FData),
aResult := TCefWindowRef.UnWrap(PCefWindowDelegate(FData)^.get_parent_window(PCefWindowDelegate(FData),
CefGetData(window),
@TempIsMenu,
@TempCanActivateMenu));
is_menu := TempIsMenu <> 0;
can_activate_menu := TempCanActivateMenu <> 0;
end;
function TCefWindowDelegateRef.IsFrameless(const window: ICefWindow): boolean;
procedure TCefWindowDelegateRef.OnIsFrameless(const window: ICefWindow; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.is_frameless(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
aResult := (PCefWindowDelegate(FData)^.is_frameless(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanResize(const window: ICefWindow): boolean;
procedure TCefWindowDelegateRef.OnCanResize(const window: ICefWindow; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.can_resize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
aResult := (PCefWindowDelegate(FData)^.can_resize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanMaximize(const window: ICefWindow): boolean;
procedure TCefWindowDelegateRef.OnCanMaximize(const window: ICefWindow; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.can_maximize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
aResult := (PCefWindowDelegate(FData)^.can_maximize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanMinimize(const window: ICefWindow): boolean;
procedure TCefWindowDelegateRef.OnCanMinimize(const window: ICefWindow; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.can_minimize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
aResult := (PCefWindowDelegate(FData)^.can_minimize(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.CanClose(const window: ICefWindow): boolean;
procedure TCefWindowDelegateRef.OnCanClose(const window: ICefWindow; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.can_close(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
aResult := (PCefWindowDelegate(FData)^.can_close(PCefWindowDelegate(FData), CefGetData(window)) <> 0);
end;
function TCefWindowDelegateRef.OnAccelerator(const window: ICefWindow; command_id: Integer): boolean;
procedure TCefWindowDelegateRef.OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.on_accelerator(PCefWindowDelegate(FData), CefGetData(window), command_id) <> 0);
aResult := (PCefWindowDelegate(FData)^.on_accelerator(PCefWindowDelegate(FData), CefGetData(window), command_id) <> 0);
end;
function TCefWindowDelegateRef.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent): boolean;
procedure TCefWindowDelegateRef.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean);
begin
Result := (PCefWindowDelegate(FData)^.on_key_event(PCefWindowDelegate(FData), CefGetData(window), @event) <> 0);
aResult := (PCefWindowDelegate(FData)^.on_key_event(PCefWindowDelegate(FData), CefGetData(window), @event) <> 0);
end;
class function TCefWindowDelegateRef.UnWrap(data: Pointer): ICefWindowDelegate;
@ -146,5 +172,237 @@ begin
Result := nil;
end;
// **************************************************************
// ******************* TCefWindowDelegateOwn ********************
// **************************************************************
procedure cef_window_delegate_on_window_created(self: PCefWindowDelegate; window: PCefWindow); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnWindowCreated(TCefWindowRef.UnWrap(window));
end;
procedure cef_window_delegate_on_window_destroyed(self: PCefWindowDelegate; window: PCefWindow); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnWindowDestroyed(TCefWindowRef.UnWrap(window));
end;
function cef_window_delegate_get_parent_window(self : PCefWindowDelegate;
window : PCefWindow;
is_menu : PInteger;
can_activate_menu : PInteger): PCefWindow; stdcall;
var
TempObject : TObject;
TempWindow : ICefWindow;
TempIsMenu, TempCanActivateMenu : boolean;
begin
TempObject := CefGetObject(self);
TempWindow := nil;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) and (is_menu <> nil) and (can_activate_menu <> nil) then
begin
TempIsMenu := (is_menu^ <> 0);
TempCanActivateMenu := (can_activate_menu^ <> 0);
TCefWindowDelegateOwn(TempObject).OnGetParentWindow(TCefWindowRef.UnWrap(window),
TempIsMenu,
TempCanActivateMenu,
TempWindow);
is_menu^ := ord(TempIsMenu);
can_activate_menu^ := ord(TempCanActivateMenu);
end;
Result := CefGetData(TempWindow);
end;
function cef_window_delegate_is_frameless(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall;
var
TempObject : TObject;
TempIsFrameless : boolean;
begin
TempObject := CefGetObject(self);
TempIsFrameless := False;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnIsFrameless(TCefWindowRef.UnWrap(window), TempIsFrameless);
Result := ord(TempIsFrameless);
end;
function cef_window_delegate_can_resize(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall;
var
TempObject : TObject;
TempCanResize : boolean;
begin
TempObject := CefGetObject(self);
TempCanResize := True;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnCanResize(TCefWindowRef.UnWrap(window), TempCanResize);
Result := ord(TempCanResize);
end;
function cef_window_delegate_can_maximize(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall;
var
TempObject : TObject;
TempCanMaximize : boolean;
begin
TempObject := CefGetObject(self);
TempCanMaximize := True;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnCanMaximize(TCefWindowRef.UnWrap(window), TempCanMaximize);
Result := ord(TempCanMaximize);
end;
function cef_window_delegate_can_minimize(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall;
var
TempObject : TObject;
TempCanMinimize : boolean;
begin
TempObject := CefGetObject(self);
TempCanMinimize := True;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnCanMinimize(TCefWindowRef.UnWrap(window), TempCanMinimize);
Result := ord(TempCanMinimize);
end;
function cef_window_delegate_can_close(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall;
var
TempObject : TObject;
TempCanClose : boolean;
begin
TempObject := CefGetObject(self);
TempCanClose := True;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnCanClose(TCefWindowRef.UnWrap(window), TempCanClose);
Result := ord(TempCanClose);
end;
function cef_window_delegate_on_accelerator(self : PCefWindowDelegate;
window : PCefWindow;
command_id : Integer): Integer; stdcall;
var
TempObject : TObject;
TempResult : boolean;
begin
TempObject := CefGetObject(self);
TempResult := False;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnAccelerator(TCefWindowRef.UnWrap(window), command_id, TempResult);
Result := ord(TempResult);
end;
function cef_window_delegate_on_key_event( self : PCefWindowDelegate;
window : PCefWindow;
const event : PCefKeyEvent): Integer; stdcall;
var
TempObject : TObject;
TempResult : boolean;
begin
TempObject := CefGetObject(self);
TempResult := False;
if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then
TCefWindowDelegateOwn(TempObject).OnKeyEvent(TCefWindowRef.UnWrap(window), event^, TempResult);
Result := ord(TempResult);
end;
constructor TCefWindowDelegateOwn.Create;
begin
inherited CreateData(SizeOf(TCefWindowDelegate));
InitializeCEFMethods;
end;
procedure TCefWindowDelegateOwn.InitializeCEFMethods;
begin
inherited InitializeCEFMethods;
with PCefWindowDelegate(FData)^ do
begin
on_window_created := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_on_window_created;
on_window_destroyed := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_on_window_destroyed;
get_parent_window := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_get_parent_window;
is_frameless := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_is_frameless;
can_resize := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_can_resize;
can_maximize := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_can_maximize;
can_minimize := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_can_minimize;
can_close := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_can_close;
on_accelerator := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_on_accelerator;
on_key_event := {$IFDEF FPC}@{$ENDIF}cef_window_delegate_on_key_event;
end;
end;
procedure TCefWindowDelegateOwn.OnWindowCreated(const window: ICefWindow);
begin
//
end;
procedure TCefWindowDelegateOwn.OnWindowDestroyed(const window: ICefWindow);
begin
//
end;
procedure TCefWindowDelegateOwn.OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow);
begin
//
end;
procedure TCefWindowDelegateOwn.OnIsFrameless(const window: ICefWindow; var aResult : boolean);
begin
//
end;
procedure TCefWindowDelegateOwn.OnCanResize(const window: ICefWindow; var aResult : boolean);
begin
//
end;
procedure TCefWindowDelegateOwn.OnCanMaximize(const window: ICefWindow; var aResult : boolean);
begin
//
end;
procedure TCefWindowDelegateOwn.OnCanMinimize(const window: ICefWindow; var aResult : boolean);
begin
//
end;
procedure TCefWindowDelegateOwn.OnCanClose(const window: ICefWindow; var aResult : boolean);
begin
//
end;
procedure TCefWindowDelegateOwn.OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean);
begin
//
end;
procedure TCefWindowDelegateOwn.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean);
begin
//
end;
end.

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 128,
"InternalVersion" : 129,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "81.2.25.0"
"Version" : "81.3.1.0"
}
],
"UpdatePackageData" : {