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

Update to CEF 74.1.16

- Copied the GlobalCEFApp_OnWebKitInitializedEvent fix for D2007 made by jepp to other demos.
- Added TChromium.DownloadImage and TChromium.OnDownloadImageFinished to download images
- Added a TChromium.DownloadImage example to the MiniBrowser demo.
- Modified some parameters in TCefImageRef
This commit is contained in:
Salvador Díaz Fau
2019-05-11 15:40:19 +02:00
parent dc56584556
commit 59f3441b1e
17 changed files with 257 additions and 38 deletions

View File

@ -70,11 +70,31 @@ type
constructor Create(const proc: TOnDownloadImageFinishedProc); reintroduce;
end;
TCefCustomDownloadImageCallback = class(TCefDownloadImageCallbackOwn)
protected
FEvents : Pointer;
procedure OnDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); override;
public
constructor Create(const aEvents : IChromiumEvents); reintroduce;
destructor Destroy; override;
end;
implementation
uses
{$IFDEF DELPHI16_UP}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF}
uCEFMiscFunctions, uCEFLibFunctions, uCEFImage;
// TCefDownloadImageCallbackOwn
procedure cef_download_image_callback_on_download_image_finished( self : PCefDownloadImageCallback;
const image_url : PCefString;
http_status_code : Integer;
@ -98,6 +118,9 @@ begin
on_download_image_finished := {$IFDEF FPC}@{$ENDIF}cef_download_image_callback_on_download_image_finished;
end;
// TCefFastDownloadImageCallback
constructor TCefFastDownloadImageCallback.Create(const proc: TOnDownloadImageFinishedProc);
begin
inherited Create;
@ -111,5 +134,37 @@ begin
end;
// TCefCustomDownloadImageCallback
constructor TCefCustomDownloadImageCallback.Create(const aEvents : IChromiumEvents);
begin
inherited Create;
FEvents := Pointer(aEvents);
end;
destructor TCefCustomDownloadImageCallback.Destroy;
begin
FEvents := nil;
inherited Destroy;
end;
procedure TCefCustomDownloadImageCallback.OnDownloadImageFinished(const imageUrl : ustring;
httpStatusCode : Integer;
const image : ICefImage);
begin
try
try
if (FEvents <> nil) then IChromiumEvents(FEvents).doDownloadImageFinished(imageUrl, httpStatusCode, image);
except
on e : exception do
if CustomExceptionHandler('TCefCustomDownloadImageCallback.OnDownloadImageFinished', e) then raise;
end;
finally
FEvents := nil;
end;
end;
end.