mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-02-02 10:25:26 +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:
parent
a3de8552e3
commit
1f96e8272b
@ -260,6 +260,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
||||
OnPdfPrintFinished = Chromium1PdfPrintFinished
|
||||
OnPrefsAvailable = Chromium1PrefsAvailable
|
||||
OnResolvedHostAvailable = Chromium1ResolvedHostAvailable
|
||||
OnNavigationVisitorResultAvailable = Chromium1NavigationVisitorResultAvailable
|
||||
OnRenderCompMsg = Chromium1RenderCompMsg
|
||||
OnLoadEnd = Chromium1LoadEnd
|
||||
OnLoadError = Chromium1LoadError
|
||||
|
@ -63,6 +63,7 @@ const
|
||||
MINIBROWSER_SAVEPREFERENCES = WM_APP + $107;
|
||||
MINIBROWSER_COPYALLTEXT = WM_APP + $108;
|
||||
MINIBROWSER_TAKESNAPSHOT = WM_APP + $109;
|
||||
MINIBROWSER_SHOWNAVIGATION = WM_APP + $10A;
|
||||
|
||||
MINIBROWSER_HOMEPAGE = 'https://www.google.com';
|
||||
|
||||
@ -77,6 +78,7 @@ const
|
||||
MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES = MENU_ID_USER_FIRST + 9;
|
||||
MINIBROWSER_CONTEXTMENU_COPYALLTEXT = MENU_ID_USER_FIRST + 10;
|
||||
MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT = MENU_ID_USER_FIRST + 11;
|
||||
MINIBROWSER_CONTEXTMENU_GETNAVIGATION = MENU_ID_USER_FIRST + 12;
|
||||
|
||||
type
|
||||
TMiniBrowserFrm = class(TForm)
|
||||
@ -208,10 +210,14 @@ type
|
||||
const browser: ICefBrowser; certError: Integer;
|
||||
const requestUrl: ustring; const sslInfo: ICefSslInfo;
|
||||
const callback: ICefRequestCallback; out Result: Boolean);
|
||||
procedure Chromium1NavigationVisitorResultAvailable(
|
||||
const entry: ICefNavigationEntry; current: Boolean; index, total: Integer;
|
||||
var aResult: Boolean);
|
||||
|
||||
protected
|
||||
FResponse : TStringList;
|
||||
FRequest : TStringList;
|
||||
FResponse : TStringList;
|
||||
FRequest : TStringList;
|
||||
FNavigation : TStringList;
|
||||
// Variables to control when can we destroy the form safely
|
||||
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||
@ -237,6 +243,7 @@ type
|
||||
procedure CopyFramesIDsMsg(var aMessage : TMessage); message MINIBROWSER_COPYFRAMEIDS;
|
||||
procedure CopyFramesNamesMsg(var aMessage : TMessage); message MINIBROWSER_COPYFRAMENAMES;
|
||||
procedure ShowResponseMsg(var aMessage : TMessage); message MINIBROWSER_SHOWRESPONSE;
|
||||
procedure ShowNavigationMsg(var aMessage : TMessage); message MINIBROWSER_SHOWNAVIGATION;
|
||||
procedure SavePreferencesMsg(var aMessage : TMessage); message MINIBROWSER_SAVEPREFERENCES;
|
||||
procedure TakeSnapshotMsg(var aMessage : TMessage); message MINIBROWSER_TAKESNAPSHOT;
|
||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||
@ -329,6 +336,7 @@ begin
|
||||
|
||||
model.AddSeparator;
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT, 'Take snapshot...');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_GETNAVIGATION, 'Get navigation entries');
|
||||
model.AddSeparator;
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_COPYALLTEXT, 'Copy displayed text to clipboard');
|
||||
model.AddItem(MINIBROWSER_CONTEXTMENU_COPYHTML, 'Copy HTML to clipboard');
|
||||
@ -475,6 +483,12 @@ begin
|
||||
MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT :
|
||||
PostMessage(Handle, MINIBROWSER_TAKESNAPSHOT, 0, 0);
|
||||
|
||||
MINIBROWSER_CONTEXTMENU_GETNAVIGATION :
|
||||
begin
|
||||
FNavigation.Clear;
|
||||
Chromium1.GetNavigationEntries(False);
|
||||
end;
|
||||
|
||||
MINIBROWSER_CONTEXTMENU_JSWRITEDOC :
|
||||
if (browser <> nil) and (browser.MainFrame <> nil) then
|
||||
browser.MainFrame.ExecuteJavaScript(
|
||||
@ -677,6 +691,21 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1NavigationVisitorResultAvailable(
|
||||
const entry: ICefNavigationEntry; current: Boolean; index, total: Integer;
|
||||
var aResult: Boolean);
|
||||
begin
|
||||
if (entry <> nil) and entry.IsValid then FNavigation.Add(entry.Url);
|
||||
|
||||
if (index < pred(total)) then
|
||||
aResult := True
|
||||
else
|
||||
begin
|
||||
aResult := False;
|
||||
PostMessage(Handle, MINIBROWSER_SHOWNAVIGATION, 0, 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean);
|
||||
begin
|
||||
if aResultOK then
|
||||
@ -844,10 +873,11 @@ end;
|
||||
|
||||
procedure TMiniBrowserFrm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FResponse := TStringList.Create;
|
||||
FRequest := TStringList.Create;
|
||||
FCanClose := False;
|
||||
FClosing := False;
|
||||
FResponse := TStringList.Create;
|
||||
FRequest := TStringList.Create;
|
||||
FNavigation := TStringList.Create;
|
||||
Chromium1.DefaultURL := MINIBROWSER_HOMEPAGE;
|
||||
end;
|
||||
|
||||
@ -855,6 +885,7 @@ procedure TMiniBrowserFrm.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
FResponse.Free;
|
||||
FRequest.Free;
|
||||
FNavigation.Free;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.FormShow(Sender: TObject);
|
||||
@ -1099,6 +1130,13 @@ begin
|
||||
SimpleTextViewerFrm.ShowModal;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.ShowNavigationMsg(var aMessage : TMessage);
|
||||
begin
|
||||
SimpleTextViewerFrm.Memo1.Lines.Clear;
|
||||
SimpleTextViewerFrm.Memo1.Lines.AddStrings(FNavigation);
|
||||
SimpleTextViewerFrm.ShowModal;
|
||||
end;
|
||||
|
||||
procedure TMiniBrowserFrm.SavePreferencesMsg(var aMessage : TMessage);
|
||||
begin
|
||||
SaveDialog1.DefaultExt := 'txt';
|
||||
|
@ -228,15 +228,16 @@ type
|
||||
FOnFindResult : TOnFindResult;
|
||||
|
||||
// Custom
|
||||
FOnTextResultAvailable : TOnTextResultAvailableEvent;
|
||||
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
|
||||
FOnPrefsAvailable : TOnPrefsAvailableEvent;
|
||||
FOnCookiesDeleted : TOnCookiesDeletedEvent;
|
||||
FOnResolvedHostAvailable : TOnResolvedIPsAvailableEvent;
|
||||
FOnTextResultAvailable : TOnTextResultAvailableEvent;
|
||||
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
|
||||
FOnPrefsAvailable : TOnPrefsAvailableEvent;
|
||||
FOnCookiesDeleted : TOnCookiesDeletedEvent;
|
||||
FOnResolvedHostAvailable : TOnResolvedIPsAvailableEvent;
|
||||
FOnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
FOnRenderCompMsg : TOnCompMsgEvent;
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
FOnRenderCompMsg : TOnCompMsgEvent;
|
||||
{$ENDIF}
|
||||
|
||||
function GetIsLoading : boolean;
|
||||
@ -468,6 +469,7 @@ type
|
||||
procedure doUpdateOwnPreferences; virtual;
|
||||
function doSavePreferences : boolean; virtual;
|
||||
procedure doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); virtual;
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual;
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -504,6 +506,7 @@ type
|
||||
procedure RetrieveText(const aFrameName : ustring = ''); overload;
|
||||
procedure RetrieveText(const aFrame : ICefFrame); overload;
|
||||
procedure RetrieveText(const aFrameIdentifier : int64); overload;
|
||||
procedure GetNavigationEntries(currentOnly: Boolean);
|
||||
function GetFrameNames(var aFrameNames : TStrings) : boolean;
|
||||
function GetFrameIdentifiers(var aFrameCount : NativeUInt; var aFrameIdentifierArray : TCefFrameIdentifierArray) : boolean;
|
||||
procedure ExecuteJavaScript(const aCode, aScriptURL : ustring; const aFrameName : ustring = ''; aStartLine : integer = 0); overload;
|
||||
@ -636,15 +639,16 @@ type
|
||||
property ProxyByPassList : ustring read FProxyByPassList write SetProxyByPassList;
|
||||
|
||||
published
|
||||
property OnTextResultAvailable : TOnTextResultAvailableEvent read FOnTextResultAvailable write FOnTextResultAvailable;
|
||||
property OnPdfPrintFinished : TOnPdfPrintFinishedEvent read FOnPdfPrintFinished write FOnPdfPrintFinished;
|
||||
property OnPrefsAvailable : TOnPrefsAvailableEvent read FOnPrefsAvailable write FOnPrefsAvailable;
|
||||
property OnCookiesDeleted : TOnCookiesDeletedEvent read FOnCookiesDeleted write FOnCookiesDeleted;
|
||||
property OnResolvedHostAvailable : TOnResolvedIPsAvailableEvent read FOnResolvedHostAvailable write FOnResolvedHostAvailable;
|
||||
property OnTextResultAvailable : TOnTextResultAvailableEvent read FOnTextResultAvailable write FOnTextResultAvailable;
|
||||
property OnPdfPrintFinished : TOnPdfPrintFinishedEvent read FOnPdfPrintFinished write FOnPdfPrintFinished;
|
||||
property OnPrefsAvailable : TOnPrefsAvailableEvent read FOnPrefsAvailable write FOnPrefsAvailable;
|
||||
property OnCookiesDeleted : TOnCookiesDeletedEvent read FOnCookiesDeleted write FOnCookiesDeleted;
|
||||
property OnResolvedHostAvailable : TOnResolvedIPsAvailableEvent read FOnResolvedHostAvailable write FOnResolvedHostAvailable;
|
||||
property OnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent read FOnNavigationVisitorResultAvailable write FOnNavigationVisitorResultAvailable;
|
||||
{$IFNDEF FPC}
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
property OnRenderCompMsg : TOnCompMsgEvent read FOnRenderCompMsg write FOnRenderCompMsg;
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
property OnRenderCompMsg : TOnCompMsgEvent read FOnRenderCompMsg write FOnRenderCompMsg;
|
||||
{$ENDIF}
|
||||
|
||||
// ICefClient
|
||||
@ -762,7 +766,7 @@ uses
|
||||
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
|
||||
uCEFApplication, uCEFProcessMessage, uCEFRequestContext, {$IFNDEF FPC}uOLEDragAndDrop,{$ENDIF}
|
||||
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor,
|
||||
uCEFListValue;
|
||||
uCEFListValue, uCEFNavigationEntryVisitor;
|
||||
|
||||
constructor TChromium.Create(AOwner: TComponent);
|
||||
begin
|
||||
@ -1103,15 +1107,16 @@ begin
|
||||
FOnFindResult := nil;
|
||||
|
||||
// Custom
|
||||
FOnTextResultAvailable := nil;
|
||||
FOnPdfPrintFinished := nil;
|
||||
FOnPrefsAvailable := nil;
|
||||
FOnCookiesDeleted := nil;
|
||||
FOnResolvedHostAvailable := nil;
|
||||
FOnTextResultAvailable := nil;
|
||||
FOnPdfPrintFinished := nil;
|
||||
FOnPrefsAvailable := nil;
|
||||
FOnCookiesDeleted := nil;
|
||||
FOnResolvedHostAvailable := nil;
|
||||
FOnNavigationVisitorResultAvailable := nil;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg := nil;
|
||||
FOnWidgetCompMsg := nil;
|
||||
FOnRenderCompMsg := nil;
|
||||
FOnBrowserCompMsg := nil;
|
||||
FOnWidgetCompMsg := nil;
|
||||
FOnRenderCompMsg := nil;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
@ -2228,6 +2233,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TChromium.GetNavigationEntries(currentOnly: Boolean);
|
||||
var
|
||||
TempVisitor : TCustomCefNavigationEntryVisitor;
|
||||
begin
|
||||
if Initialized then
|
||||
begin
|
||||
TempVisitor := TCustomCefNavigationEntryVisitor.Create(self);
|
||||
FBrowser.Host.GetNavigationEntries(TempVisitor, currentOnly);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TChromium.GetFrameNames(var aFrameNames : TStrings) : boolean;
|
||||
begin
|
||||
Result := Initialized and FBrowser.GetFrameNames(aFrameNames);
|
||||
@ -2882,6 +2898,17 @@ begin
|
||||
if assigned(FOnResolvedHostAvailable) then FOnResolvedHostAvailable(self, result, resolvedIps);
|
||||
end;
|
||||
|
||||
function TChromium.doNavigationVisitorResultAvailable(const entry : ICefNavigationEntry;
|
||||
current : Boolean;
|
||||
index : Integer;
|
||||
total : Integer) : boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if assigned(FOnNavigationVisitorResultAvailable) then
|
||||
FOnNavigationVisitorResultAvailable(entry, current, index, total, Result);
|
||||
end;
|
||||
|
||||
function TChromium.MustCreateLoadHandler : boolean;
|
||||
begin
|
||||
Result := assigned(FOnLoadStart) or
|
||||
|
@ -156,13 +156,14 @@ type
|
||||
TOnFindResult = procedure(Sender: TObject; const browser: ICefBrowser; identifier, count: Integer; const selectionRect: PCefRect; activeMatchOrdinal: Integer; finalUpdate: Boolean) of Object;
|
||||
|
||||
// Custom
|
||||
TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : ustring) of object;
|
||||
TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
||||
TOnPrefsAvailableEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
||||
TOnCookiesDeletedEvent = procedure(Sender: TObject; numDeleted : integer) of object;
|
||||
TOnResolvedIPsAvailableEvent = procedure(Sender: TObject; result: TCefErrorCode; const resolvedIps: TStrings) of object;
|
||||
TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : ustring) of object;
|
||||
TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
||||
TOnPrefsAvailableEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
||||
TOnCookiesDeletedEvent = procedure(Sender: TObject; numDeleted : integer) of object;
|
||||
TOnResolvedIPsAvailableEvent = procedure(Sender: TObject; result: TCefErrorCode; const resolvedIps: TStrings) of object;
|
||||
TOnNavigationVisitorResultAvailableEvent = procedure(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer; var aResult : boolean) of object;
|
||||
{$IFDEF MSWINDOWS}
|
||||
TOnCompMsgEvent = procedure (var aMessage: TMessage; var aHandled: Boolean) of object;
|
||||
TOnCompMsgEvent = procedure (var aMessage: TMessage; var aHandled: Boolean) of object;
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
@ -148,6 +148,4 @@ begin
|
||||
creation, lastAccess, expires, count, total, deleteCookie);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
end.
|
||||
|
@ -371,6 +371,7 @@ type
|
||||
procedure doUpdateOwnPreferences;
|
||||
function doSavePreferences : boolean;
|
||||
procedure doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings);
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean;
|
||||
end;
|
||||
|
||||
IServerEvents = interface
|
||||
|
@ -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.
|
||||
|
@ -212,14 +212,15 @@ type
|
||||
FOnFindResult : TOnFindResult;
|
||||
|
||||
// Custom
|
||||
FOnTextResultAvailable : TOnTextResultAvailableEvent;
|
||||
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
|
||||
FOnCookiesDeleted : TOnCookiesDeletedEvent;
|
||||
FOnResolvedHostAvailable : TOnResolvedIPsAvailableEvent;
|
||||
FOnTextResultAvailable : TOnTextResultAvailableEvent;
|
||||
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
|
||||
FOnCookiesDeleted : TOnCookiesDeletedEvent;
|
||||
FOnResolvedHostAvailable : TOnResolvedIPsAvailableEvent;
|
||||
FOnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent;
|
||||
{$IFDEF MSWINDOWS}
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
FOnRenderCompMsg : TOnCompMsgEvent;
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
FOnRenderCompMsg : TOnCompMsgEvent;
|
||||
{$ENDIF}
|
||||
|
||||
function GetIsLoading : boolean;
|
||||
@ -436,6 +437,7 @@ type
|
||||
procedure doUpdateOwnPreferences; virtual;
|
||||
function doSavePreferences : boolean; virtual;
|
||||
procedure doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); virtual;
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual;
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -472,6 +474,7 @@ type
|
||||
procedure RetrieveText(const aFrameName : ustring = ''); overload;
|
||||
procedure RetrieveText(const aFrame : ICefFrame); overload;
|
||||
procedure RetrieveText(const aFrameIdentifier : int64); overload;
|
||||
procedure GetNavigationEntries(currentOnly: Boolean);
|
||||
function GetFrameNames(var aFrameNames : TStrings) : boolean;
|
||||
function GetFrameIdentifiers(var aFrameCount : NativeUInt; var aFrameIdentifierArray : TCefFrameIdentifierArray) : boolean;
|
||||
procedure ExecuteJavaScript(const aCode, aScriptURL : ustring; const aFrameName : ustring = ''; aStartLine : integer = 0); overload;
|
||||
@ -594,10 +597,11 @@ type
|
||||
property ProxyByPassList : ustring read FProxyByPassList write SetProxyByPassList;
|
||||
|
||||
published
|
||||
property OnTextResultAvailable : TOnTextResultAvailableEvent read FOnTextResultAvailable write FOnTextResultAvailable;
|
||||
property OnPdfPrintFinished : TOnPdfPrintFinishedEvent read FOnPdfPrintFinished write FOnPdfPrintFinished;
|
||||
property OnCookiesDeleted : TOnCookiesDeletedEvent read FOnCookiesDeleted write FOnCookiesDeleted;
|
||||
property OnResolvedHostAvailable : TOnResolvedIPsAvailableEvent read FOnResolvedHostAvailable write FOnResolvedHostAvailable;
|
||||
property OnTextResultAvailable : TOnTextResultAvailableEvent read FOnTextResultAvailable write FOnTextResultAvailable;
|
||||
property OnPdfPrintFinished : TOnPdfPrintFinishedEvent read FOnPdfPrintFinished write FOnPdfPrintFinished;
|
||||
property OnCookiesDeleted : TOnCookiesDeletedEvent read FOnCookiesDeleted write FOnCookiesDeleted;
|
||||
property OnResolvedHostAvailable : TOnResolvedIPsAvailableEvent read FOnResolvedHostAvailable write FOnResolvedHostAvailable;
|
||||
property OnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent read FOnNavigationVisitorResultAvailable write FOnNavigationVisitorResultAvailable;
|
||||
{$IFDEF MSWINDOWS}
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
@ -709,7 +713,7 @@ uses
|
||||
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
|
||||
uCEFApplication, uCEFProcessMessage, uCEFRequestContext,
|
||||
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor,
|
||||
uCEFListValue;
|
||||
uCEFListValue, uCEFNavigationEntryVisitor;
|
||||
|
||||
constructor TFMXChromium.Create(AOwner: TComponent);
|
||||
begin
|
||||
@ -1006,10 +1010,11 @@ begin
|
||||
FOnFindResult := nil;
|
||||
|
||||
// Custom
|
||||
FOnTextResultAvailable := nil;
|
||||
FOnPdfPrintFinished := nil;
|
||||
FOnCookiesDeleted := nil;
|
||||
FOnResolvedHostAvailable := nil;
|
||||
FOnTextResultAvailable := nil;
|
||||
FOnPdfPrintFinished := nil;
|
||||
FOnCookiesDeleted := nil;
|
||||
FOnResolvedHostAvailable := nil;
|
||||
FOnNavigationVisitorResultAvailable := nil;
|
||||
end;
|
||||
|
||||
function TFMXChromium.CreateBrowser(const aWindowName : ustring;
|
||||
@ -2014,6 +2019,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TFMXChromium.GetNavigationEntries(currentOnly: Boolean);
|
||||
var
|
||||
TempVisitor : TCustomCefNavigationEntryVisitor;
|
||||
begin
|
||||
if Initialized then
|
||||
begin
|
||||
TempVisitor := TCustomCefNavigationEntryVisitor.Create(self);
|
||||
FBrowser.Host.GetNavigationEntries(TempVisitor, currentOnly);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TFMXChromium.GetFrameNames(var aFrameNames : TStrings) : boolean;
|
||||
begin
|
||||
Result := Initialized and FBrowser.GetFrameNames(aFrameNames);
|
||||
@ -2614,6 +2630,17 @@ begin
|
||||
if assigned(FOnResolvedHostAvailable) then FOnResolvedHostAvailable(self, result, resolvedIps);
|
||||
end;
|
||||
|
||||
function TFMXChromium.doNavigationVisitorResultAvailable(const entry : ICefNavigationEntry;
|
||||
current : Boolean;
|
||||
index : Integer;
|
||||
total : Integer) : boolean;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if assigned(FOnNavigationVisitorResultAvailable) then
|
||||
FOnNavigationVisitorResultAvailable(entry, current, index, total, Result);
|
||||
end;
|
||||
|
||||
function TFMXChromium.MustCreateLoadHandler : boolean;
|
||||
begin
|
||||
Result := assigned(FOnLoadStart) or
|
||||
|
Loading…
x
Reference in New Issue
Block a user