1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Added TChromium.GetNavigationEntries and TChromium.OnNavigationVisitorResultAvailable

- MiniBrowser demo : Added a context menu option to get the navigation entries.
This commit is contained in:
Salvador Díaz Fau
2019-02-03 15:34:21 +01:00
parent a3de8552e3
commit 1f96e8272b
8 changed files with 196 additions and 55 deletions

View File

@ -70,9 +70,25 @@ type
constructor Create(const proc: TCefNavigationEntryVisitorProc); reintroduce;
end;
TCustomCefNavigationEntryVisitor = class(TCefNavigationEntryVisitorOwn)
protected
FEvents : Pointer;
function Visit(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer): Boolean; override;
public
constructor Create(const aEvents : IChromiumEvents); reintroduce;
destructor Destroy; override;
end;
implementation
uses
{$IFDEF DELPHI16_UP}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF}
uCEFTypes, uCEFMiscFunctions, uCEFNavigationEntry;
function cef_navigation_entry_visitor_visit(self : PCefNavigationEntryVisitor;
@ -127,4 +143,36 @@ begin
Result := FVisitor(entry, current, index, total);
end;
// TCustomCefNavigationEntryVisitor
constructor TCustomCefNavigationEntryVisitor.Create(const aEvents : IChromiumEvents);
begin
inherited Create;
FEvents := Pointer(aEvents);
end;
destructor TCustomCefNavigationEntryVisitor.Destroy;
begin
FEvents := nil;
inherited Destroy;
end;
function TCustomCefNavigationEntryVisitor.Visit(const entry : ICefNavigationEntry;
current : Boolean;
index : Integer;
total : Integer): Boolean;
begin
Result := False;
try
if (FEvents <> nil) then
Result := IChromiumEvents(FEvents).doNavigationVisitorResultAvailable(entry, current, index, total);
except
on e : exception do
if CustomExceptionHandler('TCustomCefNavigationEntryVisitor.Visit', e) then raise;
end;
end;
end.