You've already forked CEF4Delphi
							
							
				mirror of
				https://github.com/salvadordf/CEF4Delphi.git
				synced 2025-10-30 23:07:52 +02:00 
			
		
		
		
	New PopupBrowser2 demo
This commit is contained in:
		
							
								
								
									
										14
									
								
								demos/PopupBrowser2/00-DeleteDCUs.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								demos/PopupBrowser2/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 | ||||
							
								
								
									
										76
									
								
								demos/PopupBrowser2/PopupBrowser2.dpr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								demos/PopupBrowser2/PopupBrowser2.dpr
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,76 @@ | ||||
| // ************************************************************************ | ||||
| // ***************************** 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 PopupBrowser2; | ||||
|  | ||||
| {$I cef.inc} | ||||
|  | ||||
| uses | ||||
|   {$IFDEF DELPHI16_UP} | ||||
|   Vcl.Forms, | ||||
|   WinApi.Windows, | ||||
|   {$ELSE} | ||||
|   Forms, | ||||
|   Windows, | ||||
|   {$ENDIF } | ||||
|   uCEFApplication, | ||||
|   uMainForm in 'uMainForm.pas' {MainForm}, | ||||
|   uChildForm in 'uChildForm.pas' {ChildForm}; | ||||
|  | ||||
| {$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; | ||||
|   GlobalCEFApp.FlashEnabled               := False; | ||||
|   GlobalCEFApp.EnableHighDPISupport       := True; | ||||
|  | ||||
|   if GlobalCEFApp.StartMainProcess then | ||||
|     begin | ||||
|       Application.Initialize; | ||||
|       {$IFDEF DELPHI11_UP} | ||||
|       Application.MainFormOnTaskbar := True; | ||||
|       {$ENDIF} | ||||
|       Application.CreateForm(TMainForm, MainForm); | ||||
|       Application.Run; | ||||
|     end; | ||||
|  | ||||
|   GlobalCEFApp.Free; | ||||
| end. | ||||
							
								
								
									
										601
									
								
								demos/PopupBrowser2/PopupBrowser2.dproj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										601
									
								
								demos/PopupBrowser2/PopupBrowser2.dproj
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,601 @@ | ||||
| <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||||
|     <PropertyGroup> | ||||
|         <ProjectGuid>{55E00327-9D98-4DA3-A4E1-844942A01C6B}</ProjectGuid> | ||||
|         <ProjectVersion>18.2</ProjectVersion> | ||||
|         <FrameworkType>VCL</FrameworkType> | ||||
|         <MainSource>PopupBrowser2.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="('$(Platform)'=='Win64' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win64)'!=''"> | ||||
|         <Cfg_1_Win64>true</Cfg_1_Win64> | ||||
|         <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="('$(Platform)'=='Win64' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win64)'!=''"> | ||||
|         <Cfg_2_Win64>true</Cfg_2_Win64> | ||||
|         <CfgParent>Cfg_2</CfgParent> | ||||
|         <Cfg_2>true</Cfg_2> | ||||
|         <Base>true</Base> | ||||
|     </PropertyGroup> | ||||
|     <PropertyGroup Condition="'$(Base)'!=''"> | ||||
|         <VerInfo_Keys>CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys> | ||||
|         <VerInfo_Locale>3082</VerInfo_Locale> | ||||
|         <SanitizedProjectName>PopupBrowser2</SanitizedProjectName> | ||||
|         <Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon> | ||||
|         <DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace> | ||||
|         <DCC_DcuOutput>.\$(Platform)\$(Config)</DCC_DcuOutput> | ||||
|         <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> | ||||
|     </PropertyGroup> | ||||
|     <PropertyGroup Condition="'$(Base_Win32)'!=''"> | ||||
|         <DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;frxe23;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;Componentes;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;Componentes_Int;CEF4Delphi;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyProtocols230;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;frxTee23;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;vcl;DBXSybaseASEDriver;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;Componentes_UI;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;Componentes_Misc;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;Componentes_RTF;DBXInformixDriver;bindcompvcl;frxDB23;Componentes_vCard;TeeUI;IndyCore230;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;IndySystem230;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;frx23;fmxase;$(DCC_UsePackage)</DCC_UsePackage> | ||||
|         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> | ||||
|         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> | ||||
|         <Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File> | ||||
|         <VerInfo_Locale>1033</VerInfo_Locale> | ||||
|         <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> | ||||
|         <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> | ||||
|         <DCC_ExeOutput>..\..\bin</DCC_ExeOutput> | ||||
|     </PropertyGroup> | ||||
|     <PropertyGroup Condition="'$(Base_Win64)'!=''"> | ||||
|         <DCC_UsePackage>DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;emsclientfiredac;DataSnapFireDAC;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;Intraweb;DBXOracleDriver;inetdb;FmxTeeUI;FireDACIBDriver;fmx;fmxdae;vclib;FireDACDBXDriver;dbexpress;IndyProtocols230;vclx;dsnap;DataSnapCommon;emsclient;FireDACCommon;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;CloudService;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonDriver;DataSnapClient;inet;bindcompdbx;vcl;DBXSybaseASEDriver;FireDACDb2Driver;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;TeeDB;FireDAC;FireDACSqliteDriver;FireDACPgDriver;ibmonitor;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;FMXTee;soaprtl;DbxCommonDriver;ibxpress;Tee;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;vclwinx;ibxbindings;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;bindcomp;appanalytics;DBXInformixDriver;bindcompvcl;TeeUI;IndyCore230;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;IndySystem230;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;fmxase;$(DCC_UsePackage)</DCC_UsePackage> | ||||
|         <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> | ||||
|         <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(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="'$(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)'!=''"> | ||||
|         <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> | ||||
|         <VerInfo_Locale>1033</VerInfo_Locale> | ||||
|         <AppEnableHighDPI>true</AppEnableHighDPI> | ||||
|         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> | ||||
|         <DCC_RemoteDebug>false</DCC_RemoteDebug> | ||||
|         <BT_BuildType>Debug</BT_BuildType> | ||||
|         <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> | ||||
|     </PropertyGroup> | ||||
|     <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''"> | ||||
|         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> | ||||
|         <AppEnableHighDPI>true</AppEnableHighDPI> | ||||
|     </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)'!=''"> | ||||
|         <AppEnableHighDPI>true</AppEnableHighDPI> | ||||
|         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> | ||||
|     </PropertyGroup> | ||||
|     <PropertyGroup Condition="'$(Cfg_2_Win64)'!=''"> | ||||
|         <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> | ||||
|         <AppEnableHighDPI>true</AppEnableHighDPI> | ||||
|     </PropertyGroup> | ||||
|     <ItemGroup> | ||||
|         <DelphiCompile Include="$(MainSource)"> | ||||
|             <MainSource>MainSource</MainSource> | ||||
|         </DelphiCompile> | ||||
|         <DCCReference Include="uMainForm.pas"> | ||||
|             <Form>MainForm</Form> | ||||
|         </DCCReference> | ||||
|         <DCCReference Include="uChildForm.pas"> | ||||
|             <Form>ChildForm</Form> | ||||
|             <FormType>dfm</FormType> | ||||
|         </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">PopupBrowser2.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="..\..\bin\PopupBrowser2.exe" Configuration="Debug" Class="ProjectOutput"> | ||||
|                     <Platform Name="Win32"> | ||||
|                         <RemoteName>PopupBrowser2.exe</RemoteName> | ||||
|                         <Overwrite>true</Overwrite> | ||||
|                     </Platform> | ||||
|                 </DeployFile> | ||||
|                 <DeployFile LocalName="Win32\Debug\SimpleBrowser.exe" Configuration="Debug" Class="ProjectOutput"/> | ||||
|                 <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="Win32" Name="$(PROJECTNAME)"/> | ||||
|                 <ProjectRoot Platform="Linux64" 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> | ||||
							
								
								
									
										384
									
								
								demos/PopupBrowser2/cef.inc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										384
									
								
								demos/PopupBrowser2/cef.inc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,384 @@ | ||||
| // ************************************************************************ | ||||
| // ***************************** 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 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. | ||||
|  * | ||||
|  *) | ||||
|  | ||||
|  // The complete list of compiler versions is here : | ||||
|  // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions | ||||
|  | ||||
| {$DEFINE DELPHI_VERSION_UNKNOW} | ||||
|  | ||||
| {$IFDEF FPC} | ||||
|   {$DEFINE CEF_MULTI_THREADED_MESSAGE_LOOP} | ||||
|   {$DEFINE SUPPORTS_INLINE} | ||||
| {$ENDIF} | ||||
|  | ||||
| // 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 | ||||
| {$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 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 DELPHI9_UP} | ||||
|   {$DEFINE SUPPORTS_INLINE} | ||||
| {$ENDIF} | ||||
|  | ||||
							
								
								
									
										37
									
								
								demos/PopupBrowser2/uChildForm.dfm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								demos/PopupBrowser2/uChildForm.dfm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,37 @@ | ||||
