mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
ca8bc9dff4
Added the PDS file to extract the HTML Help files using PasDoc Added more XML documentation Fixed some XML errors. Removed the license copy from the pas units. Updated the LICENSE.md file
140 lines
2.7 KiB
ObjectPascal
140 lines
2.7 KiB
ObjectPascal
unit uCEFCompletionCallback;
|
|
|
|
{$IFDEF FPC}
|
|
{$MODE OBJFPC}{$H+}
|
|
{$ENDIF}
|
|
|
|
{$I cef.inc}
|
|
|
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
|
{$MINENUMSIZE 4}
|
|
|
|
interface
|
|
|
|
uses
|
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFWaitableEvent;
|
|
|
|
type
|
|
TCefCompletionCallbackOwn = class(TCefBaseRefCountedOwn, ICefCompletionCallback)
|
|
protected
|
|
procedure OnComplete; virtual;
|
|
|
|
public
|
|
constructor Create; virtual;
|
|
end;
|
|
|
|
TCefFastCompletionCallback = class(TCefCompletionCallbackOwn)
|
|
protected
|
|
FProc: TCefCompletionCallbackProc;
|
|
|
|
procedure OnComplete; override;
|
|
|
|
public
|
|
constructor Create(const proc: TCefCompletionCallbackProc); reintroduce;
|
|
end;
|
|
|
|
TCefEventCompletionCallback = class(TCefCompletionCallbackOwn)
|
|
protected
|
|
FEvent : ICefWaitableEvent;
|
|
|
|
procedure OnComplete; override;
|
|
|
|
public
|
|
constructor Create(const event : ICefWaitableEvent); reintroduce;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
TCefCustomCompletionCallback = class(TCefCompletionCallbackOwn)
|
|
protected
|
|
FEvents : Pointer;
|
|
|
|
public
|
|
constructor Create(const aEvents : IChromiumEvents); reintroduce;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
implementation
|
|
|
|
uses
|
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFTypes;
|
|
|
|
procedure cef_completion_callback_on_complete(self: PCefCompletionCallback); stdcall;
|
|
var
|
|
TempObject : TObject;
|
|
begin
|
|
TempObject := CefGetObject(self);
|
|
|
|
if (TempObject <> nil) and (TempObject is TCefCompletionCallbackOwn) then
|
|
TCefCompletionCallbackOwn(TempObject).OnComplete;
|
|
end;
|
|
|
|
// TCefCompletionHandlerOwn
|
|
|
|
constructor TCefCompletionCallbackOwn.Create;
|
|
begin
|
|
inherited CreateData(SizeOf(TCefCompletionCallback));
|
|
|
|
PCefCompletionCallback(FData)^.on_complete := {$IFDEF FPC}@{$ENDIF}cef_completion_callback_on_complete;
|
|
end;
|
|
|
|
procedure TCefCompletionCallbackOwn.OnComplete;
|
|
begin
|
|
//
|
|
end;
|
|
|
|
// TCefFastCompletionHandler
|
|
|
|
constructor TCefFastCompletionCallback.Create(const proc: TCefCompletionCallbackProc);
|
|
begin
|
|
inherited Create;
|
|
|
|
FProc := proc;
|
|
end;
|
|
|
|
procedure TCefFastCompletionCallback.OnComplete;
|
|
begin
|
|
FProc();
|
|
end;
|
|
|
|
|
|
// TCefEventCompletionCallback
|
|
|
|
|
|
constructor TCefEventCompletionCallback.Create(const event : ICefWaitableEvent);
|
|
begin
|
|
inherited Create;
|
|
|
|
FEvent := event;
|
|
end;
|
|
|
|
destructor TCefEventCompletionCallback.Destroy;
|
|
begin
|
|
FEvent := nil;
|
|
|
|
inherited Destroy;
|
|
end;
|
|
|
|
procedure TCefEventCompletionCallback.OnComplete;
|
|
begin
|
|
if (FEvent <> nil) then FEvent.Signal;
|
|
end;
|
|
|
|
|
|
// TCefCustomCompletionCallback
|
|
|
|
constructor TCefCustomCompletionCallback.Create(const aEvents : IChromiumEvents);
|
|
begin
|
|
inherited Create;
|
|
|
|
FEvents := Pointer(aEvents);
|
|
end;
|
|
|
|
destructor TCefCustomCompletionCallback.Destroy;
|
|
begin
|
|
FEvents := nil;
|
|
|
|
inherited Destroy;
|
|
end;
|
|
|
|
end.
|