mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-15 07:45:56 +01:00
Added TCEFUrlRequestClientComponent
Added URLRequest demo
This commit is contained in:
parent
9b04141fe1
commit
95c6939a37
14
demos/URLRequest/00-DeleteDCUs.bat
Normal file
14
demos/URLRequest/00-DeleteDCUs.bat
Normal file
@ -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
|
74
demos/URLRequest/URLRequest.dpr
Normal file
74
demos/URLRequest/URLRequest.dpr
Normal file
@ -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 <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.
|
||||
*
|
||||
*)
|
||||
|
||||
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.
|
568
demos/URLRequest/URLRequest.dproj
Normal file
568
demos/URLRequest/URLRequest.dproj
Normal file
@ -0,0 +1,568 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{B474747B-C461-4724-A7DA-39C9B53BFEB0}</ProjectGuid>
|
||||
<ProjectVersion>18.2</ProjectVersion>
|
||||
<FrameworkType>VCL</FrameworkType>
|
||||
<MainSource>URLRequest.dpr</MainSource>
|
||||
<Base>True</Base>
|
||||
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||
<Platform Condition="'$(Platform)'==''">Win32</Platform>
|
||||
<TargetedPlatforms>1</TargetedPlatforms>
|
||||
<AppType>Application</AppType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
|
||||
<Base_Win32>true</Base_Win32>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
|
||||
<Base_Win64>true</Base_Win64>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
|
||||
<Cfg_1_Win32>true</Cfg_1_Win32>
|
||||
<CfgParent>Cfg_1</CfgParent>
|
||||
<Cfg_1>true</Cfg_1>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<CfgParent>Base</CfgParent>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
|
||||
<Cfg_2_Win32>true</Cfg_2_Win32>
|
||||
<CfgParent>Cfg_2</CfgParent>
|
||||
<Cfg_2>true</Cfg_2>
|
||||
<Base>true</Base>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base)'!=''">
|
||||
<DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput>
|
||||
<DCC_ExeOutput>..\..\bin</DCC_ExeOutput>
|
||||
<DCC_E>false</DCC_E>
|
||||
<DCC_N>false</DCC_N>
|
||||
<DCC_S>false</DCC_S>
|
||||
<DCC_F>false</DCC_F>
|
||||
<DCC_K>false</DCC_K>
|
||||
<DCC_UsePackage>RESTComponents;emsclientfiredac;FireDAC;FireDACSqliteDriver;soaprtl;FireDACIBDriver;soapmidas;FireDACCommon;emsclient;RESTBackendComponents;soapserver;FireDACCommonDriver;CloudService;inet;$(DCC_UsePackage)</DCC_UsePackage>
|
||||
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
|
||||
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
|
||||
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
|
||||
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
|
||||
<SanitizedProjectName>URLRequest</SanitizedProjectName>
|
||||
<VerInfo_Locale>3082</VerInfo_Locale>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win32)'!=''">
|
||||
<DCC_UsePackage>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)</DCC_UsePackage>
|
||||
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
|
||||
<BT_BuildType>Debug</BT_BuildType>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Base_Win64)'!=''">
|
||||
<DCC_UsePackage>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)</DCC_UsePackage>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1)'!=''">
|
||||
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
|
||||
<DCC_DebugDCUs>true</DCC_DebugDCUs>
|
||||
<DCC_Optimize>false</DCC_Optimize>
|
||||
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
|
||||
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
|
||||
<DCC_RemoteDebug>true</DCC_RemoteDebug>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
|
||||
<DCC_RemoteDebug>false</DCC_RemoteDebug>
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
|
||||
<VerInfo_Locale>1033</VerInfo_Locale>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2)'!=''">
|
||||
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
|
||||
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
|
||||
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
|
||||
<DCC_DebugInformation>0</DCC_DebugInformation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
|
||||
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
|
||||
<AppEnableHighDPI>true</AppEnableHighDPI>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<DelphiCompile Include="$(MainSource)">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="uURLRequest.pas">
|
||||
<Form>URLRequestFrm</Form>
|
||||
</DCCReference>
|
||||
<BuildConfiguration Include="Release">
|
||||
<Key>Cfg_2</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
<BuildConfiguration Include="Debug">
|
||||
<Key>Cfg_1</Key>
|
||||
<CfgParent>Base</CfgParent>
|
||||
</BuildConfiguration>
|
||||
</ItemGroup>
|
||||
<ProjectExtensions>
|
||||
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
|
||||
<Borland.ProjectType>Application</Borland.ProjectType>
|
||||
<BorlandProject>
|
||||
<Delphi.Personality>
|
||||
<Source>
|
||||
<Source Name="MainSource">URLRequest.dpr</Source>
|
||||
</Source>
|
||||
<Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
|
||||
</Excluded_Packages>
|
||||
</Delphi.Personality>
|
||||
<Deployment Version="3">
|
||||
<DeployFile LocalName="Win32\Debug\URLRequest.exe" Configuration="Debug" Class="ProjectOutput">
|
||||
<Platform Name="Win32">
|
||||
<RemoteName>URLRequest.exe</RemoteName>
|
||||
<Overwrite>true</Overwrite>
|
||||
</Platform>
|
||||
</DeployFile>
|
||||
<DeployClass Name="AdditionalDebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidClassesDexFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>classes</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidGDBServer">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeArmeabiFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidLibnativeMipsFile">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\mips</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidServiceOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashImageDef">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="AndroidSplashStyles">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\values</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_DefaultAppIcon">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon144">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon36">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-ldpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon48">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-mdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon72">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-hdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_LauncherIcon96">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xhdpi</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage426">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-small</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage470">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-normal</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage640">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-large</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="Android_SplashImage960">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>res\drawable-xlarge</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DebugSymbols">
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyFramework">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.framework</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="DependencyModule">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.dll;.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="DependencyPackage">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
<Extensions>.dylib</Extensions>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
<Extensions>.bpl</Extensions>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="File">
|
||||
<Platform Name="Android">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1024">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch1536">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch2048">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPad_Launch768">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch320">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="iPhone_Launch640x1136">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectAndroidManifest">
|
||||
<Platform Name="Android">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceDebug">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSDeviceResourceRules">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSEntitlements">
|
||||
<Platform Name="iOSDevice32">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSInfoPList">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectiOSResource">
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXEntitlements">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>..\</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXInfoPList">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectOSXResource">
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\Resources</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Required="true" Name="ProjectOutput">
|
||||
<Platform Name="Android">
|
||||
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSDevice64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="iOSSimulator">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Linux64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="OSX32">
|
||||
<RemoteDir>Contents\MacOS</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win32">
|
||||
<Operation>0</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="ProjectUWPManifest">
|
||||
<Platform Name="Win32">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo150">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<DeployClass Name="UWP_DelphiLogo44">
|
||||
<Platform Name="Win32">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
<Platform Name="Win64">
|
||||
<RemoteDir>Assets</RemoteDir>
|
||||
<Operation>1</Operation>
|
||||
</Platform>
|
||||
</DeployClass>
|
||||
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
|
||||
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
|
||||
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
|
||||
</Deployment>
|
||||
<Platforms>
|
||||
<Platform value="Win32">True</Platform>
|
||||
<Platform value="Win64">False</Platform>
|
||||
</Platforms>
|
||||
</BorlandProject>
|
||||
<ProjectFileVersion>12</ProjectFileVersion>
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
|
||||
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
|
||||
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
|
||||
</Project>
|
382
demos/URLRequest/cef.inc
Normal file
382
demos/URLRequest/cef.inc
Normal file
@ -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 <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.
|
||||
*
|
||||
*)
|
||||
|
||||
// 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}
|
||||
|
70
demos/URLRequest/uURLRequest.dfm
Normal file
70
demos/URLRequest/uURLRequest.dfm
Normal file
@ -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
|
287
demos/URLRequest/uURLRequest.pas
Normal file
287
demos/URLRequest/uURLRequest.pas
Normal file
@ -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 <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 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.
|
@ -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.
|
||||
|
||||
|
@ -256,6 +256,8 @@
|
||||
<DCCReference Include="..\source\uCEFv8ArrayBufferReleaseCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWinControl.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLinkedWindowParent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequestClientEvents.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
||||
|
@ -270,6 +270,8 @@
|
||||
<DCCReference Include="..\source\uCEFv8ArrayBufferReleaseCallback.pas"/>
|
||||
<DCCReference Include="..\source\uCEFWinControl.pas"/>
|
||||
<DCCReference Include="..\source\uCEFLinkedWindowParent.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequestClientEvents.pas"/>
|
||||
<DCCReference Include="..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<BuildConfiguration Include="Base">
|
||||
<Key>Base</Key>
|
||||
</BuildConfiguration>
|
||||
|
Binary file not shown.
@ -51,14 +51,15 @@ uses
|
||||
System.Classes,
|
||||
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uBufferPanel,
|
||||
uCEFWorkScheduler, uFMXBufferPanel, uFMXChromium, uFMXWorkScheduler,
|
||||
uCEFServerComponent, uCEFLinkedWindowParent;
|
||||
uCEFServerComponent, uCEFLinkedWindowParent, uCEFUrlRequestClientComponent;
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Chromium', [TChromium, TCEFWindowParent, TChromiumWindow,
|
||||
TBufferPanel, TFMXBufferPanel, TFMXChromium,
|
||||
TFMXWorkScheduler, TCEFWorkScheduler,
|
||||
TCEFServerComponent, TCEFLinkedWindowParent]);
|
||||
TCEFServerComponent, TCEFLinkedWindowParent,
|
||||
TCEFUrlRequestClientComponent]);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -54,12 +54,13 @@ uses
|
||||
Classes,
|
||||
{$ENDIF}
|
||||
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.
|
||||
|
@ -21,7 +21,7 @@
|
||||
</CompilerOptions>
|
||||
<Description Value="CEF4Delphi"/>
|
||||
<Version Major="1"/>
|
||||
<Files Count="135">
|
||||
<Files Count="137">
|
||||
<Item1>
|
||||
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>
|
||||
<UnitName Value="uCEFAccessibilityHandler"/>
|
||||
@ -569,6 +569,15 @@
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="uCEFLinkedWindowParent"/>
|
||||
</Item135>
|
||||
<Item136>
|
||||
<Filename Value="..\source\uCEFUrlRequestClientEvents.pas"/>
|
||||
<UnitName Value="uCEFUrlRequestClientEvents"/>
|
||||
</Item136>
|
||||
<Item137>
|
||||
<Filename Value="..\source\uCEFUrlRequestClientComponent.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<UnitName Value="uCEFUrlRequestClientComponent"/>
|
||||
</Item137>
|
||||
</Files>
|
||||
<RequiredPkgs Count="3">
|
||||
<Item1>
|
||||
|
@ -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
|
||||
|
@ -1,2 +1,3 @@
|
||||
brc32 chromium.rc -r -fochromium.dcr
|
||||
|
||||
pause
|
@ -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
|
Binary file not shown.
@ -7,4 +7,5 @@ TBufferPanel BITMAP "bufferpanel.bmp"
|
||||
TFMXBufferPanel BITMAP "bufferpanel.bmp"
|
||||
TCEFWorkScheduler BITMAP "workscheduler.bmp"
|
||||
TFMXWorkScheduler BITMAP "workscheduler.bmp"
|
||||
TCEFServerComponent BITMAP "server.bmp"
|
||||
TCEFServerComponent BITMAP "server.bmp"
|
||||
TCEFUrlRequestClientComponent BITMAP "tcefurlrequestclientcomponent.bmp"
|
BIN
packages/res/tcefurlrequestclientcomponent.bmp
Normal file
BIN
packages/res/tcefurlrequestclientcomponent.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
packages/res/tcefurlrequestclientcomponent.png
Normal file
BIN
packages/res/tcefurlrequestclientcomponent.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 541 B |
23
source/res/tcefurlrequestclientcomponent.lrs
Normal file
23
source/res/tcefurlrequestclientcomponent.lrs
Normal file
@ -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
|
||||
]);
|
@ -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;
|
||||
|
||||
|
||||
// *******************************************
|
||||
|
@ -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.
|
||||
|
201
source/uCEFUrlRequestClientComponent.pas
Normal file
201
source/uCEFUrlRequestClientComponent.pas
Normal file
@ -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 <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 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.
|
70
source/uCEFUrlRequestClientEvents.pas
Normal file
70
source/uCEFUrlRequestClientEvents.pas
Normal file
@ -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 <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 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.
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user