| object ChildForm: TChildForm | ||||
|   Left = 0 | ||||
|   Top = 0 | ||||
|   Caption = 'Popup' | ||||
|   ClientHeight = 256 | ||||
|   ClientWidth = 352 | ||||
|   Color = clBtnFace | ||||
|   Font.Charset = DEFAULT_CHARSET | ||||
|   Font.Color = clWindowText | ||||
|   Font.Height = -11 | ||||
|   Font.Name = 'Tahoma' | ||||
|   Font.Style = [] | ||||
|   OldCreateOrder = False | ||||
|   Position = poScreenCenter | ||||
|   OnClose = FormClose | ||||
|   OnCloseQuery = FormCloseQuery | ||||
|   OnCreate = FormCreate | ||||
|   OnDestroy = FormDestroy | ||||
|   PixelsPerInch = 96 | ||||
|   TextHeight = 13 | ||||
|   object CEFWindowParent1: TCEFWindowParent | ||||
|     Left = 0 | ||||
|     Top = 0 | ||||
|     Width = 352 | ||||
|     Height = 256 | ||||
|     Align = alClient | ||||
|     TabOrder = 0 | ||||
|   end | ||||
|   object Chromium1: TChromium | ||||
|     OnTitleChange = Chromium1TitleChange | ||||
|     OnBeforePopup = Chromium1BeforePopup | ||||
|     OnBeforeClose = Chromium1BeforeClose | ||||
|     OnClose = Chromium1Close | ||||
|     Left = 24 | ||||
|     Top = 56 | ||||
|   end | ||||
| end | ||||
							
								
								
									
										256
									
								
								demos/PopupBrowser2/uChildForm.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										256
									
								
								demos/PopupBrowser2/uChildForm.pas
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,256 @@ | ||||
| // ************************************************************************ | ||||
| // ***************************** 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 uChildForm; | ||||
|  | ||||
| {$I cef.inc} | ||||
|  | ||||
| interface | ||||
|  | ||||
| uses | ||||
|   {$IFDEF DELPHI16_UP} | ||||
|   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, | ||||
|   System.SyncObjs, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, | ||||
|   Vcl.ExtCtrls, Vcl.AppEvnts, | ||||
|   {$ELSE} | ||||
|   Windows, Messages, SysUtils, Variants, Classes, SyncObjs, | ||||
|   Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, AppEvnts, | ||||
|   {$ENDIF} | ||||
|   uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uBufferPanel, | ||||
|   uCEFWindowParent; | ||||
|  | ||||
| type | ||||
|   TChildForm = class(TForm) | ||||
|     Chromium1: TChromium; | ||||
|     CEFWindowParent1: TCEFWindowParent; | ||||
|  | ||||
|     procedure FormCreate(Sender: TObject); | ||||
|     procedure FormDestroy(Sender: TObject); | ||||
|     procedure FormClose(Sender: TObject; var Action: TCloseAction); | ||||
|     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); | ||||
|  | ||||
|     procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean); | ||||
|     procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); | ||||
|     procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); | ||||
|     procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); | ||||
|  | ||||
|   protected | ||||
|     FCanClose          : boolean; | ||||
|     FClosing           : boolean; | ||||
|     FClientInitialized : boolean; | ||||
|     FPopupFeatures     : TCefPopupFeatures; | ||||
|  | ||||
|     procedure WMMove(var aMessage : TWMMove); message WM_MOVE; | ||||
|     procedure WMMoving(var aMessage : TMessage); message WM_MOVING; | ||||
|     procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; | ||||
|     procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; | ||||
|     procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; | ||||
|  | ||||
|   public | ||||
|     procedure AfterConstruction; override; | ||||
|     function  CreateClientHandler(var windowInfo : TCefWindowInfo; var client : ICefClient; const targetFrameName : string; const popupFeatures : TCefPopupFeatures) : boolean; | ||||
|     procedure ApplyPopupFeatures; | ||||
|  | ||||
|     property  ClientInitialized : boolean   read FClientInitialized; | ||||
|     property  Closing           : boolean   read FClosing; | ||||
|   end; | ||||
|  | ||||
| implementation | ||||
|  | ||||
| {$R *.dfm} | ||||
|  | ||||
| uses | ||||
|   {$IFDEF DELPHI16_UP} | ||||
|   System.Math, | ||||
|   {$ELSE} | ||||
|   Math, | ||||
|   {$ENDIF} | ||||
|   uCEFMiscFunctions, uCEFApplication, uMainForm; | ||||
|  | ||||
| // Destruction steps | ||||
| // ================= | ||||
| // 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event. | ||||
| // 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event. | ||||
| // 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. | ||||
|  | ||||
| procedure TChildForm.AfterConstruction; | ||||
| begin | ||||
|   inherited AfterConstruction; | ||||
|  | ||||
|   CreateHandle; | ||||
|  | ||||
|   CEFWindowParent1.CreateHandle; | ||||
| end; | ||||
|  | ||||
| function TChildForm.CreateClientHandler(var   windowInfo      : TCefWindowInfo; | ||||
|                                         var   client          : ICefClient; | ||||
|                                         const targetFrameName : string; | ||||
|                                         const popupFeatures   : TCefPopupFeatures) : boolean; | ||||
| var | ||||
|   TempRect : TRect; | ||||
| begin | ||||
|   if CEFWindowParent1.HandleAllocated and | ||||
|      Chromium1.CreateClientHandler(client, False) then | ||||
|     begin | ||||
|       Result             := True; | ||||
|       FClientInitialized := True; | ||||
|       FPopupFeatures     := popupFeatures; | ||||
|       TempRect           := CEFWindowParent1.ClientRect; | ||||
|  | ||||
|       if (FPopupFeatures.widthset  <> 0) then TempRect.Right  := max(FPopupFeatures.width,  100); | ||||
|       if (FPopupFeatures.heightset <> 0) then TempRect.Bottom := max(FPopupFeatures.height, 100); | ||||
|  | ||||
|       WindowInfoAsChild(windowInfo, CEFWindowParent1.Handle, TempRect, ''); | ||||
|     end | ||||
|    else | ||||
|     Result := False; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.ApplyPopupFeatures; | ||||
| begin | ||||
|   if (FPopupFeatures.xset      <> 0) then Chromium1.SetFormLeftTo(FPopupFeatures.x); | ||||
|   if (FPopupFeatures.yset      <> 0) then Chromium1.SetFormTopTo(FPopupFeatures.y); | ||||
|   if (FPopupFeatures.widthset  <> 0) then Chromium1.ResizeFormWidthTo(FPopupFeatures.width); | ||||
|   if (FPopupFeatures.heightset <> 0) then Chromium1.ResizeFormHeightTo(FPopupFeatures.height); | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); | ||||
| begin | ||||
|   FCanClose := True; | ||||
|   PostMessage(Handle, WM_CLOSE, 0, 0); | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.Chromium1BeforePopup(Sender : TObject; | ||||
|                                           const browser            : ICefBrowser; | ||||
|                                           const frame              : ICefFrame; | ||||
|                                           const targetUrl          : ustring; | ||||
|                                           const targetFrameName    : ustring; | ||||
|                                                 targetDisposition  : TCefWindowOpenDisposition; | ||||
|                                                 userGesture        : Boolean; | ||||
|                                           const popupFeatures      : TCefPopupFeatures; | ||||
|                                           var   windowInfo         : TCefWindowInfo; | ||||
|                                           var   client             : ICefClient; | ||||
|                                           var   settings           : TCefBrowserSettings; | ||||
|                                           var   noJavascriptAccess : Boolean; | ||||
|                                           var   Result             : Boolean); | ||||
| begin | ||||
|   case targetDisposition of | ||||
|     WOD_NEW_FOREGROUND_TAB, | ||||
|     WOD_NEW_BACKGROUND_TAB, | ||||
|     WOD_NEW_WINDOW : Result := True;  // For simplicity, this demo blocks new tabs and new windows. | ||||
|  | ||||
|     WOD_NEW_POPUP : Result := not(TMainForm(Owner).CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures)); | ||||
|  | ||||
|     else Result := False; | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); | ||||
| begin | ||||
|   PostMessage(Handle, CEF_DESTROY, 0, 0); | ||||
|   Result := True; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); | ||||
| begin | ||||
|   Caption := title; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.WMMove(var aMessage : TWMMove); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.WMMoving(var aMessage : TMessage); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.WMEnterMenuLoop(var aMessage: TMessage); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.WMExitMenuLoop(var aMessage: TMessage); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction); | ||||
| begin | ||||
|   Action := caFree; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); | ||||
| begin | ||||
|   CanClose := FCanClose; | ||||
|  | ||||
|   if not(FClosing) then | ||||
|     begin | ||||
|       FClosing := True; | ||||
|       Visible  := False; | ||||
|       Chromium1.CloseBrowser(True); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.FormCreate(Sender: TObject); | ||||
| begin | ||||
|   FCanClose          := False; | ||||
|   FClosing           := False; | ||||
|   FClientInitialized := False; | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.FormDestroy(Sender: TObject); | ||||
| begin | ||||
|   if FClientInitialized and TMainForm(Owner).HandleAllocated then | ||||
|     PostMessage(TMainForm(Owner).Handle, CEF_CHILDDESTROYED, 0, 0); | ||||
| end; | ||||
|  | ||||
| procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage); | ||||
| begin | ||||
|   CEFWindowParent1.Free; | ||||
| end; | ||||
|  | ||||
| end. | ||||
							
								
								
									
										79
									
								
								demos/PopupBrowser2/uMainForm.dfm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										79
									
								
								demos/PopupBrowser2/uMainForm.dfm
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,79 @@ | ||||
| object MainForm: TMainForm | ||||
|   Left = 0 | ||||
|   Top = 0 | ||||
|   Caption = 'Initializing browser. Please wait...' | ||||
|   ClientHeight = 624 | ||||
|   ClientWidth = 1038 | ||||
|   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 | ||||
|   OnShow = FormShow | ||||
|   PixelsPerInch = 96 | ||||
|   TextHeight = 13 | ||||
|   object AddressPnl: TPanel | ||||
|     Left = 0 | ||||
|     Top = 0 | ||||
|     Width = 1038 | ||||
|     Height = 30 | ||||
|     Align = alTop | ||||
|     BevelOuter = bvNone | ||||
|     Enabled = False | ||||
|     Padding.Left = 5 | ||||
|     Padding.Top = 5 | ||||
|     Padding.Right = 5 | ||||
|     Padding.Bottom = 5 | ||||
|     ShowCaption = False | ||||
|     TabOrder = 0 | ||||
|     object AddressEdt: TEdit | ||||
|       Left = 5 | ||||
|       Top = 5 | ||||
|       Width = 997 | ||||
|       Height = 20 | ||||
|       Margins.Right = 5 | ||||
|       Align = alClient | ||||
|       TabOrder = 0 | ||||
|       Text = 'file:///PopupBrowser.html' | ||||
|       ExplicitHeight = 21 | ||||
|     end | ||||
|     object GoBtn: TButton | ||||
|       Left = 1002 | ||||
|       Top = 5 | ||||
|       Width = 31 | ||||
|       Height = 20 | ||||
|       Margins.Left = 5 | ||||
|       Align = alRight | ||||
|       Caption = 'Go' | ||||
|       TabOrder = 1 | ||||
|       OnClick = GoBtnClick | ||||
|     end | ||||
|   end | ||||
|   object CEFWindowParent1: TCEFWindowParent | ||||
|     Left = 0 | ||||
|     Top = 30 | ||||
|     Width = 1038 | ||||
|     Height = 594 | ||||
|     Align = alClient | ||||
|     TabOrder = 1 | ||||
|   end | ||||
|   object Timer1: TTimer | ||||
|     Enabled = False | ||||
|     Interval = 300 | ||||
|     OnTimer = Timer1Timer | ||||
|     Left = 56 | ||||
|     Top = 88 | ||||
|   end | ||||
|   object Chromium1: TChromium | ||||
|     OnBeforePopup = Chromium1BeforePopup | ||||
|     OnAfterCreated = Chromium1AfterCreated | ||||
|     Left = 56 | ||||
|     Top = 152 | ||||
|   end | ||||
| end | ||||
							
								
								
									
										331
									
								
								demos/PopupBrowser2/uMainForm.pas
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										331
									
								
								demos/PopupBrowser2/uMainForm.pas
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,331 @@ | ||||
| // ************************************************************************ | ||||
| // ***************************** 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 uMainForm; | ||||
|  | ||||
| {$I cef.inc} | ||||
|  | ||||
| interface | ||||
|  | ||||
| uses | ||||
|   {$IFDEF DELPHI16_UP} | ||||
|   Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, | ||||
|   Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, System.SyncObjs, | ||||
|   {$ELSE} | ||||
|   Windows, Messages, SysUtils, Variants, Classes, Graphics, | ||||
|   Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs, | ||||
|   {$ENDIF} | ||||
|   uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uChildForm, | ||||
|   Vcl.AppEvnts; | ||||
|  | ||||
| const | ||||
|   CEF_CREATENEXTCHILD  = WM_APP + $A50; | ||||
|   CEF_CHILDDESTROYED   = WM_APP + $A51; | ||||
|  | ||||
| type | ||||
|   TMainForm = class(TForm) | ||||
|     AddressPnl: TPanel; | ||||
|     AddressEdt: TEdit; | ||||
|     GoBtn: TButton; | ||||
|     Timer1: TTimer; | ||||
|     Chromium1: TChromium; | ||||
|     CEFWindowParent1: TCEFWindowParent; | ||||
|  | ||||
|     procedure GoBtnClick(Sender: TObject); | ||||
|     procedure Timer1Timer(Sender: TObject); | ||||
|  | ||||
|     procedure FormShow(Sender: TObject); | ||||
|     procedure FormCreate(Sender: TObject); | ||||
|     procedure FormDestroy(Sender: TObject); | ||||
|     procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); | ||||
|  | ||||
|     procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); | ||||
|     procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var noJavascriptAccess: Boolean; var Result: Boolean); | ||||
|  | ||||
|   protected | ||||
|     FChildForm       : TChildForm; | ||||
|     FCriticalSection : TCriticalSection; | ||||
|     FClosing         : boolean; | ||||
|  | ||||
|     function  GetPopupChildCount : integer; | ||||
|  | ||||
|     procedure ClosePopupChildren; | ||||
|  | ||||
|     procedure WMMove(var aMessage : TWMMove); message WM_MOVE; | ||||
|     procedure WMMoving(var aMessage : TMessage); message WM_MOVING; | ||||
|     procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; | ||||
|     procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; | ||||
|  | ||||
|     procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; | ||||
|     procedure CreateNextChildMsg(var aMessage : TMessage); message CEF_CREATENEXTCHILD; | ||||
|     procedure ChildDestroyedMsg(var aMessage : TMessage); message CEF_CHILDDESTROYED; | ||||
|  | ||||
|   public | ||||
|     function  CreateClientHandler(var windowInfo : TCefWindowInfo; var client : ICefClient; const targetFrameName : string; const popupFeatures : TCefPopupFeatures) : boolean; | ||||
|  | ||||
|     property  PopupChildCount : integer  read  GetPopupChildCount; | ||||
|   end; | ||||
|  | ||||
| var | ||||
|   MainForm: TMainForm; | ||||
|  | ||||
| implementation | ||||
|  | ||||
| {$R *.dfm} | ||||
|  | ||||
| uses | ||||
|   uCEFApplication, uCEFMiscFunctions; | ||||
|  | ||||
| // This is demo shows how to create popup windows in CEF. | ||||
|  | ||||
| // You need to understand The SimpleBrowser2 and SimpleOSRBrowser demos completely before trying to understand this demo. | ||||
|  | ||||
| // When TChromium needs to show a new popup window it executes TChromium.OnBeforePopup. | ||||
|  | ||||
| // VCL components *MUST* be created and destroyed in the main thread but CEF executes the | ||||
| // TChromium.OnBeforePopup in a different thread. | ||||
|  | ||||
| // For this reason this demo creates a hidden popup form (TChildForm) in case CEF needs to show a popup window. | ||||
| // TChromium.OnBeforePopup calls TChildForm.CreateClientHandler to initialize some parameters and create the new ICefClient. | ||||
| // After that, it sends a CEF_CREATENEXTCHILD message to show the popup form and create a new one. | ||||
|  | ||||
| // All the child forms must be correctly destroyed before closing the main form. Read the code comments in uChildForm.pas | ||||
| // to know how the popup windows are destroyed. | ||||
|  | ||||
| // The main form sends a WM_CLOSE to all active popup forms and waits until all of them have sent a CEF_CHILDDESTROYED message. | ||||
|  | ||||
| procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); | ||||
| begin | ||||
|   FClosing := True; | ||||
|   Visible  := False; | ||||
|  | ||||
|   if (PopupChildCount > 0) then | ||||
|     begin | ||||
|       ClosePopupChildren; | ||||
|       CanClose := False; | ||||
|     end | ||||
|    else | ||||
|     CanClose := True; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.FormCreate(Sender: TObject); | ||||
| begin | ||||
|   FClosing          := False; | ||||
|   FCriticalSection  := TCriticalSection.Create; | ||||
|  | ||||
|   Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.FormDestroy(Sender: TObject); | ||||
| begin | ||||
|   FreeAndNil(FCriticalSection); | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.FormShow(Sender: TObject); | ||||
| begin | ||||
|   // You *MUST* call CreateBrowser to create and initialize the browser. | ||||
|   // This will trigger the AfterCreated event when the browser is fully | ||||
|   // initialized and ready to receive commands. | ||||
|  | ||||
|   // GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser | ||||
|   // If it's not initialized yet, we use a simple timer to create the browser later. | ||||
|   if not(Chromium1.CreateBrowser(CEFWindowParent1)) then Timer1.Enabled := True; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); | ||||
| begin | ||||
|   // Now the browser is fully initialized we can send a message to the main form to load the initial web page. | ||||
|   PostMessage(Handle, CEF_AFTERCREATED, 0, 0); | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.Chromium1BeforePopup(Sender : TObject; | ||||
|                                          const browser            : ICefBrowser; | ||||
|                                          const frame              : ICefFrame; | ||||
|                                          const targetUrl          : ustring; | ||||
|                                          const targetFrameName    : ustring; | ||||
|                                                targetDisposition  : TCefWindowOpenDisposition; | ||||
|                                                userGesture        : Boolean; | ||||
|                                          const popupFeatures      : TCefPopupFeatures; | ||||
|                                          var   windowInfo         : TCefWindowInfo; | ||||
|                                          var   client             : ICefClient; | ||||
|                                          var   settings           : TCefBrowserSettings; | ||||
|                                          var   noJavascriptAccess : Boolean; | ||||
|                                          var   Result             : Boolean); | ||||
| begin | ||||
|   case targetDisposition of | ||||
|     WOD_NEW_FOREGROUND_TAB, | ||||
|     WOD_NEW_BACKGROUND_TAB, | ||||
|     WOD_NEW_WINDOW : Result := True;  // For simplicity, this demo blocks new tabs and new windows. | ||||
|  | ||||
|     WOD_NEW_POPUP  : Result := not(CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures)); | ||||
|  | ||||
|     else Result := False; | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function TMainForm.CreateClientHandler(var   windowInfo      : TCefWindowInfo; | ||||
|                                        var   client          : ICefClient; | ||||
|                                        const targetFrameName : string; | ||||
|                                        const popupFeatures   : TCefPopupFeatures) : boolean; | ||||
| begin | ||||
|   try | ||||
|     FCriticalSection.Acquire; | ||||
|  | ||||
|     Result := (FChildForm <> nil) and | ||||
|               FChildForm.CreateClientHandler(windowInfo, client, targetFrameName, popupFeatures) and | ||||
|               PostMessage(Handle, CEF_CREATENEXTCHILD, 0, 0); | ||||
|   finally | ||||
|     FCriticalSection.Release; | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function TMainForm.GetPopupChildCount : integer; | ||||
| var | ||||
|   i        : integer; | ||||
|   TempForm : TCustomForm; | ||||
| begin | ||||
|   Result := 0; | ||||
|   i      := pred(screen.CustomFormCount); | ||||
|  | ||||
|   while (i >= 0) do | ||||
|     begin | ||||
|       TempForm := screen.CustomForms[i]; | ||||
|  | ||||
|       // Only count the fully initialized child forms and not the one waiting to be used. | ||||
|  | ||||
|       if (TempForm is TChildForm) and | ||||
|          TChildForm(TempForm).ClientInitialized then | ||||
|         inc(Result); | ||||
|  | ||||
|       dec(i); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.ClosePopupChildren; | ||||
| var | ||||
|   i        : integer; | ||||
|   TempForm : TCustomForm; | ||||
| begin | ||||
|   i := pred(screen.CustomFormCount); | ||||
|  | ||||
|   while (i >= 0) do | ||||
|     begin | ||||
|       TempForm := screen.CustomForms[i]; | ||||
|  | ||||
|       // Only send WM_CLOSE to fully initialized child forms. | ||||
|  | ||||
|       if (TempForm is TChildForm) and | ||||
|          TChildForm(TempForm).ClientInitialized and | ||||
|          not(TChildForm(TempForm).Closing) then | ||||
|         PostMessage(TChildForm(TempForm).Handle, WM_CLOSE, 0, 0); | ||||
|  | ||||
|       dec(i); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage); | ||||
| begin | ||||
|   FChildForm         := TChildForm.Create(self); | ||||
|   Caption            := 'Popup Browser'; | ||||
|   AddressPnl.Enabled := True; | ||||
|   GoBtn.Click; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage); | ||||
| begin | ||||
|   try | ||||
|     FCriticalSection.Acquire; | ||||
|  | ||||
|     if (FChildForm <> nil) then | ||||
|       begin | ||||
|         FChildForm.ApplyPopupFeatures; | ||||
|         FChildForm.Show; | ||||
|       end; | ||||
|  | ||||
|     FChildForm := TChildForm.Create(self); | ||||
|   finally | ||||
|     FCriticalSection.Release; | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage); | ||||
| begin | ||||
|   if FClosing and (PopupChildCount = 0) then Close; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.GoBtnClick(Sender: TObject); | ||||
| begin | ||||
|   // This will load the URL in the edit box | ||||
|   Chromium1.LoadURL(AddressEdt.Text); | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.Timer1Timer(Sender: TObject); | ||||
| begin | ||||
|   Timer1.Enabled := False; | ||||
|   if not(Chromium1.CreateBrowser(CEFWindowParent1)) and not(Chromium1.Initialized) then | ||||
|     Timer1.Enabled := True; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.WMMove(var aMessage : TWMMove); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.WMMoving(var aMessage : TMessage); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.WMEnterMenuLoop(var aMessage: TMessage); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; | ||||
| end; | ||||
|  | ||||
| procedure TMainForm.WMExitMenuLoop(var aMessage: TMessage); | ||||
| begin | ||||
|   inherited; | ||||
|  | ||||
|   if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; | ||||
| end; | ||||
|  | ||||
| end. | ||||
| @@ -442,7 +442,7 @@ type | ||||
|       procedure   AfterConstruction; override; | ||||
|       procedure   BeforeDestruction; override; | ||||
|       function    CreateClientHandler(aIsOSR : boolean) : boolean; overload; | ||||
|       function    CreateClientHandler(var aClient : ICefClient) : boolean; overload; | ||||
|       function    CreateClientHandler(var aClient : ICefClient; aIsOSR : boolean = True) : boolean; overload; | ||||
|       procedure   CloseBrowser(aForceClose : boolean); | ||||
|       function    CreateBrowser(const aBrowserParent : TWinControl = nil; const aWindowName : string = ''; const aContext : ICefRequestContext = nil; const aCookiesPath : string = ''; aPersistSessionCookies : boolean = False) : boolean; overload; virtual; | ||||
|       function    CreateBrowser(aParentHandle : HWND; aParentRect : TRect; const aWindowName : string = ''; const aContext : ICefRequestContext = nil; const aCookiesPath : string = ''; aPersistSessionCookies : boolean = False) : boolean; overload; virtual; | ||||
| @@ -540,6 +540,7 @@ type | ||||
|       property  BrowserId               : integer                      read FBrowserId; | ||||
|       property  Browser                 : ICefBrowser                  read FBrowser; | ||||
|       property  CefClient               : ICefClient                   read FHandler; | ||||
|       property  CefWindowInfo           : TCefWindowInfo               read FWindowInfo; | ||||
|       property  VisibleNavigationEntry  : ICefNavigationEntry          read GetVisibleNavigationEntry; | ||||
|       property  MultithreadApp          : boolean                      read GetMultithreadApp; | ||||
|       property  IsLoading               : boolean                      read GetIsLoading; | ||||
| @@ -552,6 +553,9 @@ type | ||||
|       property  CanGoForward            : boolean                      read GetCanGoForward; | ||||
|       property  IsPopUp                 : boolean                      read GetIsPopUp; | ||||
|       property  WindowHandle            : THandle                      read GetWindowHandle; | ||||
|       property  BrowserHandle           : THandle                      read FBrowserCompHWND; | ||||
|       property  WidgetHandle            : THandle                      read FWidgetCompHWND; | ||||
|       property  RenderHandle            : THandle                      read FRenderCompHWND; | ||||
|       property  FrameIsFocused          : boolean                      read GetFrameIsFocused; | ||||
|       property  Initialized             : boolean                      read GetInitialized; | ||||
|       property  RequestContextCache     : string                       read GetRequestContextCache; | ||||
| @@ -913,9 +917,9 @@ begin | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function TChromium.CreateClientHandler(var aClient : ICefClient) : boolean; | ||||
| function TChromium.CreateClientHandler(var aClient : ICefClient; aIsOSR : boolean) : boolean; | ||||
| begin | ||||
|   if CreateClientHandler(True) then | ||||
|   if CreateClientHandler(aIsOSR) then | ||||
|     begin | ||||
|       aClient := FHandler; | ||||
|       Result  := True; | ||||
| @@ -3720,7 +3724,10 @@ begin | ||||
|       if FIsOSR then | ||||
|         FBrowser.Host.Invalidate(kind) | ||||
|        else | ||||
|         InvalidateRect(FBrowser.Host.WindowHandle, nil, False); | ||||
|         if (RenderHandle <> 0) then | ||||
|           InvalidateRect(RenderHandle, nil, False) | ||||
|          else | ||||
|           InvalidateRect(WindowHandle, nil, False); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
|   | ||||
| @@ -125,7 +125,7 @@ end; | ||||
| function TChromiumWindow.GetChildWindowHandle : THandle; | ||||
| begin | ||||
|   if (FChromium <> nil) then | ||||
|     Result := FChromium.WindowHandle | ||||
|     Result := FChromium.BrowserHandle | ||||
|    else | ||||
|     Result := inherited GetChildWindowHandle; | ||||
| end; | ||||
|   | ||||
| @@ -60,12 +60,13 @@ type | ||||
|       function  GetChildWindowHandle : THandle; virtual; | ||||
|  | ||||
|       procedure WndProc(var aMessage: TMessage); override; | ||||
|       procedure Resize; override; | ||||
|  | ||||
|     public | ||||
|       procedure UpdateSize; | ||||
|       function  TakeSnapshot(var aBitmap : TBitmap) : boolean; | ||||
|       function  DestroyChildWindow : boolean; | ||||
|       procedure CreateHandle; override; | ||||
|       procedure Resize; override; | ||||
|  | ||||
|       property  ChildWindowHandle : THandle   read GetChildWindowHandle; | ||||
|  | ||||
| @@ -98,6 +99,11 @@ begin | ||||
|   UpdateSize; | ||||
| end; | ||||
|  | ||||
| procedure TCEFWindowParent.CreateHandle; | ||||
| begin | ||||
|   inherited; | ||||
| end; | ||||
|  | ||||
| procedure TCEFWindowParent.UpdateSize; | ||||
| var | ||||
|   TempRect : TRect; | ||||
|   | ||||
| @@ -90,6 +90,7 @@ type | ||||
|       FZoomStep               : byte; | ||||
|       FWindowName             : string; | ||||
|       FPrefsFileName          : string; | ||||
|       FIsOSR                  : boolean; | ||||
|       FInitialized            : boolean; | ||||
|       FClosing                : boolean; | ||||
|       FWindowInfo             : TCefWindowInfo; | ||||
| @@ -430,8 +431,8 @@ type | ||||
|       destructor  Destroy; override; | ||||
|       procedure   AfterConstruction; override; | ||||
|       procedure   BeforeDestruction; override; | ||||
|       function    CreateClientHandler : boolean; overload; | ||||
|       function    CreateClientHandler(var aClient : ICefClient) : boolean; overload; | ||||
|       function    CreateClientHandler(aIsOSR : boolean = True) : boolean; overload; | ||||
|       function    CreateClientHandler(var aClient : ICefClient; aIsOSR : boolean = True) : boolean; overload; | ||||
|       procedure   CloseBrowser(aForceClose : boolean); | ||||
|       function    CreateBrowser(const aWindowName : string = ''; const aContext : ICefRequestContext = nil; const aCookiesPath : string = ''; aPersistSessionCookies : boolean = False) : boolean; virtual; | ||||
|       function    ShareRequestContext(var aContext : ICefRequestContext; const aHandler : ICefRequestContextHandler = nil) : boolean; | ||||
| @@ -521,6 +522,7 @@ type | ||||
|       property  BrowserId               : integer                      read FBrowserId; | ||||
|       property  Browser                 : ICefBrowser                  read FBrowser; | ||||
|       property  CefClient               : ICefClient                   read FHandler; | ||||
|       property  CefWindowInfo           : TCefWindowInfo               read FWindowInfo; | ||||
|       property  VisibleNavigationEntry  : ICefNavigationEntry          read GetVisibleNavigationEntry; | ||||
|       property  MultithreadApp          : boolean                      read GetMultithreadApp; | ||||
|       property  IsLoading               : boolean                      read GetIsLoading; | ||||
| @@ -533,6 +535,9 @@ type | ||||
|       property  CanGoForward            : boolean                      read GetCanGoForward; | ||||
|       property  IsPopUp                 : boolean                      read GetIsPopUp; | ||||
|       property  WindowHandle            : THandle                      read GetWindowHandle; | ||||
|       property  BrowserHandle           : THandle                      read FBrowserCompHWND; | ||||
|       property  WidgetHandle            : THandle                      read FWidgetCompHWND; | ||||
|       property  RenderHandle            : THandle                      read FRenderCompHWND; | ||||
|       property  FrameIsFocused          : boolean                      read GetFrameIsFocused; | ||||
|       property  Initialized             : boolean                      read GetInitialized; | ||||
|       property  RequestContextCache     : string                       read GetRequestContextCache; | ||||
| @@ -689,6 +694,7 @@ begin | ||||
|   FBrowser                := nil; | ||||
|   FBrowserId              := 0; | ||||
|   FClosing                := False; | ||||
|   FIsOSR                  := False; | ||||
|   FInitialized            := False; | ||||
|   FDefaultUrl             := 'about:blank'; | ||||
|   FHandler                := nil; | ||||
| @@ -836,13 +842,14 @@ begin | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function TFMXChromium.CreateClientHandler : boolean; | ||||
| function TFMXChromium.CreateClientHandler(aIsOSR : boolean) : boolean; | ||||
| begin | ||||
|   Result := False; | ||||
|  | ||||
|   try | ||||
|     if (FHandler = nil) then | ||||
|       begin | ||||
|         FIsOSR   := aIsOsr; | ||||
|         FHandler := TCustomClientHandler.Create(Self, | ||||
|                                                 MustCreateLoadHandler, | ||||
|                                                 MustCreateFocusHandler, | ||||
| @@ -853,7 +860,7 @@ begin | ||||
|                                                 MustCreateDownloadHandler, | ||||
|                                                 MustCreateJsDialogHandler, | ||||
|                                                 True, | ||||
|                                                 True, // FMX always uses the OSR mode | ||||
|                                                 FIsOSR, | ||||
|                                                 True, | ||||
|                                                 MustCreateDragHandler, | ||||
|                                                 MustCreateFindHandler); | ||||
| @@ -866,9 +873,9 @@ begin | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function TFMXChromium.CreateClientHandler(var aClient : ICefClient) : boolean; | ||||
| function TFMXChromium.CreateClientHandler(var aClient : ICefClient; aIsOSR : boolean) : boolean; | ||||
| begin | ||||
|   if CreateClientHandler then | ||||
|   if CreateClientHandler(aIsOSR) then | ||||
|     begin | ||||
|       aClient := FHandler; | ||||
|       Result  := True; | ||||
| @@ -3421,7 +3428,16 @@ end; | ||||
|  | ||||
| procedure TFMXChromium.Invalidate(kind: TCefPaintElementType); | ||||
| begin | ||||
|   if Initialized then FBrowser.Host.Invalidate(kind); | ||||
|   if Initialized then | ||||
|     begin | ||||
|       if FIsOSR then | ||||
|         FBrowser.Host.Invalidate(kind) | ||||
|        else | ||||
|         if (RenderHandle <> 0) then | ||||
|           InvalidateRect(RenderHandle, nil, False) | ||||
|          else | ||||
|           InvalidateRect(WindowHandle, nil, False); | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| procedure TFMXChromium.SendKeyEvent(const event: PCefKeyEvent); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user