2017-01-27 17:29:37 +01:00
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ***************************** CEF4Delphi *******************************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
//
|
2019-10-19 10:58:34 +02:00
|
|
|
|
// CEF4Delphi is based on DCEF3 which uses CEF to embed a chromium-based
|
2017-01-27 17:29:37 +01:00
|
|
|
|
// browser in Delphi applications.
|
|
|
|
|
//
|
|
|
|
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
|
|
|
|
//
|
|
|
|
|
// For more information about CEF4Delphi visit :
|
|
|
|
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
|
|
|
|
//
|
2022-01-01 10:41:21 +01:00
|
|
|
|
// Copyright <20> 2022 Salvador Diaz Fau. All rights reserved.
|
2017-01-27 17:29:37 +01:00
|
|
|
|
//
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
// ************ vvvv Original license and comments below vvvv *************
|
|
|
|
|
// ************************************************************************
|
|
|
|
|
(*
|
|
|
|
|
* Delphi Chromium Embedded 3
|
|
|
|
|
*
|
|
|
|
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
|
|
|
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
|
|
|
|
*
|
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
|
|
|
|
* the specific language governing rights and limitations under the License.
|
|
|
|
|
*
|
|
|
|
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
|
|
|
|
* Web site : http://www.progdigy.com
|
|
|
|
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
|
|
|
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
|
|
|
|
*
|
|
|
|
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
|
|
|
|
* this source code without explicit permission.
|
|
|
|
|
*
|
|
|
|
|
*)
|
|
|
|
|
|
|
|
|
|
unit uCEFClient;
|
|
|
|
|
|
2018-05-12 14:50:54 +02:00
|
|
|
|
{$IFDEF FPC}
|
|
|
|
|
{$MODE OBJFPC}{$H+}
|
|
|
|
|
{$ENDIF}
|
|
|
|
|
|
2018-11-22 15:02:21 +01:00
|
|
|
|
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
|
|
|
|
{$MINENUMSIZE 4}
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
2017-02-05 20:56:46 +01:00
|
|
|
|
{$I cef.inc}
|
|
|
|
|
|
2017-01-27 17:29:37 +01:00
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
uses
|
2017-03-16 19:09:42 +01:00
|
|
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
|
|
|
|
type
|
2017-06-11 17:48:20 +02:00
|
|
|
|
TCefClientRef = class(TCefBaseRefCountedRef, ICefClient)
|
|
|
|
|
protected
|
2020-05-23 15:00:44 +02:00
|
|
|
|
procedure GetAudioHandler(var aHandler : ICefAudioHandler); virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); virtual;
|
|
|
|
|
procedure GetDialogHandler(var aHandler : ICefDialogHandler); virtual;
|
|
|
|
|
procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); virtual;
|
|
|
|
|
procedure GetDownloadHandler(var aHandler : ICefDownloadHandler); virtual;
|
|
|
|
|
procedure GetDragHandler(var aHandler : ICefDragHandler); virtual;
|
|
|
|
|
procedure GetFindHandler(var aHandler : ICefFindHandler); virtual;
|
|
|
|
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler); virtual;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler); virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
|
|
|
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
|
|
|
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
|
|
|
|
procedure GetLoadHandler(var aHandler : ICefLoadHandler); virtual;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
procedure GetPrintHandler(var aHandler : ICefPrintHandler); virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetRenderHandler(var aHandler : ICefRenderHandler); virtual;
|
|
|
|
|
procedure GetRequestHandler(var aHandler : ICefRequestHandler); virtual;
|
2019-06-16 10:31:13 +02:00
|
|
|
|
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean; virtual;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure RemoveReferences; virtual;
|
2017-12-27 14:05:33 +01:00
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
public
|
|
|
|
|
class function UnWrap(data: Pointer): ICefClient;
|
|
|
|
|
end;
|
|
|
|
|
|
2017-03-16 19:09:42 +01:00
|
|
|
|
TCefClientOwn = class(TCefBaseRefCountedOwn, ICefClient)
|
2017-01-27 17:29:37 +01:00
|
|
|
|
protected
|
2020-05-23 15:00:44 +02:00
|
|
|
|
procedure GetAudioHandler(var aHandler : ICefAudioHandler); virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); virtual;
|
|
|
|
|
procedure GetDialogHandler(var aHandler : ICefDialogHandler); virtual;
|
|
|
|
|
procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); virtual;
|
|
|
|
|
procedure GetDownloadHandler(var aHandler : ICefDownloadHandler); virtual;
|
|
|
|
|
procedure GetDragHandler(var aHandler : ICefDragHandler); virtual;
|
|
|
|
|
procedure GetFindHandler(var aHandler : ICefFindHandler); virtual;
|
|
|
|
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler); virtual;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler); virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
|
|
|
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
|
|
|
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
|
|
|
|
procedure GetLoadHandler(var aHandler : ICefLoadHandler); virtual;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
procedure GetPrintHandler(var aHandler : ICefPrintHandler); virtual;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetRenderHandler(var aHandler : ICefRenderHandler); virtual;
|
|
|
|
|
procedure GetRequestHandler(var aHandler : ICefRequestHandler); virtual;
|
2019-06-16 10:31:13 +02:00
|
|
|
|
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean; virtual;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure RemoveReferences; virtual;
|
2017-12-27 14:05:33 +01:00
|
|
|
|
|
2017-01-27 17:29:37 +01:00
|
|
|
|
public
|
|
|
|
|
constructor Create; virtual;
|
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
TCustomClientHandler = class(TCefClientOwn)
|
2017-01-27 17:29:37 +01:00
|
|
|
|
protected
|
2018-02-03 17:52:48 +01:00
|
|
|
|
FEvents : Pointer;
|
2020-05-23 15:00:44 +02:00
|
|
|
|
FAudioHandler : ICefAudioHandler;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
FLoadHandler : ICefLoadHandler;
|
|
|
|
|
FFocusHandler : ICefFocusHandler;
|
|
|
|
|
FContextMenuHandler : ICefContextMenuHandler;
|
|
|
|
|
FDialogHandler : ICefDialogHandler;
|
|
|
|
|
FKeyboardHandler : ICefKeyboardHandler;
|
|
|
|
|
FDisplayHandler : ICefDisplayHandler;
|
|
|
|
|
FDownloadHandler : ICefDownloadHandler;
|
|
|
|
|
FJsDialogHandler : ICefJsDialogHandler;
|
|
|
|
|
FLifeSpanHandler : ICefLifeSpanHandler;
|
|
|
|
|
FRenderHandler : ICefRenderHandler;
|
|
|
|
|
FRequestHandler : ICefRequestHandler;
|
|
|
|
|
FDragHandler : ICefDragHandler;
|
|
|
|
|
FFindHandler : ICefFindHandler;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
FPrintHandler : ICefPrintHandler;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
FFrameHandler : ICefFrameHandler;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
2020-05-23 15:00:44 +02:00
|
|
|
|
procedure GetAudioHandler(var aHandler : ICefAudioHandler); override;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); override;
|
|
|
|
|
procedure GetDialogHandler(var aHandler : ICefDialogHandler); override;
|
|
|
|
|
procedure GetDisplayHandler(var aHandler : ICefDisplayHandler); override;
|
|
|
|
|
procedure GetDownloadHandler(var aHandler : ICefDownloadHandler); override;
|
|
|
|
|
procedure GetDragHandler(var aHandler : ICefDragHandler); override;
|
|
|
|
|
procedure GetFindHandler(var aHandler : ICefFindHandler); override;
|
|
|
|
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler); override;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler); override;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); override;
|
|
|
|
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); override;
|
|
|
|
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); override;
|
|
|
|
|
procedure GetLoadHandler(var aHandler : ICefLoadHandler); override;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
procedure GetPrintHandler(var aHandler : ICefPrintHandler); override;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure GetRenderHandler(var aHandler : ICefRenderHandler); override;
|
|
|
|
|
procedure GetRequestHandler(var aHandler : ICefRequestHandler); override;
|
2019-06-16 10:31:13 +02:00
|
|
|
|
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean; override;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure InitializeVars;
|
|
|
|
|
|
2017-01-27 17:29:37 +01:00
|
|
|
|
public
|
2019-06-19 16:53:26 +02:00
|
|
|
|
constructor Create(const events: IChromiumEvents; aDevToolsClient : boolean = False); reintroduce; virtual;
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure BeforeDestruction; override;
|
|
|
|
|
procedure RemoveReferences; override;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
uses
|
2017-02-05 20:56:46 +01:00
|
|
|
|
{$IFDEF DELPHI16_UP}
|
2017-01-27 17:29:37 +01:00
|
|
|
|
System.SysUtils,
|
2017-02-05 20:56:46 +01:00
|
|
|
|
{$ELSE}
|
|
|
|
|
SysUtils,
|
|
|
|
|
{$ENDIF}
|
2017-01-27 17:29:37 +01:00
|
|
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFProcessMessage, uCEFBrowser, uCEFLoadHandler,
|
|
|
|
|
uCEFFocusHandler, uCEFContextMenuHandler, uCEFDialogHandler, uCEFKeyboardHandler,
|
2018-03-08 11:47:04 +01:00
|
|
|
|
uCEFDisplayHandler, uCEFDownloadHandler, uCEFJsDialogHandler,
|
2017-01-27 17:29:37 +01:00
|
|
|
|
uCEFLifeSpanHandler, uCEFRequestHandler, uCEFRenderHandler, uCEFDragHandler,
|
2021-04-18 19:36:20 +02:00
|
|
|
|
uCEFFindHandler, uCEFConstants, uCEFApplicationCore, uCEFFrame, uCEFAudioHandler,
|
2021-07-29 16:20:34 +02:00
|
|
|
|
uCEFPrintHandler, uCEFFrameHandler;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
|
|
|
|
|
2017-12-18 19:38:56 +01:00
|
|
|
|
// ******************************************************
|
2017-06-11 17:48:20 +02:00
|
|
|
|
// ****************** TCefClientRef *********************
|
|
|
|
|
// ******************************************************
|
|
|
|
|
|
|
|
|
|
class function TCefClientRef.UnWrap(data: Pointer): ICefClient;
|
|
|
|
|
begin
|
|
|
|
|
if (data <> nil) then
|
|
|
|
|
Result := Create(data) as ICefClient
|
|
|
|
|
else
|
|
|
|
|
Result := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2020-05-23 15:00:44 +02:00
|
|
|
|
procedure TCefClientRef.GetAudioHandler(var aHandler : ICefAudioHandler);
|
|
|
|
|
begin
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetContextMenuHandler(var aHandler : ICefContextMenuHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetDialogHandler(var aHandler : ICefDialogHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetDisplayHandler(var aHandler : ICefDisplayHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetDownloadHandler(var aHandler : ICefDownloadHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetDragHandler(var aHandler : ICefDragHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetFindHandler(var aHandler : ICefFindHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetFocusHandler(var aHandler : ICefFocusHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2021-07-29 16:20:34 +02:00
|
|
|
|
procedure TCefClientRef.GetFrameHandler(var aHandler : ICefFrameHandler);
|
|
|
|
|
begin
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetLoadHandler(var aHandler : ICefLoadHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2021-04-18 19:36:20 +02:00
|
|
|
|
procedure TCefClientRef.GetPrintHandler(var aHandler : ICefPrintHandler);
|
|
|
|
|
begin
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetRenderHandler(var aHandler : ICefRenderHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientRef.GetRequestHandler(var aHandler : ICefRequestHandler);
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
2019-06-16 10:31:13 +02:00
|
|
|
|
function TCefClientRef.OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean;
|
2017-06-11 17:48:20 +02:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure TCefClientRef.RemoveReferences;
|
2017-12-27 14:05:33 +01:00
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
|
|
|
|
|
// ******************************************************
|
|
|
|
|
// ****************** TCefClientOwn *********************
|
|
|
|
|
// ******************************************************
|
|
|
|
|
|
|
|
|
|
|
2020-05-23 15:00:44 +02:00
|
|
|
|
function cef_client_own_get_audio_handler(self: PCefClient): PCefAudioHandler; stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefAudioHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetAudioHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_context_menu_handler(self: PCefClient): PCefContextMenuHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefContextMenuHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetContextMenuHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_dialog_handler(self: PCefClient): PCefDialogHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefDialogHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetDialogHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_display_handler(self: PCefClient): PCefDisplayHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefDisplayHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetDisplayHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_download_handler(self: PCefClient): PCefDownloadHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefDownloadHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetDownloadHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_drag_handler(self: PCefClient): PCefDragHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefDragHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetDragHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_find_handler(self: PCefClient): PCefFindHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefFindHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetFindHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_focus_handler(self: PCefClient): PCefFocusHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefFocusHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetFocusHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-07-29 16:20:34 +02:00
|
|
|
|
function cef_client_own_get_frame_handler(self: PCefClient): PCefFrameHandler; stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefFrameHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetFrameHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_jsdialog_handler(self: PCefClient): PCefJsDialogHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefJsDialogHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetJsdialogHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_keyboard_handler(self: PCefClient): PCefKeyboardHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefKeyboardHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetKeyboardHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_life_span_handler(self: PCefClient): PCefLifeSpanHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefLifeSpanHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetLifeSpanHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_load_handler(self: PCefClient): PCefLoadHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefLoadHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetLoadHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-04-18 19:36:20 +02:00
|
|
|
|
function cef_client_own_get_render_handler(self: PCefClient): PCefRenderHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefRenderHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetRenderHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
function cef_client_own_get_request_handler(self: PCefClient): PCefRequestHandler; stdcall;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefRequestHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TCefClientOwn(TempObject).GetRequestHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-04-18 19:36:20 +02:00
|
|
|
|
function cef_client_own_get_print_handler(self: PCefClient): PCefPrintHandler; stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
|
|
|
|
TempHandler : ICefPrintHandler;
|
|
|
|
|
begin
|
|
|
|
|
Result := nil;
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
try
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
TCefClientOwn(TempObject).GetPrintHandler(TempHandler);
|
|
|
|
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
|
|
|
|
finally
|
|
|
|
|
TempHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
function cef_client_own_on_process_message_received(self : PCefClient;
|
|
|
|
|
browser : PCefBrowser;
|
2019-06-16 10:31:13 +02:00
|
|
|
|
frame : PCefFrame;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
source_process : TCefProcessId;
|
|
|
|
|
message_ : PCefProcessMessage): Integer; stdcall;
|
|
|
|
|
var
|
|
|
|
|
TempObject : TObject;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
Result := Ord(False);
|
|
|
|
|
TempObject := CefGetObject(self);
|
|
|
|
|
|
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
|
|
|
|
Result := Ord(TCefClientOwn(TempObject).OnProcessMessageReceived(TCefBrowserRef.UnWrap(browser),
|
2019-06-16 10:31:13 +02:00
|
|
|
|
TCefFrameRef.UnWrap(frame),
|
2018-03-29 20:02:04 +02:00
|
|
|
|
source_process,
|
|
|
|
|
TCefProcessMessageRef.UnWrap(message_)));
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
constructor TCefClientOwn.Create;
|
|
|
|
|
begin
|
|
|
|
|
inherited CreateData(SizeOf(TCefClient));
|
|
|
|
|
|
|
|
|
|
with PCefClient(FData)^ do
|
|
|
|
|
begin
|
2020-05-23 15:00:44 +02:00
|
|
|
|
get_audio_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_audio_handler;
|
2018-05-12 14:50:54 +02:00
|
|
|
|
get_context_menu_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_context_menu_handler;
|
|
|
|
|
get_dialog_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_dialog_handler;
|
|
|
|
|
get_display_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_display_handler;
|
|
|
|
|
get_download_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_download_handler;
|
|
|
|
|
get_drag_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_drag_handler;
|
|
|
|
|
get_find_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_find_handler;
|
|
|
|
|
get_focus_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_focus_handler;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
get_frame_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_frame_handler;
|
2018-05-12 14:50:54 +02:00
|
|
|
|
get_jsdialog_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_jsdialog_handler;
|
|
|
|
|
get_keyboard_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_keyboard_handler;
|
|
|
|
|
get_life_span_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_life_span_handler;
|
|
|
|
|
get_load_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_load_handler;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
get_print_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_print_handler;
|
|
|
|
|
get_render_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_render_handler;
|
2018-05-12 14:50:54 +02:00
|
|
|
|
get_request_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_request_handler;
|
|
|
|
|
on_process_message_received := {$IFDEF FPC}@{$ENDIF}cef_client_own_on_process_message_received;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
end;
|
|
|
|
|
|
2020-05-23 15:00:44 +02:00
|
|
|
|
procedure TCefClientOwn.GetAudioHandler(var aHandler : ICefAudioHandler);
|
|
|
|
|
begin
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetContextMenuHandler(var aHandler : ICefContextMenuHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetDialogHandler(var aHandler : ICefDialogHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetDisplayHandler(var aHandler : ICefDisplayHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetDownloadHandler(var aHandler : ICefDownloadHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetDragHandler(var aHandler : ICefDragHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetFindHandler(var aHandler : ICefFindHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetFocusHandler(var aHandler : ICefFocusHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-07-29 16:20:34 +02:00
|
|
|
|
procedure TCefClientOwn.GetFrameHandler(var aHandler : ICefFrameHandler);
|
|
|
|
|
begin
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetLoadHandler(var aHandler : ICefLoadHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-04-18 19:36:20 +02:00
|
|
|
|
procedure TCefClientOwn.GetPrintHandler(var aHandler : ICefPrintHandler);
|
|
|
|
|
begin
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetRenderHandler(var aHandler : ICefRenderHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCefClientOwn.GetRequestHandler(var aHandler : ICefRequestHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
function TCefClientOwn.OnProcessMessageReceived(const browser : ICefBrowser;
|
2019-06-16 10:31:13 +02:00
|
|
|
|
const frame : ICefFrame;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
sourceProcess : TCefProcessId;
|
|
|
|
|
const message_ : ICefProcessMessage): Boolean;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
|
|
|
|
Result := False;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure TCefClientOwn.RemoveReferences;
|
2017-12-27 14:05:33 +01:00
|
|
|
|
begin
|
|
|
|
|
//
|
|
|
|
|
end;
|
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
|
|
|
|
|
// ******************************************************
|
|
|
|
|
// *************** TCustomClientHandler *****************
|
|
|
|
|
// ******************************************************
|
|
|
|
|
|
2017-01-27 17:29:37 +01:00
|
|
|
|
|
2019-06-19 16:53:26 +02:00
|
|
|
|
constructor TCustomClientHandler.Create(const events : IChromiumEvents; aDevToolsClient : boolean);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
|
|
|
|
inherited Create;
|
|
|
|
|
|
2017-12-27 14:05:33 +01:00
|
|
|
|
InitializeVars;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
FEvents := Pointer(events);
|
2017-12-18 19:38:56 +01:00
|
|
|
|
|
2019-06-19 16:53:26 +02:00
|
|
|
|
if (events <> nil) then
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2019-06-19 16:53:26 +02:00
|
|
|
|
if aDevToolsClient then
|
|
|
|
|
begin
|
|
|
|
|
if events.MustCreateKeyboardHandler then FKeyboardHandler := TCustomKeyboardHandler.Create(events);
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
2020-05-23 15:00:44 +02:00
|
|
|
|
if events.MustCreateAudioHandler then FAudioHandler := TCustomAudioHandler.Create(events);
|
2019-06-19 16:53:26 +02:00
|
|
|
|
if events.MustCreateLoadHandler then FLoadHandler := TCustomLoadHandler.Create(events);
|
|
|
|
|
if events.MustCreateFocusHandler then FFocusHandler := TCustomFocusHandler.Create(events);
|
|
|
|
|
if events.MustCreateContextMenuHandler then FContextMenuHandler := TCustomContextMenuHandler.Create(events);
|
|
|
|
|
if events.MustCreateDialogHandler then FDialogHandler := TCustomDialogHandler.Create(events);
|
|
|
|
|
if events.MustCreateKeyboardHandler then FKeyboardHandler := TCustomKeyboardHandler.Create(events);
|
|
|
|
|
if events.MustCreateDisplayHandler then FDisplayHandler := TCustomDisplayHandler.Create(events);
|
|
|
|
|
if events.MustCreateDownloadHandler then FDownloadHandler := TCustomDownloadHandler.Create(events);
|
|
|
|
|
if events.MustCreateJsDialogHandler then FJsDialogHandler := TCustomJsDialogHandler.Create(events);
|
|
|
|
|
if events.MustCreateLifeSpanHandler then FLifeSpanHandler := TCustomLifeSpanHandler.Create(events);
|
|
|
|
|
if events.MustCreateRenderHandler then FRenderHandler := TCustomRenderHandler.Create(events);
|
|
|
|
|
if events.MustCreateRequestHandler then FRequestHandler := TCustomRequestHandler.Create(events);
|
|
|
|
|
if events.MustCreateDragHandler then FDragHandler := TCustomDragHandler.Create(events);
|
|
|
|
|
if events.MustCreateFindHandler then FFindHandler := TCustomFindHandler.Create(events);
|
2021-04-18 19:36:20 +02:00
|
|
|
|
if events.MustCreatePrintHandler then FPrintHandler := TCustomPrintHandler.Create(events);
|
2021-07-29 16:20:34 +02:00
|
|
|
|
if events.MustCreateFrameHandler then FFrameHandler := TCustomFrameHandler.Create(events);
|
2019-06-19 16:53:26 +02:00
|
|
|
|
end;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
procedure TCustomClientHandler.BeforeDestruction;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
begin
|
2017-12-27 14:05:33 +01:00
|
|
|
|
InitializeVars;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
inherited BeforeDestruction;
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomClientHandler.RemoveReferences;
|
|
|
|
|
begin
|
|
|
|
|
FEvents := nil;
|
|
|
|
|
|
2020-05-23 15:00:44 +02:00
|
|
|
|
if (FAudioHandler <> nil) then FAudioHandler.RemoveReferences;
|
2018-02-03 17:52:48 +01:00
|
|
|
|
if (FLoadHandler <> nil) then FLoadHandler.RemoveReferences;
|
|
|
|
|
if (FFocusHandler <> nil) then FFocusHandler.RemoveReferences;
|
|
|
|
|
if (FContextMenuHandler <> nil) then FContextMenuHandler.RemoveReferences;
|
|
|
|
|
if (FDialogHandler <> nil) then FDialogHandler.RemoveReferences;
|
|
|
|
|
if (FKeyboardHandler <> nil) then FKeyboardHandler.RemoveReferences;
|
|
|
|
|
if (FDisplayHandler <> nil) then FDisplayHandler.RemoveReferences;
|
|
|
|
|
if (FDownloadHandler <> nil) then FDownloadHandler.RemoveReferences;
|
|
|
|
|
if (FJsDialogHandler <> nil) then FJsDialogHandler.RemoveReferences;
|
|
|
|
|
if (FLifeSpanHandler <> nil) then FLifeSpanHandler.RemoveReferences;
|
|
|
|
|
if (FRequestHandler <> nil) then FRequestHandler.RemoveReferences;
|
|
|
|
|
if (FRenderHandler <> nil) then FRenderHandler.RemoveReferences;
|
|
|
|
|
if (FDragHandler <> nil) then FDragHandler.RemoveReferences;
|
|
|
|
|
if (FFindHandler <> nil) then FFindHandler.RemoveReferences;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
if (FPrintHandler <> nil) then FPrintHandler.RemoveReferences;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
if (FFrameHandler <> nil) then FFrameHandler.RemoveReferences;
|
2017-12-18 19:38:56 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2017-12-27 14:05:33 +01:00
|
|
|
|
procedure TCustomClientHandler.InitializeVars;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2020-05-23 15:00:44 +02:00
|
|
|
|
FAudioHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
FLoadHandler := nil;
|
|
|
|
|
FFocusHandler := nil;
|
|
|
|
|
FContextMenuHandler := nil;
|
|
|
|
|
FDialogHandler := nil;
|
|
|
|
|
FKeyboardHandler := nil;
|
|
|
|
|
FDisplayHandler := nil;
|
|
|
|
|
FDownloadHandler := nil;
|
|
|
|
|
FJsDialogHandler := nil;
|
|
|
|
|
FLifeSpanHandler := nil;
|
|
|
|
|
FRequestHandler := nil;
|
|
|
|
|
FRenderHandler := nil;
|
|
|
|
|
FDragHandler := nil;
|
|
|
|
|
FFindHandler := nil;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
FPrintHandler := nil;
|
2021-07-29 16:20:34 +02:00
|
|
|
|
FFrameHandler := nil;
|
2017-09-08 17:44:32 +02:00
|
|
|
|
FEvents := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2020-05-23 15:00:44 +02:00
|
|
|
|
procedure TCustomClientHandler.GetAudioHandler(var aHandler : ICefAudioHandler);
|
|
|
|
|
begin
|
|
|
|
|
if (FAudioHandler <> nil) then
|
|
|
|
|
aHandler := FAudioHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetContextMenuHandler(var aHandler : ICefContextMenuHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FContextMenuHandler <> nil) then
|
|
|
|
|
aHandler := FContextMenuHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetDialogHandler(var aHandler : ICefDialogHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FDialogHandler <> nil) then
|
|
|
|
|
aHandler := FDialogHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetDisplayHandler(var aHandler : ICefDisplayHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FDisplayHandler <> nil) then
|
|
|
|
|
aHandler := FDisplayHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetDownloadHandler(var aHandler : ICefDownloadHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FDownloadHandler <> nil) then
|
|
|
|
|
aHandler := FDownloadHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetDragHandler(var aHandler : ICefDragHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FDragHandler <> nil) then
|
|
|
|
|
aHandler := FDragHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetFindHandler(var aHandler : ICefFindHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FFindHandler <> nil) then
|
|
|
|
|
aHandler := FFindHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetFocusHandler(var aHandler : ICefFocusHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FFocusHandler <> nil) then
|
|
|
|
|
aHandler := FFocusHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2021-07-29 16:20:34 +02:00
|
|
|
|
procedure TCustomClientHandler.GetFrameHandler(var aHandler : ICefFrameHandler);
|
|
|
|
|
begin
|
|
|
|
|
if (FFrameHandler <> nil) then
|
|
|
|
|
aHandler := FFrameHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FJsDialogHandler <> nil) then
|
|
|
|
|
aHandler := FJsDialogHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FKeyboardHandler <> nil) then
|
|
|
|
|
aHandler := FKeyboardHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FLifeSpanHandler <> nil) then
|
|
|
|
|
aHandler := FLifeSpanHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetLoadHandler(var aHandler : ICefLoadHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FLoadHandler <> nil) then
|
|
|
|
|
aHandler := FLoadHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2021-04-18 19:36:20 +02:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
procedure TCustomClientHandler.GetPrintHandler(var aHandler : ICefPrintHandler);
|
|
|
|
|
begin
|
|
|
|
|
if (FPrintHandler <> nil) then
|
|
|
|
|
aHandler := FPrintHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetRenderHandler(var aHandler : ICefRenderHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FRenderHandler <> nil) then
|
|
|
|
|
aHandler := FRenderHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
|
procedure TCustomClientHandler.GetRequestHandler(var aHandler : ICefRequestHandler);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
|
if (FRequestHandler <> nil) then
|
|
|
|
|
aHandler := FRequestHandler
|
|
|
|
|
else
|
|
|
|
|
aHandler := nil;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
2018-02-03 17:52:48 +01:00
|
|
|
|
function TCustomClientHandler.OnProcessMessageReceived(const browser : ICefBrowser;
|
2019-06-16 10:31:13 +02:00
|
|
|
|
const frame : ICefFrame;
|
2018-02-03 17:52:48 +01:00
|
|
|
|
sourceProcess : TCefProcessId;
|
2018-03-29 20:02:04 +02:00
|
|
|
|
const message_ : ICefProcessMessage): Boolean;
|
2017-01-27 17:29:37 +01:00
|
|
|
|
begin
|
2017-12-18 19:38:56 +01:00
|
|
|
|
if (FEvents <> nil) then
|
2019-06-16 10:31:13 +02:00
|
|
|
|
Result := IChromiumEvents(FEvents).doOnProcessMessageReceived(browser, frame, sourceProcess, message_)
|
2017-01-27 17:29:37 +01:00
|
|
|
|
else
|
2019-06-16 10:31:13 +02:00
|
|
|
|
Result := inherited OnProcessMessageReceived(browser, frame, sourceProcess, message_);
|
2017-01-27 17:29:37 +01:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
end.
|