From 95c6939a37a54e0728816c91203f57922a9397a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Sat, 17 Nov 2018 11:50:34 +0100 Subject: [PATCH] Added TCEFUrlRequestClientComponent Added URLRequest demo --- demos/URLRequest/00-DeleteDCUs.bat | 14 + demos/URLRequest/URLRequest.dpr | 74 +++ demos/URLRequest/URLRequest.dproj | 568 ++++++++++++++++++ demos/URLRequest/cef.inc | 382 ++++++++++++ demos/URLRequest/uURLRequest.dfm | 70 +++ demos/URLRequest/uURLRequest.pas | 287 +++++++++ packages/CEF4Delphi.dpk | 4 +- packages/CEF4Delphi.dproj | 2 + packages/CEF4Delphi_D7.dpk | 4 +- packages/CEF4Delphi_D7_Register.pas | 5 +- packages/CEF4Delphi_FMX.dpk | 4 +- packages/CEF4Delphi_FMX.dproj | 2 + packages/CEF4Delphi_FMX.res | Bin 676 -> 724 bytes packages/CEF4Delphi_FMX_Register.pas | 5 +- packages/CEF4Delphi_Register.pas | 5 +- packages/cef4delphi_lazarus.lpk | 11 +- packages/cef4delphi_lazarus.pas | 4 +- packages/res/00-CreateDelphiResources.bat | 1 + packages/res/00-CreateLazarusResources.bat | 1 + packages/res/chromium.dcr | Bin 18328 -> 20184 bytes packages/res/chromium.rc | 3 +- .../res/tcefurlrequestclientcomponent.bmp | Bin 0 -> 1782 bytes .../res/tcefurlrequestclientcomponent.png | Bin 0 -> 541 bytes source/res/tcefurlrequestclientcomponent.lrs | 23 + source/uCEFInterfaces.pas | 12 + source/uCEFTask.pas | 44 +- source/uCEFUrlRequestClientComponent.pas | 201 +++++++ source/uCEFUrlRequestClientEvents.pas | 70 +++ source/uCEFUrlrequestClient.pas | 106 +++- 29 files changed, 1881 insertions(+), 21 deletions(-) create mode 100644 demos/URLRequest/00-DeleteDCUs.bat create mode 100644 demos/URLRequest/URLRequest.dpr create mode 100644 demos/URLRequest/URLRequest.dproj create mode 100644 demos/URLRequest/cef.inc create mode 100644 demos/URLRequest/uURLRequest.dfm create mode 100644 demos/URLRequest/uURLRequest.pas create mode 100644 packages/res/tcefurlrequestclientcomponent.bmp create mode 100644 packages/res/tcefurlrequestclientcomponent.png create mode 100644 source/res/tcefurlrequestclientcomponent.lrs create mode 100644 source/uCEFUrlRequestClientComponent.pas create mode 100644 source/uCEFUrlRequestClientEvents.pas diff --git a/demos/URLRequest/00-DeleteDCUs.bat b/demos/URLRequest/00-DeleteDCUs.bat new file mode 100644 index 00000000..dbd008bc --- /dev/null +++ b/demos/URLRequest/00-DeleteDCUs.bat @@ -0,0 +1,14 @@ +del /s /q *.dcu +del /s /q *.exe +del /s /q *.res +del /s /q *.log +del /s /q *.dsk +del /s /q *.identcache +del /s /q *.stat +del /s /q *.local +del /s /q *.~* +rmdir Win32\Debug +rmdir Win32\Release +rmdir Win32 +rmdir __history +rmdir __recovery diff --git a/demos/URLRequest/URLRequest.dpr b/demos/URLRequest/URLRequest.dpr new file mode 100644 index 00000000..a19dcc5f --- /dev/null +++ b/demos/URLRequest/URLRequest.dpr @@ -0,0 +1,74 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// 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 +// +// Copyright © 2018 Salvador Díaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ 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 + * 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. + * + *) + +program URLRequest; + +{$I cef.inc} + +uses + FastMM4, + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + Windows, + {$ENDIF } + uCEFApplication, + uURLRequest in 'uURLRequest.pas' {URLRequestFrm}; + +{$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +// If you don't add this flag the rederer process will crash when you try to load large images. +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TURLRequestFrm, URLRequestFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/URLRequest/URLRequest.dproj b/demos/URLRequest/URLRequest.dproj new file mode 100644 index 00000000..323db9c8 --- /dev/null +++ b/demos/URLRequest/URLRequest.dproj @@ -0,0 +1,568 @@ + + + {B474747B-C461-4724-A7DA-39C9B53BFEB0} + 18.2 + VCL + URLRequest.dpr + True + Debug + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + .\$(Platform)\$(Config) + ..\..\bin + false + false + false + false + false + RESTComponents;emsclientfiredac;FireDAC;FireDACSqliteDriver;soaprtl;FireDACIBDriver;soapmidas;FireDACCommon;emsclient;RESTBackendComponents;soapserver;FireDACCommonDriver;CloudService;inet;$(DCC_UsePackage) + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + URLRequest + 3082 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + + + DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + true + true + true + 1033 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + true + + + + MainSource + + +
URLRequestFrm
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + URLRequest.dpr + + + IP Abstraction Indy Implementation Design Time + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + URLRequest.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 0 + + + + + classes + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + + + res\values + 1 + + + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + 1 + + + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\ + 1 + + + + + Contents + 1 + + + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + True + False + + + 12 + + + + +
diff --git a/demos/URLRequest/cef.inc b/demos/URLRequest/cef.inc new file mode 100644 index 00000000..8ad3597b --- /dev/null +++ b/demos/URLRequest/cef.inc @@ -0,0 +1,382 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// 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 +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ 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 + * 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. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/URLRequest/uURLRequest.dfm b/demos/URLRequest/uURLRequest.dfm new file mode 100644 index 00000000..69cfe61b --- /dev/null +++ b/demos/URLRequest/uURLRequest.dfm @@ -0,0 +1,70 @@ +object URLRequestFrm: TURLRequestFrm + Left = 0 + Top = 0 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'URL request' + ClientHeight = 111 + ClientWidth = 494 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + PixelsPerInch = 96 + TextHeight = 13 + object Label1: TLabel + Left = 16 + Top = 19 + Width = 19 + Height = 13 + Caption = 'URL' + end + object Edit1: TEdit + Left = 48 + Top = 16 + Width = 433 + Height = 21 + TabOrder = 0 + Text = + 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/du' + + 'mmy.pdf' + end + object DownloadBtn: TButton + Left = 16 + Top = 51 + Width = 465 + Height = 25 + Caption = 'Download' + TabOrder = 1 + OnClick = DownloadBtnClick + end + object StatusBar1: TStatusBar + Left = 0 + Top = 92 + Width = 494 + Height = 19 + Panels = < + item + Width = 500 + end> + end + object SaveDialog1: TSaveDialog + Left = 384 + Top = 64 + end + object CEFUrlRequestClientComponent1: TCEFUrlRequestClientComponent + OnRequestComplete = CEFUrlRequestClientComponent1RequestComplete + OnDownloadProgress = CEFUrlRequestClientComponent1DownloadProgress + OnDownloadData = CEFUrlRequestClientComponent1DownloadData + OnCreateURLRequest = CEFUrlRequestClientComponent1CreateURLRequest + Left = 80 + Top = 64 + end +end diff --git a/demos/URLRequest/uURLRequest.pas b/demos/URLRequest/uURLRequest.pas new file mode 100644 index 00000000..7b8b9a1f --- /dev/null +++ b/demos/URLRequest/uURLRequest.pas @@ -0,0 +1,287 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// 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 +// +// Copyright © 2018 Salvador Díaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ 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 + * 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 uURLRequest; + +interface + +uses + + {$IFDEF DELPHI16_UP} + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, Vcl.StdCtrls, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, ComCtrls, StdCtrls, + {$ENDIF} + uCEFInterfaces, uCEFUrlRequestClientComponent; + +const + URLREQUEST_SUCCESS = WM_APP + $101; + URLREQUEST_ERROR = WM_APP + $102; + +type + TURLRequestFrm = class(TForm) + Edit1: TEdit; + Label1: TLabel; + DownloadBtn: TButton; + StatusBar1: TStatusBar; + SaveDialog1: TSaveDialog; + CEFUrlRequestClientComponent1: TCEFUrlRequestClientComponent; + + procedure DownloadBtnClick(Sender: TObject); + + procedure FormDestroy(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + + procedure CEFUrlRequestClientComponent1DownloadData(Sender: TObject; const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); + procedure CEFUrlRequestClientComponent1DownloadProgress(Sender: TObject; const request: ICefUrlRequest; current, total: Int64); + procedure CEFUrlRequestClientComponent1RequestComplete(Sender: TObject; const request: ICefUrlRequest); + procedure CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); + private + FStream : TMemoryStream; + FCanClose : boolean; + FClosing : boolean; + FDownloading : boolean; + FPendingURL : string; + + procedure URLRequestSuccessMsg(var aMessage : TMessage); message URLREQUEST_SUCCESS; + procedure URLRequestErrorMsg(var aMessage : TMessage); message URLREQUEST_ERROR; + + procedure SaveStreamToFile; + end; + +var + URLRequestFrm: TURLRequestFrm; + +implementation + +{$R *.dfm} + +// This is a simple URL request example to download small files using TCEFUrlRequestClientComponent. +// WARNING : If you try to download big files you may get an "Out of memory" exception. Replace TMemoryStream in that case. + +// All TCEFUrlRequestClientComponent events are executed in a different thread. Don't create or destroy VCL componets +// inside them. + +// To keep this demo as simple as possible, it's only allowed to download one file at a time. You can add as many requests +// as you want but then you would have to use a different way to store the data with synchronization objects. + +// It's much safer to cancel all requests before closing the app. +// This demo follows this destruction sequence in case there is a file download running : +// -------------------------------------------------------------------------------------- +// 1- Set CanClose to FALSE in the TForm.OnCloseQuery event and set FClosing to TRUE. +// 2- The next time TCEFUrlRequestClientComponent.OnDownloadProgress is executed we call request.Cancel, which triggers the +// TCEFUrlRequestClientComponent.OnRequestComplete event. +// 3- in the TCEFUrlRequestClientComponent.OnRequestComplete event we set FCanClose to TRUE and send WM_CLOSE to the form. + +uses + uCEFMiscFunctions, uCEFTypes, uCEFUrlRequest, uCEFRequest, uCEFPostData, uCEFPostDataElement; + +procedure TURLRequestFrm.DownloadBtnClick(Sender: TObject); +var + TempURL, TempPath, TempName : string; + TempParts : TUrlParts; + i : integer; +begin + TempURL := trim(Edit1.Text); + + if (length(TempURL) > 0) then + begin + CefParseUrl(TempURL, TempParts); + TempPath := trim(TempParts.path); + TempName := ''; + + if (length(TempPath) > 0) then + begin + i := LastDelimiter('/', TempPath); + + if (i > 0) then + TempName := trim(copy(TempPath, succ(i), length(TempPath))) + else + TempName := TempPath; + end; + + if (length(TempName) > 0) then + SaveDialog1.FileName := TempName // This name should be decoded and sanitized before using it in Windows + else + SaveDialog1.FileName := 'UnknownFileName'; + + if SaveDialog1.Execute and + (length(SaveDialog1.FileName) > 0) then + begin + FPendingURL := TempURL; + DownloadBtn.Enabled := False; + StatusBar1.Panels[0].Text := 'Downloading...'; + FStream.Clear; + + // TCEFUrlRequestClientComponent.AddURLRequest will trigger the + // TCEFUrlRequestClientComponent.OnCreateURLRequest event in the right + // thread where you can create your custom requests. + CEFUrlRequestClientComponent1.AddURLRequest; + end; + end; +end; + +procedure TURLRequestFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose or not(FDownloading); + FClosing := True; +end; + +procedure TURLRequestFrm.FormCreate(Sender: TObject); +begin + FStream := TMemoryStream.Create; + FCanClose := False; + FClosing := False; + FDownloading := False; +end; + +procedure TURLRequestFrm.FormDestroy(Sender: TObject); +begin + if (FStream <> nil) then FreeAndNil(FStream); +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); +var + TempRequest : ICefRequest; + // TempPostData : ICefPostData; + // TempElement : ICefPostDataElement; +begin + try + if (length(FPendingURL) > 0) then + begin + FDownloading := True; + + // GET request example + // ------------------- + TempRequest := TCefRequestRef.New; + TempRequest.URL := FPendingURL; + TempRequest.Method := 'GET'; + + // POST request example + // -------------------- + // TempElement := TCefPostDataElementOwn.Create(True); + // TempElement.SetToFile('c:\myfile.txt'); + // + // TempPostData := TCefPostDataRef.New; + // TempPostData.AddElement := TempElement; + // + // TempRequest := TCefRequestRef.New; + // TempRequest.URL := FPendingURL; + // TempRequest.Method := 'POST'; + // TempRequest.PostData := TempPostData; + + // Set the "client" parameter to the TCEFUrlRequestClientComponent.Client property + // to use the TCEFUrlRequestClientComponent events. + // The "requestContext" parameter can be nil to use the global request context. + TCefUrlRequestRef.New(TempRequest, CEFUrlRequestClientComponent1.Client, nil); + end; + finally + TempRequest := nil; + end; +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData(Sender: TObject; const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); +begin + try + if FClosing then + request.Cancel + else + if (data <> nil) and (dataLength > 0) then + FStream.WriteBuffer(data^, dataLength); + except + on e : exception do + if CustomExceptionHandler('TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData', e) then raise; + end; +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1DownloadProgress(Sender: TObject; const request: ICefUrlRequest; current, total: Int64); +begin + if FClosing then + request.Cancel + else + if (total > 0) then + StatusBar1.Panels[0].Text := 'Downloading : ' + inttostr(round((current / total) * 100)) + ' %' + else + StatusBar1.Panels[0].Text := 'Downloading : ' + inttostr(current) + ' bytes'; +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1RequestComplete(Sender: TObject; const request: ICefUrlRequest); +begin + FDownloading := False; + + // Use request.response here to get a ICefResponse interface with all the response headers, status, error code, etc. + + if FClosing then + begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); + end + else + if (request <> nil) and (request.RequestStatus = UR_SUCCESS) then + PostMessage(Handle, URLREQUEST_SUCCESS, 0, 0) + else + PostMessage(Handle, URLREQUEST_ERROR, 0, request.RequestError); +end; + +procedure TURLRequestFrm.URLRequestSuccessMsg(var aMessage : TMessage); +begin + DownloadBtn.Enabled := True; + StatusBar1.Panels[0].Text := 'Download complete!'; + SaveStreamToFile; +end; + +procedure TURLRequestFrm.URLRequestErrorMsg(var aMessage : TMessage); +begin + DownloadBtn.Enabled := True; + StatusBar1.Panels[0].Text := 'Download error : ' + inttostr(aMessage.lParam); +end; + +procedure TURLRequestFrm.SaveStreamToFile; +begin + try + FStream.SaveToFile(SaveDialog1.FileName); + FStream.Clear; + except + on e : exception do + if CustomExceptionHandler('TURLRequestFrm.SaveStreamToFile', e) then raise; + end; +end; + +end. diff --git a/packages/CEF4Delphi.dpk b/packages/CEF4Delphi.dpk index e49355b1..50398286 100644 --- a/packages/CEF4Delphi.dpk +++ b/packages/CEF4Delphi.dpk @@ -164,7 +164,9 @@ contains uCEFStringList in '..\source\uCEFStringList.pas', uCEFv8ArrayBufferReleaseCallback in '..\source\uCEFv8ArrayBufferReleaseCallback.pas', uCEFWinControl in '..\source\uCEFWinControl.pas', - uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas'; + uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', + uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', + uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas'; end. diff --git a/packages/CEF4Delphi.dproj b/packages/CEF4Delphi.dproj index a9311f4c..25cccd74 100644 --- a/packages/CEF4Delphi.dproj +++ b/packages/CEF4Delphi.dproj @@ -256,6 +256,8 @@ + + Base diff --git a/packages/CEF4Delphi_D7.dpk b/packages/CEF4Delphi_D7.dpk index 164bdbfb..da59126b 100644 --- a/packages/CEF4Delphi_D7.dpk +++ b/packages/CEF4Delphi_D7.dpk @@ -161,6 +161,8 @@ contains uCEFStringList in '..\source\uCEFStringList.pas', uCEFv8ArrayBufferReleaseCallback in '..\source\uCEFv8ArrayBufferReleaseCallback.pas', uCEFWinControl in '..\source\uCEFWinControl.pas', - uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas'; + uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', + uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', + uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas'; end. diff --git a/packages/CEF4Delphi_D7_Register.pas b/packages/CEF4Delphi_D7_Register.pas index a7a024f6..ed019a50 100644 --- a/packages/CEF4Delphi_D7_Register.pas +++ b/packages/CEF4Delphi_D7_Register.pas @@ -50,12 +50,13 @@ implementation uses Classes, uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uBufferPanel, uCEFWorkScheduler, - uCEFServerComponent, uCEFLinkedWindowParent; + uCEFServerComponent, uCEFLinkedWindowParent, uCEFUrlRequestClientComponent; procedure Register; begin RegisterComponents('Chromium', [TChromium, TCEFWindowParent, TChromiumWindow, TBufferPanel, - TCEFWorkScheduler, TCEFServerComponent, TCEFLinkedWindowParent]); + TCEFWorkScheduler, TCEFServerComponent, TCEFLinkedWindowParent, + TCEFUrlRequestClientComponent]); end; end. diff --git a/packages/CEF4Delphi_FMX.dpk b/packages/CEF4Delphi_FMX.dpk index a60c3cd4..6196b7c1 100644 --- a/packages/CEF4Delphi_FMX.dpk +++ b/packages/CEF4Delphi_FMX.dpk @@ -168,7 +168,9 @@ contains uFMXWindowParent in '..\source\uFMXWindowParent.pas', uCEFv8ArrayBufferReleaseCallback in '..\source\uCEFv8ArrayBufferReleaseCallback.pas', uCEFWinControl in '..\source\uCEFWinControl.pas', - uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas'; + uCEFLinkedWindowParent in '..\source\uCEFLinkedWindowParent.pas', + uCEFUrlRequestClientEvents in '..\source\uCEFUrlRequestClientEvents.pas', + uCEFUrlRequestClientComponent in '..\source\uCEFUrlRequestClientComponent.pas'; end. diff --git a/packages/CEF4Delphi_FMX.dproj b/packages/CEF4Delphi_FMX.dproj index efefcaeb..866bdec4 100644 --- a/packages/CEF4Delphi_FMX.dproj +++ b/packages/CEF4Delphi_FMX.dproj @@ -270,6 +270,8 @@ + + Base diff --git a/packages/CEF4Delphi_FMX.res b/packages/CEF4Delphi_FMX.res index 2b6bf397780fb584fc767b5ef780f54b506d6cb3..0b1d7bfebb7dc1e50dd62d97ee57ed52405f8ff3 100644 GIT binary patch delta 82 zcmZ3&dWCg@0%OQTMR_3M7|pn8;#_6MzKI9jWz87485kKn8S)rP7*ZLEfOH~54uc<% g%w - + @@ -569,6 +569,15 @@ + + + + + + + + + diff --git a/packages/cef4delphi_lazarus.pas b/packages/cef4delphi_lazarus.pas index c24e04ee..3f7becd3 100644 --- a/packages/cef4delphi_lazarus.pas +++ b/packages/cef4delphi_lazarus.pas @@ -46,7 +46,7 @@ uses uCEFWriteHandler, uCEFX509Certificate, uCEFX509CertPrincipal, uCEFXmlReader, uCEFZipReader, uCEFChromium, uBufferPanel, uCEFServer, uCEFServerComponent, uCEFServerEvents, uCEFServerHandler, uCEFWinControl, uCEFLinkedWindowParent, - LazarusPackageIntf; + uCEFUrlRequestClientEvents, uCEFUrlRequestClientComponent, LazarusPackageIntf; implementation @@ -59,6 +59,8 @@ begin RegisterUnit('uBufferPanel', @uBufferPanel.Register); RegisterUnit('uCEFServerComponent', @uCEFServerComponent.Register); RegisterUnit('uCEFLinkedWindowParent', @uCEFLinkedWindowParent.Register); + RegisterUnit('uCEFUrlRequestClientComponent', + @uCEFUrlRequestClientComponent.Register); end; initialization diff --git a/packages/res/00-CreateDelphiResources.bat b/packages/res/00-CreateDelphiResources.bat index af5012b4..6aa749e1 100644 --- a/packages/res/00-CreateDelphiResources.bat +++ b/packages/res/00-CreateDelphiResources.bat @@ -1,2 +1,3 @@ brc32 chromium.rc -r -fochromium.dcr + pause \ No newline at end of file diff --git a/packages/res/00-CreateLazarusResources.bat b/packages/res/00-CreateLazarusResources.bat index 72e24d44..8d375ba0 100644 --- a/packages/res/00-CreateLazarusResources.bat +++ b/packages/res/00-CreateLazarusResources.bat @@ -5,4 +5,5 @@ c:\lazarus\tools\lazres.exe ..\..\source\res\tceflinkedwindowparent.lrs tceflink c:\lazarus\tools\lazres.exe ..\..\source\res\tcefworkscheduler.lrs tcefworkscheduler.png c:\lazarus\tools\lazres.exe ..\..\source\res\tchromium.lrs tchromium.png c:\lazarus\tools\lazres.exe ..\..\source\res\tchromiumwindow.lrs tchromiumwindow.png +c:\lazarus\tools\lazres.exe ..\..\source\res\tcefurlrequestclientcomponent.lrs tcefurlrequestclientcomponent.png pause \ No newline at end of file diff --git a/packages/res/chromium.dcr b/packages/res/chromium.dcr index 5a9e6ade341dce95888a0fd0bf6c51472bd7f8c2..c6bc0923a470252947226f05335727bf7d414352 100644 GIT binary patch delta 917 zcmaiwT}#_w6vrROzJY911VIo64q3mzpdeKTWw6bG-^ShV!i(H^qxYidYDJ5RFSTjX zG(Kz6Hbxs0yNx!qg%)gS)7SmCOnJ0pdpIE{=l44&IayvB(pQGQEYEVEo;`iFKnUsg zpOASnP5fkrd?fEl0GFSoDYSf!JsIL$WcKZ6b@#=M;ANC-3p(J zMJkm_xm+$5i?(g2Baz7JDgsHNP_XUiHUKarsAzDP<8s5EaSXw+&d=eO4C9BYBEchG z{wS7lHfpZte7sE>O8s}DALyx4?|?}}o{ayAzG z6N11}G2-InL_a-c;EgO_MWgBc{q(^> z=I~HEI%1$DNwAgOU1e`i4ToVd&=f`3bbI@2D3sjUfx^IRLBK$Hb5q{hqQM|I1C3ZL o6%I@5>xqpGaP+f~=KdQ;c84G#5{-9RF zPP^T1wOY+)^ZB!pAx{-ezu!ksmwS-maMShQ`sP$=Z{`CKlS$z;+WMofl0 zRWvBk(?#zDMa);K)v9G#hGFQsE`&%V67hIk3Iw8lzoIC_WXMxR0}4G|ZjQ4Q)3Qgs zUa!?^l}e>tE@vZ=$mS+aP%4$kkf(|UCHk+cO=cqii`mH}gsN#irPBnw@@c2!7SE3F zgqT1~MR8ChXLn6iryy`VpuUCt7BvGhKk7%woG5;*+aGn^*0e$__U^Lmt`blE)o)*s zJ)}~Ws$O4QIDR8ZbN0G{wA>3}%Cd2GhF^ul`SWvcoI6dsiAJ+WN7>`!+{uY?dg_g1 zt12_-!JvM4m=1*idgEA%!VF@6|1uCr9UMUO#<`VcHqv%?wY@#z_k;4rF=MezD5P$0 jCw6u~F_lM-B*BSqZGmDc7WBYz?lz5XC+WT${~>+@A9Od7 literal 0 HcmV?d00001 diff --git a/packages/res/tcefurlrequestclientcomponent.png b/packages/res/tcefurlrequestclientcomponent.png new file mode 100644 index 0000000000000000000000000000000000000000..433249cb761919032f580b5e26798568f89d2d27 GIT binary patch literal 541 zcmV+&0^1>;qHO>2)+VdIpfWvR}*4D6k2DN zDJc!hE`&DuQkYJ^uQTn;a-|e=IRtY&oC~CE!)Wwoo4SA?VtBtF!LtcqYBmDiHa!@HV*v*dq|;)Xva{ZS8G&g#RUm9m)9L5VC2JA;>4Kl#%y^st zR%g&?+_3q43HV`)#d7bdb%Et_SvHw`=)JLphNa&dkKbWqCfs~zSmfQLm7GW*81p!h-@?ZlgT&if?igdW{+%Q zIDCC57Rw#hXdeV}x2CM*oG)v%CrT`LM0I<;)09g|9w9sJiaxbOiLC}0Q z$kzlUUI4xczrZbR0X+33rWueiqR^3Ws~}AQJT(@~oP<`kfUZJefEzQ9sCq4=NJ#1Q f?A(E?@h`vtcaWeeu!LdH00000NkvXXu0mjfv2gBw literal 0 HcmV?d00001 diff --git a/source/res/tcefurlrequestclientcomponent.lrs b/source/res/tcefurlrequestclientcomponent.lrs new file mode 100644 index 00000000..b7987f51 --- /dev/null +++ b/source/res/tcefurlrequestclientcomponent.lrs @@ -0,0 +1,23 @@ +LazarusResources.Add('tcefurlrequestclientcomponent','PNG',[ + #137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0 + +#0#0#4'gAMA'#0#0#175#200'7'#5#138#233#0#0#0#25'tEXtSoftware'#0'Adobe ImageRe' + +'adyq'#201'e<'#0#0#1#175'IDATx'#218#180'U'#205'N'#2'1'#16'n'#187' '#8'B '#225 + +#180'g'#19'"O'#192'E^'#193'g'#128#196';'#9#241#188#252'\5'#225#238#129#248#8 + +#190#2'^9'#227#205#163'W'#19'b@'#20'Zg'#150'))'#13#203'.'#132'6'#249'R'#152 + +'N'#191#175'3'#237#204'r'#165#20's9'#4's<'#156#11#164'l'#195'h'#244'f'#155 + +#186#128' b'#127#143#214#183#163#217#188'M'#22'A'#173#230#135'@'#242'j'#213 + +'g'#190'_f'#249'|'#134#21#10'YV*'#229'X'#165'r'#21#174#25'~'#167#167#136'sr' + +#22#28'~'#243#240'?'#215#198'cS'#180'_'#128'3'#207'C'#136#144'\'#8#225'B@' + +#176'TJP'#4#27#193#179#9'`j6'#2#222'6='#24#133'c'#1#7#17#164#211'b'#155#178 + +#179#222#129#25#129'i;U lN'#211#233#231#206'%k'#17#251#233#130#159#221#204'x' + +#156#0'Vg'#208'h'#220#176#249'|'#9#248'a'#139#197'r'#239#169'u'#129#229'rY6' + +#153'|'#232#189#177#133#134#165#223#27#143#223'ac&'#220'|hX'#228#221#164#149 + +#156'H$'#142'<'#174#23#29#20'1'#201#201#247#248'^'#20'%'#146#148'|G`'#223#219 + +#174#215#175'y'#171#213#232')%'#251#166#8#146#163#13#214#250#232#131#136'l3' + +#250#147#201'7'#236#130'^V'#154'f'#143'lb8|}('#22#203#29#244#157#205#190#158 + +#218#237#187'Gz'#210#146#176#6#172#0#127'4K'#224'V'#166#0#18']'#0#176#209#23 + +#0'Y'#18#242#180#208'`'#240'r/'#165#228'A'#208'|6'#200#215#4'$^'#0#190#9#191 + +#192'-m'#1'<'#245'%'#166#25#144'1'#162#208#145'p'#171' M'#1'<5'#22#204#156 + +#132'V'#182#128#174'Ba'#128#27'3'#143#168'z-'#164'HH'#233#244#236#220#129#171 + +#241'/'#192#0'w'#144#160'*'#176#132'a'#207#0#0#0#0'IEND'#174'B`'#130 +]); diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 92d4ebb6..e8282b06 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -139,6 +139,7 @@ type ICefWindow = interface; ICefLabelButton = interface; ICefMenuButton = interface; + ICefUrlRequest = interface; TCefv8ValueArray = array of ICefv8Value; TCefX509CertificateArray = array of ICefX509Certificate; @@ -385,6 +386,17 @@ type procedure doOnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt); end; + ICEFUrlRequestClientEvents = interface + // ICefUrlrequestClient + procedure doOnRequestComplete(const request: ICefUrlRequest); + procedure doOnUploadProgress(const request: ICefUrlRequest; current, total: Int64); + procedure doOnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); + procedure doOnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); + function doOnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; + + // Custom + procedure doOnCreateURLRequest; + end; // ******************************************* diff --git a/source/uCEFTask.pas b/source/uCEFTask.pas index 9d36f9e4..fd7a130c 100644 --- a/source/uCEFTask.pas +++ b/source/uCEFTask.pas @@ -104,6 +104,17 @@ type destructor Destroy; override; end; + TCefURLRequestTask = class(TCefTaskOwn) + protected + FEvents : Pointer; + + procedure Execute; override; + + public + constructor Create(const aEvents : ICEFUrlRequestClientEvents); reintroduce; + destructor Destroy; override; + end; + implementation uses @@ -112,7 +123,7 @@ uses {$ELSE} SysUtils, {$ENDIF} - uCEFMiscFunctions, uCEFLibFunctions, uCEFCookieManager; + uCEFMiscFunctions, uCEFLibFunctions, uCEFCookieManager, uCEFUrlRequest; procedure cef_task_execute(self: PCefTask); stdcall; var @@ -243,4 +254,35 @@ begin end; end; + +// TCefURLRequestTask + +procedure TCefURLRequestTask.Execute; +begin + try + try + if (FEvents <> nil) then ICEFUrlRequestClientEvents(FEvents).doOnCreateURLRequest; + except + on e : exception do + if CustomExceptionHandler('TCefURLRequestTask.Execute', e) then raise; + end; + finally + FEvents := nil; + end; +end; + +constructor TCefURLRequestTask.Create(const aEvents : ICEFUrlRequestClientEvents); +begin + inherited Create; + + FEvents := Pointer(aEvents); +end; + +destructor TCefURLRequestTask.Destroy; +begin + FEvents := nil; + + inherited Destroy; +end; + end. diff --git a/source/uCEFUrlRequestClientComponent.pas b/source/uCEFUrlRequestClientComponent.pas new file mode 100644 index 00000000..31eb7bd5 --- /dev/null +++ b/source/uCEFUrlRequestClientComponent.pas @@ -0,0 +1,201 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// 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 +// +// Copyright © 2018 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ 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 + * 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 uCEFUrlRequestClientComponent; + +{$IFDEF FPC} + {$MODE OBJFPC}{$H+} +{$ENDIF} + +{$IFNDEF CPUX64} + {$ALIGN ON} + {$MINENUMSIZE 4} +{$ENDIF} + +{$I cef.inc} + +interface + +uses + {$IFDEF DELPHI16_UP} + {$IFDEF MSWINDOWS}WinApi.Windows, WinApi.Messages, WinApi.ActiveX,{$ENDIF} + System.Classes, Vcl.Controls, Vcl.Graphics, Vcl.Forms, System.Math, + {$ELSE} + {$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, Forms, Controls, Graphics, ActiveX, Math, + {$IFDEF FPC} + LCLProc, LCLType, LCLIntf, LResources, LMessages, InterfaceBase, + {$ELSE} + Messages, + {$ENDIF} + {$ENDIF} + uCEFTypes, uCEFInterfaces, uCEFUrlRequestClientEvents, uCEFUrlrequestClient, uCEFUrlRequest; + +type + TCEFUrlRequestClientComponent = class(TComponent, ICEFUrlRequestClientEvents) + protected + FClient : ICefUrlrequestClient; + FThreadID : TCefThreadId; + + FOnRequestComplete : TOnRequestComplete; + FOnUploadProgress : TOnUploadProgress; + FOnDownloadProgress : TOnDownloadProgress; + FOnDownloadData : TOnDownloadData; + FOnGetAuthCredentials : TOnGetAuthCredentials; + FOnCreateURLRequest : TNotifyEvent; + + // ICefUrlrequestClient + procedure doOnRequestComplete(const request: ICefUrlRequest); + procedure doOnUploadProgress(const request: ICefUrlRequest; current, total: Int64); + procedure doOnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); + procedure doOnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); + function doOnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; + + // Custom + procedure doOnCreateURLRequest; + + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure AfterConstruction; override; + + procedure AddURLRequest; + + property Client : ICefUrlrequestClient read FClient; + property ThreadID : TCefThreadId read FThreadID write FThreadID; + + published + property OnRequestComplete : TOnRequestComplete read FOnRequestComplete write FOnRequestComplete; + property OnUploadProgress : TOnUploadProgress read FOnUploadProgress write FOnUploadProgress; + property OnDownloadProgress : TOnDownloadProgress read FOnDownloadProgress write FOnDownloadProgress; + property OnDownloadData : TOnDownloadData read FOnDownloadData write FOnDownloadData; + property OnGetAuthCredentials : TOnGetAuthCredentials read FOnGetAuthCredentials write FOnGetAuthCredentials; + property OnCreateURLRequest : TNotifyEvent read FOnCreateURLRequest write FOnCreateURLRequest; + end; + +{$IFDEF FPC} +procedure Register; +{$ENDIF} + +implementation + +uses + {$IFDEF DELPHI16_UP} + System.SysUtils, + {$ELSE} + SysUtils, + {$ENDIF} + uCEFRequest, uCEFTask, uCEFMiscFunctions; + + +constructor TCEFUrlRequestClientComponent.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FClient := nil; + FThreadID := TID_UI; + FOnRequestComplete := nil; + FOnUploadProgress := nil; + FOnDownloadProgress := nil; + FOnDownloadData := nil; + FOnGetAuthCredentials := nil; + FOnCreateURLRequest := nil; +end; + +destructor TCEFUrlRequestClientComponent.Destroy; +begin + FClient := nil; + + inherited Destroy; +end; + +procedure TCEFUrlRequestClientComponent.AfterConstruction; +begin + inherited AfterConstruction; + + if not(csDesigning in ComponentState) then + FClient := TCustomCefUrlrequestClient.Create(self); +end; + +procedure TCEFUrlRequestClientComponent.doOnRequestComplete(const request: ICefUrlRequest); +begin + if assigned(FOnRequestComplete) then FOnRequestComplete(self, request); +end; + +procedure TCEFUrlRequestClientComponent.doOnUploadProgress(const request: ICefUrlRequest; current, total: Int64); +begin + if assigned(FOnUploadProgress) then FOnUploadProgress(self, request, current, total); +end; + +procedure TCEFUrlRequestClientComponent.doOnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); +begin + if assigned(FOnDownloadProgress) then FOnDownloadProgress(self, request, current, total); +end; + +procedure TCEFUrlRequestClientComponent.doOnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); +begin + if assigned(FOnDownloadData) then FOnDownloadData(self, request, data, datalength); +end; + +function TCEFUrlRequestClientComponent.doOnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; +begin + Result := False; + + if assigned(FOnGetAuthCredentials) then FOnGetAuthCredentials(self, isProxy, host, port, realm, scheme, callback, Result); +end; + +procedure TCEFUrlRequestClientComponent.doOnCreateURLRequest; +begin + if assigned(FOnCreateURLRequest) then FOnCreateURLRequest(self); +end; + +procedure TCEFUrlRequestClientComponent.AddURLRequest; +var + TempTask : ICefTask; +begin + TempTask := TCefURLRequestTask.Create(self); + CefPostTask(FThreadID, TempTask); +end; + +{$IFDEF FPC} +procedure Register; +begin + {$I res/tcefurlrequestclientcomponent.lrs} + RegisterComponents('Chromium', [TCEFUrlRequestClientComponent]); +end; +{$ENDIF} + +end. diff --git a/source/uCEFUrlRequestClientEvents.pas b/source/uCEFUrlRequestClientEvents.pas new file mode 100644 index 00000000..05b31c80 --- /dev/null +++ b/source/uCEFUrlRequestClientEvents.pas @@ -0,0 +1,70 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// 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 +// +// Copyright © 2018 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ 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 + * 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 uCEFUrlRequestClientEvents; + +{$IFDEF FPC} + {$MODE OBJFPC}{$H+} +{$ENDIF} + +{$IFNDEF CPUX64} + {$ALIGN ON} + {$MINENUMSIZE 4} +{$ENDIF} + +{$I cef.inc} + +interface + +uses + {$IFDEF DELPHI16_UP} + System.Classes, + {$ELSE} + Classes, + {$ENDIF} + uCEFTypes, uCEFInterfaces; + +type + TOnRequestComplete = procedure(Sender: TObject; const request: ICefUrlRequest) of object; + TOnUploadProgress = procedure(Sender: TObject; const request: ICefUrlRequest; current, total: Int64) of object; + TOnDownloadProgress = procedure(Sender: TObject; const request: ICefUrlRequest; current, total: Int64) of object; + TOnDownloadData = procedure(Sender: TObject; const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt) of object; + TOnGetAuthCredentials = procedure(Sender: TObject; isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback; var aResult : Boolean) of object; + +implementation + +end. diff --git a/source/uCEFUrlrequestClient.pas b/source/uCEFUrlrequestClient.pas index 217a72af..9b23901b 100644 --- a/source/uCEFUrlrequestClient.pas +++ b/source/uCEFUrlrequestClient.pas @@ -55,22 +55,43 @@ uses type TCefUrlrequestClientOwn = class(TCefBaseRefCountedOwn, ICefUrlrequestClient) - protected - procedure OnRequestComplete(const request: ICefUrlRequest); virtual; - procedure OnUploadProgress(const request: ICefUrlRequest; current, total: Int64); virtual; - procedure OnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); virtual; - procedure OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); virtual; - function OnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; virtual; - public - constructor Create; virtual; + protected + procedure OnRequestComplete(const request: ICefUrlRequest); virtual; + procedure OnUploadProgress(const request: ICefUrlRequest; current, total: Int64); virtual; + procedure OnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); virtual; + procedure OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); virtual; + function OnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; virtual; + public + constructor Create; virtual; + end; + + TCustomCefUrlrequestClient = class(TCefUrlrequestClientOwn) + protected + FEvents : ICEFUrlRequestClientEvents; + + procedure OnRequestComplete(const request: ICefUrlRequest); override; + procedure OnUploadProgress(const request: ICefUrlRequest; current, total: Int64); override; + procedure OnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); override; + procedure OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); override; + function OnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; override; + public + constructor Create(const events: ICEFUrlRequestClientEvents); reintroduce; + destructor Destroy; override; end; implementation uses + {$IFDEF DELPHI16_UP} + System.SysUtils, + {$ELSE} + SysUtils, + {$ENDIF} uCEFMiscFunctions, uCEFLibFunctions, uCEFUrlRequest, uCEFAuthCallback; +// TCefUrlrequestClientOwn + procedure cef_url_request_client_on_request_complete(self : PCefUrlRequestClient; request : PCefUrlRequest); stdcall; var @@ -189,4 +210,73 @@ begin // end; + +// TCustomCefUrlrequestClient + +constructor TCustomCefUrlrequestClient.Create(const events: ICEFUrlRequestClientEvents); +begin + inherited Create; + + FEvents := events; +end; + +destructor TCustomCefUrlrequestClient.Destroy; +begin + FEvents := nil; + + inherited Destroy; +end; + +procedure TCustomCefUrlrequestClient.OnRequestComplete(const request: ICefUrlRequest); +begin + try + if (FEvents <> nil) then FEvents.doOnRequestComplete(request); + except + on e : exception do + if CustomExceptionHandler('TCustomCefUrlrequestClient.OnRequestComplete', e) then raise; + end; +end; + +procedure TCustomCefUrlrequestClient.OnUploadProgress(const request: ICefUrlRequest; current, total: Int64); +begin + try + if (FEvents <> nil) then FEvents.doOnUploadProgress(request, current, total); + except + on e : exception do + if CustomExceptionHandler('TCustomCefUrlrequestClient.OnUploadProgress', e) then raise; + end; +end; + +procedure TCustomCefUrlrequestClient.OnDownloadProgress(const request: ICefUrlRequest; current, total: Int64); +begin + try + if (FEvents <> nil) then FEvents.doOnDownloadProgress(request, current, total); + except + on e : exception do + if CustomExceptionHandler('TCustomCefUrlrequestClient.OnDownloadProgress', e) then raise; + end; +end; + +procedure TCustomCefUrlrequestClient.OnDownloadData(const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); +begin + try + if (FEvents <> nil) then FEvents.doOnDownloadData(request, data, dataLength); + except + on e : exception do + if CustomExceptionHandler('TCustomCefUrlrequestClient.OnDownloadData', e) then raise; + end; +end; + +function TCustomCefUrlrequestClient.OnGetAuthCredentials(isProxy: Boolean; const host: ustring; port: Integer; const realm, scheme: ustring; const callback: ICefAuthCallback): Boolean; +begin + Result := False; + try + if (FEvents <> nil) then Result := FEvents.doOnGetAuthCredentials(isProxy, host, port, realm, scheme, callback); + except + on e : exception do + if CustomExceptionHandler('TCustomCefUrlrequestClient.OnGetAuthCredentials', e) then raise; + end; +end; + + end.