2017-01-27 18:29:37 +02: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 18:29:37 +02: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
|
|
|
|
//
|
2021-01-01 12:11:30 +02:00
|
|
|
// Copyright � 2021 Salvador Diaz Fau. All rights reserved.
|
2017-01-27 18:29:37 +02: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 16:02:21 +02:00
|
|
|
{$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF}
|
|
|
|
{$MINENUMSIZE 4}
|
2017-01-27 18:29:37 +02:00
|
|
|
|
2017-02-05 21:56:46 +02:00
|
|
|
{$I cef.inc}
|
|
|
|
|
2017-01-27 18:29:37 +02:00
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
2017-03-16 20:09:42 +02:00
|
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
2017-01-27 18:29:37 +02: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;
|
|
|
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
|
|
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
|
|
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
|
|
|
procedure GetLoadHandler(var aHandler : ICefLoadHandler); virtual;
|
|
|
|
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 18:52:48 +02:00
|
|
|
procedure RemoveReferences; virtual;
|
2017-12-27 15:05:33 +02:00
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
public
|
|
|
|
class function UnWrap(data: Pointer): ICefClient;
|
|
|
|
end;
|
|
|
|
|
2017-03-16 20:09:42 +02:00
|
|
|
TCefClientOwn = class(TCefBaseRefCountedOwn, ICefClient)
|
2017-01-27 18:29:37 +02: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;
|
|
|
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
|
|
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
|
|
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
|
|
|
procedure GetLoadHandler(var aHandler : ICefLoadHandler); virtual;
|
|
|
|
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 18:29:37 +02:00
|
|
|
|
2018-02-03 18:52:48 +02:00
|
|
|
procedure RemoveReferences; virtual;
|
2017-12-27 15:05:33 +02:00
|
|
|
|
2017-01-27 18:29:37 +02:00
|
|
|
public
|
|
|
|
constructor Create; virtual;
|
|
|
|
end;
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
TCustomClientHandler = class(TCefClientOwn)
|
2017-01-27 18:29:37 +02:00
|
|
|
protected
|
2018-02-03 18:52:48 +02:00
|
|
|
FEvents : Pointer;
|
2020-05-23 15:00:44 +02:00
|
|
|
FAudioHandler : ICefAudioHandler;
|
2017-01-27 18:29:37 +02: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;
|
|
|
|
|
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;
|
|
|
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); override;
|
|
|
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); override;
|
|
|
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); override;
|
|
|
|
procedure GetLoadHandler(var aHandler : ICefLoadHandler); override;
|
|
|
|
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 20:38:56 +02:00
|
|
|
|
2018-02-03 18:52:48 +02:00
|
|
|
procedure InitializeVars;
|
|
|
|
|
2017-01-27 18:29:37 +02:00
|
|
|
public
|
2019-06-19 16:53:26 +02:00
|
|
|
constructor Create(const events: IChromiumEvents; aDevToolsClient : boolean = False); reintroduce; virtual;
|
2018-02-03 18:52:48 +02:00
|
|
|
procedure BeforeDestruction; override;
|
|
|
|
procedure RemoveReferences; override;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
uses
|
2017-02-05 21:56:46 +02:00
|
|
|
{$IFDEF DELPHI16_UP}
|
2017-01-27 18:29:37 +02:00
|
|
|
System.SysUtils,
|
2017-02-05 21:56:46 +02:00
|
|
|
{$ELSE}
|
|
|
|
SysUtils,
|
|
|
|
{$ENDIF}
|
2017-01-27 18:29:37 +02:00
|
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFProcessMessage, uCEFBrowser, uCEFLoadHandler,
|
|
|
|
uCEFFocusHandler, uCEFContextMenuHandler, uCEFDialogHandler, uCEFKeyboardHandler,
|
2018-03-08 12:47:04 +02:00
|
|
|
uCEFDisplayHandler, uCEFDownloadHandler, uCEFJsDialogHandler,
|
2017-01-27 18:29:37 +02:00
|
|
|
uCEFLifeSpanHandler, uCEFRequestHandler, uCEFRenderHandler, uCEFDragHandler,
|
2020-05-23 15:00:44 +02:00
|
|
|
uCEFFindHandler, uCEFConstants, uCEFApplicationCore, uCEFFrame, uCEFAudioHandler;
|
2017-01-27 18:29:37 +02:00
|
|
|
|
|
|
|
|
2017-12-18 20:38:56 +02: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;
|
|
|
|
|
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;
|
|
|
|
|
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 18:52:48 +02:00
|
|
|
procedure TCefClientRef.RemoveReferences;
|
2017-12-27 15:05:33 +02: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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02:00
|
|
|
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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02: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 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
function cef_client_own_get_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 18:29:37 +02: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 18:29:37 +02:00
|
|
|
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 18:29:37 +02: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 18:29:37 +02: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;
|
|
|
|
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;
|
|
|
|
get_render_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_get_render_handler;
|
|
|
|
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 18:29:37 +02: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 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetDialogHandler(var aHandler : ICefDialogHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetDisplayHandler(var aHandler : ICefDisplayHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetDownloadHandler(var aHandler : ICefDownloadHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetDragHandler(var aHandler : ICefDragHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetFindHandler(var aHandler : ICefFindHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetFocusHandler(var aHandler : ICefFocusHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetLoadHandler(var aHandler : ICefLoadHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetRenderHandler(var aHandler : ICefRenderHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCefClientOwn.GetRequestHandler(var aHandler : ICefRequestHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02: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 18:29:37 +02:00
|
|
|
begin
|
|
|
|
Result := False;
|
|
|
|
end;
|
|
|
|
|
2018-02-03 18:52:48 +02:00
|
|
|
procedure TCefClientOwn.RemoveReferences;
|
2017-12-27 15:05:33 +02:00
|
|
|
begin
|
|
|
|
//
|
|
|
|
end;
|
|
|
|
|
2017-06-11 17:48:20 +02:00
|
|
|
|
|
|
|
// ******************************************************
|
|
|
|
// *************** TCustomClientHandler *****************
|
|
|
|
// ******************************************************
|
|
|
|
|
2017-01-27 18:29:37 +02:00
|
|
|
|
2019-06-19 16:53:26 +02:00
|
|
|
constructor TCustomClientHandler.Create(const events : IChromiumEvents; aDevToolsClient : boolean);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
|
|
|
inherited Create;
|
|
|
|
|
2017-12-27 15:05:33 +02:00
|
|
|
InitializeVars;
|
2017-12-18 20:38:56 +02:00
|
|
|
|
2018-02-03 18:52:48 +02:00
|
|
|
FEvents := Pointer(events);
|
2017-12-18 20:38:56 +02:00
|
|
|
|
2019-06-19 16:53:26 +02:00
|
|
|
if (events <> nil) then
|
2017-12-18 20:38:56 +02: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);
|
|
|
|
end;
|
2017-12-18 20:38:56 +02:00
|
|
|
end;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-02-03 18:52:48 +02:00
|
|
|
procedure TCustomClientHandler.BeforeDestruction;
|
2017-12-18 20:38:56 +02:00
|
|
|
begin
|
2017-12-27 15:05:33 +02:00
|
|
|
InitializeVars;
|
2017-12-18 20:38:56 +02:00
|
|
|
|
2018-02-03 18:52:48 +02: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 18:52:48 +02: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;
|
2017-12-18 20:38:56 +02:00
|
|
|
end;
|
|
|
|
|
2017-12-27 15:05:33 +02:00
|
|
|
procedure TCustomClientHandler.InitializeVars;
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2020-05-23 15:00:44 +02:00
|
|
|
FAudioHandler := nil;
|
2017-01-27 18:29:37 +02: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;
|
2017-09-08 17:44:32 +02:00
|
|
|
FEvents := nil;
|
2017-01-27 18:29:37 +02: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 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FContextMenuHandler <> nil) then
|
|
|
|
aHandler := FContextMenuHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetDialogHandler(var aHandler : ICefDialogHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FDialogHandler <> nil) then
|
|
|
|
aHandler := FDialogHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetDisplayHandler(var aHandler : ICefDisplayHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FDisplayHandler <> nil) then
|
|
|
|
aHandler := FDisplayHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetDownloadHandler(var aHandler : ICefDownloadHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FDownloadHandler <> nil) then
|
|
|
|
aHandler := FDownloadHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetDragHandler(var aHandler : ICefDragHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FDragHandler <> nil) then
|
|
|
|
aHandler := FDragHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetFindHandler(var aHandler : ICefFindHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FFindHandler <> nil) then
|
|
|
|
aHandler := FFindHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetFocusHandler(var aHandler : ICefFocusHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FFocusHandler <> nil) then
|
|
|
|
aHandler := FFocusHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FJsDialogHandler <> nil) then
|
|
|
|
aHandler := FJsDialogHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FKeyboardHandler <> nil) then
|
|
|
|
aHandler := FKeyboardHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FLifeSpanHandler <> nil) then
|
|
|
|
aHandler := FLifeSpanHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetLoadHandler(var aHandler : ICefLoadHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FLoadHandler <> nil) then
|
|
|
|
aHandler := FLoadHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetRenderHandler(var aHandler : ICefRenderHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FRenderHandler <> nil) then
|
|
|
|
aHandler := FRenderHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-03-29 20:02:04 +02:00
|
|
|
procedure TCustomClientHandler.GetRequestHandler(var aHandler : ICefRequestHandler);
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2018-03-29 20:02:04 +02:00
|
|
|
if (FRequestHandler <> nil) then
|
|
|
|
aHandler := FRequestHandler
|
|
|
|
else
|
|
|
|
aHandler := nil;
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
2018-02-03 18:52:48 +02:00
|
|
|
function TCustomClientHandler.OnProcessMessageReceived(const browser : ICefBrowser;
|
2019-06-16 10:31:13 +02:00
|
|
|
const frame : ICefFrame;
|
2018-02-03 18:52:48 +02:00
|
|
|
sourceProcess : TCefProcessId;
|
2018-03-29 20:02:04 +02:00
|
|
|
const message_ : ICefProcessMessage): Boolean;
|
2017-01-27 18:29:37 +02:00
|
|
|
begin
|
2017-12-18 20:38:56 +02:00
|
|
|
if (FEvents <> nil) then
|
2019-06-16 10:31:13 +02:00
|
|
|
Result := IChromiumEvents(FEvents).doOnProcessMessageReceived(browser, frame, sourceProcess, message_)
|
2017-01-27 18:29:37 +02:00
|
|
|
else
|
2019-06-16 10:31:13 +02:00
|
|
|
Result := inherited OnProcessMessageReceived(browser, frame, sourceProcess, message_);
|
2017-01-27 18:29:37 +02:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|