You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-22 22:17:48 +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:
@ -240,6 +240,7 @@ type
|
||||
FOnCookiesDeleted : TOnCookiesDeletedEvent;
|
||||
FOnResolvedHostAvailable : TOnResolvedIPsAvailableEvent;
|
||||
FOnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent;
|
||||
FOnDownloadImageFinished : TOnDownloadImageFinishedEvent;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg : TOnCompMsgEvent;
|
||||
FOnWidgetCompMsg : TOnCompMsgEvent;
|
||||
@ -486,6 +487,7 @@ type
|
||||
function doSavePreferences : boolean; virtual;
|
||||
procedure doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); virtual;
|
||||
function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual;
|
||||
procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage);
|
||||
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
@ -513,6 +515,7 @@ type
|
||||
procedure ReloadIgnoreCache;
|
||||
procedure StopLoad;
|
||||
procedure StartDownload(const aURL : ustring);
|
||||
procedure DownloadImage(const imageUrl: ustring; isFavicon: Boolean; maxImageSize: cardinal; bypassCache: Boolean);
|
||||
|
||||
procedure SimulateMouseWheel(aDeltaX, aDeltaY : integer);
|
||||
function DeleteCookies(const url : ustring = ''; const cookieName : ustring = '') : boolean;
|
||||
@ -663,6 +666,7 @@ type
|
||||
property OnCookiesDeleted : TOnCookiesDeletedEvent read FOnCookiesDeleted write FOnCookiesDeleted;
|
||||
property OnResolvedHostAvailable : TOnResolvedIPsAvailableEvent read FOnResolvedHostAvailable write FOnResolvedHostAvailable;
|
||||
property OnNavigationVisitorResultAvailable : TOnNavigationVisitorResultAvailableEvent read FOnNavigationVisitorResultAvailable write FOnNavigationVisitorResultAvailable;
|
||||
property OnDownloadImageFinished : TOnDownloadImageFinishedEvent read FOnDownloadImageFinished write FOnDownloadImageFinished;
|
||||
{$IFNDEF FPC}
|
||||
property OnBrowserCompMsg : TOnCompMsgEvent read FOnBrowserCompMsg write FOnBrowserCompMsg;
|
||||
property OnWidgetCompMsg : TOnCompMsgEvent read FOnWidgetCompMsg write FOnWidgetCompMsg;
|
||||
@ -790,7 +794,7 @@ uses
|
||||
uCEFBrowser, uCEFValue, uCEFDictionaryValue, uCEFStringMultimap, uCEFFrame,
|
||||
uCEFApplication, uCEFProcessMessage, uCEFRequestContext, {$IFNDEF FPC}uCEFOLEDragAndDrop,{$ENDIF}
|
||||
uCEFPDFPrintCallback, uCEFResolveCallback, uCEFDeleteCookiesCallback, uCEFStringVisitor,
|
||||
uCEFListValue, uCEFNavigationEntryVisitor;
|
||||
uCEFListValue, uCEFNavigationEntryVisitor, uCEFDownloadImageCallBack;
|
||||
|
||||
constructor TChromium.Create(AOwner: TComponent);
|
||||
begin
|
||||
@ -1144,6 +1148,7 @@ begin
|
||||
FOnCookiesDeleted := nil;
|
||||
FOnResolvedHostAvailable := nil;
|
||||
FOnNavigationVisitorResultAvailable := nil;
|
||||
FOnDownloadImageFinished := nil;
|
||||
{$IFNDEF FPC}
|
||||
FOnBrowserCompMsg := nil;
|
||||
FOnWidgetCompMsg := nil;
|
||||
@ -1727,6 +1732,25 @@ begin
|
||||
if Initialized then FBrowser.Host.StartDownload(aURL);
|
||||
end;
|
||||
|
||||
// Use the OnDownloadImageFinished event to receive the image
|
||||
procedure TChromium.DownloadImage(const imageUrl : ustring;
|
||||
isFavicon : boolean;
|
||||
maxImageSize : cardinal;
|
||||
bypassCache : boolean);
|
||||
var
|
||||
TempCallback : ICefDownloadImageCallback;
|
||||
begin
|
||||
try
|
||||
if Initialized and (FBrowser.Host <> nil) then
|
||||
begin
|
||||
TempCallback := TCefCustomDownloadImageCallback.Create(self);
|
||||
FBrowser.Host.DownloadImage(imageUrl, isFavicon, maxImageSize, bypassCache, TempCallback);
|
||||
end;
|
||||
finally
|
||||
TempCallback := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TChromium.GetIsLoading : boolean;
|
||||
begin
|
||||
Result := Initialized and FBrowser.IsLoading;
|
||||
@ -2950,6 +2974,14 @@ begin
|
||||
FOnNavigationVisitorResultAvailable(entry, current, index, total, Result);
|
||||
end;
|
||||
|
||||
procedure TChromium.doDownloadImageFinished(const imageUrl : ustring;
|
||||
httpStatusCode : Integer;
|
||||
const image : ICefImage);
|
||||
begin
|
||||
if assigned(FOnDownloadImageFinished) then
|
||||
FOnDownloadImageFinished(self, imageUrl, httpStatusCode, image);
|
||||
end;
|
||||
|
||||
function TChromium.MustCreateLoadHandler : boolean;
|
||||
begin
|
||||
Result := assigned(FOnLoadStart) or
|
||||
|
Reference in New Issue
Block a user