diff --git a/README.md b/README.md index e2ebc285..b0c9476e 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador D CEF4Delphi is based on DCEF3, made by Henri Gourvest. The original license of DCEF3 still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file. -CEF4Delphi uses CEF 74.1.16 which includes Chromium 74.0.3729.131. +CEF4Delphi uses CEF 74.1.19 which includes Chromium 74.0.3729.157. The CEF binaries used by CEF4Delphi are available for download at spotify : -* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_74.1.16%2Bge20b240%2Bchromium-74.0.3729.131_windows32.tar.bz2) -* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_74.1.16%2Bge20b240%2Bchromium-74.0.3729.131_windows64.tar.bz2) +* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_74.1.19%2Bgb62bacf%2Bchromium-74.0.3729.157_windows32.tar.bz2) +* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_74.1.19%2Bgb62bacf%2Bchromium-74.0.3729.157_windows64.tar.bz2) CEF4Delphi was developed and tested on Delphi 10.3 Rio and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2 and Lazarus 2.0.2/FPC 3.0.4. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. diff --git a/demos/ConsoleBrowser/00-DeleteDCUs.bat b/demos/Delphi_FMX/FMXExternalPumpBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/ConsoleBrowser/00-DeleteDCUs.bat rename to demos/Delphi_FMX/FMXExternalPumpBrowser/00-DeleteDCUs.bat diff --git a/demos/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dpr b/demos/Delphi_FMX/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dpr similarity index 100% rename from demos/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dpr rename to demos/Delphi_FMX/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dpr diff --git a/demos/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dproj b/demos/Delphi_FMX/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dproj similarity index 99% rename from demos/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dproj rename to demos/Delphi_FMX/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dproj index d1e5b642..71cbf61f 100644 --- a/demos/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dproj +++ b/demos/Delphi_FMX/FMXExternalPumpBrowser/FMXExternalPumpBrowser.dproj @@ -59,7 +59,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -79,7 +79,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 $(BDS)\bin\default_app.manifest $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png @@ -123,6 +122,8 @@ true PerMonitor + true + 1033 true diff --git a/demos/ConsoleBrowser/cef.inc b/demos/Delphi_FMX/FMXExternalPumpBrowser/cef.inc similarity index 100% rename from demos/ConsoleBrowser/cef.inc rename to demos/Delphi_FMX/FMXExternalPumpBrowser/cef.inc diff --git a/demos/FMXExternalPumpBrowser/uFMXApplicationService.pas b/demos/Delphi_FMX/FMXExternalPumpBrowser/uFMXApplicationService.pas similarity index 100% rename from demos/FMXExternalPumpBrowser/uFMXApplicationService.pas rename to demos/Delphi_FMX/FMXExternalPumpBrowser/uFMXApplicationService.pas diff --git a/demos/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx b/demos/Delphi_FMX/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx similarity index 100% rename from demos/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx rename to demos/Delphi_FMX/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.fmx diff --git a/demos/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas b/demos/Delphi_FMX/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas similarity index 100% rename from demos/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas rename to demos/Delphi_FMX/FMXExternalPumpBrowser/uFMXExternalPumpBrowser.pas diff --git a/demos/CookieVisitor/00-DeleteDCUs.bat b/demos/Delphi_FMX/FMXToolBoxBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/CookieVisitor/00-DeleteDCUs.bat rename to demos/Delphi_FMX/FMXToolBoxBrowser/00-DeleteDCUs.bat diff --git a/demos/FMXToolBoxBrowser/FMXToolBoxBrowser.dpr b/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dpr similarity index 100% rename from demos/FMXToolBoxBrowser/FMXToolBoxBrowser.dpr rename to demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dpr diff --git a/demos/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj b/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj similarity index 99% rename from demos/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj rename to demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj index 317ec09f..e49bc2cb 100644 --- a/demos/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj +++ b/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj @@ -59,7 +59,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -124,6 +124,8 @@ true PerMonitor + true + 1033 true diff --git a/demos/CookieVisitor/cef.inc b/demos/Delphi_FMX/FMXToolBoxBrowser/cef.inc similarity index 100% rename from demos/CookieVisitor/cef.inc rename to demos/Delphi_FMX/FMXToolBoxBrowser/cef.inc diff --git a/demos/FMXToolBoxBrowser/uChildForm.fmx b/demos/Delphi_FMX/FMXToolBoxBrowser/uChildForm.fmx similarity index 100% rename from demos/FMXToolBoxBrowser/uChildForm.fmx rename to demos/Delphi_FMX/FMXToolBoxBrowser/uChildForm.fmx diff --git a/demos/FMXToolBoxBrowser/uChildForm.pas b/demos/Delphi_FMX/FMXToolBoxBrowser/uChildForm.pas similarity index 100% rename from demos/FMXToolBoxBrowser/uChildForm.pas rename to demos/Delphi_FMX/FMXToolBoxBrowser/uChildForm.pas diff --git a/demos/FMXToolBoxBrowser/uFMXApplicationService.pas b/demos/Delphi_FMX/FMXToolBoxBrowser/uFMXApplicationService.pas similarity index 100% rename from demos/FMXToolBoxBrowser/uFMXApplicationService.pas rename to demos/Delphi_FMX/FMXToolBoxBrowser/uFMXApplicationService.pas diff --git a/demos/FMXToolBoxBrowser/uMainForm.fmx b/demos/Delphi_FMX/FMXToolBoxBrowser/uMainForm.fmx similarity index 100% rename from demos/FMXToolBoxBrowser/uMainForm.fmx rename to demos/Delphi_FMX/FMXToolBoxBrowser/uMainForm.fmx diff --git a/demos/FMXToolBoxBrowser/uMainForm.pas b/demos/Delphi_FMX/FMXToolBoxBrowser/uMainForm.pas similarity index 100% rename from demos/FMXToolBoxBrowser/uMainForm.pas rename to demos/Delphi_FMX/FMXToolBoxBrowser/uMainForm.pas diff --git a/demos/CustomResourceBrowser/00-DeleteDCUs.bat b/demos/Delphi_FMX/SimpleFMXBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/CustomResourceBrowser/00-DeleteDCUs.bat rename to demos/Delphi_FMX/SimpleFMXBrowser/00-DeleteDCUs.bat diff --git a/demos/SimpleFMXBrowser/SimpleFMXBrowser.dpr b/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dpr similarity index 100% rename from demos/SimpleFMXBrowser/SimpleFMXBrowser.dpr rename to demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dpr diff --git a/demos/SimpleFMXBrowser/SimpleFMXBrowser.dproj b/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj similarity index 99% rename from demos/SimpleFMXBrowser/SimpleFMXBrowser.dproj rename to demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj index aba3e6b2..6105bb67 100644 --- a/demos/SimpleFMXBrowser/SimpleFMXBrowser.dproj +++ b/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj @@ -59,7 +59,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -124,6 +124,8 @@ true PerMonitor + true + 1033 true diff --git a/demos/CustomResourceBrowser/cef.inc b/demos/Delphi_FMX/SimpleFMXBrowser/cef.inc similarity index 100% rename from demos/CustomResourceBrowser/cef.inc rename to demos/Delphi_FMX/SimpleFMXBrowser/cef.inc diff --git a/demos/SimpleFMXBrowser/uFMXApplicationService.pas b/demos/Delphi_FMX/SimpleFMXBrowser/uFMXApplicationService.pas similarity index 100% rename from demos/SimpleFMXBrowser/uFMXApplicationService.pas rename to demos/Delphi_FMX/SimpleFMXBrowser/uFMXApplicationService.pas diff --git a/demos/SimpleFMXBrowser/uSimpleFMXBrowser.fmx b/demos/Delphi_FMX/SimpleFMXBrowser/uSimpleFMXBrowser.fmx similarity index 100% rename from demos/SimpleFMXBrowser/uSimpleFMXBrowser.fmx rename to demos/Delphi_FMX/SimpleFMXBrowser/uSimpleFMXBrowser.fmx diff --git a/demos/SimpleFMXBrowser/uSimpleFMXBrowser.pas b/demos/Delphi_FMX/SimpleFMXBrowser/uSimpleFMXBrowser.pas similarity index 100% rename from demos/SimpleFMXBrowser/uSimpleFMXBrowser.pas rename to demos/Delphi_FMX/SimpleFMXBrowser/uSimpleFMXBrowser.pas diff --git a/demos/DLLBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/ConsoleBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/DLLBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/ConsoleBrowser/00-DeleteDCUs.bat diff --git a/demos/ConsoleBrowser/ConsoleLoader.dpr b/demos/Delphi_VCL/ConsoleBrowser/ConsoleLoader.dpr similarity index 100% rename from demos/ConsoleBrowser/ConsoleLoader.dpr rename to demos/Delphi_VCL/ConsoleBrowser/ConsoleLoader.dpr diff --git a/demos/ConsoleBrowser/ConsoleLoader.dproj b/demos/Delphi_VCL/ConsoleBrowser/ConsoleLoader.dproj similarity index 98% rename from demos/ConsoleBrowser/ConsoleLoader.dproj rename to demos/Delphi_VCL/ConsoleBrowser/ConsoleLoader.dproj index a2357174..3011ab16 100644 --- a/demos/ConsoleBrowser/ConsoleLoader.dproj +++ b/demos/Delphi_VCL/ConsoleBrowser/ConsoleLoader.dproj @@ -41,7 +41,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -117,9 +117,10 @@ ConsoleLoader.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components @@ -629,7 +630,6 @@ - False True True diff --git a/demos/ConsoleBrowser/OSRDLLBrowser.dpr b/demos/Delphi_VCL/ConsoleBrowser/OSRDLLBrowser.dpr similarity index 100% rename from demos/ConsoleBrowser/OSRDLLBrowser.dpr rename to demos/Delphi_VCL/ConsoleBrowser/OSRDLLBrowser.dpr diff --git a/demos/ConsoleBrowser/OSRDLLBrowser.dproj b/demos/Delphi_VCL/ConsoleBrowser/OSRDLLBrowser.dproj similarity index 98% rename from demos/ConsoleBrowser/OSRDLLBrowser.dproj rename to demos/Delphi_VCL/ConsoleBrowser/OSRDLLBrowser.dproj index 6fb329e6..41651adb 100644 --- a/demos/ConsoleBrowser/OSRDLLBrowser.dproj +++ b/demos/Delphi_VCL/ConsoleBrowser/OSRDLLBrowser.dproj @@ -41,7 +41,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -118,9 +118,10 @@ OSRDLLBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/ConsoleBrowser/OSRSubProcess.dpr b/demos/Delphi_VCL/ConsoleBrowser/OSRSubProcess.dpr similarity index 100% rename from demos/ConsoleBrowser/OSRSubProcess.dpr rename to demos/Delphi_VCL/ConsoleBrowser/OSRSubProcess.dpr diff --git a/demos/ConsoleBrowser/OSRSubProcess.dproj b/demos/Delphi_VCL/ConsoleBrowser/OSRSubProcess.dproj similarity index 95% rename from demos/ConsoleBrowser/OSRSubProcess.dproj rename to demos/Delphi_VCL/ConsoleBrowser/OSRSubProcess.dproj index 33662b4f..eea6acbf 100644 --- a/demos/ConsoleBrowser/OSRSubProcess.dproj +++ b/demos/Delphi_VCL/ConsoleBrowser/OSRSubProcess.dproj @@ -34,6 +34,12 @@ true true + + true + Cfg_1 + true + true + true Base @@ -57,6 +63,7 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -67,7 +74,6 @@ 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) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -77,6 +83,7 @@ Debug CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 + (None) DEBUG;$(DCC_Define) @@ -92,6 +99,11 @@ true false PerMonitor + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + + + 1033 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= false @@ -132,9 +144,10 @@ OSRSubProcess.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/DLLBrowser/cef.inc b/demos/Delphi_VCL/ConsoleBrowser/cef.inc similarity index 100% rename from demos/DLLBrowser/cef.inc rename to demos/Delphi_VCL/ConsoleBrowser/cef.inc diff --git a/demos/ConsoleBrowser/uWebBrowser.dfm b/demos/Delphi_VCL/ConsoleBrowser/uWebBrowser.dfm similarity index 100% rename from demos/ConsoleBrowser/uWebBrowser.dfm rename to demos/Delphi_VCL/ConsoleBrowser/uWebBrowser.dfm diff --git a/demos/ConsoleBrowser/uWebBrowser.pas b/demos/Delphi_VCL/ConsoleBrowser/uWebBrowser.pas similarity index 100% rename from demos/ConsoleBrowser/uWebBrowser.pas rename to demos/Delphi_VCL/ConsoleBrowser/uWebBrowser.pas diff --git a/demos/DOMVisitor/00-DeleteDCUs.bat b/demos/Delphi_VCL/CookieVisitor/00-DeleteDCUs.bat similarity index 100% rename from demos/DOMVisitor/00-DeleteDCUs.bat rename to demos/Delphi_VCL/CookieVisitor/00-DeleteDCUs.bat diff --git a/demos/CookieVisitor/CookieVisitor.dpr b/demos/Delphi_VCL/CookieVisitor/CookieVisitor.dpr similarity index 100% rename from demos/CookieVisitor/CookieVisitor.dpr rename to demos/Delphi_VCL/CookieVisitor/CookieVisitor.dpr diff --git a/demos/CookieVisitor/CookieVisitor.dproj b/demos/Delphi_VCL/CookieVisitor/CookieVisitor.dproj similarity index 98% rename from demos/CookieVisitor/CookieVisitor.dproj rename to demos/Delphi_VCL/CookieVisitor/CookieVisitor.dproj index 10e4d83a..12f78e5e 100644 --- a/demos/CookieVisitor/CookieVisitor.dproj +++ b/demos/Delphi_VCL/CookieVisitor/CookieVisitor.dproj @@ -72,7 +72,7 @@ 3082 CookieVisitor CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - ..\..\bin + ..\..\..\bin DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;GR32_DSGN_RSXE5;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;CEF4Delphi;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;GR32_RSXE5;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage) @@ -81,7 +81,6 @@ true 1033 $(BDS)\bin\default_app.manifest - ..\..\bin DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;vclFireDAC;FireDACDb2Driver;DataSnapFireDAC;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;IndyProtocols240;IndySystem240;fmx;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;bindcompvcl;DataSnapConnectors;VCLRESTComponents;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;DataSnapClient;DataSnapServerMidas;$(DCC_UsePackage) @@ -159,9 +158,10 @@ CookieVisitor.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/DOMVisitor/cef.inc b/demos/Delphi_VCL/CookieVisitor/cef.inc similarity index 100% rename from demos/DOMVisitor/cef.inc rename to demos/Delphi_VCL/CookieVisitor/cef.inc diff --git a/demos/CookieVisitor/uCookieVisitor.dfm b/demos/Delphi_VCL/CookieVisitor/uCookieVisitor.dfm similarity index 100% rename from demos/CookieVisitor/uCookieVisitor.dfm rename to demos/Delphi_VCL/CookieVisitor/uCookieVisitor.dfm diff --git a/demos/CookieVisitor/uCookieVisitor.pas b/demos/Delphi_VCL/CookieVisitor/uCookieVisitor.pas similarity index 100% rename from demos/CookieVisitor/uCookieVisitor.pas rename to demos/Delphi_VCL/CookieVisitor/uCookieVisitor.pas diff --git a/demos/CookieVisitor/uSimpleTextViewer.dfm b/demos/Delphi_VCL/CookieVisitor/uSimpleTextViewer.dfm similarity index 100% rename from demos/CookieVisitor/uSimpleTextViewer.dfm rename to demos/Delphi_VCL/CookieVisitor/uSimpleTextViewer.dfm diff --git a/demos/CookieVisitor/uSimpleTextViewer.pas b/demos/Delphi_VCL/CookieVisitor/uSimpleTextViewer.pas similarity index 100% rename from demos/CookieVisitor/uSimpleTextViewer.pas rename to demos/Delphi_VCL/CookieVisitor/uSimpleTextViewer.pas diff --git a/demos/ExternalPumpBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/CustomResourceBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/ExternalPumpBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/CustomResourceBrowser/00-DeleteDCUs.bat diff --git a/demos/CustomResourceBrowser/CRBrowser.dpr b/demos/Delphi_VCL/CustomResourceBrowser/CRBrowser.dpr similarity index 100% rename from demos/CustomResourceBrowser/CRBrowser.dpr rename to demos/Delphi_VCL/CustomResourceBrowser/CRBrowser.dpr diff --git a/demos/CustomResourceBrowser/CRBrowser.dproj b/demos/Delphi_VCL/CustomResourceBrowser/CRBrowser.dproj similarity index 98% rename from demos/CustomResourceBrowser/CRBrowser.dproj rename to demos/Delphi_VCL/CustomResourceBrowser/CRBrowser.dproj index 4421c5f9..c6fdb1be 100644 --- a/demos/CustomResourceBrowser/CRBrowser.dproj +++ b/demos/Delphi_VCL/CustomResourceBrowser/CRBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 1033 @@ -78,7 +79,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -155,9 +155,10 @@ CRBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/ExternalPumpBrowser/cef.inc b/demos/Delphi_VCL/CustomResourceBrowser/cef.inc similarity index 100% rename from demos/ExternalPumpBrowser/cef.inc rename to demos/Delphi_VCL/CustomResourceBrowser/cef.inc diff --git a/demos/CustomResourceBrowser/uCustomResourceHandler.pas b/demos/Delphi_VCL/CustomResourceBrowser/uCustomResourceHandler.pas similarity index 100% rename from demos/CustomResourceBrowser/uCustomResourceHandler.pas rename to demos/Delphi_VCL/CustomResourceBrowser/uCustomResourceHandler.pas diff --git a/demos/CustomResourceBrowser/uMainForm.dfm b/demos/Delphi_VCL/CustomResourceBrowser/uMainForm.dfm similarity index 100% rename from demos/CustomResourceBrowser/uMainForm.dfm rename to demos/Delphi_VCL/CustomResourceBrowser/uMainForm.dfm diff --git a/demos/CustomResourceBrowser/uMainForm.pas b/demos/Delphi_VCL/CustomResourceBrowser/uMainForm.pas similarity index 100% rename from demos/CustomResourceBrowser/uMainForm.pas rename to demos/Delphi_VCL/CustomResourceBrowser/uMainForm.pas diff --git a/demos/FMXExternalPumpBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/DLLBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/FMXExternalPumpBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/DLLBrowser/00-DeleteDCUs.bat diff --git a/demos/DLLBrowser/CEF4DelphiLoader.dpr b/demos/Delphi_VCL/DLLBrowser/CEF4DelphiLoader.dpr similarity index 100% rename from demos/DLLBrowser/CEF4DelphiLoader.dpr rename to demos/Delphi_VCL/DLLBrowser/CEF4DelphiLoader.dpr diff --git a/demos/DLLBrowser/CEF4DelphiLoader.dproj b/demos/Delphi_VCL/DLLBrowser/CEF4DelphiLoader.dproj similarity index 98% rename from demos/DLLBrowser/CEF4DelphiLoader.dproj rename to demos/Delphi_VCL/DLLBrowser/CEF4DelphiLoader.dproj index 05f62113..c8d72976 100644 --- a/demos/DLLBrowser/CEF4DelphiLoader.dproj +++ b/demos/Delphi_VCL/DLLBrowser/CEF4DelphiLoader.dproj @@ -59,7 +59,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -79,7 +79,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 $(BDS)\bin\default_app.manifest @@ -153,9 +152,10 @@ CEF4DelphiLoader.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/DLLBrowser/DLLBrowser.dpr b/demos/Delphi_VCL/DLLBrowser/DLLBrowser.dpr similarity index 100% rename from demos/DLLBrowser/DLLBrowser.dpr rename to demos/Delphi_VCL/DLLBrowser/DLLBrowser.dpr diff --git a/demos/DLLBrowser/DLLBrowser.dproj b/demos/Delphi_VCL/DLLBrowser/DLLBrowser.dproj similarity index 98% rename from demos/DLLBrowser/DLLBrowser.dproj rename to demos/Delphi_VCL/DLLBrowser/DLLBrowser.dproj index 9971edeb..cff26761 100644 --- a/demos/DLLBrowser/DLLBrowser.dproj +++ b/demos/Delphi_VCL/DLLBrowser/DLLBrowser.dproj @@ -41,7 +41,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -59,7 +59,7 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + (None) 1033 @@ -118,9 +118,10 @@ DLLBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/DLLBrowser/SubProcess.dpr b/demos/Delphi_VCL/DLLBrowser/SubProcess.dpr similarity index 100% rename from demos/DLLBrowser/SubProcess.dpr rename to demos/Delphi_VCL/DLLBrowser/SubProcess.dpr diff --git a/demos/DLLBrowser/SubProcess.dproj b/demos/Delphi_VCL/DLLBrowser/SubProcess.dproj similarity index 98% rename from demos/DLLBrowser/SubProcess.dproj rename to demos/Delphi_VCL/DLLBrowser/SubProcess.dproj index 4539c752..30bc6291 100644 --- a/demos/DLLBrowser/SubProcess.dproj +++ b/demos/Delphi_VCL/DLLBrowser/SubProcess.dproj @@ -57,6 +57,7 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -67,7 +68,6 @@ 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) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -132,9 +132,10 @@ SubProcess.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/FMXExternalPumpBrowser/cef.inc b/demos/Delphi_VCL/DLLBrowser/cef.inc similarity index 100% rename from demos/FMXExternalPumpBrowser/cef.inc rename to demos/Delphi_VCL/DLLBrowser/cef.inc diff --git a/demos/DLLBrowser/uCEF4DelphiLoader.dfm b/demos/Delphi_VCL/DLLBrowser/uCEF4DelphiLoader.dfm similarity index 97% rename from demos/DLLBrowser/uCEF4DelphiLoader.dfm rename to demos/Delphi_VCL/DLLBrowser/uCEF4DelphiLoader.dfm index 927742f1..a8a7d716 100644 --- a/demos/DLLBrowser/uCEF4DelphiLoader.dfm +++ b/demos/Delphi_VCL/DLLBrowser/uCEF4DelphiLoader.dfm @@ -3,7 +3,7 @@ object Form1: TForm1 Top = 0 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle - Caption = 'CEF4Delpi loader' + Caption = 'CEF4Delphi loader' ClientHeight = 249 ClientWidth = 274 Color = clBtnFace diff --git a/demos/DLLBrowser/uCEF4DelphiLoader.pas b/demos/Delphi_VCL/DLLBrowser/uCEF4DelphiLoader.pas similarity index 100% rename from demos/DLLBrowser/uCEF4DelphiLoader.pas rename to demos/Delphi_VCL/DLLBrowser/uCEF4DelphiLoader.pas diff --git a/demos/DLLBrowser/uWebBrowser.dfm b/demos/Delphi_VCL/DLLBrowser/uWebBrowser.dfm similarity index 100% rename from demos/DLLBrowser/uWebBrowser.dfm rename to demos/Delphi_VCL/DLLBrowser/uWebBrowser.dfm diff --git a/demos/DLLBrowser/uWebBrowser.pas b/demos/Delphi_VCL/DLLBrowser/uWebBrowser.pas similarity index 100% rename from demos/DLLBrowser/uWebBrowser.pas rename to demos/Delphi_VCL/DLLBrowser/uWebBrowser.pas diff --git a/demos/FMXToolBoxBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/DOMVisitor/00-DeleteDCUs.bat similarity index 100% rename from demos/FMXToolBoxBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/DOMVisitor/00-DeleteDCUs.bat diff --git a/demos/DOMVisitor/DOMVisitor.dpr b/demos/Delphi_VCL/DOMVisitor/DOMVisitor.dpr similarity index 100% rename from demos/DOMVisitor/DOMVisitor.dpr rename to demos/Delphi_VCL/DOMVisitor/DOMVisitor.dpr diff --git a/demos/DOMVisitor/DOMVisitor.dproj b/demos/Delphi_VCL/DOMVisitor/DOMVisitor.dproj similarity index 98% rename from demos/DOMVisitor/DOMVisitor.dproj rename to demos/Delphi_VCL/DOMVisitor/DOMVisitor.dproj index 26fff332..1e954e44 100644 --- a/demos/DOMVisitor/DOMVisitor.dproj +++ b/demos/Delphi_VCL/DOMVisitor/DOMVisitor.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin $(BDS)\bin\default_app.manifest @@ -79,7 +80,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -155,9 +155,10 @@ DOMVisitor.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/FMXToolBoxBrowser/cef.inc b/demos/Delphi_VCL/DOMVisitor/cef.inc similarity index 100% rename from demos/FMXToolBoxBrowser/cef.inc rename to demos/Delphi_VCL/DOMVisitor/cef.inc diff --git a/demos/DOMVisitor/uDOMVisitor.dfm b/demos/Delphi_VCL/DOMVisitor/uDOMVisitor.dfm similarity index 100% rename from demos/DOMVisitor/uDOMVisitor.dfm rename to demos/Delphi_VCL/DOMVisitor/uDOMVisitor.dfm diff --git a/demos/DOMVisitor/uDOMVisitor.pas b/demos/Delphi_VCL/DOMVisitor/uDOMVisitor.pas similarity index 100% rename from demos/DOMVisitor/uDOMVisitor.pas rename to demos/Delphi_VCL/DOMVisitor/uDOMVisitor.pas diff --git a/demos/FullScreenBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/ExternalPumpBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/FullScreenBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/ExternalPumpBrowser/00-DeleteDCUs.bat diff --git a/demos/ExternalPumpBrowser/ExternalPumpBrowser.dpr b/demos/Delphi_VCL/ExternalPumpBrowser/ExternalPumpBrowser.dpr similarity index 100% rename from demos/ExternalPumpBrowser/ExternalPumpBrowser.dpr rename to demos/Delphi_VCL/ExternalPumpBrowser/ExternalPumpBrowser.dpr diff --git a/demos/ExternalPumpBrowser/ExternalPumpBrowser.dproj b/demos/Delphi_VCL/ExternalPumpBrowser/ExternalPumpBrowser.dproj similarity index 98% rename from demos/ExternalPumpBrowser/ExternalPumpBrowser.dproj rename to demos/Delphi_VCL/ExternalPumpBrowser/ExternalPumpBrowser.dproj index 7aa7fc48..9202512b 100644 --- a/demos/ExternalPumpBrowser/ExternalPumpBrowser.dproj +++ b/demos/Delphi_VCL/ExternalPumpBrowser/ExternalPumpBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -155,9 +155,10 @@ ExternalPumpBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/FullScreenBrowser/cef.inc b/demos/Delphi_VCL/ExternalPumpBrowser/cef.inc similarity index 100% rename from demos/FullScreenBrowser/cef.inc rename to demos/Delphi_VCL/ExternalPumpBrowser/cef.inc diff --git a/demos/ExternalPumpBrowser/uExternalPumpBrowser.dfm b/demos/Delphi_VCL/ExternalPumpBrowser/uExternalPumpBrowser.dfm similarity index 100% rename from demos/ExternalPumpBrowser/uExternalPumpBrowser.dfm rename to demos/Delphi_VCL/ExternalPumpBrowser/uExternalPumpBrowser.dfm diff --git a/demos/ExternalPumpBrowser/uExternalPumpBrowser.pas b/demos/Delphi_VCL/ExternalPumpBrowser/uExternalPumpBrowser.pas similarity index 100% rename from demos/ExternalPumpBrowser/uExternalPumpBrowser.pas rename to demos/Delphi_VCL/ExternalPumpBrowser/uExternalPumpBrowser.pas diff --git a/demos/JavaScript/JSDialog/00-DeleteDCUs.bat b/demos/Delphi_VCL/FullScreenBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSDialog/00-DeleteDCUs.bat rename to demos/Delphi_VCL/FullScreenBrowser/00-DeleteDCUs.bat diff --git a/demos/FullScreenBrowser/FullScreenBrowser.dpr b/demos/Delphi_VCL/FullScreenBrowser/FullScreenBrowser.dpr similarity index 100% rename from demos/FullScreenBrowser/FullScreenBrowser.dpr rename to demos/Delphi_VCL/FullScreenBrowser/FullScreenBrowser.dpr diff --git a/demos/FullScreenBrowser/FullScreenBrowser.dproj b/demos/Delphi_VCL/FullScreenBrowser/FullScreenBrowser.dproj similarity index 98% rename from demos/FullScreenBrowser/FullScreenBrowser.dproj rename to demos/Delphi_VCL/FullScreenBrowser/FullScreenBrowser.dproj index 4b839bde..9482c7b9 100644 --- a/demos/FullScreenBrowser/FullScreenBrowser.dproj +++ b/demos/Delphi_VCL/FullScreenBrowser/FullScreenBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin true @@ -78,7 +79,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -153,9 +153,10 @@ FullScreenBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSDialog/cef.inc b/demos/Delphi_VCL/FullScreenBrowser/cef.inc similarity index 100% rename from demos/JavaScript/JSDialog/cef.inc rename to demos/Delphi_VCL/FullScreenBrowser/cef.inc diff --git a/demos/FullScreenBrowser/uMainForm.dfm b/demos/Delphi_VCL/FullScreenBrowser/uMainForm.dfm similarity index 100% rename from demos/FullScreenBrowser/uMainForm.dfm rename to demos/Delphi_VCL/FullScreenBrowser/uMainForm.dfm diff --git a/demos/FullScreenBrowser/uMainForm.pas b/demos/Delphi_VCL/FullScreenBrowser/uMainForm.pas similarity index 100% rename from demos/FullScreenBrowser/uMainForm.pas rename to demos/Delphi_VCL/FullScreenBrowser/uMainForm.pas diff --git a/demos/JavaScript/JSEval/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSDialog/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSEval/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSDialog/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSDialog/JSDialogBrowser.dpr b/demos/Delphi_VCL/JavaScript/JSDialog/JSDialogBrowser.dpr similarity index 100% rename from demos/JavaScript/JSDialog/JSDialogBrowser.dpr rename to demos/Delphi_VCL/JavaScript/JSDialog/JSDialogBrowser.dpr diff --git a/demos/JavaScript/JSDialog/JSDialogBrowser.dproj b/demos/Delphi_VCL/JavaScript/JSDialog/JSDialogBrowser.dproj similarity index 98% rename from demos/JavaScript/JSDialog/JSDialogBrowser.dproj rename to demos/Delphi_VCL/JavaScript/JSDialog/JSDialogBrowser.dproj index bb004337..3a92dd2a 100644 --- a/demos/JavaScript/JSDialog/JSDialogBrowser.dproj +++ b/demos/Delphi_VCL/JavaScript/JSDialog/JSDialogBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -155,9 +155,10 @@ JSDialogBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSEval/cef.inc b/demos/Delphi_VCL/JavaScript/JSDialog/cef.inc similarity index 100% rename from demos/JavaScript/JSEval/cef.inc rename to demos/Delphi_VCL/JavaScript/JSDialog/cef.inc diff --git a/demos/JavaScript/JSDialog/uJSDialogBrowser.dfm b/demos/Delphi_VCL/JavaScript/JSDialog/uJSDialogBrowser.dfm similarity index 100% rename from demos/JavaScript/JSDialog/uJSDialogBrowser.dfm rename to demos/Delphi_VCL/JavaScript/JSDialog/uJSDialogBrowser.dfm diff --git a/demos/JavaScript/JSDialog/uJSDialogBrowser.pas b/demos/Delphi_VCL/JavaScript/JSDialog/uJSDialogBrowser.pas similarity index 100% rename from demos/JavaScript/JSDialog/uJSDialogBrowser.pas rename to demos/Delphi_VCL/JavaScript/JSDialog/uJSDialogBrowser.pas diff --git a/demos/JavaScript/JSExecutingFunctions/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSEval/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSExecutingFunctions/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSEval/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSEval/JSEval.dpr b/demos/Delphi_VCL/JavaScript/JSEval/JSEval.dpr similarity index 100% rename from demos/JavaScript/JSEval/JSEval.dpr rename to demos/Delphi_VCL/JavaScript/JSEval/JSEval.dpr diff --git a/demos/JavaScript/JSEval/JSEval.dproj b/demos/Delphi_VCL/JavaScript/JSEval/JSEval.dproj similarity index 98% rename from demos/JavaScript/JSEval/JSEval.dproj rename to demos/Delphi_VCL/JavaScript/JSEval/JSEval.dproj index d7bed10a..480d7371 100644 --- a/demos/JavaScript/JSEval/JSEval.dproj +++ b/demos/Delphi_VCL/JavaScript/JSEval/JSEval.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin $(BDS)\bin\default_app.manifest @@ -79,7 +80,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -159,9 +159,10 @@ JSEval.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSExecutingFunctions/cef.inc b/demos/Delphi_VCL/JavaScript/JSEval/cef.inc similarity index 100% rename from demos/JavaScript/JSExecutingFunctions/cef.inc rename to demos/Delphi_VCL/JavaScript/JSEval/cef.inc diff --git a/demos/JavaScript/JSEval/uJSEval.dfm b/demos/Delphi_VCL/JavaScript/JSEval/uJSEval.dfm similarity index 100% rename from demos/JavaScript/JSEval/uJSEval.dfm rename to demos/Delphi_VCL/JavaScript/JSEval/uJSEval.dfm diff --git a/demos/JavaScript/JSEval/uJSEval.pas b/demos/Delphi_VCL/JavaScript/JSEval/uJSEval.pas similarity index 100% rename from demos/JavaScript/JSEval/uJSEval.pas rename to demos/Delphi_VCL/JavaScript/JSEval/uJSEval.pas diff --git a/demos/JavaScript/JSEval/uSimpleTextViewer.dfm b/demos/Delphi_VCL/JavaScript/JSEval/uSimpleTextViewer.dfm similarity index 100% rename from demos/JavaScript/JSEval/uSimpleTextViewer.dfm rename to demos/Delphi_VCL/JavaScript/JSEval/uSimpleTextViewer.dfm diff --git a/demos/JavaScript/JSEval/uSimpleTextViewer.pas b/demos/Delphi_VCL/JavaScript/JSEval/uSimpleTextViewer.pas similarity index 100% rename from demos/JavaScript/JSEval/uSimpleTextViewer.pas rename to demos/Delphi_VCL/JavaScript/JSEval/uSimpleTextViewer.pas diff --git a/demos/JavaScript/JSExtension/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSExtension/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dpr b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dpr similarity index 100% rename from demos/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dpr rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dpr diff --git a/demos/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dproj b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dproj similarity index 98% rename from demos/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dproj rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dproj index bf59a98c..19ce3656 100644 --- a/demos/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dproj +++ b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/JSExecutingFunctions.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -157,9 +157,10 @@ JSExecutingFunctions.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSExtension/cef.inc b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/cef.inc similarity index 100% rename from demos/JavaScript/JSExtension/cef.inc rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/cef.inc diff --git a/demos/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.dfm b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.dfm similarity index 100% rename from demos/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.dfm rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.dfm diff --git a/demos/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas similarity index 100% rename from demos/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas diff --git a/demos/JavaScript/JSExecutingFunctions/uMyV8Handler.pas b/demos/Delphi_VCL/JavaScript/JSExecutingFunctions/uMyV8Handler.pas similarity index 100% rename from demos/JavaScript/JSExecutingFunctions/uMyV8Handler.pas rename to demos/Delphi_VCL/JavaScript/JSExecutingFunctions/uMyV8Handler.pas diff --git a/demos/JavaScript/JSExtensionWithFunction/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSExtension/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSExtensionWithFunction/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSExtension/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSExtension/JSExtension.dpr b/demos/Delphi_VCL/JavaScript/JSExtension/JSExtension.dpr similarity index 100% rename from demos/JavaScript/JSExtension/JSExtension.dpr rename to demos/Delphi_VCL/JavaScript/JSExtension/JSExtension.dpr diff --git a/demos/JavaScript/JSExtension/JSExtension.dproj b/demos/Delphi_VCL/JavaScript/JSExtension/JSExtension.dproj similarity index 98% rename from demos/JavaScript/JSExtension/JSExtension.dproj rename to demos/Delphi_VCL/JavaScript/JSExtension/JSExtension.dproj index 5078548c..0e0a7d48 100644 --- a/demos/JavaScript/JSExtension/JSExtension.dproj +++ b/demos/Delphi_VCL/JavaScript/JSExtension/JSExtension.dproj @@ -86,6 +86,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -96,7 +97,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -201,9 +201,10 @@ JSExtension.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSExtensionWithFunction/cef.inc b/demos/Delphi_VCL/JavaScript/JSExtension/cef.inc similarity index 100% rename from demos/JavaScript/JSExtensionWithFunction/cef.inc rename to demos/Delphi_VCL/JavaScript/JSExtension/cef.inc diff --git a/demos/JavaScript/JSExtension/uJSExtension.dfm b/demos/Delphi_VCL/JavaScript/JSExtension/uJSExtension.dfm similarity index 100% rename from demos/JavaScript/JSExtension/uJSExtension.dfm rename to demos/Delphi_VCL/JavaScript/JSExtension/uJSExtension.dfm diff --git a/demos/JavaScript/JSExtension/uJSExtension.pas b/demos/Delphi_VCL/JavaScript/JSExtension/uJSExtension.pas similarity index 100% rename from demos/JavaScript/JSExtension/uJSExtension.pas rename to demos/Delphi_VCL/JavaScript/JSExtension/uJSExtension.pas diff --git a/demos/JavaScript/JSExtension/uSimpleTextViewer.dfm b/demos/Delphi_VCL/JavaScript/JSExtension/uSimpleTextViewer.dfm similarity index 100% rename from demos/JavaScript/JSExtension/uSimpleTextViewer.dfm rename to demos/Delphi_VCL/JavaScript/JSExtension/uSimpleTextViewer.dfm diff --git a/demos/JavaScript/JSExtension/uSimpleTextViewer.pas b/demos/Delphi_VCL/JavaScript/JSExtension/uSimpleTextViewer.pas similarity index 100% rename from demos/JavaScript/JSExtension/uSimpleTextViewer.pas rename to demos/Delphi_VCL/JavaScript/JSExtension/uSimpleTextViewer.pas diff --git a/demos/JavaScript/JSExtension/uTestExtensionHandler.pas b/demos/Delphi_VCL/JavaScript/JSExtension/uTestExtensionHandler.pas similarity index 100% rename from demos/JavaScript/JSExtension/uTestExtensionHandler.pas rename to demos/Delphi_VCL/JavaScript/JSExtension/uTestExtensionHandler.pas diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSExtensionWithObjectParameter/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dpr b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dpr similarity index 100% rename from demos/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dpr rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dpr diff --git a/demos/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dproj b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dproj similarity index 98% rename from demos/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dproj rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dproj index ea022ae0..aa6e77e6 100644 --- a/demos/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dproj +++ b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -157,9 +157,10 @@ JSExtensionWithFunction.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/cef.inc b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/cef.inc similarity index 100% rename from demos/JavaScript/JSExtensionWithObjectParameter/cef.inc rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/cef.inc diff --git a/demos/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.dfm b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.dfm similarity index 100% rename from demos/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.dfm rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.dfm diff --git a/demos/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas similarity index 100% rename from demos/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas diff --git a/demos/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas b/demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas similarity index 100% rename from demos/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas rename to demos/Delphi_VCL/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas diff --git a/demos/JavaScript/JSRTTIExtension/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSRTTIExtension/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dpr b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dpr similarity index 100% rename from demos/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dpr rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dpr diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dproj b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dproj similarity index 98% rename from demos/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dproj rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dproj index 0cb42abb..11ad80f9 100644 --- a/demos/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dproj +++ b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -157,19 +157,20 @@ JSExtensionWithObjectParameter.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + JSExtensionWithObjectParameter.exe true - 1 diff --git a/demos/JavaScript/JSRTTIExtension/cef.inc b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/cef.inc similarity index 100% rename from demos/JavaScript/JSRTTIExtension/cef.inc rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/cef.inc diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.dfm b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.dfm similarity index 100% rename from demos/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.dfm rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.dfm diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas similarity index 100% rename from demos/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas diff --git a/demos/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas b/demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas similarity index 100% rename from demos/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas rename to demos/Delphi_VCL/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas diff --git a/demos/JavaScript/JSSimpleExtension/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSSimpleExtension/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSRTTIExtension/JSRTTIExtension.dpr b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/JSRTTIExtension.dpr similarity index 100% rename from demos/JavaScript/JSRTTIExtension/JSRTTIExtension.dpr rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/JSRTTIExtension.dpr diff --git a/demos/JavaScript/JSRTTIExtension/JSRTTIExtension.dproj b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/JSRTTIExtension.dproj similarity index 98% rename from demos/JavaScript/JSRTTIExtension/JSRTTIExtension.dproj rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/JSRTTIExtension.dproj index 234dd878..e5aae7e0 100644 --- a/demos/JavaScript/JSRTTIExtension/JSRTTIExtension.dproj +++ b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/JSRTTIExtension.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -159,19 +159,20 @@ JSRTTIExtension.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components - JSRTTIExtension.exe true + 1 diff --git a/demos/JavaScript/JSSimpleExtension/cef.inc b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/cef.inc similarity index 100% rename from demos/JavaScript/JSSimpleExtension/cef.inc rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/cef.inc diff --git a/demos/JavaScript/JSRTTIExtension/uJSRTTIExtension.dfm b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/uJSRTTIExtension.dfm similarity index 100% rename from demos/JavaScript/JSRTTIExtension/uJSRTTIExtension.dfm rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/uJSRTTIExtension.dfm diff --git a/demos/JavaScript/JSRTTIExtension/uJSRTTIExtension.pas b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/uJSRTTIExtension.pas similarity index 100% rename from demos/JavaScript/JSRTTIExtension/uJSRTTIExtension.pas rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/uJSRTTIExtension.pas diff --git a/demos/JavaScript/JSRTTIExtension/uSimpleTextViewer.dfm b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/uSimpleTextViewer.dfm similarity index 100% rename from demos/JavaScript/JSRTTIExtension/uSimpleTextViewer.dfm rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/uSimpleTextViewer.dfm diff --git a/demos/JavaScript/JSRTTIExtension/uSimpleTextViewer.pas b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/uSimpleTextViewer.pas similarity index 100% rename from demos/JavaScript/JSRTTIExtension/uSimpleTextViewer.pas rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/uSimpleTextViewer.pas diff --git a/demos/JavaScript/JSRTTIExtension/uTestExtension.pas b/demos/Delphi_VCL/JavaScript/JSRTTIExtension/uTestExtension.pas similarity index 100% rename from demos/JavaScript/JSRTTIExtension/uTestExtension.pas rename to demos/Delphi_VCL/JavaScript/JSRTTIExtension/uTestExtension.pas diff --git a/demos/JavaScript/JSSimpleWindowBinding/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSSimpleWindowBinding/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSSimpleExtension/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSSimpleExtension/JSSimpleExtension.dpr b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/JSSimpleExtension.dpr similarity index 100% rename from demos/JavaScript/JSSimpleExtension/JSSimpleExtension.dpr rename to demos/Delphi_VCL/JavaScript/JSSimpleExtension/JSSimpleExtension.dpr diff --git a/demos/JavaScript/JSSimpleExtension/JSSimpleExtension.dproj b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/JSSimpleExtension.dproj similarity index 98% rename from demos/JavaScript/JSSimpleExtension/JSSimpleExtension.dproj rename to demos/Delphi_VCL/JavaScript/JSSimpleExtension/JSSimpleExtension.dproj index e2f741d1..fb207a44 100644 --- a/demos/JavaScript/JSSimpleExtension/JSSimpleExtension.dproj +++ b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/JSSimpleExtension.dproj @@ -86,6 +86,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -96,7 +97,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -192,9 +192,10 @@ JSSimpleExtension.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSSimpleWindowBinding/cef.inc b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/cef.inc similarity index 100% rename from demos/JavaScript/JSSimpleWindowBinding/cef.inc rename to demos/Delphi_VCL/JavaScript/JSSimpleExtension/cef.inc diff --git a/demos/JavaScript/JSSimpleExtension/uJSSimpleExtension.dfm b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/uJSSimpleExtension.dfm similarity index 100% rename from demos/JavaScript/JSSimpleExtension/uJSSimpleExtension.dfm rename to demos/Delphi_VCL/JavaScript/JSSimpleExtension/uJSSimpleExtension.dfm diff --git a/demos/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas b/demos/Delphi_VCL/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas similarity index 100% rename from demos/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas rename to demos/Delphi_VCL/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas diff --git a/demos/JavaScript/JSWindowBindingSubProcess/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSWindowBindingSubProcess/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dpr b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dpr similarity index 100% rename from demos/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dpr rename to demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dpr diff --git a/demos/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dproj b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dproj similarity index 98% rename from demos/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dproj rename to demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dproj index de2ba180..c4114205 100644 --- a/demos/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dproj +++ b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -156,9 +156,10 @@ JSSimpleWindowBinding.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSWindowBindingSubProcess/cef.inc b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/cef.inc similarity index 100% rename from demos/JavaScript/JSWindowBindingSubProcess/cef.inc rename to demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/cef.inc diff --git a/demos/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.dfm b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.dfm similarity index 100% rename from demos/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.dfm rename to demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.dfm diff --git a/demos/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas b/demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas similarity index 100% rename from demos/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas rename to demos/Delphi_VCL/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas diff --git a/demos/JavaScript/JSWindowBindingWithFunction/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSWindowBindingWithFunction/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dpr b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dpr similarity index 100% rename from demos/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dpr rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dpr diff --git a/demos/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dproj b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dproj similarity index 98% rename from demos/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dproj rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dproj index df62b39a..9bd43c47 100644 --- a/demos/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dproj +++ b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -159,9 +159,10 @@ JSSimpleWindowBinding.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSWindowBindingSubProcess/SubProcess.dpr b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/SubProcess.dpr similarity index 100% rename from demos/JavaScript/JSWindowBindingSubProcess/SubProcess.dpr rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/SubProcess.dpr diff --git a/demos/SubProcess/SubProcess.dproj b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/SubProcess.dproj similarity index 97% rename from demos/SubProcess/SubProcess.dproj rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/SubProcess.dproj index 4539c752..0581b809 100644 --- a/demos/SubProcess/SubProcess.dproj +++ b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/SubProcess.dproj @@ -57,6 +57,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -67,7 +68,6 @@ 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) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -91,6 +91,7 @@ 1033 true false + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) PerMonitor @@ -132,9 +133,10 @@ SubProcess.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSWindowBindingWithFunction/cef.inc b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/cef.inc similarity index 100% rename from demos/JavaScript/JSWindowBindingWithFunction/cef.inc rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/cef.inc diff --git a/demos/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.dfm b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.dfm similarity index 100% rename from demos/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.dfm rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.dfm diff --git a/demos/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas b/demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas similarity index 100% rename from demos/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas rename to demos/Delphi_VCL/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas diff --git a/demos/JavaScript/JSWindowBindingWithObject/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/00-DeleteDCUs.bat similarity index 100% rename from demos/JavaScript/JSWindowBindingWithObject/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dpr b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dpr similarity index 100% rename from demos/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dpr rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dpr diff --git a/demos/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dproj b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dproj similarity index 98% rename from demos/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dproj rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dproj index aa7db423..fe1f0b1c 100644 --- a/demos/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dproj +++ b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -157,9 +157,10 @@ JSWindowBindingWithFunction.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/JavaScript/JSWindowBindingWithObject/cef.inc b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/cef.inc similarity index 100% rename from demos/JavaScript/JSWindowBindingWithObject/cef.inc rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/cef.inc diff --git a/demos/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.dfm b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.dfm similarity index 100% rename from demos/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.dfm rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.dfm diff --git a/demos/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas similarity index 100% rename from demos/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas diff --git a/demos/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas similarity index 100% rename from demos/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas diff --git a/demos/KioskOSRBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/00-DeleteDCUs.bat similarity index 100% rename from demos/KioskOSRBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/00-DeleteDCUs.bat diff --git a/demos/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dpr b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dpr similarity index 100% rename from demos/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dpr rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dpr diff --git a/demos/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dproj b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dproj similarity index 98% rename from demos/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dproj rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dproj index aa93256d..34786d6e 100644 --- a/demos/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dproj +++ b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -79,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -157,9 +157,10 @@ JSWindowBindingWithObject.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/KioskOSRBrowser/cef.inc b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/cef.inc similarity index 100% rename from demos/KioskOSRBrowser/cef.inc rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/cef.inc diff --git a/demos/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.dfm b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.dfm similarity index 100% rename from demos/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.dfm rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.dfm diff --git a/demos/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas similarity index 100% rename from demos/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas diff --git a/demos/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas b/demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas similarity index 100% rename from demos/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas rename to demos/Delphi_VCL/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas diff --git a/demos/MDIBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/KioskOSRBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/MDIBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/KioskOSRBrowser/00-DeleteDCUs.bat diff --git a/demos/KioskOSRBrowser/KioskOSRBrowser.dpr b/demos/Delphi_VCL/KioskOSRBrowser/KioskOSRBrowser.dpr similarity index 100% rename from demos/KioskOSRBrowser/KioskOSRBrowser.dpr rename to demos/Delphi_VCL/KioskOSRBrowser/KioskOSRBrowser.dpr diff --git a/demos/KioskOSRBrowser/KioskOSRBrowser.dproj b/demos/Delphi_VCL/KioskOSRBrowser/KioskOSRBrowser.dproj similarity index 96% rename from demos/KioskOSRBrowser/KioskOSRBrowser.dproj rename to demos/Delphi_VCL/KioskOSRBrowser/KioskOSRBrowser.dproj index 5188f03b..0340188c 100644 --- a/demos/KioskOSRBrowser/KioskOSRBrowser.dproj +++ b/demos/Delphi_VCL/KioskOSRBrowser/KioskOSRBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -105,13 +106,15 @@ true false Debug - ..\..\bin CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) PerMonitor true PerMonitorV2 + true + 1033 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= false @@ -122,6 +125,9 @@ true PerMonitor + true + 1033 + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) true @@ -155,9 +161,10 @@ KioskOSRBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/MDIBrowser/cef.inc b/demos/Delphi_VCL/KioskOSRBrowser/cef.inc similarity index 100% rename from demos/MDIBrowser/cef.inc rename to demos/Delphi_VCL/KioskOSRBrowser/cef.inc diff --git a/demos/KioskOSRBrowser/uKioskOSRBrowser.dfm b/demos/Delphi_VCL/KioskOSRBrowser/uKioskOSRBrowser.dfm similarity index 100% rename from demos/KioskOSRBrowser/uKioskOSRBrowser.dfm rename to demos/Delphi_VCL/KioskOSRBrowser/uKioskOSRBrowser.dfm diff --git a/demos/KioskOSRBrowser/uKioskOSRBrowser.pas b/demos/Delphi_VCL/KioskOSRBrowser/uKioskOSRBrowser.pas similarity index 100% rename from demos/KioskOSRBrowser/uKioskOSRBrowser.pas rename to demos/Delphi_VCL/KioskOSRBrowser/uKioskOSRBrowser.pas diff --git a/demos/MDIExternalPumpBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/MDIBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/MDIExternalPumpBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/MDIBrowser/00-DeleteDCUs.bat diff --git a/demos/MDIBrowser/MDIBrowser.dpr b/demos/Delphi_VCL/MDIBrowser/MDIBrowser.dpr similarity index 100% rename from demos/MDIBrowser/MDIBrowser.dpr rename to demos/Delphi_VCL/MDIBrowser/MDIBrowser.dpr diff --git a/demos/MDIBrowser/MDIBrowser.dproj b/demos/Delphi_VCL/MDIBrowser/MDIBrowser.dproj similarity index 98% rename from demos/MDIBrowser/MDIBrowser.dproj rename to demos/Delphi_VCL/MDIBrowser/MDIBrowser.dproj index 9a93af1d..bd945dfe 100644 --- a/demos/MDIBrowser/MDIBrowser.dproj +++ b/demos/Delphi_VCL/MDIBrowser/MDIBrowser.dproj @@ -75,13 +75,13 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png @@ -179,9 +179,10 @@ - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/MDIExternalPumpBrowser/cef.inc b/demos/Delphi_VCL/MDIBrowser/cef.inc similarity index 100% rename from demos/MDIExternalPumpBrowser/cef.inc rename to demos/Delphi_VCL/MDIBrowser/cef.inc diff --git a/demos/MDIBrowser/uChildForm.dfm b/demos/Delphi_VCL/MDIBrowser/uChildForm.dfm similarity index 100% rename from demos/MDIBrowser/uChildForm.dfm rename to demos/Delphi_VCL/MDIBrowser/uChildForm.dfm diff --git a/demos/MDIBrowser/uChildForm.pas b/demos/Delphi_VCL/MDIBrowser/uChildForm.pas similarity index 100% rename from demos/MDIBrowser/uChildForm.pas rename to demos/Delphi_VCL/MDIBrowser/uChildForm.pas diff --git a/demos/MDIBrowser/uMainForm.dfm b/demos/Delphi_VCL/MDIBrowser/uMainForm.dfm similarity index 100% rename from demos/MDIBrowser/uMainForm.dfm rename to demos/Delphi_VCL/MDIBrowser/uMainForm.dfm diff --git a/demos/MDIBrowser/uMainForm.pas b/demos/Delphi_VCL/MDIBrowser/uMainForm.pas similarity index 100% rename from demos/MDIBrowser/uMainForm.pas rename to demos/Delphi_VCL/MDIBrowser/uMainForm.pas diff --git a/demos/MiniBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/MDIExternalPumpBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/MiniBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/MDIExternalPumpBrowser/00-DeleteDCUs.bat diff --git a/demos/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dpr b/demos/Delphi_VCL/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dpr similarity index 100% rename from demos/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dpr rename to demos/Delphi_VCL/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dpr diff --git a/demos/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dproj b/demos/Delphi_VCL/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dproj similarity index 98% rename from demos/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dproj rename to demos/Delphi_VCL/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dproj index 3be055db..e8ebe1ba 100644 --- a/demos/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dproj +++ b/demos/Delphi_VCL/MDIExternalPumpBrowser/MDIExternalPumpBrowser.dproj @@ -75,13 +75,13 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png @@ -179,9 +179,10 @@ - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/MiniBrowser/cef.inc b/demos/Delphi_VCL/MDIExternalPumpBrowser/cef.inc similarity index 100% rename from demos/MiniBrowser/cef.inc rename to demos/Delphi_VCL/MDIExternalPumpBrowser/cef.inc diff --git a/demos/MDIExternalPumpBrowser/uChildForm.dfm b/demos/Delphi_VCL/MDIExternalPumpBrowser/uChildForm.dfm similarity index 100% rename from demos/MDIExternalPumpBrowser/uChildForm.dfm rename to demos/Delphi_VCL/MDIExternalPumpBrowser/uChildForm.dfm diff --git a/demos/MDIExternalPumpBrowser/uChildForm.pas b/demos/Delphi_VCL/MDIExternalPumpBrowser/uChildForm.pas similarity index 100% rename from demos/MDIExternalPumpBrowser/uChildForm.pas rename to demos/Delphi_VCL/MDIExternalPumpBrowser/uChildForm.pas diff --git a/demos/MDIExternalPumpBrowser/uMainForm.dfm b/demos/Delphi_VCL/MDIExternalPumpBrowser/uMainForm.dfm similarity index 100% rename from demos/MDIExternalPumpBrowser/uMainForm.dfm rename to demos/Delphi_VCL/MDIExternalPumpBrowser/uMainForm.dfm diff --git a/demos/MDIExternalPumpBrowser/uMainForm.pas b/demos/Delphi_VCL/MDIExternalPumpBrowser/uMainForm.pas similarity index 100% rename from demos/MDIExternalPumpBrowser/uMainForm.pas rename to demos/Delphi_VCL/MDIExternalPumpBrowser/uMainForm.pas diff --git a/demos/OSRExternalPumpBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/MiniBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/OSRExternalPumpBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/MiniBrowser/00-DeleteDCUs.bat diff --git a/demos/MiniBrowser/MiniBrowser.dpr b/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dpr similarity index 100% rename from demos/MiniBrowser/MiniBrowser.dpr rename to demos/Delphi_VCL/MiniBrowser/MiniBrowser.dpr diff --git a/demos/MiniBrowser/MiniBrowser.dproj b/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj similarity index 99% rename from demos/MiniBrowser/MiniBrowser.dproj rename to demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj index 79fef5a2..f530b8f8 100644 --- a/demos/MiniBrowser/MiniBrowser.dproj +++ b/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj @@ -69,7 +69,7 @@ false false false - ..\..\bin + ..\..\..\bin CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) @@ -80,7 +80,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -168,7 +167,6 @@ MiniBrowser.dpr - File c:\program files (x86)\embarcadero\studio\20.0\bin\dclemsedge260.bpl not found IP Abstraction Indy Implementation Design Time DBExpress Enterprise Data Explorer Integration Microsoft Office 2000 Sample Automation Server Wrapper Components diff --git a/demos/OSRExternalPumpBrowser/cef.inc b/demos/Delphi_VCL/MiniBrowser/cef.inc similarity index 100% rename from demos/OSRExternalPumpBrowser/cef.inc rename to demos/Delphi_VCL/MiniBrowser/cef.inc diff --git a/demos/MiniBrowser/uMiniBrowser.dfm b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm similarity index 100% rename from demos/MiniBrowser/uMiniBrowser.dfm rename to demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm diff --git a/demos/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas similarity index 100% rename from demos/MiniBrowser/uMiniBrowser.pas rename to demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas diff --git a/demos/MiniBrowser/uPreferences.dfm b/demos/Delphi_VCL/MiniBrowser/uPreferences.dfm similarity index 100% rename from demos/MiniBrowser/uPreferences.dfm rename to demos/Delphi_VCL/MiniBrowser/uPreferences.dfm diff --git a/demos/MiniBrowser/uPreferences.pas b/demos/Delphi_VCL/MiniBrowser/uPreferences.pas similarity index 100% rename from demos/MiniBrowser/uPreferences.pas rename to demos/Delphi_VCL/MiniBrowser/uPreferences.pas diff --git a/demos/MiniBrowser/uSimpleTextViewer.dfm b/demos/Delphi_VCL/MiniBrowser/uSimpleTextViewer.dfm similarity index 100% rename from demos/MiniBrowser/uSimpleTextViewer.dfm rename to demos/Delphi_VCL/MiniBrowser/uSimpleTextViewer.dfm diff --git a/demos/MiniBrowser/uSimpleTextViewer.pas b/demos/Delphi_VCL/MiniBrowser/uSimpleTextViewer.pas similarity index 100% rename from demos/MiniBrowser/uSimpleTextViewer.pas rename to demos/Delphi_VCL/MiniBrowser/uSimpleTextViewer.pas diff --git a/demos/PopupBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/OSRExternalPumpBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/PopupBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/OSRExternalPumpBrowser/00-DeleteDCUs.bat diff --git a/demos/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dpr b/demos/Delphi_VCL/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dpr similarity index 100% rename from demos/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dpr rename to demos/Delphi_VCL/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dpr diff --git a/demos/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dproj b/demos/Delphi_VCL/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dproj similarity index 98% rename from demos/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dproj rename to demos/Delphi_VCL/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dproj index 78344c7e..7b1417cd 100644 --- a/demos/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dproj +++ b/demos/Delphi_VCL/OSRExternalPumpBrowser/OSRExternalPumpBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -105,7 +106,6 @@ true false Debug - ..\..\bin CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) PerMonitor @@ -155,9 +155,10 @@ OSRExternalPumpBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/PopupBrowser/cef.inc b/demos/Delphi_VCL/OSRExternalPumpBrowser/cef.inc similarity index 100% rename from demos/PopupBrowser/cef.inc rename to demos/Delphi_VCL/OSRExternalPumpBrowser/cef.inc diff --git a/demos/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.dfm b/demos/Delphi_VCL/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.dfm similarity index 100% rename from demos/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.dfm rename to demos/Delphi_VCL/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.dfm diff --git a/demos/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas b/demos/Delphi_VCL/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas similarity index 100% rename from demos/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas rename to demos/Delphi_VCL/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas diff --git a/demos/PopupBrowser2/00-DeleteDCUs.bat b/demos/Delphi_VCL/PopupBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/PopupBrowser2/00-DeleteDCUs.bat rename to demos/Delphi_VCL/PopupBrowser/00-DeleteDCUs.bat diff --git a/demos/PopupBrowser/PopupBrowser.dpr b/demos/Delphi_VCL/PopupBrowser/PopupBrowser.dpr similarity index 100% rename from demos/PopupBrowser/PopupBrowser.dpr rename to demos/Delphi_VCL/PopupBrowser/PopupBrowser.dpr diff --git a/demos/PopupBrowser/PopupBrowser.dproj b/demos/Delphi_VCL/PopupBrowser/PopupBrowser.dproj similarity index 98% rename from demos/PopupBrowser/PopupBrowser.dproj rename to demos/Delphi_VCL/PopupBrowser/PopupBrowser.dproj index d157447d..736a4188 100644 --- a/demos/PopupBrowser/PopupBrowser.dproj +++ b/demos/Delphi_VCL/PopupBrowser/PopupBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -159,9 +159,10 @@ PopupBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/PopupBrowser2/cef.inc b/demos/Delphi_VCL/PopupBrowser/cef.inc similarity index 100% rename from demos/PopupBrowser2/cef.inc rename to demos/Delphi_VCL/PopupBrowser/cef.inc diff --git a/demos/PopupBrowser/uChildForm.dfm b/demos/Delphi_VCL/PopupBrowser/uChildForm.dfm similarity index 100% rename from demos/PopupBrowser/uChildForm.dfm rename to demos/Delphi_VCL/PopupBrowser/uChildForm.dfm diff --git a/demos/PopupBrowser/uChildForm.pas b/demos/Delphi_VCL/PopupBrowser/uChildForm.pas similarity index 100% rename from demos/PopupBrowser/uChildForm.pas rename to demos/Delphi_VCL/PopupBrowser/uChildForm.pas diff --git a/demos/PopupBrowser/uMainForm.dfm b/demos/Delphi_VCL/PopupBrowser/uMainForm.dfm similarity index 96% rename from demos/PopupBrowser/uMainForm.dfm rename to demos/Delphi_VCL/PopupBrowser/uMainForm.dfm index a1347b01..39ed268a 100644 --- a/demos/PopupBrowser/uMainForm.dfm +++ b/demos/Delphi_VCL/PopupBrowser/uMainForm.dfm @@ -73,6 +73,8 @@ object MainForm: TMainForm object Chromium1: TChromium OnBeforePopup = Chromium1BeforePopup OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close Left = 56 Top = 152 end diff --git a/demos/PopupBrowser/uMainForm.pas b/demos/Delphi_VCL/PopupBrowser/uMainForm.pas similarity index 85% rename from demos/PopupBrowser/uMainForm.pas rename to demos/Delphi_VCL/PopupBrowser/uMainForm.pas index 6346512d..733cb79e 100644 --- a/demos/PopupBrowser/uMainForm.pas +++ b/demos/Delphi_VCL/PopupBrowser/uMainForm.pas @@ -77,11 +77,15 @@ type 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); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); protected FChildForm : TChildForm; FCriticalSection : TCriticalSection; - FClosing : boolean; + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosingMainForm : boolean; // Set to True in the CloseQuery event. + FClosingChildren : boolean; // Set to True in the CloseQuery event. function GetPopupChildCount : integer; @@ -93,6 +97,7 @@ type procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; procedure CreateNextChildMsg(var aMessage : TMessage); message CEF_CREATENEXTCHILD; procedure ChildDestroyedMsg(var aMessage : TMessage); message CEF_CHILDDESTROYED; @@ -130,10 +135,17 @@ uses // The main form sends a WM_CLOSE to all active popup forms and waits until all of them have sent a CEF_CHILDDESTROYED message. +// Destruction steps +// ================= +// 1. FormCloseQuery sets CanClose to FALSE and it closes all child forms. +// 2. When all the child forms are closed then FormCloseQuery is triggered again, sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event. +// 3. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event. +// 4. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. + procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin - FClosing := True; - Visible := False; + FClosingChildren := True; + Visible := False; if (PopupChildCount > 0) then begin @@ -141,14 +153,26 @@ begin CanClose := False; end else - CanClose := True; + begin + CanClose := FCanClose; + + if not(FClosingMainForm) then + begin + FClosingMainForm := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; + end; end; procedure TMainForm.FormCreate(Sender: TObject); begin - FClosing := False; - FCriticalSection := TCriticalSection.Create; + FClosingChildren := False; + FClosingMainForm := False; + FCanClose := False; + FCriticalSection := TCriticalSection.Create; + Chromium1.DefaultURL := AddressEdt.Text; Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); end; @@ -199,6 +223,18 @@ begin end; end; +procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + function TMainForm.CreateClientHandler(var windowInfo : TCefWindowInfo; var client : ICefClient; const targetFrameName : string; @@ -279,7 +315,11 @@ begin FChildForm := TChildForm.Create(self); Caption := 'Popup Browser'; AddressPnl.Enabled := True; - GoBtn.Click; +end; + +procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; end; procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage); @@ -302,7 +342,7 @@ end; procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage); begin - if FClosing and (PopupChildCount = 0) then Close; + if FClosingChildren and (PopupChildCount = 0) then Close; end; procedure TMainForm.GoBtnClick(Sender: TObject); diff --git a/demos/PostInspectorBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/PopupBrowser2/00-DeleteDCUs.bat similarity index 100% rename from demos/PostInspectorBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/PopupBrowser2/00-DeleteDCUs.bat diff --git a/demos/PopupBrowser2/PopupBrowser2.dpr b/demos/Delphi_VCL/PopupBrowser2/PopupBrowser2.dpr similarity index 100% rename from demos/PopupBrowser2/PopupBrowser2.dpr rename to demos/Delphi_VCL/PopupBrowser2/PopupBrowser2.dpr diff --git a/demos/PopupBrowser2/PopupBrowser2.dproj b/demos/Delphi_VCL/PopupBrowser2/PopupBrowser2.dproj similarity index 98% rename from demos/PopupBrowser2/PopupBrowser2.dproj rename to demos/Delphi_VCL/PopupBrowser2/PopupBrowser2.dproj index 55991304..8b5c315e 100644 --- a/demos/PopupBrowser2/PopupBrowser2.dproj +++ b/demos/Delphi_VCL/PopupBrowser2/PopupBrowser2.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -159,9 +159,10 @@ PopupBrowser2.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/PostInspectorBrowser/cef.inc b/demos/Delphi_VCL/PopupBrowser2/cef.inc similarity index 100% rename from demos/PostInspectorBrowser/cef.inc rename to demos/Delphi_VCL/PopupBrowser2/cef.inc diff --git a/demos/PopupBrowser2/uChildForm.dfm b/demos/Delphi_VCL/PopupBrowser2/uChildForm.dfm similarity index 100% rename from demos/PopupBrowser2/uChildForm.dfm rename to demos/Delphi_VCL/PopupBrowser2/uChildForm.dfm diff --git a/demos/PopupBrowser2/uChildForm.pas b/demos/Delphi_VCL/PopupBrowser2/uChildForm.pas similarity index 100% rename from demos/PopupBrowser2/uChildForm.pas rename to demos/Delphi_VCL/PopupBrowser2/uChildForm.pas diff --git a/demos/PopupBrowser2/uMainForm.dfm b/demos/Delphi_VCL/PopupBrowser2/uMainForm.dfm similarity index 95% rename from demos/PopupBrowser2/uMainForm.dfm rename to demos/Delphi_VCL/PopupBrowser2/uMainForm.dfm index 3f71a6df..359d1bb4 100644 --- a/demos/PopupBrowser2/uMainForm.dfm +++ b/demos/Delphi_VCL/PopupBrowser2/uMainForm.dfm @@ -73,6 +73,8 @@ object MainForm: TMainForm object Chromium1: TChromium OnBeforePopup = Chromium1BeforePopup OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close Left = 56 Top = 152 end diff --git a/demos/PopupBrowser2/uMainForm.pas b/demos/Delphi_VCL/PopupBrowser2/uMainForm.pas similarity index 84% rename from demos/PopupBrowser2/uMainForm.pas rename to demos/Delphi_VCL/PopupBrowser2/uMainForm.pas index e932df0b..2c37234e 100644 --- a/demos/PopupBrowser2/uMainForm.pas +++ b/demos/Delphi_VCL/PopupBrowser2/uMainForm.pas @@ -75,11 +75,15 @@ type 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); + procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); protected FChildForm : TChildForm; FCriticalSection : TCriticalSection; - FClosing : boolean; + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosingMainForm : boolean; // Set to True in the CloseQuery event. + FClosingChildren : boolean; // Set to True in the CloseQuery event. function GetPopupChildCount : integer; @@ -91,6 +95,7 @@ type procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; procedure CreateNextChildMsg(var aMessage : TMessage); message CEF_CREATENEXTCHILD; procedure ChildDestroyedMsg(var aMessage : TMessage); message CEF_CHILDDESTROYED; @@ -128,10 +133,17 @@ uses // The main form sends a WM_CLOSE to all active popup forms and waits until all of them have sent a CEF_CHILDDESTROYED message. +// Destruction steps +// ================= +// 1. FormCloseQuery sets CanClose to FALSE and it closes all child forms. +// 2. When all the child forms are closed then FormCloseQuery is triggered again, sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event. +// 3. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event. +// 4. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. + procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin - FClosing := True; - Visible := False; + FClosingChildren := True; + Visible := False; if (PopupChildCount > 0) then begin @@ -139,14 +151,26 @@ begin CanClose := False; end else - CanClose := True; + begin + CanClose := FCanClose; + + if not(FClosingMainForm) then + begin + FClosingMainForm := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; + end; end; procedure TMainForm.FormCreate(Sender: TObject); begin - FClosing := False; - FCriticalSection := TCriticalSection.Create; + FClosingChildren := False; + FClosingMainForm := False; + FCanClose := False; + FCriticalSection := TCriticalSection.Create; + Chromium1.DefaultURL := AddressEdt.Text; Chromium1.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); end; @@ -172,6 +196,12 @@ begin PostMessage(Handle, CEF_AFTERCREATED, 0, 0); end; +procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + procedure TMainForm.Chromium1BeforePopup(Sender : TObject; const browser : ICefBrowser; const frame : ICefFrame; @@ -197,6 +227,12 @@ begin end; end; +procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + function TMainForm.CreateClientHandler(var windowInfo : TCefWindowInfo; var client : ICefClient; const targetFrameName : string; @@ -262,7 +298,11 @@ begin FChildForm := TChildForm.Create(self); Caption := 'Popup Browser'; AddressPnl.Enabled := True; - GoBtn.Click; +end; + +procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; end; procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage); @@ -284,7 +324,7 @@ end; procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage); begin - if FClosing and (PopupChildCount = 0) then Close; + if FClosingChildren and (PopupChildCount = 0) then Close; end; procedure TMainForm.GoBtnClick(Sender: TObject); diff --git a/demos/ResponseFilterBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/PostInspectorBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/ResponseFilterBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/PostInspectorBrowser/00-DeleteDCUs.bat diff --git a/demos/PostInspectorBrowser/PostInspectorBrowser.dpr b/demos/Delphi_VCL/PostInspectorBrowser/PostInspectorBrowser.dpr similarity index 100% rename from demos/PostInspectorBrowser/PostInspectorBrowser.dpr rename to demos/Delphi_VCL/PostInspectorBrowser/PostInspectorBrowser.dpr diff --git a/demos/PostInspectorBrowser/PostInspectorBrowser.dproj b/demos/Delphi_VCL/PostInspectorBrowser/PostInspectorBrowser.dproj similarity index 98% rename from demos/PostInspectorBrowser/PostInspectorBrowser.dproj rename to demos/Delphi_VCL/PostInspectorBrowser/PostInspectorBrowser.dproj index 4063040d..6c1f5586 100644 --- a/demos/PostInspectorBrowser/PostInspectorBrowser.dproj +++ b/demos/Delphi_VCL/PostInspectorBrowser/PostInspectorBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -155,9 +155,10 @@ PostInspectorBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/ResponseFilterBrowser/cef.inc b/demos/Delphi_VCL/PostInspectorBrowser/cef.inc similarity index 100% rename from demos/ResponseFilterBrowser/cef.inc rename to demos/Delphi_VCL/PostInspectorBrowser/cef.inc diff --git a/demos/PostInspectorBrowser/uPostInspectorBrowser.dfm b/demos/Delphi_VCL/PostInspectorBrowser/uPostInspectorBrowser.dfm similarity index 100% rename from demos/PostInspectorBrowser/uPostInspectorBrowser.dfm rename to demos/Delphi_VCL/PostInspectorBrowser/uPostInspectorBrowser.dfm diff --git a/demos/PostInspectorBrowser/uPostInspectorBrowser.pas b/demos/Delphi_VCL/PostInspectorBrowser/uPostInspectorBrowser.pas similarity index 100% rename from demos/PostInspectorBrowser/uPostInspectorBrowser.pas rename to demos/Delphi_VCL/PostInspectorBrowser/uPostInspectorBrowser.pas diff --git a/demos/SchemeRegistrationBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/ResponseFilterBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/SchemeRegistrationBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/ResponseFilterBrowser/00-DeleteDCUs.bat diff --git a/demos/ResponseFilterBrowser/ResponseFilterBrowser.dpr b/demos/Delphi_VCL/ResponseFilterBrowser/ResponseFilterBrowser.dpr similarity index 100% rename from demos/ResponseFilterBrowser/ResponseFilterBrowser.dpr rename to demos/Delphi_VCL/ResponseFilterBrowser/ResponseFilterBrowser.dpr diff --git a/demos/ResponseFilterBrowser/ResponseFilterBrowser.dproj b/demos/Delphi_VCL/ResponseFilterBrowser/ResponseFilterBrowser.dproj similarity index 99% rename from demos/ResponseFilterBrowser/ResponseFilterBrowser.dproj rename to demos/Delphi_VCL/ResponseFilterBrowser/ResponseFilterBrowser.dproj index 227657c2..dd8c9374 100644 --- a/demos/ResponseFilterBrowser/ResponseFilterBrowser.dproj +++ b/demos/Delphi_VCL/ResponseFilterBrowser/ResponseFilterBrowser.dproj @@ -69,7 +69,7 @@ false false false - ..\..\bin + ..\..\..\bin 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) @@ -80,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -159,7 +158,6 @@ ResponseFilterBrowser.dpr - File c:\program files (x86)\embarcadero\studio\20.0\bin\dclemsedge260.bpl not found IP Abstraction Indy Implementation Design Time DBExpress Enterprise Data Explorer Integration Microsoft Office 2000 Sample Automation Server Wrapper Components diff --git a/demos/SchemeRegistrationBrowser/cef.inc b/demos/Delphi_VCL/ResponseFilterBrowser/cef.inc similarity index 100% rename from demos/SchemeRegistrationBrowser/cef.inc rename to demos/Delphi_VCL/ResponseFilterBrowser/cef.inc diff --git a/demos/ResponseFilterBrowser/uResponseFilterBrowser.dfm b/demos/Delphi_VCL/ResponseFilterBrowser/uResponseFilterBrowser.dfm similarity index 100% rename from demos/ResponseFilterBrowser/uResponseFilterBrowser.dfm rename to demos/Delphi_VCL/ResponseFilterBrowser/uResponseFilterBrowser.dfm diff --git a/demos/ResponseFilterBrowser/uResponseFilterBrowser.pas b/demos/Delphi_VCL/ResponseFilterBrowser/uResponseFilterBrowser.pas similarity index 100% rename from demos/ResponseFilterBrowser/uResponseFilterBrowser.pas rename to demos/Delphi_VCL/ResponseFilterBrowser/uResponseFilterBrowser.pas diff --git a/demos/SimpleBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/SchemeRegistrationBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/SimpleBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SchemeRegistrationBrowser/00-DeleteDCUs.bat diff --git a/demos/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dpr b/demos/Delphi_VCL/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dpr similarity index 100% rename from demos/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dpr rename to demos/Delphi_VCL/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dpr diff --git a/demos/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dproj b/demos/Delphi_VCL/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dproj similarity index 98% rename from demos/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dproj rename to demos/Delphi_VCL/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dproj index 95181a9a..9b052824 100644 --- a/demos/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dproj +++ b/demos/Delphi_VCL/SchemeRegistrationBrowser/SchemeRegistrationBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin $(BDS)\bin\default_app.manifest @@ -105,7 +106,6 @@ true false Debug - ..\..\bin CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) PerMonitor @@ -156,9 +156,10 @@ SchemeRegistrationBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SimpleBrowser/cef.inc b/demos/Delphi_VCL/SchemeRegistrationBrowser/cef.inc similarity index 100% rename from demos/SimpleBrowser/cef.inc rename to demos/Delphi_VCL/SchemeRegistrationBrowser/cef.inc diff --git a/demos/SchemeRegistrationBrowser/uHelloScheme.pas b/demos/Delphi_VCL/SchemeRegistrationBrowser/uHelloScheme.pas similarity index 100% rename from demos/SchemeRegistrationBrowser/uHelloScheme.pas rename to demos/Delphi_VCL/SchemeRegistrationBrowser/uHelloScheme.pas diff --git a/demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.dfm b/demos/Delphi_VCL/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.dfm similarity index 100% rename from demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.dfm rename to demos/Delphi_VCL/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.dfm diff --git a/demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas b/demos/Delphi_VCL/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas similarity index 100% rename from demos/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas rename to demos/Delphi_VCL/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas diff --git a/demos/SimpleBrowser2/00-DeleteDCUs.bat b/demos/Delphi_VCL/SimpleBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/SimpleBrowser2/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SimpleBrowser/00-DeleteDCUs.bat diff --git a/demos/SimpleBrowser/SimpleBrowser.dpr b/demos/Delphi_VCL/SimpleBrowser/SimpleBrowser.dpr similarity index 100% rename from demos/SimpleBrowser/SimpleBrowser.dpr rename to demos/Delphi_VCL/SimpleBrowser/SimpleBrowser.dpr diff --git a/demos/SimpleBrowser/SimpleBrowser.dproj b/demos/Delphi_VCL/SimpleBrowser/SimpleBrowser.dproj similarity index 98% rename from demos/SimpleBrowser/SimpleBrowser.dproj rename to demos/Delphi_VCL/SimpleBrowser/SimpleBrowser.dproj index 8bebf785..b16393ab 100644 --- a/demos/SimpleBrowser/SimpleBrowser.dproj +++ b/demos/Delphi_VCL/SimpleBrowser/SimpleBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -155,9 +155,10 @@ SimpleBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SimpleBrowser/SimpleBrowser_D7.dof b/demos/Delphi_VCL/SimpleBrowser/SimpleBrowser_D7.dof similarity index 98% rename from demos/SimpleBrowser/SimpleBrowser_D7.dof rename to demos/Delphi_VCL/SimpleBrowser/SimpleBrowser_D7.dof index 31bc313f..2e87c43d 100644 --- a/demos/SimpleBrowser/SimpleBrowser_D7.dof +++ b/demos/Delphi_VCL/SimpleBrowser/SimpleBrowser_D7.dof @@ -90,7 +90,7 @@ MaxStackSize=1048576 ImageBase=4194304 ExeDescription= [Directories] -OutputDir=..\..\bin +OutputDir=..\..\..\bin UnitOutputDir= PackageDLLOutputDir= PackageDCPOutputDir= @@ -135,4 +135,4 @@ Count=1 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [HistoryLists\hlOutputDirectorry] Count=1 -Item0=..\..\bin +Item0=..\..\..\bin diff --git a/demos/SimpleBrowser/SimpleBrowser_D7.dpr b/demos/Delphi_VCL/SimpleBrowser/SimpleBrowser_D7.dpr similarity index 100% rename from demos/SimpleBrowser/SimpleBrowser_D7.dpr rename to demos/Delphi_VCL/SimpleBrowser/SimpleBrowser_D7.dpr diff --git a/demos/SimpleBrowser2/cef.inc b/demos/Delphi_VCL/SimpleBrowser/cef.inc similarity index 100% rename from demos/SimpleBrowser2/cef.inc rename to demos/Delphi_VCL/SimpleBrowser/cef.inc diff --git a/demos/SimpleBrowser/uSimpleBrowser.dfm b/demos/Delphi_VCL/SimpleBrowser/uSimpleBrowser.dfm similarity index 100% rename from demos/SimpleBrowser/uSimpleBrowser.dfm rename to demos/Delphi_VCL/SimpleBrowser/uSimpleBrowser.dfm diff --git a/demos/SimpleBrowser/uSimpleBrowser.pas b/demos/Delphi_VCL/SimpleBrowser/uSimpleBrowser.pas similarity index 100% rename from demos/SimpleBrowser/uSimpleBrowser.pas rename to demos/Delphi_VCL/SimpleBrowser/uSimpleBrowser.pas diff --git a/demos/SimpleExternalPumpBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/SimpleBrowser2/00-DeleteDCUs.bat similarity index 100% rename from demos/SimpleExternalPumpBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SimpleBrowser2/00-DeleteDCUs.bat diff --git a/demos/SimpleBrowser2/SimpleBrowser2.dpr b/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2.dpr similarity index 100% rename from demos/SimpleBrowser2/SimpleBrowser2.dpr rename to demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2.dpr diff --git a/demos/SimpleBrowser2/SimpleBrowser2.dproj b/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2.dproj similarity index 98% rename from demos/SimpleBrowser2/SimpleBrowser2.dproj rename to demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2.dproj index 3affa839..b9ab8454 100644 --- a/demos/SimpleBrowser2/SimpleBrowser2.dproj +++ b/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2.dproj @@ -69,7 +69,7 @@ false false false - ..\..\bin + ..\..\..\bin 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) @@ -158,9 +158,10 @@ SimpleBrowser2.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SimpleBrowser2/SimpleBrowser2_D7.dof b/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2_D7.dof similarity index 98% rename from demos/SimpleBrowser2/SimpleBrowser2_D7.dof rename to demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2_D7.dof index 31bc313f..2e87c43d 100644 --- a/demos/SimpleBrowser2/SimpleBrowser2_D7.dof +++ b/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2_D7.dof @@ -90,7 +90,7 @@ MaxStackSize=1048576 ImageBase=4194304 ExeDescription= [Directories] -OutputDir=..\..\bin +OutputDir=..\..\..\bin UnitOutputDir= PackageDLLOutputDir= PackageDCPOutputDir= @@ -135,4 +135,4 @@ Count=1 Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; [HistoryLists\hlOutputDirectorry] Count=1 -Item0=..\..\bin +Item0=..\..\..\bin diff --git a/demos/SimpleBrowser2/SimpleBrowser2_D7.dpr b/demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2_D7.dpr similarity index 100% rename from demos/SimpleBrowser2/SimpleBrowser2_D7.dpr rename to demos/Delphi_VCL/SimpleBrowser2/SimpleBrowser2_D7.dpr diff --git a/demos/SimpleExternalPumpBrowser/cef.inc b/demos/Delphi_VCL/SimpleBrowser2/cef.inc similarity index 100% rename from demos/SimpleExternalPumpBrowser/cef.inc rename to demos/Delphi_VCL/SimpleBrowser2/cef.inc diff --git a/demos/SimpleBrowser2/uSimpleBrowser2.dfm b/demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.dfm similarity index 100% rename from demos/SimpleBrowser2/uSimpleBrowser2.dfm rename to demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.dfm diff --git a/demos/SimpleBrowser2/uSimpleBrowser2.pas b/demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.pas similarity index 100% rename from demos/SimpleBrowser2/uSimpleBrowser2.pas rename to demos/Delphi_VCL/SimpleBrowser2/uSimpleBrowser2.pas diff --git a/demos/SimpleFMXBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/SimpleExternalPumpBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/SimpleFMXBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SimpleExternalPumpBrowser/00-DeleteDCUs.bat diff --git a/demos/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dpr b/demos/Delphi_VCL/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dpr similarity index 100% rename from demos/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dpr rename to demos/Delphi_VCL/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dpr diff --git a/demos/Delphi_VCL/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj b/demos/Delphi_VCL/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj new file mode 100644 index 00000000..aa760552 --- /dev/null +++ b/demos/Delphi_VCL/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj @@ -0,0 +1,651 @@ + + + {55E00327-9D98-4DA3-A4E1-844942A01C6B} + 18.5 + VCL + SimpleExternalPumpBrowser.dpr + True + Debug + Win32 + 3 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + true + Cfg_2 + true + true + + + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + 3082 + SimpleExternalPumpBrowser + $(BDS)\bin\delphi_PROJECTICON.ico + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + .\$(Platform)\$(Config) + false + false + false + false + false + ..\..\..\bin + + + 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) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + true + $(BDS)\bin\default_app.manifest + 1033 + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + + + 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) + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + true + 1033 + true + false + Debug + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) + PerMonitor + + + true + PerMonitorV2 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitor + + + true + PerMonitorV2 + + + + MainSource + + +
SimpleExternalPumpBrowserFrm
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + SimpleExternalPumpBrowser.dpr + + + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + SimpleExternalPumpBrowser.exe + true + + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 1 + + + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + + + res\values + 1 + + + + + res\values-v21 + 1 + + + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + Contents\MacOS + 1 + .framework + + + Contents\MacOS + 1 + .framework + + + 0 + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .dll;.bpl + + + + + 1 + .dylib + + + 1 + .dylib + + + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + Contents\MacOS + 1 + .dylib + + + 0 + .bpl + + + + + 0 + + + 0 + + + 0 + + + 0 + + + Contents\Resources\StartUp\ + 0 + + + Contents\Resources\StartUp\ + 0 + + + 0 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + 1 + + + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF + 1 + + + + + ..\ + 1 + + + ..\ + 1 + + + + + Contents + 1 + + + Contents + 1 + + + + + Contents\Resources + 1 + + + Contents\Resources + 1 + + + + + library\lib\armeabi-v7a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + True + True + + + 12 + + + + +
diff --git a/demos/SimpleFMXBrowser/cef.inc b/demos/Delphi_VCL/SimpleExternalPumpBrowser/cef.inc similarity index 100% rename from demos/SimpleFMXBrowser/cef.inc rename to demos/Delphi_VCL/SimpleExternalPumpBrowser/cef.inc diff --git a/demos/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.dfm b/demos/Delphi_VCL/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.dfm similarity index 100% rename from demos/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.dfm rename to demos/Delphi_VCL/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.dfm diff --git a/demos/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas b/demos/Delphi_VCL/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas similarity index 100% rename from demos/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas rename to demos/Delphi_VCL/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas diff --git a/demos/SimpleOSRBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/SimpleOSRBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/SimpleOSRBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SimpleOSRBrowser/00-DeleteDCUs.bat diff --git a/demos/SimpleOSRBrowser/SimpleOSRBrowser.dpr b/demos/Delphi_VCL/SimpleOSRBrowser/SimpleOSRBrowser.dpr similarity index 100% rename from demos/SimpleOSRBrowser/SimpleOSRBrowser.dpr rename to demos/Delphi_VCL/SimpleOSRBrowser/SimpleOSRBrowser.dpr diff --git a/demos/SimpleOSRBrowser/SimpleOSRBrowser.dproj b/demos/Delphi_VCL/SimpleOSRBrowser/SimpleOSRBrowser.dproj similarity index 99% rename from demos/SimpleOSRBrowser/SimpleOSRBrowser.dproj rename to demos/Delphi_VCL/SimpleOSRBrowser/SimpleOSRBrowser.dproj index c990188f..33981e0c 100644 --- a/demos/SimpleOSRBrowser/SimpleOSRBrowser.dproj +++ b/demos/Delphi_VCL/SimpleOSRBrowser/SimpleOSRBrowser.dproj @@ -69,7 +69,7 @@ false false false - ..\..\bin + ..\..\..\bin
Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -106,7 +106,6 @@ true false Debug - ..\..\bin CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) PerMonitor diff --git a/demos/SimpleLazOSRBrowser/cef.inc b/demos/Delphi_VCL/SimpleOSRBrowser/cef.inc similarity index 100% rename from demos/SimpleLazOSRBrowser/cef.inc rename to demos/Delphi_VCL/SimpleOSRBrowser/cef.inc diff --git a/demos/SimpleOSRBrowser/uSimpleOSRBrowser.dfm b/demos/Delphi_VCL/SimpleOSRBrowser/uSimpleOSRBrowser.dfm similarity index 100% rename from demos/SimpleOSRBrowser/uSimpleOSRBrowser.dfm rename to demos/Delphi_VCL/SimpleOSRBrowser/uSimpleOSRBrowser.dfm diff --git a/demos/SimpleOSRBrowser/uSimpleOSRBrowser.pas b/demos/Delphi_VCL/SimpleOSRBrowser/uSimpleOSRBrowser.pas similarity index 100% rename from demos/SimpleOSRBrowser/uSimpleOSRBrowser.pas rename to demos/Delphi_VCL/SimpleOSRBrowser/uSimpleOSRBrowser.pas diff --git a/demos/SimpleServer/00-DeleteDCUs.bat b/demos/Delphi_VCL/SimpleServer/00-DeleteDCUs.bat similarity index 100% rename from demos/SimpleServer/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SimpleServer/00-DeleteDCUs.bat diff --git a/demos/SimpleServer/SimpleServer.dpr b/demos/Delphi_VCL/SimpleServer/SimpleServer.dpr similarity index 100% rename from demos/SimpleServer/SimpleServer.dpr rename to demos/Delphi_VCL/SimpleServer/SimpleServer.dpr diff --git a/demos/SimpleServer/SimpleServer.dproj b/demos/Delphi_VCL/SimpleServer/SimpleServer.dproj similarity index 98% rename from demos/SimpleServer/SimpleServer.dproj rename to demos/Delphi_VCL/SimpleServer/SimpleServer.dproj index baa77aef..7ac00320 100644 --- a/demos/SimpleServer/SimpleServer.dproj +++ b/demos/Delphi_VCL/SimpleServer/SimpleServer.dproj @@ -59,7 +59,7 @@
.\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -79,7 +79,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 $(BDS)\bin\default_app.manifest @@ -153,9 +152,10 @@ SimpleServer.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SimpleLazarusBrowser/cef.inc b/demos/Delphi_VCL/SimpleServer/cef.inc similarity index 100% rename from demos/SimpleLazarusBrowser/cef.inc rename to demos/Delphi_VCL/SimpleServer/cef.inc diff --git a/demos/SimpleServer/uSimpleServer.dfm b/demos/Delphi_VCL/SimpleServer/uSimpleServer.dfm similarity index 100% rename from demos/SimpleServer/uSimpleServer.dfm rename to demos/Delphi_VCL/SimpleServer/uSimpleServer.dfm diff --git a/demos/SimpleServer/uSimpleServer.pas b/demos/Delphi_VCL/SimpleServer/uSimpleServer.pas similarity index 100% rename from demos/SimpleServer/uSimpleServer.pas rename to demos/Delphi_VCL/SimpleServer/uSimpleServer.pas diff --git a/demos/SubProcess/00-DeleteDCUs.bat b/demos/Delphi_VCL/SubProcess/00-DeleteDCUs.bat similarity index 100% rename from demos/SubProcess/00-DeleteDCUs.bat rename to demos/Delphi_VCL/SubProcess/00-DeleteDCUs.bat diff --git a/demos/SubProcess/SimpleBrowser.dpr b/demos/Delphi_VCL/SubProcess/SimpleBrowser.dpr similarity index 100% rename from demos/SubProcess/SimpleBrowser.dpr rename to demos/Delphi_VCL/SubProcess/SimpleBrowser.dpr diff --git a/demos/SubProcess/SimpleBrowser.dproj b/demos/Delphi_VCL/SubProcess/SimpleBrowser.dproj similarity index 98% rename from demos/SubProcess/SimpleBrowser.dproj rename to demos/Delphi_VCL/SubProcess/SimpleBrowser.dproj index a1021e8f..426922b7 100644 --- a/demos/SubProcess/SimpleBrowser.dproj +++ b/demos/Delphi_VCL/SubProcess/SimpleBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin 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) @@ -79,7 +80,6 @@ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -156,9 +156,10 @@ SimpleBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SubProcess/SubProcess.dpr b/demos/Delphi_VCL/SubProcess/SubProcess.dpr similarity index 100% rename from demos/SubProcess/SubProcess.dpr rename to demos/Delphi_VCL/SubProcess/SubProcess.dpr diff --git a/demos/JavaScript/JSWindowBindingSubProcess/SubProcess.dproj b/demos/Delphi_VCL/SubProcess/SubProcess.dproj similarity index 98% rename from demos/JavaScript/JSWindowBindingSubProcess/SubProcess.dproj rename to demos/Delphi_VCL/SubProcess/SubProcess.dproj index 8c376d4f..5dbefbd0 100644 --- a/demos/JavaScript/JSWindowBindingSubProcess/SubProcess.dproj +++ b/demos/Delphi_VCL/SubProcess/SubProcess.dproj @@ -57,6 +57,7 @@ false false false + ..\..\..\bin Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) @@ -67,7 +68,6 @@ 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) $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\..\bin 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) @@ -91,8 +91,8 @@ 1033 true false - CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) PerMonitor + CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName) false @@ -133,9 +133,10 @@ SubProcess.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SimpleOSRBrowser/cef.inc b/demos/Delphi_VCL/SubProcess/cef.inc similarity index 100% rename from demos/SimpleOSRBrowser/cef.inc rename to demos/Delphi_VCL/SubProcess/cef.inc diff --git a/demos/SubProcess/uCEFLoader.pas b/demos/Delphi_VCL/SubProcess/uCEFLoader.pas similarity index 100% rename from demos/SubProcess/uCEFLoader.pas rename to demos/Delphi_VCL/SubProcess/uCEFLoader.pas diff --git a/demos/SubProcess/uSimpleBrowser.dfm b/demos/Delphi_VCL/SubProcess/uSimpleBrowser.dfm similarity index 100% rename from demos/SubProcess/uSimpleBrowser.dfm rename to demos/Delphi_VCL/SubProcess/uSimpleBrowser.dfm diff --git a/demos/SubProcess/uSimpleBrowser.pas b/demos/Delphi_VCL/SubProcess/uSimpleBrowser.pas similarity index 100% rename from demos/SubProcess/uSimpleBrowser.pas rename to demos/Delphi_VCL/SubProcess/uSimpleBrowser.pas diff --git a/demos/TabbedBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/TabbedBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/TabbedBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/TabbedBrowser/00-DeleteDCUs.bat diff --git a/demos/TabbedBrowser/TabBrowser.dpr b/demos/Delphi_VCL/TabbedBrowser/TabBrowser.dpr similarity index 100% rename from demos/TabbedBrowser/TabBrowser.dpr rename to demos/Delphi_VCL/TabbedBrowser/TabBrowser.dpr diff --git a/demos/TabbedBrowser/TabBrowser.dproj b/demos/Delphi_VCL/TabbedBrowser/TabBrowser.dproj similarity index 98% rename from demos/TabbedBrowser/TabBrowser.dproj rename to demos/Delphi_VCL/TabbedBrowser/TabBrowser.dproj index 8b644957..b83fb15f 100644 --- a/demos/TabbedBrowser/TabBrowser.dproj +++ b/demos/Delphi_VCL/TabbedBrowser/TabBrowser.dproj @@ -72,13 +72,13 @@ 3082 TabBrowser CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + ..\..\..\bin DBXSqliteDriver;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;vclFireDAC;DataSnapFireDAC;svnui;tethering;Componentes;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;DBXOracleDriver;inetdb;Componentes_Int;CEF4Delphi;IndyProtocols240;fmx;fmxdae;FireDACDBXDriver;dbexpress;vclx;dsnap;DataSnapCommon;DataSnapConnectors;VCLRESTComponents;vclie;bindengine;DBXMySQLDriver;FireDACOracleDriver;FireDACMySQLDriver;DBXFirebirdDriver;FireDACCommonODBC;DataSnapClient;bindcompdbx;vcl;DBXSybaseASEDriver;FireDACDb2Driver;GR32_DSGN_RSXE5;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;Componentes_UI;FireDACPgDriver;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;DbxCommonDriver;Componentes_Misc;IndySystem240;DataSnapServer;xmlrtl;DataSnapNativeClient;fmxobj;vclwinx;FireDACDSDriver;rtl;DbxClientDriver;IndyCore240;DBXSybaseASADriver;CustomIPTransport;vcldsnap;GR32_RSXE5;bindcomp;appanalytics;Componentes_RTF;DBXInformixDriver;bindcompvcl;Componentes_vCard;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;fmxase;$(DCC_UsePackage) Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 $(BDS)\bin\default_app.manifest @@ -103,7 +103,6 @@ true true 1033 - ..\..\bin PerMonitor @@ -152,9 +151,10 @@ TabBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SimpleServer/cef.inc b/demos/Delphi_VCL/TabbedBrowser/cef.inc similarity index 100% rename from demos/SimpleServer/cef.inc rename to demos/Delphi_VCL/TabbedBrowser/cef.inc diff --git a/demos/TabbedBrowser/uMainForm.dfm b/demos/Delphi_VCL/TabbedBrowser/uMainForm.dfm similarity index 100% rename from demos/TabbedBrowser/uMainForm.dfm rename to demos/Delphi_VCL/TabbedBrowser/uMainForm.dfm diff --git a/demos/TabbedBrowser/uMainForm.pas b/demos/Delphi_VCL/TabbedBrowser/uMainForm.pas similarity index 100% rename from demos/TabbedBrowser/uMainForm.pas rename to demos/Delphi_VCL/TabbedBrowser/uMainForm.pas diff --git a/demos/ToolBoxBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/ToolBoxBrowser/00-DeleteDCUs.bat similarity index 100% rename from demos/ToolBoxBrowser/00-DeleteDCUs.bat rename to demos/Delphi_VCL/ToolBoxBrowser/00-DeleteDCUs.bat diff --git a/demos/ToolBoxBrowser/ToolBoxBrowser.dpr b/demos/Delphi_VCL/ToolBoxBrowser/ToolBoxBrowser.dpr similarity index 100% rename from demos/ToolBoxBrowser/ToolBoxBrowser.dpr rename to demos/Delphi_VCL/ToolBoxBrowser/ToolBoxBrowser.dpr diff --git a/demos/ToolBoxBrowser/ToolBoxBrowser.dproj b/demos/Delphi_VCL/ToolBoxBrowser/ToolBoxBrowser.dproj similarity index 98% rename from demos/ToolBoxBrowser/ToolBoxBrowser.dproj rename to demos/Delphi_VCL/ToolBoxBrowser/ToolBoxBrowser.dproj index cf374c95..f53d6489 100644 --- a/demos/ToolBoxBrowser/ToolBoxBrowser.dproj +++ b/demos/Delphi_VCL/ToolBoxBrowser/ToolBoxBrowser.dproj @@ -69,6 +69,7 @@ false false false + ..\..\..\bin DBXSqliteDriver;RESTComponents;DataSnapServerMidas;DBXDb2Driver;DBXInterBaseDriver;vclactnband;frxe23;vclFireDAC;emsclientfiredac;DataSnapFireDAC;svnui;tethering;FireDACADSDriver;DBXMSSQLDriver;DatasnapConnectorsFreePascal;FireDACMSSQLDriver;vcltouch;vcldb;bindcompfmx;svn;Intraweb;DBXOracleDriver;inetdb;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;GR32_DSGN_RSXE5;dsnapcon;FireDACMSAccDriver;fmxFireDAC;FireDACInfxDriver;vclimg;Componentes_UI;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;GR32_RSXE5;bindcomp;appanalytics;DBXInformixDriver;bindcompvcl;frxDB23;TeeUI;IndyCore230;vclribbon;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;IndySystem230;dsnapxml;DataSnapProviderClient;dbrtl;inetdbxpress;FireDACMongoDBDriver;frx23;fmxase;$(DCC_UsePackage) @@ -78,7 +79,6 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png - ..\..\bin 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) @@ -160,9 +160,10 @@ ToolBoxBrowser.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/SubProcess/cef.inc b/demos/Delphi_VCL/ToolBoxBrowser/cef.inc similarity index 100% rename from demos/SubProcess/cef.inc rename to demos/Delphi_VCL/ToolBoxBrowser/cef.inc diff --git a/demos/ToolBoxBrowser/uChildForm.dfm b/demos/Delphi_VCL/ToolBoxBrowser/uChildForm.dfm similarity index 100% rename from demos/ToolBoxBrowser/uChildForm.dfm rename to demos/Delphi_VCL/ToolBoxBrowser/uChildForm.dfm diff --git a/demos/ToolBoxBrowser/uChildForm.pas b/demos/Delphi_VCL/ToolBoxBrowser/uChildForm.pas similarity index 100% rename from demos/ToolBoxBrowser/uChildForm.pas rename to demos/Delphi_VCL/ToolBoxBrowser/uChildForm.pas diff --git a/demos/ToolBoxBrowser/uMainForm.dfm b/demos/Delphi_VCL/ToolBoxBrowser/uMainForm.dfm similarity index 100% rename from demos/ToolBoxBrowser/uMainForm.dfm rename to demos/Delphi_VCL/ToolBoxBrowser/uMainForm.dfm diff --git a/demos/ToolBoxBrowser/uMainForm.pas b/demos/Delphi_VCL/ToolBoxBrowser/uMainForm.pas similarity index 100% rename from demos/ToolBoxBrowser/uMainForm.pas rename to demos/Delphi_VCL/ToolBoxBrowser/uMainForm.pas diff --git a/demos/URLRequest/00-DeleteDCUs.bat b/demos/Delphi_VCL/URLRequest/00-DeleteDCUs.bat similarity index 100% rename from demos/URLRequest/00-DeleteDCUs.bat rename to demos/Delphi_VCL/URLRequest/00-DeleteDCUs.bat diff --git a/demos/URLRequest/URLRequest.dpr b/demos/Delphi_VCL/URLRequest/URLRequest.dpr similarity index 100% rename from demos/URLRequest/URLRequest.dpr rename to demos/Delphi_VCL/URLRequest/URLRequest.dpr diff --git a/demos/URLRequest/URLRequest.dproj b/demos/Delphi_VCL/URLRequest/URLRequest.dproj similarity index 98% rename from demos/URLRequest/URLRequest.dproj rename to demos/Delphi_VCL/URLRequest/URLRequest.dproj index 8b8127fd..40a7af7f 100644 --- a/demos/URLRequest/URLRequest.dproj +++ b/demos/Delphi_VCL/URLRequest/URLRequest.dproj @@ -59,7 +59,7 @@ .\$(Platform)\$(Config) - ..\..\bin + ..\..\..\bin false false false @@ -79,7 +79,6 @@ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) Debug true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= 1033 $(BDS)\bin\default_app.manifest @@ -152,9 +151,10 @@ URLRequest.dpr - IP Abstraction Indy Implementation Design Time - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components + IP Abstraction Indy Implementation Design Time + DBExpress Enterprise Data Explorer Integration + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components diff --git a/demos/TabbedBrowser/cef.inc b/demos/Delphi_VCL/URLRequest/cef.inc similarity index 100% rename from demos/TabbedBrowser/cef.inc rename to demos/Delphi_VCL/URLRequest/cef.inc diff --git a/demos/URLRequest/uURLRequest.dfm b/demos/Delphi_VCL/URLRequest/uURLRequest.dfm similarity index 100% rename from demos/URLRequest/uURLRequest.dfm rename to demos/Delphi_VCL/URLRequest/uURLRequest.dfm diff --git a/demos/URLRequest/uURLRequest.pas b/demos/Delphi_VCL/URLRequest/uURLRequest.pas similarity index 100% rename from demos/URLRequest/uURLRequest.pas rename to demos/Delphi_VCL/URLRequest/uURLRequest.pas diff --git a/demos/JavaScript/JSWindowBindingSubProcess/crash_reporter.cfg b/demos/JavaScript/JSWindowBindingSubProcess/crash_reporter.cfg deleted file mode 100644 index 13d85354..00000000 --- a/demos/JavaScript/JSWindowBindingSubProcess/crash_reporter.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[Config] -ExternalHandler=".\SubProcess.exe" - -[CrashKeys] -my_key1=medium -my_key2=medium \ No newline at end of file diff --git a/demos/SimpleLazOSRBrowser/00-Delete.bat b/demos/Lazarus/CookieVisitor/00-Delete.bat similarity index 100% rename from demos/SimpleLazOSRBrowser/00-Delete.bat rename to demos/Lazarus/CookieVisitor/00-Delete.bat diff --git a/demos/Lazarus/CookieVisitor/CookieVisitor.lpi b/demos/Lazarus/CookieVisitor/CookieVisitor.lpi new file mode 100644 index 00000000..abc1cc51 --- /dev/null +++ b/demos/Lazarus/CookieVisitor/CookieVisitor.lpi @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="CookieVisitor.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uCookieVisitor.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="CookieVisitorFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\CookieVisitor"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/CookieVisitor/CookieVisitor.lpr b/demos/Lazarus/CookieVisitor/CookieVisitor.lpr new file mode 100644 index 00000000..a0521562 --- /dev/null +++ b/demos/Lazarus/CookieVisitor/CookieVisitor.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 CookieVisitor; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, + uCookieVisitor in 'uCookieVisitor.pas' {CookieVisitorFrm}, + uSimpleTextViewer in 'uSimpleTextViewer.pas' {SimpleTextViewerFrm}; + +//{$R *.res} + +{$IFDEF MSWINDOWS} + // CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. + {$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} +{$ENDIF} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TCookieVisitorFrm, CookieVisitorFrm); + Application.CreateForm(TSimpleTextViewerFrm, SimpleTextViewerFrm); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/CookieVisitor/CookieVisitor.lps b/demos/Lazarus/CookieVisitor/CookieVisitor.lps new file mode 100644 index 00000000..364173de --- /dev/null +++ b/demos/Lazarus/CookieVisitor/CookieVisitor.lps @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="CookieVisitor.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="41"/> + <CursorPos X="16" Y="58"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uCookieVisitor.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="CookieVisitorFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="209"/> + <CursorPos X="8" Y="126"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <CursorPos X="8" Y="29"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="10" HistoryIndex="9"> + <Position1> + <Filename Value="CookieVisitor.lpr"/> + </Position1> + <Position2> + <Filename Value="CookieVisitor.lpr"/> + <Caret Line="50" Column="3" TopLine="32"/> + </Position2> + <Position3> + <Filename Value="uCookieVisitor.pas"/> + <Caret Line="368" TopLine="335"/> + </Position3> + <Position4> + <Filename Value="uCookieVisitor.pas"/> + <Caret Line="126" Column="8" TopLine="116"/> + </Position4> + <Position5> + <Filename Value="CookieVisitor.lpr"/> + <Caret Line="74" TopLine="39"/> + </Position5> + <Position6> + <Filename Value="CookieVisitor.lpr"/> + <Caret Line="57" TopLine="39"/> + </Position6> + <Position7> + <Filename Value="CookieVisitor.lpr"/> + <Caret Line="40" TopLine="40"/> + </Position7> + <Position8> + <Filename Value="CookieVisitor.lpr"/> + <Caret Line="75" TopLine="40"/> + </Position8> + <Position9> + <Filename Value="CookieVisitor.lpr"/> + <Caret Line="58" Column="31" TopLine="36"/> + </Position9> + <Position10> + <Filename Value="uSimpleTextViewer.pas"/> + <Caret Line="31"/> + </Position10> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/ToolBoxBrowser/cef.inc b/demos/Lazarus/CookieVisitor/cef.inc similarity index 100% rename from demos/ToolBoxBrowser/cef.inc rename to demos/Lazarus/CookieVisitor/cef.inc diff --git a/demos/Lazarus/CookieVisitor/uCookieVisitor.lfm b/demos/Lazarus/CookieVisitor/uCookieVisitor.lfm new file mode 100644 index 00000000..e93731ec --- /dev/null +++ b/demos/Lazarus/CookieVisitor/uCookieVisitor.lfm @@ -0,0 +1,78 @@ +object CookieVisitorFrm: TCookieVisitorFrm + Left = 183 + Height = 762 + Top = 77 + Width = 884 + Caption = 'Cookie Visitor' + ClientHeight = 762 + ClientWidth = 884 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object AddressBarPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 884 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 884 + DoubleBuffered = True + Enabled = False + ParentDoubleBuffered = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 853 + Align = alClient + TabOrder = 0 + Text = 'https://www.google.com' + end + object GoBtn: TButton + Left = 853 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 741 + Top = 21 + Width = 884 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnCookiesDeleted = Chromium1CookiesDeleted + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 280 + end +end diff --git a/demos/Lazarus/CookieVisitor/uCookieVisitor.pas b/demos/Lazarus/CookieVisitor/uCookieVisitor.pas new file mode 100644 index 00000000..cf5dce48 --- /dev/null +++ b/demos/Lazarus/CookieVisitor/uCookieVisitor.pas @@ -0,0 +1,370 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uCookieVisitor; + +{$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, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFCookieManager, uCEFCookieVisitor, uCEFWinControl; + +const + MINIBROWSER_SHOWCOOKIES = WM_APP + $101; + MINIBROWSER_SETCOOKIERSLT = WM_APP + $102; + + MINIBROWSER_CONTEXTMENU_DELETECOOKIES = MENU_ID_USER_FIRST + 1; + MINIBROWSER_CONTEXTMENU_GETCOOKIES = MENU_ID_USER_FIRST + 2; + MINIBROWSER_CONTEXTMENU_SETCOOKIE = MENU_ID_USER_FIRST + 3; + +type + TCookieVisitorFrm = class(TForm) + AddressBarPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); + procedure Chromium1CookiesDeleted(Sender: TObject; + numDeleted: Integer); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + 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 FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + + private + 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 BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + procedure ShowCookiesMsg(var aMessage : TMessage); message MINIBROWSER_SHOWCOOKIES; + procedure SetCookieRsltMsg(var aMessage : TMessage); message MINIBROWSER_SETCOOKIERSLT; + + protected + FText : string; + FVisitor : ICefCookieVisitor; + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + public + procedure AddCookieInfo(const aCookie : TCookie); + + end; + +var + CookieVisitorFrm: TCookieVisitorFrm; + +implementation + +{$R *.lfm} + +uses + uSimpleTextViewer, uCEFTask, uCEFMiscFunctions; + +// This demo has a context menu to test the DeleteCookies function and a CookieVisitor example. + +// The cookie visitor gets the global cookie manager to call the VisitAllCookies function. +// The cookie visitor will call CookieVisitorProc for each cookie and it'll save the information using the AddCookieInfo function. +// When the last cookie arrives we show the information in a SimpleTextViewer form. + +// 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. + +// This function is called in the IO thread. +function CookieVisitorProc(const name, value, domain, path: ustring; + secure, httponly, hasExpires: Boolean; + const creation, lastAccess, expires: TDateTime; + count, total: Integer; + out deleteCookie: Boolean): Boolean; +var + TempCookie : TCookie; +begin + deleteCookie := False; + + TempCookie.name := name; + TempCookie.value := value; + TempCookie.domain := domain; + TempCookie.path := path; + TempCookie.secure := secure; + TempCookie.httponly := httponly; + TempCookie.creation := creation; + TempCookie.last_access := lastAccess; + TempCookie.has_expires := hasExpires; + TempCookie.expires := expires; + + CookieVisitorFrm.AddCookieInfo(TempCookie); + + if (count = pred(total)) then + begin + if (CookieVisitorFrm <> nil) and CookieVisitorFrm.HandleAllocated then + PostMessage(CookieVisitorFrm.Handle, MINIBROWSER_SHOWCOOKIES, 0, 0); + + Result := False; + end + else + Result := True; +end; + +procedure TCookieVisitorFrm.AddCookieInfo(const aCookie : TCookie); +begin + // This should be protected by a mutex. + FText := FText + aCookie.name + ' : ' + aCookie.value + #13 + #10; +end; + +procedure TCookieVisitorFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + CEFWindowParent1.UpdateSize; + AddressBarPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TCookieVisitorFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TCookieVisitorFrm.ShowCookiesMsg(var aMessage : TMessage); +begin + SimpleTextViewerFrm.Memo1.Lines.Text := FText; // This should be protected by a mutex. + SimpleTextViewerFrm.ShowModal; +end; + +procedure TCookieVisitorFrm.SetCookieRsltMsg(var aMessage : TMessage); +begin + if (aMessage.wParam = 0) then + showmessage('There was a problem setting the cookie') + else + showmessage('Cookie set successfully !'); +end; + +procedure TCookieVisitorFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TCookieVisitorFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TCookieVisitorFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TCookieVisitorFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TCookieVisitorFrm.Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_DELETECOOKIES, 'Delete cookies'); + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_GETCOOKIES, 'Visit cookies'); + model.AddItem(MINIBROWSER_CONTEXTMENU_SETCOOKIE, 'Set cookie'); +end; + +procedure TCookieVisitorFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TCookieVisitorFrm.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TCookieVisitorFrm.Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); +var + TempManager : ICefCookieManager; +begin + Result := False; + + case commandId of + MINIBROWSER_CONTEXTMENU_DELETECOOKIES : Chromium1.DeleteCookies; + + MINIBROWSER_CONTEXTMENU_GETCOOKIES : + begin + // This should be protected by a mutex + FText := ''; + TempManager := TCefCookieManagerRef.Global(nil); + TempManager.VisitAllCookies(FVisitor); + end; + + MINIBROWSER_CONTEXTMENU_SETCOOKIE : + begin + TempManager := TCefCookieManagerRef.Global(nil); + + if TempManager.SetCookie('https://www.example.com', + 'example_cookie_name', + '1234', + '', + '/', + True, + True, + False, + now, + now, + now, + nil) then + PostMessage(Handle, MINIBROWSER_SETCOOKIERSLT, ord(True), 0) + else + PostMessage(Handle, MINIBROWSER_SETCOOKIERSLT, ord(False), 0); + end; + end; +end; + +procedure TCookieVisitorFrm.Chromium1CookiesDeleted(Sender: TObject; numDeleted: Integer); +begin + showmessage('Deleted cookies : ' + inttostr(numDeleted)); +end; + +procedure TCookieVisitorFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TCookieVisitorFrm.FormCreate(Sender: TObject); +begin + FVisitor := TCefFastCookieVisitor.Create(CookieVisitorProc); + FCanClose := False; + FClosing := False; +end; + +procedure TCookieVisitorFrm.FormDestroy(Sender: TObject); +begin + FVisitor := nil; +end; + +procedure TCookieVisitorFrm.FormShow(Sender: TObject); +begin + // 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 TCookieVisitorFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TCookieVisitorFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TCookieVisitorFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TCookieVisitorFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/CookieVisitor/uSimpleTextViewer.lfm b/demos/Lazarus/CookieVisitor/uSimpleTextViewer.lfm new file mode 100644 index 00000000..54ab49b5 --- /dev/null +++ b/demos/Lazarus/CookieVisitor/uSimpleTextViewer.lfm @@ -0,0 +1,27 @@ +object SimpleTextViewerFrm: TSimpleTextViewerFrm + Left = 0 + Height = 572 + Top = 0 + Width = 694 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'Simple text viewer' + ClientHeight = 572 + ClientWidth = 694 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Position = poScreenCenter + LCLVersion = '2.0.1.0' + object Memo1: TMemo + Left = 0 + Height = 572 + Top = 0 + Width = 694 + Align = alClient + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end +end diff --git a/demos/Lazarus/CookieVisitor/uSimpleTextViewer.pas b/demos/Lazarus/CookieVisitor/uSimpleTextViewer.pas new file mode 100644 index 00000000..8c12f96d --- /dev/null +++ b/demos/Lazarus/CookieVisitor/uSimpleTextViewer.pas @@ -0,0 +1,31 @@ +unit uSimpleTextViewer; + +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; + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls; + {$ENDIF} + + +type + TSimpleTextViewerFrm = class(TForm) + Memo1: TMemo; + private + { Private declarations } + public + { Public declarations } + end; + +var + SimpleTextViewerFrm: TSimpleTextViewerFrm; + +implementation + +{$R *.lfm} + +end. diff --git a/demos/SimpleLazarusBrowser/00-Delete.bat b/demos/Lazarus/CustomResourceBrowser/00-Delete.bat similarity index 100% rename from demos/SimpleLazarusBrowser/00-Delete.bat rename to demos/Lazarus/CustomResourceBrowser/00-Delete.bat diff --git a/demos/Lazarus/CustomResourceBrowser/CRBrowser.lpi b/demos/Lazarus/CustomResourceBrowser/CRBrowser.lpi new file mode 100644 index 00000000..6546046a --- /dev/null +++ b/demos/Lazarus/CustomResourceBrowser/CRBrowser.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="CRBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="CRBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uCustomResourceHandler.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\CRBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/CustomResourceBrowser/CRBrowser.lpr b/demos/Lazarus/CustomResourceBrowser/CRBrowser.lpr new file mode 100644 index 00000000..fe292e48 --- /dev/null +++ b/demos/Lazarus/CustomResourceBrowser/CRBrowser.lpr @@ -0,0 +1,73 @@ +// ************************************************************************ +// ***************************** 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 CRBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, + uMainForm in 'uMainForm.pas' {MainForm}, + uCustomResourceHandler in 'uCustomResourceHandler.pas'; + +//{$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TMainForm, MainForm); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/CustomResourceBrowser/CRBrowser.lps b/demos/Lazarus/CustomResourceBrowser/CRBrowser.lps new file mode 100644 index 00000000..f6ebfc70 --- /dev/null +++ b/demos/Lazarus/CustomResourceBrowser/CRBrowser.lps @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="5"> + <Unit0> + <Filename Value="CRBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="37"/> + <CursorPos Y="56"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="48"/> + <CursorPos X="31" Y="60"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uCustomResourceHandler.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <WindowIndex Value="-1"/> + <TopLine Value="-1"/> + <CursorPos X="-1" Y="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\..\..\..\fpcsrc\rtl\objpas\classes\classesh.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="998"/> + <CursorPos X="17" Y="1016"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + <Unit4> + <Filename Value="..\..\source\uCEFChromiumWindow.pas"/> + <EditorIndex Value="-1"/> + <CursorPos X="3" Y="66"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit4> + </Units> + <JumpHistory Count="6" HistoryIndex="5"> + <Position1> + <Filename Value="uMainForm.pas"/> + </Position1> + <Position2> + <Filename Value="CRBrowser.lpr"/> + <Caret Line="50" Column="3" TopLine="32"/> + </Position2> + <Position3> + <Filename Value="uMainForm.pas"/> + <Caret Line="183" Column="121" TopLine="165"/> + </Position3> + <Position4> + <Filename Value="uMainForm.pas"/> + <Caret Line="95" Column="8" TopLine="76"/> + </Position4> + <Position5> + <Filename Value="uMainForm.pas"/> + <Caret Line="99" Column="8" TopLine="63"/> + </Position5> + <Position6> + <Filename Value="uMainForm.pas"/> + <Caret Line="60" Column="31" TopLine="48"/> + </Position6> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/ToolBoxLazBrowser/cef.inc b/demos/Lazarus/CustomResourceBrowser/cef.inc similarity index 100% rename from demos/ToolBoxLazBrowser/cef.inc rename to demos/Lazarus/CustomResourceBrowser/cef.inc diff --git a/demos/Lazarus/CustomResourceBrowser/uCustomResourceHandler.pas b/demos/Lazarus/CustomResourceBrowser/uCustomResourceHandler.pas new file mode 100644 index 00000000..63b007f7 --- /dev/null +++ b/demos/Lazarus/CustomResourceBrowser/uCustomResourceHandler.pas @@ -0,0 +1,140 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uCustomResourceHandler; + +{$I cef.inc} + +interface +uses + {$IFDEF DELPHI16_UP} + System.Classes, WinApi.Windows, System.SysUtils, + {$ELSE} + Classes, Windows, SysUtils, + {$ENDIF} + uCEFInterfaces, uCEFTypes, uCEFResourceHandler; + +type + TCustomResourceHandler = class(TCefResourceHandlerOwn) + private + FStream : TMemoryStream; + FMimeType : string; + FStatusText : string; + FStatus : Integer; + + protected + function ProcessRequest(const request: ICefRequest; const callback: ICefCallback): Boolean; override; + procedure GetResponseHeaders(const response: ICefResponse; out responseLength: Int64; out redirectUrl: ustring); override; + function ReadResponse(const dataOut: Pointer; bytesToRead: Integer; var bytesRead: Integer; const callback: ICefCallback): Boolean; override; + + public + constructor Create(const browser: ICefBrowser; const frame: ICefFrame; const schemeName: ustring; const request: ICefRequest; const aStream : TStream; const aMimeType : ustring); reintroduce; + destructor Destroy; override; + end; + +implementation + +constructor TCustomResourceHandler.Create(const browser : ICefBrowser; + const frame : ICefFrame; + const schemeName : ustring; + const request : ICefRequest; + const aStream : TStream; + const aMimeType : ustring); +begin + inherited Create(browser, frame, schemeName, request); + + FStream := TMemoryStream.Create; + FStatus := 0; + FMimeType := aMimeType; + FStatusText := ''; + + if (FStream <> nil) and (aStream <> nil) then + begin + FStream.LoadFromStream(aStream); + FStream.Seek(0, soFromBeginning); + end; +end; + +destructor TCustomResourceHandler.Destroy; +begin + if (FStream <> nil) then FreeAndNil(FStream); + + inherited Destroy; +end; + +procedure TCustomResourceHandler.GetResponseHeaders(const response : ICefResponse; + out responseLength : Int64; + out redirectUrl : ustring); +begin + if (response <> nil) then + begin + response.Status := FStatus; + response.StatusText := FStatusText; + response.MimeType := FMimeType; + end; + + if (FStream <> nil) then + responseLength := FStream.Size + else + responseLength := 0; +end; + +function TCustomResourceHandler.ProcessRequest(const request : ICefRequest; const callback : ICefCallback): Boolean; +begin + Result := True; + FStatus := 200; + FStatusText := 'OK'; + + if (FStream <> nil) then FStream.Seek(0, soFromBeginning); + if (callback <> nil) then callback.Cont; +end; + +function TCustomResourceHandler.ReadResponse(const dataOut : Pointer; + bytesToRead : Integer; + var bytesRead : Integer; + const callback : ICefCallback): Boolean; +begin + if (FStream <> nil) and (DataOut <> nil) then + begin + BytesRead := FStream.Read(DataOut^, BytesToRead); + Result := True; + end + else + Result := False; +end; + +end. diff --git a/demos/Lazarus/CustomResourceBrowser/uMainForm.lfm b/demos/Lazarus/CustomResourceBrowser/uMainForm.lfm new file mode 100644 index 00000000..5c4f8db3 --- /dev/null +++ b/demos/Lazarus/CustomResourceBrowser/uMainForm.lfm @@ -0,0 +1,69 @@ +object MainForm: TMainForm + Left = 150 + Height = 658 + Top = 86 + Width = 781 + Caption = 'Custom Resource Browser' + ClientHeight = 658 + ClientWidth = 781 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object ChromiumWindow1: TChromiumWindow + Left = 0 + Height = 637 + Top = 21 + Width = 781 + Align = alClient + TabOrder = 0 + OnClose = ChromiumWindow1Close + OnBeforeClose = ChromiumWindow1BeforeClose + OnAfterCreated = ChromiumWindow1AfterCreated + end + object AddressBarPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 781 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 781 + DoubleBuffered = True + Enabled = False + ParentDoubleBuffered = False + TabOrder = 1 + object Edit1: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 750 + Align = alClient + TabOrder = 0 + Text = 'http://www.example.com' + end + object Button1: TButton + Left = 750 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = Button1Click + TabOrder = 1 + end + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 48 + top = 240 + end +end diff --git a/demos/Lazarus/CustomResourceBrowser/uMainForm.pas b/demos/Lazarus/CustomResourceBrowser/uMainForm.pas new file mode 100644 index 00000000..e61a77a8 --- /dev/null +++ b/demos/Lazarus/CustomResourceBrowser/uMainForm.pas @@ -0,0 +1,243 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit 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, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFInterfaces, uCustomResourceHandler, + uCEFConstants, uCEFTypes; + +type + + { TMainForm } + + TMainForm = class(TForm) + ChromiumWindow1: TChromiumWindow; + AddressBarPnl: TPanel; + Edit1: TEdit; + Button1: TButton; + Timer1: TTimer; + + procedure ChromiumWindow1AfterCreated(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Button1Click(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure ChromiumWindow1Close(Sender: TObject); + procedure ChromiumWindow1BeforeClose(Sender: TObject); + + private + 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; + + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure Chromium_OnAfterCreated(Sender: TObject); + procedure Chromium_OnGetResourceHandler(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const request: ICefRequest; out Result: ICefResourceHandler); + procedure Chromium_OnBeforePopup(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); + + public + { Public declarations } + end; + +var + MainForm: TMainForm; + +implementation + +{$R *.lfm} + +uses + uCEFMiscFunctions, uCEFApplication; + +// Destruction steps +// ================= +// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event. +// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event. +// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form. + +procedure TMainForm.Button1Click(Sender: TObject); +begin + ChromiumWindow1.LoadURL(Edit1.Text); +end; + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + ChromiumWindow1.CloseBrowser(True); + end; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TMainForm.FormShow(Sender: TObject); +begin + ChromiumWindow1.OnAfterCreated := Chromium_OnAfterCreated; + ChromiumWindow1.ChromiumBrowser.OnGetResourceHandler := Chromium_OnGetResourceHandler; + ChromiumWindow1.ChromiumBrowser.OnBeforePopup := Chromium_OnBeforePopup; + + // 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(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True; +end; + +procedure TMainForm.ChromiumWindow1AfterCreated(Sender: TObject); +begin + +end; + +procedure TMainForm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(ChromiumWindow1.CreateBrowser) and not(ChromiumWindow1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TMainForm.ChromiumWindow1BeforeClose(Sender: TObject); +begin + FCanClose := True; + Close; +end; + +procedure TMainForm.ChromiumWindow1Close(Sender: TObject); +begin + // DestroyChildWindow will destroy the child window created by CEF at the top of the Z order. + if not(ChromiumWindow1.DestroyChildWindow) then + begin + FCanClose := True; + Close; + end; +end; + +procedure TMainForm.Chromium_OnAfterCreated(Sender: TObject); +begin + ChromiumWindow1.UpdateSize; + AddressBarPnl.Enabled := True; +end; + +procedure TMainForm.Chromium_OnGetResourceHandler(Sender : TObject; + const browser : ICefBrowser; + const frame : ICefFrame; + const request : ICefRequest; + out Result : ICefResourceHandler); +var + TempStream : TStringStream; +begin + // This event is called from the IO thread. Use mutexes if necessary. + TempStream := nil; + Result := nil; + + try + try + TempStream := TStringStream.Create('<!DOCTYPE html><html><body><p>test</p></body></html>'{, TEncoding.UTF8, false}); + Result := TCustomResourceHandler.Create(browser, frame, '', request, TStream(TempStream), CefGetMimeType('html')); + except + on e : exception do + if CustomExceptionHandler('TMainForm.Chromium_OnGetResourceHandler', e) then raise; + end; + finally + if (TempStream <> nil) then FreeAndNil(TempStream); + end; +end; + +procedure TMainForm.Chromium_OnBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TMainForm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TMainForm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.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. diff --git a/demos/ToolBoxLazBrowser/00-Delete.bat b/demos/Lazarus/DOMVisitor/00-Delete.bat similarity index 100% rename from demos/ToolBoxLazBrowser/00-Delete.bat rename to demos/Lazarus/DOMVisitor/00-Delete.bat diff --git a/demos/Lazarus/DOMVisitor/DOMVisitor.lpi b/demos/Lazarus/DOMVisitor/DOMVisitor.lpi new file mode 100644 index 00000000..825a40e1 --- /dev/null +++ b/demos/Lazarus/DOMVisitor/DOMVisitor.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="DOMVisitor"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="DOMVisitor.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uDOMVisitor.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="DOMVisitorFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\DOMVisitor"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/DOMVisitor/DOMVisitor.lpr b/demos/Lazarus/DOMVisitor/DOMVisitor.lpr new file mode 100644 index 00000000..6a3ca25c --- /dev/null +++ b/demos/Lazarus/DOMVisitor/DOMVisitor.lpr @@ -0,0 +1,70 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2018 Salvador 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 DOMVisitor; + +{$I cef.inc} + +uses + Forms, Interfaces, + Windows, + uCEFApplication, + uDOMVisitor in 'uDOMVisitor.pas' {DOMVisitorFrm}; + +//{$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + //ReportMemoryLeaksOnShutdown := True; + + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TDOMVisitorFrm, DOMVisitorFrm); + Application.Run; + end; + + // This is not really necessary to fix the bug #89 but if you free GlobalCEFApp in a different unit + // then you can call 'FreeAndNil' without adding SysUtils to this DPR. + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/DOMVisitor/DOMVisitor.lps b/demos/Lazarus/DOMVisitor/DOMVisitor.lps new file mode 100644 index 00000000..c3b9c200 --- /dev/null +++ b/demos/Lazarus/DOMVisitor/DOMVisitor.lps @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="4"> + <Unit0> + <Filename Value="DOMVisitor.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="40"/> + <CursorPos X="13" Y="44"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uDOMVisitor.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="DOMVisitorFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="458"/> + <CursorPos X="86" Y="471"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="..\..\source\uCEFApplication.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="420"/> + <CursorPos X="16" Y="438"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\source\uCEFInterfaces.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="147"/> + <CursorPos X="78" Y="159"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + </Units> + <JumpHistory Count="19" HistoryIndex="18"> + <Position1> + <Filename Value="DOMVisitor.lpr"/> + </Position1> + <Position2> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="303" Column="44" TopLine="285"/> + </Position2> + <Position3> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="39" TopLine="19"/> + </Position3> + <Position4> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="305" Column="44" TopLine="287"/> + </Position4> + <Position5> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="306" Column="64" TopLine="287"/> + </Position5> + <Position6> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="261" Column="11" TopLine="243"/> + </Position6> + <Position7> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="305" Column="81" TopLine="287"/> + </Position7> + <Position8> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="305" Column="113" TopLine="287"/> + </Position8> + <Position9> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="311" Column="59" TopLine="287"/> + </Position9> + <Position10> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="261" Column="11" TopLine="109"/> + </Position10> + <Position11> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="305" Column="44" TopLine="287"/> + </Position11> + <Position12> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="305" Column="44" TopLine="287"/> + </Position12> + <Position13> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="483" TopLine="449"/> + </Position13> + <Position14> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="52" TopLine="33"/> + </Position14> + <Position15> + <Filename Value="uDOMVisitor.pas"/> + </Position15> + <Position16> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="136" Column="8" TopLine="106"/> + </Position16> + <Position17> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="305" Column="67" TopLine="289"/> + </Position17> + <Position18> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="378" Column="16" TopLine="364"/> + </Position18> + <Position19> + <Filename Value="uDOMVisitor.pas"/> + <Caret Line="121" Column="15" TopLine="111"/> + </Position19> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/URLRequest/cef.inc b/demos/Lazarus/DOMVisitor/cef.inc similarity index 100% rename from demos/URLRequest/cef.inc rename to demos/Lazarus/DOMVisitor/cef.inc diff --git a/demos/Lazarus/DOMVisitor/uDOMVisitor.lfm b/demos/Lazarus/DOMVisitor/uDOMVisitor.lfm new file mode 100644 index 00000000..6d3c4423 --- /dev/null +++ b/demos/Lazarus/DOMVisitor/uDOMVisitor.lfm @@ -0,0 +1,107 @@ +object DOMVisitorFrm: TDOMVisitorFrm + Left = 299 + Height = 579 + Top = 127 + Width = 878 + Caption = 'DOMVisitor' + ClientHeight = 579 + ClientWidth = 878 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 539 + Top = 21 + Width = 878 + Align = alClient + TabOrder = 0 + end + object AddressBarPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 878 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 878 + DoubleBuffered = True + Enabled = False + ParentDoubleBuffered = False + TabOrder = 1 + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 764 + Align = alClient + TabOrder = 0 + Text = 'https://www.google.com' + end + object Panel1: TPanel + Left = 764 + Height = 21 + Top = 0 + Width = 114 + Align = alRight + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 114 + TabOrder = 1 + object GoBtn: TButton + Left = 0 + Height = 21 + Top = 0 + Width = 31 + Align = alLeft + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 0 + end + object VisitDOMBtn: TButton + Left = 39 + Height = 21 + Top = 0 + Width = 75 + Align = alRight + Caption = 'Visit DOM' + OnClick = VisitDOMBtnClick + TabOrder = 1 + end + end + end + object StatusPnl: TPanel + Left = 0 + Height = 19 + Top = 560 + Width = 878 + Align = alBottom + BevelOuter = bvLowered + TabOrder = 2 + end + object Chromium1: TChromium + OnProcessMessageReceived = Chromium1ProcessMessageReceived + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 16 + top = 40 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 16 + top = 96 + end +end diff --git a/demos/Lazarus/DOMVisitor/uDOMVisitor.pas b/demos/Lazarus/DOMVisitor/uDOMVisitor.pas new file mode 100644 index 00000000..6354c58b --- /dev/null +++ b/demos/Lazarus/DOMVisitor/uDOMVisitor.pas @@ -0,0 +1,482 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +{$MODE DELPHI} + +unit uDOMVisitor; + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +const + MINIBROWSER_VISITDOM_PARTIAL = WM_APP + $101; + MINIBROWSER_VISITDOM_FULL = WM_APP + $102; + + MINIBROWSER_CONTEXTMENU_VISITDOM_PARTIAL = MENU_ID_USER_FIRST + 1; + MINIBROWSER_CONTEXTMENU_VISITDOM_FULL = MENU_ID_USER_FIRST + 2; + + DOMVISITOR_MSGNAME_PARTIAL = 'domvisitorpartial'; + DOMVISITOR_MSGNAME_FULL = 'domvisitorfull'; + RETRIEVEDOM_MSGNAME_PARTIAL = 'retrievedompartial'; + RETRIEVEDOM_MSGNAME_FULL = 'retrievedomfull'; + +type + + { TDOMVisitorFrm } + + TDOMVisitorFrm = class(TForm) + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + AddressBarPnl: TPanel; + AddressEdt: TEdit; + StatusPnl: TPanel; + Timer1: TTimer; + Panel1: TPanel; + GoBtn: TButton; + VisitDOMBtn: TButton; + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; + const browser: ICefBrowser); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); + procedure Chromium1ProcessMessageReceived(Sender: TObject; + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage; out Result: Boolean); + procedure Timer1Timer(Sender: TObject); + procedure VisitDOMBtnClick(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + private + { Private declarations } + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + procedure VisitDOMMsg(var aMessage : TMessage); message MINIBROWSER_VISITDOM_PARTIAL; + procedure VisitDOM2Msg(var aMessage : TMessage); message MINIBROWSER_VISITDOM_FULL; + procedure WMMove(var aMessage : TWMMove); message WM_MOVE; + procedure WMMoving(var aMessage : TMessage); message WM_MOVING; + + procedure ShowStatusText(const aText : string); + public + { Public declarations } + end; + +var + DOMVisitorFrm: TDOMVisitorFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFProcessMessage, uCEFMiscFunctions, uCEFSchemeRegistrar, uCEFRenderProcessHandler, + uCEFv8Handler, uCEFDomVisitor, uCEFDomNode, uCEFTask; + +// This demo sends messages from the browser process to the render process, +// and from the render process to the browser process. + +// To send a message from the browser process you must use the TChromium.SendProcessMessage +// procedure with a PID_RENDERER parameter. The render process receives those messages in +// the GlobalCEFApp.OnProcessMessageReceived event. + +// To send messages from the render process you must use the browser.SendProcessMessage +// procedure with a PID_BROWSER parameter. The browser process receives those messages in +// the TChromium.OnProcessMessageReceived event. + +// message.name is used to identify different messages sent with SendProcessMessage. + +// The OnProcessMessageReceived event can recognize any number of messages identifying them +// by message.name + +// 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 SimpleDOMIteration(const aDocument: ICefDomDocument); +var + TempHead, TempChild : ICefDomNode; +begin + try + if (aDocument <> nil) then + begin + TempHead := aDocument.Head; + + if (TempHead <> nil) then + begin + TempChild := TempHead.FirstChild; + + while (TempChild <> nil) do + begin + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, 'Head child element : ' + TempChild.Name); + TempChild := TempChild.NextSibling; + end; + end; + end; + except + on e : exception do + if CustomExceptionHandler('SimpleDOMIteration', e) then raise; + end; +end; + +procedure SimpleNodeSearch(const aDocument: ICefDomDocument); +const + NODE_ID = 'lst-ib'; // input box node found in google.com homepage +var + TempNode : ICefDomNode; +begin + try + if (aDocument <> nil) then + begin + TempNode := aDocument.GetElementById(NODE_ID); + + if (TempNode <> nil) then + begin + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, NODE_ID + ' element name : ' + TempNode.Name); + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, NODE_ID + ' element value : ' + TempNode.GetValue); + end; + + TempNode := aDocument.GetFocusedNode; + + if (TempNode <> nil) then + begin + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, 'Focused element name : ' + TempNode.Name); + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, 'Focused element inner text : ' + TempNode.ElementInnerText); + end; + end; + except + on e : exception do + if CustomExceptionHandler('SimpleNodeSearch', e) then raise; + end; +end; + +procedure DOMVisitor_OnDocAvailable(const browser: ICefBrowser; const document: ICefDomDocument); +var + msg: ICefProcessMessage; +begin + // This function is called from a different process. + // document is only valid inside this function. + // As an example, this function only writes the document title to the 'debug.log' file. + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, 'document.Title : ' + document.Title); + + if document.HasSelection then + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, 'document.SelectionAsText : ' + quotedstr(document.SelectionAsText)) + else + CefLog('CEF4Delphi', 1, CEF_LOG_SEVERITY_ERROR, 'document.HasSelection : False'); + + // Simple DOM iteration example + SimpleDOMIteration(document); + + // Simple DOM searches + SimpleNodeSearch(document); + + // Sending back some custom results to the browser process + // Notice that the DOMVISITOR_MSGNAME_PARTIAL message name needs to be recognized in + // Chromium1ProcessMessageReceived + msg := TCefProcessMessageRef.New(DOMVISITOR_MSGNAME_PARTIAL); + msg.ArgumentList.SetString(0, 'document.Title : ' + document.Title); + browser.SendProcessMessage(PID_BROWSER, msg); +end; + +procedure DOMVisitor_OnDocAvailableFullMarkup(const browser: ICefBrowser; const document: ICefDomDocument); +var + msg: ICefProcessMessage; +begin + // Sending back some custom results to the browser process + // Notice that the DOMVISITOR_MSGNAME_FULL message name needs to be recognized in + // Chromium1ProcessMessageReceived + msg := TCefProcessMessageRef.New(DOMVISITOR_MSGNAME_FULL); + msg.ArgumentList.SetString(0, document.Body.AsMarkup); + browser.SendProcessMessage(PID_BROWSER, msg); +end; + +procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser; + sourceProcess : TCefProcessId; + const message : ICefProcessMessage; + var aHandled : boolean); +var + TempFrame : ICefFrame; + TempVisitor : TCefFastDomVisitor2; +begin + aHandled := False; + + if (browser <> nil) then + begin + if (message.name = RETRIEVEDOM_MSGNAME_PARTIAL) then + begin + TempFrame := browser.MainFrame; + + if (TempFrame <> nil) then + begin + TempVisitor := TCefFastDomVisitor2.Create(browser, DOMVisitor_OnDocAvailable); + TempFrame.VisitDom(TempVisitor); + end; + + aHandled := True; + end + else + if (message.name = RETRIEVEDOM_MSGNAME_FULL) then + begin + TempFrame := browser.MainFrame; + + if (TempFrame <> nil) then + begin + TempVisitor := TCefFastDomVisitor2.Create(browser, DOMVisitor_OnDocAvailableFullMarkup); + TempFrame.VisitDom(TempVisitor); + end; + + aHandled := True; + end; + end; +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.RemoteDebuggingPort := 9000; + GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived; + + // Enabling the debug log file for then DOM visitor demo. + // This adds lots of warnings to the console, specially if you run this inside VirtualBox. + // Remove it if you don't want to use the DOM visitor + GlobalCEFApp.LogFile := 'debug.log'; + GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; +end; + +procedure TDOMVisitorFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TDOMVisitorFrm.Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TDOMVisitorFrm.Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + model.AddItem(MINIBROWSER_CONTEXTMENU_VISITDOM_PARTIAL, 'Visit DOM in CEF (only Title)'); + model.AddItem(MINIBROWSER_CONTEXTMENU_VISITDOM_FULL, 'Visit DOM in CEF (BODY HTML)'); +end; + +procedure TDOMVisitorFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TDOMVisitorFrm.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TDOMVisitorFrm.Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); +begin + Result := False; + + case commandId of + MINIBROWSER_CONTEXTMENU_VISITDOM_PARTIAL : + PostMessage(Handle, MINIBROWSER_VISITDOM_PARTIAL, 0, 0); + + MINIBROWSER_CONTEXTMENU_VISITDOM_FULL : + PostMessage(Handle, MINIBROWSER_VISITDOM_FULL, 0, 0); + end; +end; + +procedure TDOMVisitorFrm.Chromium1ProcessMessageReceived(Sender: TObject; + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage; out Result: Boolean); +begin + Result := False; + + if (message = nil) or (message.ArgumentList = nil) then exit; + + // Message received from the DOMVISITOR in CEF + + if (message.Name = DOMVISITOR_MSGNAME_PARTIAL) then + begin + ShowStatusText('DOM Visitor result text : ' + message.ArgumentList.GetString(0)); + Result := True; + end + else + if (message.Name = DOMVISITOR_MSGNAME_FULL) then + begin + Clipboard.AsText := message.ArgumentList.GetString(0); + ShowStatusText('HTML copied to the clipboard'); + Result := True; + end; +end; + +procedure TDOMVisitorFrm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TDOMVisitorFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TDOMVisitorFrm.FormShow(Sender: TObject); +begin + // 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 TDOMVisitorFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(AddressEdt.Text); +end; + +procedure TDOMVisitorFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + CEFWindowParent1.UpdateSize; + AddressBarPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TDOMVisitorFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TDOMVisitorFrm.VisitDOMBtnClick(Sender: TObject); +begin + PostMessage(Handle, MINIBROWSER_VISITDOM_PARTIAL, 0, 0); +end; + +procedure TDOMVisitorFrm.VisitDOMMsg(var aMessage : TMessage); +var + TempMsg : ICefProcessMessage; +begin + // Use the ArgumentList property if you need to pass some parameters. + TempMsg := TCefProcessMessageRef.New(RETRIEVEDOM_MSGNAME_PARTIAL); // Same name than TCefCustomRenderProcessHandler.MessageName + Chromium1.SendProcessMessage(PID_RENDERER, TempMsg); +end; + +procedure TDOMVisitorFrm.VisitDOM2Msg(var aMessage : TMessage); +var + TempMsg : ICefProcessMessage; +begin + // Use the ArgumentList property if you need to pass some parameters. + TempMsg := TCefProcessMessageRef.New(RETRIEVEDOM_MSGNAME_FULL); // Same name than TCefCustomRenderProcessHandler.MessageName + Chromium1.SendProcessMessage(PID_RENDERER, TempMsg); +end; + +procedure TDOMVisitorFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TDOMVisitorFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TDOMVisitorFrm.ShowStatusText(const aText : string); +begin + StatusPnl.Caption := aText; +end; + +procedure TDOMVisitorFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +end. diff --git a/demos/Lazarus/ExternalPumpBrowser/00-Delete.bat b/demos/Lazarus/ExternalPumpBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lpi b/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lpi new file mode 100644 index 00000000..f3cebb73 --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="ExternalPumpBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="ExternalPumpBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uExternalPumpBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ExternalPumpBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\ExternalPumpBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lpr b/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lpr new file mode 100644 index 00000000..5e7017ab --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lpr @@ -0,0 +1,82 @@ +// ************************************************************************ +// ***************************** 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 ExternalPumpBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, + uCEFWorkScheduler, + uExternalPumpBrowser in 'uExternalPumpBrowser.pas' {ExternalPumpBrowserFrm}; + +//{$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 creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TExternalPumpBrowserFrm, ExternalPumpBrowserFrm); + Application.Run; + + // The form needs to be destroyed *BEFORE* stopping the scheduler. + ExternalPumpBrowserFrm.Free; + + GlobalCEFWorkScheduler.StopScheduler; + end; + + DestroyGlobalCEFApp; + DestroyGlobalCEFWorkScheduler; +end. diff --git a/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lps b/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lps new file mode 100644 index 00000000..c05e4ce8 --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/ExternalPumpBrowser.lps @@ -0,0 +1,90 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="4"> + <Unit0> + <Filename Value="ExternalPumpBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="46"/> + <CursorPos X="32" Y="75"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uExternalPumpBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ExternalPumpBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="191"/> + <CursorPos X="3" Y="211"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="..\..\source\uCEFApplication.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="404"/> + <CursorPos X="16" Y="422"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\source\uCEFInterfaces.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="151"/> + <CursorPos X="174" Y="168"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + </Units> + <JumpHistory Count="9" HistoryIndex="8"> + <Position1> + <Filename Value="ExternalPumpBrowser.lpr"/> + </Position1> + <Position2> + <Filename Value="ExternalPumpBrowser.lpr"/> + <Caret Line="50" Column="3" TopLine="32"/> + </Position2> + <Position3> + <Filename Value="uExternalPumpBrowser.pas"/> + <Caret Line="129" Column="83" TopLine="111"/> + </Position3> + <Position4> + <Filename Value="uExternalPumpBrowser.pas"/> + <Caret Line="129" Column="83" TopLine="111"/> + </Position4> + <Position5> + <Filename Value="uExternalPumpBrowser.pas"/> + <Caret Line="238" TopLine="204"/> + </Position5> + <Position6> + <Filename Value="uExternalPumpBrowser.pas"/> + <Caret Line="224" Column="15" TopLine="204"/> + </Position6> + <Position7> + <Filename Value="uExternalPumpBrowser.pas"/> + </Position7> + <Position8> + <Filename Value="uExternalPumpBrowser.pas"/> + <Caret Line="104" TopLine="74"/> + </Position8> + <Position9> + <Filename Value="uExternalPumpBrowser.pas"/> + <Caret Line="108" TopLine="72"/> + </Position9> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/ExternalPumpBrowser/cef.inc b/demos/Lazarus/ExternalPumpBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/ExternalPumpBrowser/uExternalPumpBrowser.lfm b/demos/Lazarus/ExternalPumpBrowser/uExternalPumpBrowser.lfm new file mode 100644 index 00000000..80aebbf9 --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/uExternalPumpBrowser.lfm @@ -0,0 +1,94 @@ +object ExternalPumpBrowserFrm: TExternalPumpBrowserFrm + Left = 37 + Height = 624 + Top = 74 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 0 + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 0 + end + object URLCbx: TComboBox + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'https://www.google.com' + 'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close' + 'https://www.w3schools.com/html/html5_video.asp' + 'http://www.adobe.com/software/flash/about/' + 'http://isflashinstalled.com/' + 'chrome://version/' + 'http://html5test.com/' + 'https://www.w3schools.com/' + 'http://webglsamples.org/' + 'https://get.webgl.org/' + 'https://www.youtube.com' + 'https://html5demos.com/drag/' + 'https://developers.google.com/maps/documentation/javascript/examples/streetview-embed?hl=fr' + 'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe_name' + 'https://www.browserleaks.com/webrtc' + 'https://frames-per-second.appspot.com/' + ) + TabOrder = 1 + Text = 'https://www.google.com' + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + Align = alClient + TabOrder = 1 + OnResize = CEFWindowParent1Resize + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 56 + top = 88 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 56 + top = 152 + end +end diff --git a/demos/Lazarus/ExternalPumpBrowser/uExternalPumpBrowser.pas b/demos/Lazarus/ExternalPumpBrowser/uExternalPumpBrowser.pas new file mode 100644 index 00000000..da59d6dc --- /dev/null +++ b/demos/Lazarus/ExternalPumpBrowser/uExternalPumpBrowser.pas @@ -0,0 +1,249 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uExternalPumpBrowser; + +{$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, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFTypes, uCEFConstants, uCEFInterfaces, uCEFWorkScheduler, + uCEFWinControl; + +type + + { TExternalPumpBrowserFrm } + + TExternalPumpBrowserFrm = class(TForm) + AddressPnl: TPanel; + GoBtn: TButton; + Timer1: TTimer; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + URLCbx: TComboBox; + + procedure CEFWindowParent1Resize(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(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); + + private + FCanClose : boolean; + FClosing : boolean; + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + + public + + end; + +var + ExternalPumpBrowserFrm : TExternalPumpBrowserFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFApplication; + +// This demo has a simple browser with a TChromium + TCEFWindowParent combination +// It was necessary to destroy the browser following the destruction sequence described in the MDIBrowser demo. + +procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64); +begin + if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS); +end; + +procedure CreateGlobalCEFApp; +begin + // TCEFWorkScheduler will call cef_do_message_loop_work when + // it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event. + // GlobalCEFWorkScheduler needs to be created before the + // GlobalCEFApp.StartMainProcess call. + GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil); + + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.FlashEnabled := False; + GlobalCEFApp.ExternalMessagePump := True; + GlobalCEFApp.MultiThreadedMessageLoop := False; + GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork; +end; + +procedure TExternalPumpBrowserFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + AddressPnl.Enabled := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TExternalPumpBrowserFrm.FormShow(Sender: TObject); +begin + // 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 TExternalPumpBrowserFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TExternalPumpBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TExternalPumpBrowserFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TExternalPumpBrowserFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TExternalPumpBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'External Pump Browser'; + CEFWindowParent1.UpdateSize; + AddressPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TExternalPumpBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TExternalPumpBrowserFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(URLCbx.Text); +end; + +procedure TExternalPumpBrowserFrm.CEFWindowParent1Resize(Sender: TObject); +begin + +end; + +procedure TExternalPumpBrowserFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TExternalPumpBrowserFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TExternalPumpBrowserFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TExternalPumpBrowserFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TExternalPumpBrowserFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/FullScreenBrowser/00-Delete.bat b/demos/Lazarus/FullScreenBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lpi b/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lpi new file mode 100644 index 00000000..97e00158 --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="FullScreenBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="FullScreenBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\FullScreenBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lpr b/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lpr new file mode 100644 index 00000000..4207e60b --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lpr @@ -0,0 +1,70 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2018 Salvador 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 FullScreenBrowser; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Windows, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uMainForm in 'uMainForm.pas' {MainForm}; + +{.$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + Application.CreateForm(TMainForm, MainForm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lps b/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lps new file mode 100644 index 00000000..4d508659 --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/FullScreenBrowser.lps @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="FullScreenBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="34"/> + <CursorPos X="18" Y="49"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="40"/> + <CursorPos X="3" Y="250"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="uMainForm.pas"/> + </Position1> + <Position2> + <Filename Value="uMainForm.pas"/> + <Caret Line="54" Column="14" TopLine="36"/> + </Position2> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/FullScreenBrowser/cef.inc b/demos/Lazarus/FullScreenBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/FullScreenBrowser/uMainForm.lfm b/demos/Lazarus/FullScreenBrowser/uMainForm.lfm new file mode 100644 index 00000000..80bf0372 --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/uMainForm.lfm @@ -0,0 +1,46 @@ +object MainForm: TMainForm + Left = -8 + Height = 327 + Top = -8 + Width = 450 + BorderIcons = [] + BorderStyle = bsNone + Caption = 'MainForm' + ClientHeight = 327 + ClientWidth = 450 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + FormStyle = fsStayOnTop + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + LCLVersion = '2.0.1.0' + WindowState = wsMaximized + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 296 + Top = 0 + Width = 442 + Align = alClient + TabOrder = 0 + end + object Chromium1: TChromium + OnPreKeyEvent = Chromium1PreKeyEvent + OnKeyEvent = Chromium1KeyEvent + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 208 + top = 120 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 272 + top = 120 + end +end diff --git a/demos/Lazarus/FullScreenBrowser/uMainForm.pas b/demos/Lazarus/FullScreenBrowser/uMainForm.pas new file mode 100644 index 00000000..092796e6 --- /dev/null +++ b/demos/Lazarus/FullScreenBrowser/uMainForm.pas @@ -0,0 +1,284 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMainForm; + +{$MODE Delphi} + +interface + +uses + {$IFDEF DELPHI16_UP} + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, + System.UITypes, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFTypes, uCEFConstants, + {ExtCtrls,} uCEFWinControl; + +type + TMainForm = class(TForm) + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure Chromium1PreKeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out isKeyboardShortcut, Result: Boolean); + procedure Chromium1KeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out Result: Boolean); + procedure FormShow(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; + const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + private + { Private declarations } + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + 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 BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + + procedure HandleKeyUp(const aMsg : TMsg; var aHandled : boolean); + procedure HandleKeyDown(const aMsg : TMsg; var aHandled : boolean); + public + { Public declarations } + end; + +var + MainForm: TMainForm; + +implementation + +{$R *.lfm} + +uses + uCEFApplication; + +procedure TMainForm.HandleKeyUp(const aMsg : TMsg; var aHandled : boolean); +var + TempMessage : TMessage; + TempKeyMsg : TWMKey; +begin + TempMessage.Msg := aMsg.message; + TempMessage.wParam := aMsg.wParam; + TempMessage.lParam := aMsg.lParam; + TempKeyMsg := TWMKey(TempMessage); + + if (TempKeyMsg.CharCode = VK_ESCAPE) then + begin + aHandled := True; + + PostMessage(Handle, WM_CLOSE, 0, 0); + end; +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.HandleKeyDown(const aMsg : TMsg; var aHandled : boolean); +var + TempMessage : TMessage; + TempKeyMsg : TWMKey; +begin + TempMessage.Msg := aMsg.message; + TempMessage.wParam := aMsg.wParam; + TempMessage.lParam := aMsg.lParam; + TempKeyMsg := TWMKey(TempMessage); + + if (TempKeyMsg.CharCode = VK_ESCAPE) then aHandled := True; +end; + +procedure TMainForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TMainForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TMainForm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage); +begin + CEFWindowParent1.UpdateSize; +end; + +procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TMainForm.Chromium1KeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out Result: Boolean); +var + TempMsg : TMsg; +begin + Result := False; + + if (event <> nil) and (osEvent <> nil) then + case osEvent.Message of + WM_KEYUP : + begin + TempMsg := osEvent^; + + HandleKeyUp(TempMsg, Result); + end; + + WM_KEYDOWN : + begin + TempMsg := osEvent^; + + HandleKeyDown(TempMsg, Result); + end; + end; +end; + +procedure TMainForm.Chromium1PreKeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out isKeyboardShortcut, Result: Boolean); +begin + Result := False; + + if (event <> nil) and + (event.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and + (event.windows_key_code = VK_ESCAPE) then + isKeyboardShortcut := True; +end; + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TMainForm.FormShow(Sender: TObject); +begin + Chromium1.DefaultUrl := 'https://www.google.com'; + + // 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.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. diff --git a/demos/Lazarus/JavaScript/JSDialog/00-Delete.bat b/demos/Lazarus/JavaScript/JSDialog/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lpi b/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lpi new file mode 100644 index 00000000..48592f1f --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSDialogBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="JSDialogBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSDialogBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSDialogBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSDialogBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lpr b/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lpr new file mode 100644 index 00000000..0e363fd0 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lpr @@ -0,0 +1,72 @@ +// ************************************************************************ +// ***************************** 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 JSDialogBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, + uJSDialogBrowser in 'uJSDialogBrowser.pas' {JSDialogBrowserFrm}; + +//{$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSDialogBrowserFrm, JSDialogBrowserFrm); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lps b/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lps new file mode 100644 index 00000000..c1fa7bd1 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/JSDialogBrowser.lps @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="JSDialogBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="36"/> + <CursorPos X="3" Y="53"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSDialogBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSDialogBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="69"/> + <CursorPos X="8" Y="103"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="3" HistoryIndex="2"> + <Position1> + <Filename Value="JSDialogBrowser.lpr"/> + </Position1> + <Position2> + <Filename Value="JSDialogBrowser.lpr"/> + <Caret Line="50" Column="3" TopLine="32"/> + </Position2> + <Position3> + <Filename Value="uJSDialogBrowser.pas"/> + <Caret Line="103" Column="8" TopLine="69"/> + </Position3> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSDialog/cef.inc b/demos/Lazarus/JavaScript/JSDialog/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSDialog/uJSDialogBrowser.lfm b/demos/Lazarus/JavaScript/JSDialog/uJSDialogBrowser.lfm new file mode 100644 index 00000000..0b656b3d --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/uJSDialogBrowser.lfm @@ -0,0 +1,68 @@ +object JSDialogBrowserFrm: TJSDialogBrowserFrm + Left = 161 + Height = 624 + Top = 157 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object ChromiumWindow1: TChromiumWindow + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + Align = alClient + TabOrder = 0 + OnClose = ChromiumWindow1Close + OnBeforeClose = ChromiumWindow1BeforeClose + OnAfterCreated = ChromiumWindow1AfterCreated + end + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 1 + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + TabOrder = 0 + Text = 'file:///JSDialog.html' + end + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 56 + top = 88 + end +end diff --git a/demos/Lazarus/JavaScript/JSDialog/uJSDialogBrowser.pas b/demos/Lazarus/JavaScript/JSDialog/uJSDialogBrowser.pas new file mode 100644 index 00000000..1cfcab53 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSDialog/uJSDialogBrowser.pas @@ -0,0 +1,297 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSDialogBrowser; + +{$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, uCEFChromiumWindow, uCEFInterfaces, uCEFTypes, uCEFConstants; + +const + CEFBROWSER_SHOWJSDIALOG = WM_APP + $101; + +type + TJSDialogBrowserFrm = class(TForm) + ChromiumWindow1: TChromiumWindow; + AddressPnl: TPanel; + AddressEdt: TEdit; + GoBtn: TButton; + Timer1: TTimer; + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ChromiumWindow1AfterCreated(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure ChromiumWindow1Close(Sender: TObject); + procedure ChromiumWindow1BeforeClose(Sender: TObject); + + protected + FJSDialogInfoCS : TCriticalSection; + FOriginUrl : ustring; + FMessageText : ustring; + FDefaultPromptText : ustring; + FPendingDlg : boolean; + FDialogType : TCefJsDialogType; + FCallback : ICefJsDialogCallback; + + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure Chromium_OnJsdialog(Sender: TObject; const browser: ICefBrowser; const originUrl: ustring; dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; const callback: ICefJsDialogCallback; out suppressMessage: Boolean; out Result: Boolean); + procedure Chromium_OnBeforePopup(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 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 ShowJSDialogMsg(var aMessage: TMessage); message CEFBROWSER_SHOWJSDIALOG; + + end; + +var + JSDialogBrowserFrm: TJSDialogBrowserFrm; + +implementation + +{$R *.lfm} + +uses + uCEFApplication; + +// This is a demo with custom JS dialogs + +// Destruction steps +// ================= +// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event. +// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event. +// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form. + +procedure TJSDialogBrowserFrm.FormCreate(Sender: TObject); +begin + FJSDialogInfoCS := TCriticalSection.Create; + FOriginUrl := ''; + FMessageText := ''; + FDefaultPromptText := ''; + FPendingDlg := False; + FDialogType := JSDIALOGTYPE_ALERT; + FCallback := nil; + FCanClose := False; + FClosing := False; +end; + +procedure TJSDialogBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + ChromiumWindow1.CloseBrowser(True); + end; +end; + +procedure TJSDialogBrowserFrm.FormDestroy(Sender: TObject); +begin + FreeAndNil(FJSDialogInfoCS); + FCallback := nil; +end; + +procedure TJSDialogBrowserFrm.FormShow(Sender: TObject); +begin + ChromiumWindow1.ChromiumBrowser.OnJsdialog := Chromium_OnJsdialog; + ChromiumWindow1.ChromiumBrowser.OnBeforePopup := Chromium_OnBeforePopup; + + // 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(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True; +end; + +procedure TJSDialogBrowserFrm.ChromiumWindow1AfterCreated(Sender: TObject); +begin + Caption := 'JS Dialog Browser'; + AddressPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSDialogBrowserFrm.GoBtnClick(Sender: TObject); +begin + ChromiumWindow1.LoadURL(AddressEdt.Text); +end; + +procedure TJSDialogBrowserFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(ChromiumWindow1.CreateBrowser) and not(ChromiumWindow1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSDialogBrowserFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TJSDialogBrowserFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TJSDialogBrowserFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSDialogBrowserFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSDialogBrowserFrm.Chromium_OnJsdialog(Sender : TObject; + const browser : ICefBrowser; + const originUrl : ustring; + dialogType : TCefJsDialogType; + const messageText : ustring; + const defaultPromptText : ustring; + const callback : ICefJsDialogCallback; + out suppressMessage : Boolean; + out Result : Boolean); +begin + // In this event we must store the dialog information and post a message to the main form to show the dialog + FJSDialogInfoCS.Acquire; + + if FPendingDlg then + begin + Result := False; + suppressMessage := True; + end + else + begin + FOriginUrl := originUrl; + FMessageText := messageText; + FDefaultPromptText := defaultPromptText; + FDialogType := dialogType; + FCallback := callback; + FPendingDlg := True; + Result := True; + suppressMessage := False; + + PostMessage(Handle, CEFBROWSER_SHOWJSDIALOG, 0, 0); + end; + + FJSDialogInfoCS.Release; +end; + +procedure TJSDialogBrowserFrm.ChromiumWindow1BeforeClose(Sender: TObject); +begin + FCanClose := True; + Close; +end; + +procedure TJSDialogBrowserFrm.ChromiumWindow1Close(Sender: TObject); +begin + // DestroyChildWindow will destroy the child window created by CEF at the top of the Z order. + if not(ChromiumWindow1.DestroyChildWindow) then + begin + FCanClose := True; + Close; + end; +end; + +procedure TJSDialogBrowserFrm.Chromium_OnBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSDialogBrowserFrm.ShowJSDialogMsg(var aMessage: TMessage); +var + TempCaption : string; +begin + // Here we show the dialog and reset the information. + // showmessage, MessageDlg and InputBox should be replaced by nicer custom forms with the same functionality. + + FJSDialogInfoCS.Acquire; + + if FPendingDlg then + begin + TempCaption := 'JavaScript message from : ' + FOriginUrl; + + case FDialogType of + JSDIALOGTYPE_ALERT : showmessage(TempCaption + CRLF + CRLF + FMessageText); + JSDIALOGTYPE_CONFIRM : FCallback.cont((MessageDlg(TempCaption + CRLF + CRLF + FMessageText, mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes), ''); + JSDIALOGTYPE_PROMPT : FCallback.cont(True, InputBox(TempCaption, FMessageText, FDefaultPromptText)); + end; + end; + + FOriginUrl := ''; + FMessageText := ''; + FDefaultPromptText := ''; + FPendingDlg := False; + FDialogType := JSDIALOGTYPE_ALERT; + FCallback := nil; + + FJSDialogInfoCS.Release; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSEval/00-Delete.bat b/demos/Lazarus/JavaScript/JSEval/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSEval/JSEval.lpi b/demos/Lazarus/JavaScript/JSEval/JSEval.lpi new file mode 100644 index 00000000..c82a1b62 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/JSEval.lpi @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSEval"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="JSEval.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSEval.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSEvalFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSEval"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSEval/JSEval.lpr b/demos/Lazarus/JavaScript/JSEval/JSEval.lpr new file mode 100644 index 00000000..5ac59f8e --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/JSEval.lpr @@ -0,0 +1,73 @@ +// ************************************************************************ +// ***************************** 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 JSEval; + +{$MODE Delphi} + +{$I cef.inc} + +uses + Forms, Windows, + LCLIntf, LCLType, LMessages, Interfaces, + uCEFApplication, + uJSEval in 'uJSEval.pas' {JSEvalFrm}, + uSimpleTextViewer in 'uSimpleTextViewer.pas' {SimpleTextViewerFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSEvalFrm, JSEvalFrm); + Application.CreateForm(TSimpleTextViewerFrm, SimpleTextViewerFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSEval/JSEval.lps b/demos/Lazarus/JavaScript/JSEval/JSEval.lps new file mode 100644 index 00000000..6a20ad49 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/JSEval.lps @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="8"> + <Unit0> + <Filename Value="JSEval.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="2"/> + <TopLine Value="44"/> + <CursorPos X="76" Y="60"/> + <UsageCount Value="21"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSEval.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSEvalFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="165"/> + <CursorPos X="52" Y="199"/> + <UsageCount Value="21"/> + <Bookmarks Count="1"> + <Item0 X="85" Y="473" ID="1"/> + </Bookmarks> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="-1"/> + <UsageCount Value="21"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\..\..\..\..\fpcsrc\packages\fcl-base\src\base64.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="34"/> + <CursorPos X="28" Y="89"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + <Unit4> + <Filename Value="C:\lazarus\fpc\3.0.4\source\packages\fcl-base\src\base64.pp"/> + <EditorIndex Value="-1"/> + <TopLine Value="25"/> + <CursorPos X="3" Y="33"/> + <UsageCount Value="10"/> + </Unit4> + <Unit5> + <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\objpas\classes\classesh.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="968"/> + <CursorPos X="14" Y="990"/> + <UsageCount Value="10"/> + </Unit5> + <Unit6> + <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\objpas\classes\streams.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="746"/> + <CursorPos X="3" Y="751"/> + <UsageCount Value="10"/> + </Unit6> + <Unit7> + <Filename Value="..\..\..\..\source\uCEFBinaryValue.pas"/> + <EditorIndex Value="1"/> + <TopLine Value="120"/> + <CursorPos Y="132"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit7> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="uJSEval.pas"/> + <Caret Line="162" Column="79" TopLine="150"/> + </Position1> + <Position2> + <Filename Value="uJSEval.pas"/> + <Caret Line="48" Column="83" TopLine="35"/> + </Position2> + <Position3> + <Filename Value="uJSEval.pas"/> + <Caret Line="466" Column="48" TopLine="435"/> + </Position3> + <Position4> + <Filename Value="uJSEval.pas"/> + <Caret Line="465" Column="36" TopLine="435"/> + </Position4> + <Position5> + <Filename Value="uJSEval.pas"/> + <Caret Line="475" Column="75" TopLine="441"/> + </Position5> + <Position6> + <Filename Value="uJSEval.pas"/> + <Caret Line="468" Column="40" TopLine="450"/> + </Position6> + <Position7> + <Filename Value="uJSEval.pas"/> + <Caret Line="62" Column="52" TopLine="43"/> + </Position7> + <Position8> + <Filename Value="uJSEval.pas"/> + <Caret Line="199" Column="51" TopLine="162"/> + </Position8> + <Position9> + <Filename Value="uJSEval.pas"/> + <Caret Line="228" Column="95" TopLine="196"/> + </Position9> + <Position10> + <Filename Value="uJSEval.pas"/> + <Caret Line="30" Column="122" TopLine="21"/> + </Position10> + <Position11> + <Filename Value="uJSEval.pas"/> + <Caret Line="55" Column="25" TopLine="21"/> + </Position11> + <Position12> + <Filename Value="uJSEval.pas"/> + <Caret Line="115" Column="25" TopLine="79"/> + </Position12> + <Position13> + <Filename Value="uJSEval.pas"/> + <Caret Line="15" Column="103"/> + </Position13> + <Position14> + <Filename Value="uJSEval.pas"/> + <Caret Line="64" Column="90" TopLine="26"/> + </Position14> + <Position15> + <Filename Value="uJSEval.pas"/> + <Caret Line="373" Column="76" TopLine="336"/> + </Position15> + <Position16> + <Filename Value="uJSEval.pas"/> + <Caret Line="470" Column="70" TopLine="433"/> + </Position16> + <Position17> + <Filename Value="uJSEval.pas"/> + <Caret Line="524" Column="40" TopLine="487"/> + </Position17> + <Position18> + <Filename Value="uJSEval.pas"/> + <Caret Line="555" Column="39" TopLine="518"/> + </Position18> + <Position19> + <Filename Value="uJSEval.pas"/> + <Caret Line="63" Column="18" TopLine="41"/> + </Position19> + <Position20> + <Filename Value="uJSEval.pas"/> + <Caret Line="373" Column="76" TopLine="336"/> + </Position20> + <Position21> + <Filename Value="JSEval.lpr"/> + <Caret Line="60" Column="76" TopLine="44"/> + </Position21> + <Position22> + <Filename Value="uJSEval.pas"/> + <Caret Line="125" Column="29" TopLine="114"/> + </Position22> + <Position23> + <Filename Value="uJSEval.pas"/> + <Caret Line="536" Column="38" TopLine="518"/> + </Position23> + <Position24> + <Filename Value="uJSEval.pas"/> + <Caret Line="511" Column="75" TopLine="499"/> + </Position24> + <Position25> + <Filename Value="uJSEval.pas"/> + <Caret Line="463" Column="50" TopLine="452"/> + </Position25> + <Position26> + <Filename Value="uJSEval.pas"/> + <Caret Line="372" TopLine="360"/> + </Position26> + <Position27> + <Filename Value="uJSEval.pas"/> + <Caret Line="54" Column="73" TopLine="24"/> + </Position27> + <Position28> + <Filename Value="uJSEval.pas"/> + <Caret Line="51" Column="90" TopLine="24"/> + </Position28> + <Position29> + <Filename Value="uJSEval.pas"/> + <Caret Line="59" Column="37" TopLine="24"/> + </Position29> + <Position30> + <Filename Value="uJSEval.pas"/> + <Caret Line="181" Column="63" TopLine="162"/> + </Position30> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSEval/cef.inc b/demos/Lazarus/JavaScript/JSEval/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSEval/uJSEval.lfm b/demos/Lazarus/JavaScript/JSEval/uJSEval.lfm new file mode 100644 index 00000000..098d163c --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/uJSEval.lfm @@ -0,0 +1,76 @@ +object JSEvalFrm: TJSEvalFrm + Left = 147 + Height = 571 + Top = 117 + Width = 878 + Caption = 'JSEval' + ClientHeight = 571 + ClientWidth = 878 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 550 + Top = 21 + Width = 878 + Align = alClient + TabOrder = 0 + end + object AddressBarPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 878 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 878 + DoubleBuffered = True + Enabled = False + ParentDoubleBuffered = False + TabOrder = 1 + object GoBtn: TButton + Left = 847 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 0 + end + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 847 + Align = alClient + TabOrder = 1 + Text = 'https://www.google.com' + end + end + object Chromium1: TChromium + OnProcessMessageReceived = Chromium1ProcessMessageReceived + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 16 + top = 40 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 16 + top = 96 + end +end diff --git a/demos/Lazarus/JavaScript/JSEval/uJSEval.pas b/demos/Lazarus/JavaScript/JSEval/uJSEval.pas new file mode 100644 index 00000000..e420911e --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/uJSEval.pas @@ -0,0 +1,565 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSEval; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Menus, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, base64, + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +const + MINIBROWSER_SHOWTEXTVIEWER = WM_APP + $101; + MINIBROWSER_EVALJSCODE = WM_APP + $102; + MINIBROWSER_JSBINPARAM = WM_APP + $103; + MINIBROWSER_GETSCROLLPOS = WM_APP + $104; + + MINIBROWSER_CONTEXTMENU_EVALJSCODE = MENU_ID_USER_FIRST + 1; + MINIBROWSER_CONTEXTMENU_JSBINPARAM = MENU_ID_USER_FIRST + 2; + MINIBROWSER_CONTEXTMENU_GETSCROLLPOS = MENU_ID_USER_FIRST + 3; + + EVAL_JS = 'JSContextEvalDemo'; + BINARY_PARAM_JS = 'JSBinaryParameter'; + +type + TJSEvalFrm = class(TForm) + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + AddressBarPnl: TPanel; + GoBtn: TButton; + AddressEdt: TEdit; + Timer1: TTimer; + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + + procedure Chromium1ProcessMessageReceived(Sender: TObject; + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage; out Result: Boolean); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); + procedure Timer1Timer(Sender: TObject); + 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 FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + + private + { Private declarations } + + protected + FText : string; + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + procedure ShowTextViewerMsg(var aMessage : TMessage); message MINIBROWSER_SHOWTEXTVIEWER; + procedure EvalJSCodeMsg(var aMessage : TMessage); message MINIBROWSER_EVALJSCODE; + procedure GetScrollPosMsg(var aMessage : TMessage); message MINIBROWSER_GETSCROLLPOS; + procedure EvalJSBinParamMsg(var aMessage : TMessage); message MINIBROWSER_JSBINPARAM; + 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; + end; + +var + JSEvalFrm: TJSEvalFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uSimpleTextViewer, uCEFProcessMessage, uCEFBinaryValue, uCEFMiscFunctions; + +// 99.9% of the code in this demo was created by xpert13 and shared in the CEF4Delphi forum. + +// Steps to evaluate some JavaScript code using the V8Context +// ---------------------------------------------------------- +// 1. Set GlobalCEFApp.OnProcessMessageReceived to RenderProcessHandler_OnProcessMessageReceivedEvent. +// 2. To get the Javascript code in this demo we use a context menu that sends a MINIBROWSER_EVALJSCODE to the form. +// 3. The EvalJSCodeMsg asks for the Javascript code and sends it to the renderer using a process message. +// 4. RenderProcessHandler_OnProcessMessageReceivedEvent receives the process message and calls ParseEvalJsAnswer +// to evaluate the code. +// 5. ParseEvalJsAnswer evaluates the code and sends a message with the results to the browser process using a +// process message. +// 6. Chromium1ProcessMessageReceived receives the message, stores the results and sends a +// MINIBROWSER_SHOWTEXTVIEWER message to the form. +// 7. ShowTextViewerMsg shows the results safely using a SimpleTextViewer. + + +// This demo also has an example of binary parameters in process messages +// ---------------------------------------------------------------------- +// 1. Set GlobalCEFApp.OnProcessMessageReceived to RenderProcessHandler_OnProcessMessageReceivedEvent. +// 2. The context menu has a 'Send JPEG image' option that sends a MINIBROWSER_JSBINPARAM message to the form. +// 3. EvalJSBinParamMsg asks for a JPEG image and sends a process message with a ICefBinaryValue parameter to the +// renderer process. +// 4. The renderer process parses the binary parameter in the ParseBinaryValue function and sends back the image +// size and encoded image data to the browser process. +// 5. Chromium1ProcessMessageReceived receives the message, stores the results and sends a +// MINIBROWSER_SHOWTEXTVIEWER message to the form. +// 6. ShowTextViewerMsg shows the results safely using a SimpleTextViewer. + + +// About binary parameters +// ----------------------- +// There is a size limit in the binary parameters of only a few kilobytes. +// For more info and alternatives read this thread in the official CEF3 forum : +// http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10590 +// +// Compress the binary data if necessary! + + +// 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 TJSEvalFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSEvalFrm.Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSEvalFrm.Chromium1BeforeContextMenu(Sender : TObject; + const browser : ICefBrowser; + const frame : ICefFrame; + const params : ICefContextMenuParams; + const model : ICefMenuModel); +begin + model.AddItem(MINIBROWSER_CONTEXTMENU_EVALJSCODE, 'Evaluate JavaScript code...'); + model.AddItem(MINIBROWSER_CONTEXTMENU_GETSCROLLPOS, 'Get vertical scroll position...'); + // TODO: Fix bug in creating a TCefBinaryValueRef + //model.AddItem(MINIBROWSER_CONTEXTMENU_JSBINPARAM, 'Send JPEG image...'); +end; + +procedure TJSEvalFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSEvalFrm.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSEvalFrm.Chromium1ContextMenuCommand(Sender : TObject; + const browser : ICefBrowser; + const frame : ICefFrame; + const params : ICefContextMenuParams; + commandId : Integer; + eventFlags : Cardinal; + out Result : Boolean); +begin + Result := False; + + case commandId of + MINIBROWSER_CONTEXTMENU_EVALJSCODE : PostMessage(Handle, MINIBROWSER_EVALJSCODE, 0, 0); + MINIBROWSER_CONTEXTMENU_JSBINPARAM : PostMessage(Handle, MINIBROWSER_JSBINPARAM, 0, 0); + MINIBROWSER_CONTEXTMENU_GETSCROLLPOS : PostMessage(Handle, MINIBROWSER_GETSCROLLPOS, 0, 0); + end; +end; + +procedure TJSEvalFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSEvalFrm.FormShow(Sender: TObject); +begin + // 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 TJSEvalFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(AddressEdt.Text); +end; + +procedure TJSEvalFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + CEFWindowParent1.UpdateSize; + AddressBarPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSEvalFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TJSEvalFrm.ShowTextViewerMsg(var aMessage : TMessage); +begin + SimpleTextViewerFrm.Memo1.Lines.Text := FText; + SimpleTextViewerFrm.ShowModal; +end; + +procedure TJSEvalFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSEvalFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSEvalFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSEvalFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSEvalFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSEvalFrm.EvalJSCodeMsg(var aMessage : TMessage); +var + TempMsg : ICefProcessMessage; + TempScript : string; +begin + TempScript := InputBox('JSEval demo', 'Please type some JavaScript code', 'document.title;'); + + if (length(TempScript) > 0) then + begin + TempMsg := TCefProcessMessageRef.New(EVAL_JS); + + if TempMsg.ArgumentList.SetString(0, TempScript) then + Chromium1.SendProcessMessage(PID_RENDERER, TempMsg); + end; +end; + +procedure TJSEvalFrm.GetScrollPosMsg(var aMessage : TMessage); +var + TempMsg : ICefProcessMessage; +begin + TempMsg := TCefProcessMessageRef.New(EVAL_JS); + + if TempMsg.ArgumentList.SetString(0, 'window.pageYOffset') then + Chromium1.SendProcessMessage(PID_RENDERER, TempMsg); +end; + +procedure TJSEvalFrm.EvalJSBinParamMsg(var aMessage : TMessage); +var + TempMsg : ICefProcessMessage; + TempOpenDialog : TOpenDialog; + TempStream : TFileStream; + TempBinValue : ICefBinaryValue; + TempBuffer : TBytes; + TempSize : NativeUInt; + TempPointer : pointer; +begin + TempOpenDialog := nil; + TempStream := nil; + + try + try + TempOpenDialog := TOpenDialog.Create(nil); + TempOpenDialog.Filter := 'JPEG files (*.jpg)|*.JPG'; + + if TempOpenDialog.Execute then + begin + TempStream := TFileStream.Create(TempOpenDialog.FileName, fmOpenRead); + TempSize := TempStream.Size; + + if (TempSize > 0) then + begin + SetLength(TempBuffer, TempSize); + TempSize := TempStream.Read(TempBuffer, TempSize); + + if (TempSize > 0) then + begin + TempPointer := @TempBuffer[0]; + TempBinValue := TCefBinaryValueRef.New(TempPointer, TempSize); + TempMsg := TCefProcessMessageRef.New(BINARY_PARAM_JS); + + if TempMsg.ArgumentList.SetBinary(0, TempBinValue) then + Chromium1.SendProcessMessage(PID_RENDERER, TempMsg); + end; + end; + end; + except + on e : exception do + if CustomExceptionHandler('TJSEvalFrm.EvalJSBinParamMsg', e) then raise; + end; + finally + if (TempOpenDialog <> nil) then FreeAndNil(TempOpenDialog); + if (TempStream <> nil) then FreeAndNil(TempStream); + SetLength(TempBuffer, 0); + end; +end; + +procedure ParseEvalJsAnswer(const pMessage : ICefProcessMessage; + pBrowser : ICefBrowser; + pReturnValue : ICefv8Value; + pException : ICefV8Exception); +var + pAnswer : ICefProcessMessage; + strResult : String; + bGoodDataType : Boolean; +begin + pAnswer := TCefProcessMessageRef.New(EVAL_JS); + + if (pReturnValue = nil) or not(pReturnValue.IsValid) then + begin + pAnswer.ArgumentList.SetBool(0, false); + pAnswer.ArgumentList.SetString(1, pException.Message); + end + else + begin + bGoodDataType := True; + + if pReturnValue.IsString then strResult := pReturnValue.GetStringValue + else if pReturnValue.IsBool then strResult := BoolToStr(pReturnValue.GetBoolValue) + else if pReturnValue.IsInt then strResult := IntToStr(pReturnValue.GetIntValue) + else if pReturnValue.IsUInt then strResult := IntToStr(pReturnValue.GetUIntValue) + else if pReturnValue.IsDouble then strResult := FloatToStr(pReturnValue.GetDoubleValue) + else bGoodDataType := False; + + if bGoodDataType then + begin + pAnswer.ArgumentList.SetBool(0, true); + pAnswer.ArgumentList.SetString(1, strResult); + end + else + begin + pAnswer.ArgumentList.SetBool(0, false); + pAnswer.ArgumentList.SetString(1, 'Result data type need to be string, int, uint or double!'); + end; + end; + + pBrowser.SendProcessMessage(PID_BROWSER, pAnswer); +end; + +procedure ParseBinaryValue(const pBrowser : ICefBrowser; const aBinaryValue : ICefBinaryValue); +var + pAnswer : ICefProcessMessage; + TempBuffer : TBytes; + TempPointer : pointer; + TempSize : NativeUInt; + TempString : string; + TempDecodedStream : TMemoryStream; + TempEncodedStream : TStringStream; + TempEncoder : TBase64EncodingStream; +begin + TempDecodedStream := nil; + TempEncodedStream := nil; + TempEncoder := nil; + + if (aBinaryValue = nil) then exit; + + try + try + TempSize := aBinaryValue.GetSize; + + if (TempSize > 0) then + begin + SetLength(TempBuffer, TempSize); + TempPointer := @TempBuffer[0]; + TempSize := aBinaryValue.GetData(TempPointer, TempSize, 0); + + if (TempSize > 0) then + begin + TempDecodedStream := TMemoryStream.Create(); + TempDecodedStream.write(TempPointer, TempSize); + TempDecodedStream.position := 0; + + TempEncodedStream := TStringStream.Create(''); + TempEncoder := TBase64EncodingStream.Create(TempEncodedStream); + TempEncoder.CopyFrom(TempDecodedStream, TempDecodedStream.Size); + + pAnswer := TCefProcessMessageRef.New(BINARY_PARAM_JS); + TempString := 'Image size : ' + inttostr(TempSize) + #13 + #10 + + 'Encoded image : ' + TempEncodedStream.DataString; + + if pAnswer.ArgumentList.SetString(0, TempString) then + pBrowser.SendProcessMessage(PID_BROWSER, pAnswer); + end; + end; + except + on e : exception do + if CustomExceptionHandler('ParseBinaryValue', e) then raise; + end; + finally + if (TempDecodedStream <> nil) then FreeAndnil(TempDecodedStream); + if (TempEncodedStream <> nil) then FreeAndnil(TempEncodedStream); + if (TempEncoder <> nil) then FreeAndnil(TempEncoder); + SetLength(TempBuffer, 0); + end; +end; + +procedure RenderProcessHandler_OnProcessMessageReceivedEvent(const pBrowser : ICefBrowser; + uSourceProcess : TCefProcessId; + const pMessage : ICefProcessMessage; + var aHandled : boolean); +var + pV8Context : ICefv8Context; + pReturnValue : ICefv8Value; + pException : ICefV8Exception; + TempScript : string; + TempBinValue : ICefBinaryValue; +begin + aHandled := False; + + if (pMessage = nil) or (pMessage.ArgumentList = nil) then exit; + + if (pMessage.Name = EVAL_JS) then + begin + TempScript := pMessage.ArgumentList.GetString(0); + + if (length(TempScript) > 0) then + begin + pV8Context := pBrowser.MainFrame.GetV8Context; + + if pV8Context.Enter then + begin + pV8Context.Eval(TempScript, '', 1, pReturnValue, pException); + ParseEvalJsAnswer(pMessage, pBrowser, pReturnValue, pException); + pV8Context.Exit; + end; + end; + + aHandled := True; + end + else + if (pMessage.Name = BINARY_PARAM_JS) then + begin + TempBinValue := pMessage.ArgumentList.GetBinary(0); + ParseBinaryValue(pBrowser, TempBinValue); + aHandled := True; + end; +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnProcessMessageReceived := RenderProcessHandler_OnProcessMessageReceivedEvent; + GlobalCEFApp.SingleProcess := True; +end; + +procedure TJSEvalFrm.Chromium1ProcessMessageReceived(Sender : TObject; + const browser : ICefBrowser; + sourceProcess : TCefProcessId; + const message : ICefProcessMessage; + out Result : Boolean); +begin + Result := False; + + if (message = nil) or (message.ArgumentList = nil) then exit; + + if (message.Name = EVAL_JS) then + begin + FText := message.ArgumentList.GetString(1); + PostMessage(Handle, MINIBROWSER_SHOWTEXTVIEWER, 0, 0); + Result := True; + end + else + if (message.Name = BINARY_PARAM_JS) then + begin + FText := message.ArgumentList.GetString(0); + PostMessage(Handle, MINIBROWSER_SHOWTEXTVIEWER, 0, 0); + Result := True; + end; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSEval/uSimpleTextViewer.lfm b/demos/Lazarus/JavaScript/JSEval/uSimpleTextViewer.lfm new file mode 100644 index 00000000..54ab49b5 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/uSimpleTextViewer.lfm @@ -0,0 +1,27 @@ +object SimpleTextViewerFrm: TSimpleTextViewerFrm + Left = 0 + Height = 572 + Top = 0 + Width = 694 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'Simple text viewer' + ClientHeight = 572 + ClientWidth = 694 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Position = poScreenCenter + LCLVersion = '2.0.1.0' + object Memo1: TMemo + Left = 0 + Height = 572 + Top = 0 + Width = 694 + Align = alClient + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end +end diff --git a/demos/Lazarus/JavaScript/JSEval/uSimpleTextViewer.pas b/demos/Lazarus/JavaScript/JSEval/uSimpleTextViewer.pas new file mode 100644 index 00000000..9db77fcb --- /dev/null +++ b/demos/Lazarus/JavaScript/JSEval/uSimpleTextViewer.pas @@ -0,0 +1,33 @@ +unit uSimpleTextViewer; + +{$MODE Delphi} + +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; + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls; + {$ENDIF} + + +type + TSimpleTextViewerFrm = class(TForm) + Memo1: TMemo; + private + { Private declarations } + public + { Public declarations } + end; + +var + SimpleTextViewerFrm: TSimpleTextViewerFrm; + +implementation + +{$R *.lfm} + +end. diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/00-Delete.bat b/demos/Lazarus/JavaScript/JSExecutingFunctions/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lpi b/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lpi new file mode 100644 index 00000000..e253da11 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSExecutingFunctions"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="JSExecutingFunctions.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSExecutingFunctions.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExecutingFunctionsFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSExecutingFunctions"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lpr b/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lpr new file mode 100644 index 00000000..3ab00e8c --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 JSExecutingFunctions; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSExecutingFunctions in 'uJSExecutingFunctions.pas' {JSExecutingFunctionsFrm}, + uMyV8Handler in 'uMyV8Handler.pas'; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSExecutingFunctionsFrm, JSExecutingFunctionsFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lps b/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lps new file mode 100644 index 00000000..e4d46c1b --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/JSExecutingFunctions.lps @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="5"> + <Unit0> + <Filename Value="JSExecutingFunctions.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="41"/> + <CursorPos X="17" Y="59"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSExecutingFunctions.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExecutingFunctionsFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="157"/> + <CursorPos X="73" Y="175"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\..\source\uCEFApplication.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="418"/> + <CursorPos X="16" Y="434"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + <Unit4> + <Filename Value="..\..\..\source\uCEFInterfaces.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="146"/> + <CursorPos X="188" Y="166"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit4> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="uJSExecutingFunctions.pas"/> + </Position1> + <Position2> + <Filename Value="uJSExecutingFunctions.pas"/> + <Caret Line="175" Column="73" TopLine="157"/> + </Position2> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/cef.inc b/demos/Lazarus/JavaScript/JSExecutingFunctions/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.lfm b/demos/Lazarus/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.lfm new file mode 100644 index 00000000..b349b5ce --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.lfm @@ -0,0 +1,75 @@ +object JSExecutingFunctionsFrm: TJSExecutingFunctionsFrm + Left = 188 + Height = 587 + Top = 128 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 587 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSExecutingFunctions.html' + end + object GoBtn: TButton + Left = 947 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 566 + Top = 21 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas b/demos/Lazarus/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas new file mode 100644 index 00000000..4dbcf970 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/uJSExecutingFunctions.pas @@ -0,0 +1,320 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSExecutingFunctions; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, + uCEFConstants, uCEFv8Value, uCEFWinControl; + +const + JSDEMO_CONTEXTMENU_EXECFUNCTION = MENU_ID_USER_FIRST + 1; + + EXECFUNCTION_MSGNAME = 'execfunction'; + +type + TJSExecutingFunctionsFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: 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 FormDestroy(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure FormCreate(Sender: TObject); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSExecutingFunctionsFrm : TJSExecutingFunctionsFrm; + GlobalCallbackFunc : ICefv8Value = nil; + GlobalCallbackContext : ICefv8Context = nil; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that registers 'myfunc()' using +// a "register" function we previously binded to the window in the +// GlobalCEFApp.OnContextCreated event. + +// After registering the function you can right-click over the demo and +// select "Execute registered JS function" to execute the function. + +// This will send a process message to the "render" where the function can +// be executed. + +// 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. + +uses + uCEFProcessMessage, uMyV8Handler; + +procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); +var + TempHandler : ICefv8Handler; + TempFunction : ICefv8Value; +begin + TempHandler := TMyV8Handler.Create; + TempFunction := TCefv8ValueRef.NewFunction('register', TempHandler); + + context.Global.SetValueByKey('register', TempFunction, V8_PROPERTY_ATTRIBUTE_NONE); +end; + +procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser; + sourceProcess : TCefProcessId; + const aMessage : ICefProcessMessage; + var aHandled : boolean); +var + arguments: TCefv8ValueArray; +begin + if (aMessage.name = EXECFUNCTION_MSGNAME) then + begin + if (GlobalCallbackFunc <> nil) then + GlobalCallbackFunc.ExecuteFunctionWithContext(GlobalCallbackContext, nil, arguments); + + aHandled := True; + end + else + aHandled := False; +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated; + GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived; +end; + +procedure TJSExecutingFunctionsFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSExecutingFunctionsFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSExecutingFunctionsFrm.Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSExecutingFunctionsFrm.Chromium1BeforeContextMenu( + Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + model.AddSeparator; + model.AddItem(JSDEMO_CONTEXTMENU_EXECFUNCTION, 'Execute registered JS function'); +end; + +procedure TJSExecutingFunctionsFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSExecutingFunctionsFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSExecutingFunctionsFrm.Chromium1ContextMenuCommand( + Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); +var + TempMsg : ICefProcessMessage; +begin + Result := False; + + case commandId of + JSDEMO_CONTEXTMENU_EXECFUNCTION : + begin + TempMsg := TCefProcessMessageRef.New(EXECFUNCTION_MSGNAME); + Chromium1.SendProcessMessage(PID_RENDERER, TempMsg); + end; + end; +end; + +procedure TJSExecutingFunctionsFrm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSExecutingFunctionsFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSExecutingFunctionsFrm.FormDestroy(Sender: TObject); +begin + GlobalCallbackFunc := nil; + GlobalCallbackContext := nil; +end; + +procedure TJSExecutingFunctionsFrm.FormShow(Sender: TObject); +begin + // 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 TJSExecutingFunctionsFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExecutingFunctionsFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExecutingFunctionsFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSExecutingFunctionsFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSExecutingFunctionsFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSExecutingFunctionsFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSExecutingFunctions'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSExecutingFunctionsFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSExecutingFunctions/uMyV8Handler.pas b/demos/Lazarus/JavaScript/JSExecutingFunctions/uMyV8Handler.pas new file mode 100644 index 00000000..81c942af --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExecutingFunctions/uMyV8Handler.pas @@ -0,0 +1,79 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMyV8Handler; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + uCEFv8Context, uCEFTypes, uCEFInterfaces, uCEFv8Value, uCEFv8Handler; + +type + TMyV8Handler = class(TCefv8HandlerOwn) + protected + function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override; + end; + +implementation + +uses + uJSExecutingFunctions; + +function TMyV8Handler.Execute(const name : ustring; + const obj : ICefv8Value; + const arguments : TCefv8ValueArray; + var retval : ICefv8Value; + var exception : ustring): Boolean; +begin + Result := False; + + if (name = 'register') and + (length(arguments) = 1) and + arguments[0].IsFunction then + begin + GlobalCallbackFunc := arguments[0]; + GlobalCallbackContext := TCefv8ContextRef.Current; + Result := True; + end; +end; + + +end. diff --git a/demos/Lazarus/JavaScript/JSExtension/00-Delete.bat b/demos/Lazarus/JavaScript/JSExtension/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSExtension/JSExtension.lpi b/demos/Lazarus/JavaScript/JSExtension/JSExtension.lpi new file mode 100644 index 00000000..35a99d6d --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/JSExtension.lpi @@ -0,0 +1,102 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSExtension"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="4"> + <Unit0> + <Filename Value="JSExtension.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSExtension.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExtensionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uTestExtensionHandler.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + <Unit3> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit3> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSExtension"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExtension/JSExtension.lpr b/demos/Lazarus/JavaScript/JSExtension/JSExtension.lpr new file mode 100644 index 00000000..f30845fb --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/JSExtension.lpr @@ -0,0 +1,79 @@ +// ************************************************************************ +// ***************************** 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 JSExtension; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSExtension in 'uJSExtension.pas' {JSExtensionFrm}, + uTestExtensionHandler in 'uTestExtensionHandler.pas', + uSimpleTextViewer in 'uSimpleTextViewer.pas' {SimpleTextViewerFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSExtensionFrm, JSExtensionFrm); + Application.CreateForm(TSimpleTextViewerFrm, SimpleTextViewerFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSExtension/JSExtension.lps b/demos/Lazarus/JavaScript/JSExtension/JSExtension.lps new file mode 100644 index 00000000..5fbe4c34 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/JSExtension.lps @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="4"> + <Unit0> + <Filename Value="JSExtension.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="42"/> + <CursorPos X="17" Y="60"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSExtension.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExtensionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="377"/> + <CursorPos X="20" Y="410"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uTestExtensionHandler.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSExtension.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExtension/cef.inc b/demos/Lazarus/JavaScript/JSExtension/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSExtension/uJSExtension.lfm b/demos/Lazarus/JavaScript/JSExtension/uJSExtension.lfm new file mode 100644 index 00000000..2ea4853c --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/uJSExtension.lfm @@ -0,0 +1,84 @@ +object JSExtensionFrm: TJSExtensionFrm + Left = 185 + Height = 589 + Top = 131 + Width = 978 + Caption = 'JSExtension' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'http://www.google.com' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 538 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object StatusPnl: TPanel + Left = 0 + Height = 21 + Top = 568 + Width = 978 + Align = alBottom + BevelOuter = bvLowered + TabOrder = 2 + end + object Chromium1: TChromium + OnProcessMessageReceived = Chromium1ProcessMessageReceived + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSExtension/uJSExtension.pas b/demos/Lazarus/JavaScript/JSExtension/uJSExtension.pas new file mode 100644 index 00000000..cbf2c3f4 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/uJSExtension.pas @@ -0,0 +1,421 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSExtension; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +const + MINIBROWSER_SHOWTEXTVIEWER = WM_APP + $100; + + MINIBROWSER_CONTEXTMENU_SETJSEVENT = MENU_ID_USER_FIRST + 1; + MINIBROWSER_CONTEXTMENU_JSVISITDOM = MENU_ID_USER_FIRST + 2; + + MOUSEOVER_MESSAGE_NAME = 'mouseover'; + CUSTOMNAME_MESSAGE_NAME = 'customname'; + +type + + { TJSExtensionFrm } + + TJSExtensionFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + StatusPnl: TPanel; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); + procedure Chromium1ProcessMessageReceived(Sender: TObject; + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage; out Result: Boolean); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + FText : string; + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + procedure ShowTextViewerMsg(var aMessage : TMessage); message MINIBROWSER_SHOWTEXTVIEWER; + 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; + public + { Public declarations } + end; + +var + JSExtensionFrm: TJSExtensionFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uSimpleTextViewer, uCEFMiscFunctions, uTestExtensionHandler; + +// To test this demo follow these steps : +// ====================================== +// 1. Run the demo and wait until google.com is loaded +// 2. Right-click and select the "Set the mouseover event" menu option. +// 3. Move the mouse pointer over the web page and see the HTML elements in the status bar. + +// The CEF3 document describing extensions is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The Chromium project document describing Chromium's architecture is here : +// http://www.chromium.org/developers/design-documents/multi-process-architecture + +// This demo has a JavaScript extension class that is registered in the +// GlobalCEFApp.OnWebKitInitialized event when the application is initializing. + +// The extension in this demo is called "myextension" and it has 2 functions called +// "mouseover" and "sendresulttobrowser". + +// When the JavaScript code uses those functions it executes the TTestExtensionHandler.Execute +// function in uTestExtensionHandler.pas. + +// When you run this demo and you select the "Set the mouseover event" menu option, the +// TChromium.OnContextMenuCommand event is triggered and it adds an event listener to the +// document's body. That listener calls one of the functions available in the registered +// extension called "myextension.mouseover". + +// The TTestExtensionHandler.Execute function is executed in the renderer process and it +// can use the TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg) function +// to send a message with the results to the browser process. + +// TCefv8ContextRef.Current returns the v8 context for the frame that is currently +// executing JavaScript, TCefv8ContextRef.Current.Browser.SendProcessMessage sends a message +// to the right browser even if you have created several browsers in one app. + +// That message is received in the TChromium.OnProcessMessageReceived event. +// Even if you create several TChromium objects you should have no problem because each of +// them will have its own TChromium.OnProcessMessageReceived event to receive the messages +// from the extension. + +// TChromium.OnProcessMessageReceived receives that message and shows the information in +// the status bar. + +// If you have to debug the code executed by the extension you will need to use the +// debugging methods described in +// https://www.briskbard.com/index.php?lang=en&pageid=cef + +// 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 GlobalCEFApp_OnWebKitInitialized; +var + TempExtensionCode : string; + TempHandler : ICefv8Handler; +begin + // This is a JS extension example with 2 functions and several parameters. + // Please, read the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempExtensionCode := 'var myextension;' + + 'if (!myextension)' + + ' myextension = {};' + + '(function() {' + + ' myextension.mouseover = function(a) {' + + ' native function mouseover();' + + ' mouseover(a);' + + ' };' + + ' myextension.sendresulttobrowser = function(b,c) {' + + ' native function sendresulttobrowser();' + + ' sendresulttobrowser(b,c);' + + ' };' + + '})();'; + + try + TempHandler := TTestExtensionHandler.Create; + CefRegisterExtension('myextension', TempExtensionCode, TempHandler); + finally + TempHandler := nil; + end; +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitialized; + + {$IFDEF INTFLOG} + GlobalCEFApp.LogFile := 'debug.log'; + GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; + {$ENDIF} +end; + +procedure TJSExtensionFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSExtensionFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSExtensionFrm.Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSExtensionFrm.Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + // Adding some custom context menu entries + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_SETJSEVENT, 'Set mouseover event'); + model.AddItem(MINIBROWSER_CONTEXTMENU_JSVISITDOM, 'Visit DOM in JavaScript'); +end; + +procedure TJSExtensionFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSExtensionFrm.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSExtensionFrm.Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); +begin + Result := False; + + // Here is the code executed for each custom context menu entry + + case commandId of + MINIBROWSER_CONTEXTMENU_SETJSEVENT : + if (browser <> nil) and (browser.MainFrame <> nil) then + browser.MainFrame.ExecuteJavaScript( + 'document.body.addEventListener("mouseover", function(evt){'+ + 'function getpath(n){'+ + 'var ret = "<" + n.nodeName + ">";'+ + 'if (n.parentNode){return getpath(n.parentNode) + ret} else '+ + 'return ret'+ + '};'+ + 'myextension.mouseover(getpath(evt.target))}'+ // This is the call from JavaScript to the extension with DELPHI code in uTestExtensionHandler.pas + ')', 'about:blank', 0); + + MINIBROWSER_CONTEXTMENU_JSVISITDOM : + if (browser <> nil) and (browser.MainFrame <> nil) then + browser.MainFrame.ExecuteJavaScript( + 'var testhtml = document.body.innerHTML;' + + 'myextension.sendresulttobrowser(testhtml, ' + quotedstr(CUSTOMNAME_MESSAGE_NAME) + ');', // This is the call from JavaScript to the extension with DELPHI code in uTestExtensionHandler.pas + 'about:blank', 0); + end; +end; + +procedure TJSExtensionFrm.Chromium1ProcessMessageReceived(Sender: TObject; + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage; out Result: Boolean); +begin + Result := False; + + if (message = nil) or (message.ArgumentList = nil) then exit; + + // This function receives the messages with the JavaScript results + + // Many of these events are received in different threads and the VCL + // doesn't like to create and destroy components in different threads. + + // It's safer to store the results and send a message to the main thread to show them. + + // The message names are defined in the extension or in JS code. + + if (message.Name = MOUSEOVER_MESSAGE_NAME) then + begin + StatusPnl.Caption := message.ArgumentList.GetString(0); // this doesn't create/destroy components + Result := True; + end + else + if (message.Name = CUSTOMNAME_MESSAGE_NAME) then + begin + FText := message.ArgumentList.GetString(0); + PostMessage(Handle, MINIBROWSER_SHOWTEXTVIEWER, 0, 0); + Result := True; + end; +end; + +procedure TJSExtensionFrm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSExtensionFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSExtensionFrm.FormShow(Sender: TObject); +begin + StatusPnl.Caption := 'Initializing browser. Please wait...'; + + // 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 TJSExtensionFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExtensionFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExtensionFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSExtensionFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSExtensionFrm.ShowTextViewerMsg(var aMessage : TMessage); +begin + // This form will show the HTML received from JavaScript + SimpleTextViewerFrm.Memo1.Lines.Text := FText; + SimpleTextViewerFrm.ShowModal; +end; + +procedure TJSExtensionFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSExtensionFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + StatusPnl.Caption := ''; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSExtensionFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSExtension/uSimpleTextViewer.lfm b/demos/Lazarus/JavaScript/JSExtension/uSimpleTextViewer.lfm new file mode 100644 index 00000000..54ab49b5 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/uSimpleTextViewer.lfm @@ -0,0 +1,27 @@ +object SimpleTextViewerFrm: TSimpleTextViewerFrm + Left = 0 + Height = 572 + Top = 0 + Width = 694 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'Simple text viewer' + ClientHeight = 572 + ClientWidth = 694 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Position = poScreenCenter + LCLVersion = '2.0.1.0' + object Memo1: TMemo + Left = 0 + Height = 572 + Top = 0 + Width = 694 + Align = alClient + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end +end diff --git a/demos/Lazarus/JavaScript/JSExtension/uSimpleTextViewer.pas b/demos/Lazarus/JavaScript/JSExtension/uSimpleTextViewer.pas new file mode 100644 index 00000000..9db77fcb --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/uSimpleTextViewer.pas @@ -0,0 +1,33 @@ +unit uSimpleTextViewer; + +{$MODE Delphi} + +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; + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls; + {$ENDIF} + + +type + TSimpleTextViewerFrm = class(TForm) + Memo1: TMemo; + private + { Private declarations } + public + { Public declarations } + end; + +var + SimpleTextViewerFrm: TSimpleTextViewerFrm; + +implementation + +{$R *.lfm} + +end. diff --git a/demos/Lazarus/JavaScript/JSExtension/uTestExtensionHandler.pas b/demos/Lazarus/JavaScript/JSExtension/uTestExtensionHandler.pas new file mode 100644 index 00000000..7769328c --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtension/uTestExtensionHandler.pas @@ -0,0 +1,103 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uTestExtensionHandler; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + {$IFDEF DELPHI16_UP} + Winapi.Windows, + {$ELSE} + LCLIntf, LCLType, LMessages, + {$ENDIF} + uCEFRenderProcessHandler, uCEFBrowserProcessHandler, uCEFInterfaces, uCEFProcessMessage, + uCEFv8Context, uCEFTypes, uCEFv8Handler; + +type + TTestExtensionHandler = class(TCefv8HandlerOwn) + protected + function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override; + end; + +implementation + +uses + uCEFMiscFunctions, uCEFConstants, uJSExtension; + +function TTestExtensionHandler.Execute(const name : ustring; + const obj : ICefv8Value; + const arguments : TCefv8ValueArray; + var retval : ICefv8Value; + var exception : ustring): Boolean; +var + msg: ICefProcessMessage; +begin + if (name = 'mouseover') then + begin + if (length(arguments) > 0) and arguments[0].IsString then + begin + msg := TCefProcessMessageRef.New(MOUSEOVER_MESSAGE_NAME); + msg.ArgumentList.SetString(0, arguments[0].GetStringValue); + + TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg); + end; + + Result := True; + end + else + if (name = 'sendresulttobrowser') then + begin + if (length(arguments) > 1) and arguments[0].IsString and arguments[1].IsString then + begin + msg := TCefProcessMessageRef.New(arguments[1].GetStringValue); + msg.ArgumentList.SetString(0, arguments[0].GetStringValue); + + TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg); + end; + + Result := True; + end + else + Result := False; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/00-Delete.bat b/demos/Lazarus/JavaScript/JSExtensionWithFunction/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lpi b/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lpi new file mode 100644 index 00000000..eeda7ca1 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSExtensionWithFunction"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="JSExtensionWithFunction.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSExtensionWithFunction.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExtensionWithFunctionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSExtensionWithFunction"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lpr b/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lpr new file mode 100644 index 00000000..7ae9f838 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 JSExtensionWithFunction; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSExtensionWithFunction in 'uJSExtensionWithFunction.pas' {JSExtensionWithFunctionFrm}, + uMyV8Handler in 'uMyV8Handler.pas'; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSExtensionWithFunctionFrm, JSExtensionWithFunctionFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lps b/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lps new file mode 100644 index 00000000..2dec9a7c --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/JSExtensionWithFunction.lps @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="5"> + <Unit0> + <Filename Value="JSExtensionWithFunction.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="41"/> + <CursorPos X="17" Y="59"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSExtensionWithFunction.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExtensionWithFunctionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="107"/> + <CursorPos X="11" Y="125"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\..\source\uCEFApplication.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="415"/> + <CursorPos X="16" Y="431"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + <Unit4> + <Filename Value="..\..\..\source\uCEFInterfaces.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="140"/> + <CursorPos X="3" Y="157"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit4> + </Units> + <JumpHistory Count="3" HistoryIndex="2"> + <Position1> + <Filename Value="uJSExtensionWithFunction.pas"/> + </Position1> + <Position2> + <Filename Value="uJSExtensionWithFunction.pas"/> + <Caret Line="151" Column="39" TopLine="133"/> + </Position2> + <Position3> + <Filename Value="uJSExtensionWithFunction.pas"/> + <Caret Line="151" Column="39" TopLine="133"/> + </Position3> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/cef.inc b/demos/Lazarus/JavaScript/JSExtensionWithFunction/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.lfm b/demos/Lazarus/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.lfm new file mode 100644 index 00000000..8747770e --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.lfm @@ -0,0 +1,83 @@ +object JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm + Left = 187 + Height = 589 + Top = 156 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSExtensionWithFunction.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 536 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object StatusBar1: TStatusBar + Left = 0 + Height = 23 + Top = 566 + Width = 978 + Panels = < + item + Width = 500 + end> + end + object Chromium1: TChromium + OnProcessMessageReceived = Chromium1ProcessMessageReceived + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas b/demos/Lazarus/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas new file mode 100644 index 00000000..de0d55af --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/uJSExtensionWithFunction.pas @@ -0,0 +1,276 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSExtensionWithFunction; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +type + TJSExtensionWithFunctionFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + StatusBar1: TStatusBar; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 Chromium1ProcessMessageReceived(Sender: TObject; + const browser: ICefBrowser; sourceProcess: TCefProcessId; + const message: ICefProcessMessage; out Result: Boolean); + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSExtensionWithFunctionFrm: TJSExtensionWithFunctionFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFMiscFunctions, uMyV8Handler; + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that shows the contents of 'test.myfunc()' +// which was registered in the GlobalCEFApp.OnWebKitInitialized event. + +// 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 GlobalCEFApp_OnWebKitInitializedEvent; +var + TempExtensionCode : string; + TempHandler : ICefv8Handler; +begin + // This is the JS extension example with a function in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempExtensionCode := 'var test;' + + 'if (!test)' + + ' test = {};' + + '(function() {' + + ' test.myfunc = function() {' + + ' native function myfunc();' + + ' return myfunc();' + + ' };' + + '})();'; + + TempHandler := TMyV8Handler.Create; + + CefRegisterExtension('v8/test', TempExtensionCode, TempHandler); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent; +end; + +procedure TJSExtensionWithFunctionFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSExtensionWithFunctionFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSExtensionWithFunctionFrm.Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSExtensionWithFunctionFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSExtensionWithFunctionFrm.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSExtensionWithFunctionFrm.Chromium1ProcessMessageReceived( + Sender: TObject; const browser: ICefBrowser; + sourceProcess: TCefProcessId; const message: ICefProcessMessage; + out Result: Boolean); +begin + if (message.Name = TEST_MESSAGE_NAME) then + begin + StatusBar1.Panels[0].Text := DateTimeToStr(now) + ' - ' + message.ArgumentList.GetString(0); // this doesn't create/destroy components + Result := True; + end +end; + +procedure TJSExtensionWithFunctionFrm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSExtensionWithFunctionFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSExtensionWithFunctionFrm.FormShow(Sender: TObject); +begin + // 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 TJSExtensionWithFunctionFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExtensionWithFunctionFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExtensionWithFunctionFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSExtensionWithFunctionFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSExtensionWithFunction'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSExtensionWithFunctionFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSExtensionWithFunctionFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSExtensionWithFunctionFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas b/demos/Lazarus/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas new file mode 100644 index 00000000..07571a3c --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithFunction/uMyV8Handler.pas @@ -0,0 +1,82 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMyV8Handler; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + uCEFTypes, uCEFInterfaces, uCEFv8Value, uCEFProcessMessage, uCEFv8Handler, uCEFv8Context; + +const + TEST_MESSAGE_NAME = 'test_message'; + +type + TMyV8Handler = class(TCefv8HandlerOwn) + protected + function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override; + end; + +implementation + +function TMyV8Handler.Execute(const name : ustring; + const obj : ICefv8Value; + const arguments : TCefv8ValueArray; + var retval : ICefv8Value; + var exception : ustring): Boolean; +var + msg: ICefProcessMessage; +begin + if (name = 'myfunc') then + begin + msg := TCefProcessMessageRef.New(TEST_MESSAGE_NAME); + msg.ArgumentList.SetString(0, 'Message received!'); + TCefv8ContextRef.Current.Browser.SendProcessMessage(PID_BROWSER, msg); + + retval := TCefv8ValueRef.NewString('My Value!'); + Result := True; + end + else + Result := False; +end; + + +end. diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/00-Delete.bat b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lpi b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lpi new file mode 100644 index 00000000..31b375a4 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSExtensionWithObjectParameter"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="JSExtensionWithObjectParameter.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSExtensionWithObjectParameter.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExtensionWithObjectParameterFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSExtensionWithObjectParameter"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lpr b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lpr new file mode 100644 index 00000000..6eeee6f4 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 JSExtensionWithObjectParameter; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSExtensionWithObjectParameter in 'uJSExtensionWithObjectParameter.pas' {JSExtensionWithObjectParameterFrm}, + uMyV8Handler in 'uMyV8Handler.pas'; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSExtensionWithObjectParameterFrm, JSExtensionWithObjectParameterFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lps b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lps new file mode 100644 index 00000000..373859b9 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/JSExtensionWithObjectParameter.lps @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="JSExtensionWithObjectParameter.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="41"/> + <CursorPos X="17" Y="59"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSExtensionWithObjectParameter.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSExtensionWithObjectParameterFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSExtensionWithObjectParameter.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/cef.inc b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.lfm b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.lfm new file mode 100644 index 00000000..d3c56451 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.lfm @@ -0,0 +1,72 @@ +object JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm + Left = 136 + Height = 589 + Top = 103 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSExtensionWithObjectParameter.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 559 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas new file mode 100644 index 00000000..85b36fe1 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uJSExtensionWithObjectParameter.pas @@ -0,0 +1,267 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSExtensionWithObjectParameter; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +type + TJSExtensionWithObjectParameterFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSExtensionWithObjectParameterFrm: TJSExtensionWithObjectParameterFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFMiscFunctions, uMyV8Handler; + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a couple of buttons to set and show the value of 'test.myparam' +// which was registered in the GlobalCEFApp.OnWebKitInitialized event. + +// This demo is based in the code comments for the cef_register_extension function in the file +// /include/capi/cef_v8_capi.h + +// 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 GlobalCEFApp_OnWebKitInitializedEvent; +var + TempExtensionCode : string; + TempHandler : ICefv8Handler; +begin + // This is the JS extension example with a function in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempExtensionCode := 'var test;' + + 'if (!test)' + + ' test = {};' + + '(function() {' + + ' test.__defineGetter__(' + quotedstr('myparam') + ', function() {' + + ' native function GetMyParam();' + + ' return GetMyParam();' + + ' });' + + ' test.__defineSetter__(' + quotedstr('myparam') + ', function(b) {' + + ' native function SetMyParam();' + + ' if(b) SetMyParam(b);' + + ' });' + + '})();'; + + TempHandler := TMyV8Handler.Create; + + CefRegisterExtension('v8/test', TempExtensionCode, TempHandler); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent; +end; + +procedure TJSExtensionWithObjectParameterFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSExtensionWithObjectParameterFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSExtensionWithObjectParameterFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSExtensionWithObjectParameterFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSExtensionWithObjectParameterFrm.Chromium1Close( + Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSExtensionWithObjectParameterFrm.FormCloseQuery( + Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSExtensionWithObjectParameterFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSExtensionWithObjectParameterFrm.FormShow(Sender: TObject); +begin + // 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 TJSExtensionWithObjectParameterFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExtensionWithObjectParameterFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSExtensionWithObjectParameterFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSExtensionWithObjectParameterFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSExtensionWithObjectParameterFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSExtensionWithObjectParameterFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSExtensionWithObjectParameter'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSExtensionWithObjectParameterFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas new file mode 100644 index 00000000..5d5525f2 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSExtensionWithObjectParameter/uMyV8Handler.pas @@ -0,0 +1,83 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMyV8Handler; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + uCEFTypes, uCEFInterfaces, uCEFv8Value, uCEFv8Handler; + +type + TMyV8Handler = class(TCefv8HandlerOwn) + protected + FMyParam : string; + + function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override; + end; + +implementation + +function TMyV8Handler.Execute(const name : ustring; + const obj : ICefv8Value; + const arguments : TCefv8ValueArray; + var retval : ICefv8Value; + var exception : ustring): Boolean; +begin + if (name = 'GetMyParam') then + begin + retval := TCefv8ValueRef.NewString(FMyParam); + Result := True; + end + else + if (name = 'SetMyParam') then + begin + if (length(arguments) > 0) and arguments[0].IsString then + FMyParam := arguments[0].GetStringValue; + + Result := True; + end + else + Result := False; +end; + + +end. diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/00-Delete.bat b/demos/Lazarus/JavaScript/JSSimpleExtension/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lpi b/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lpi new file mode 100644 index 00000000..d54c8949 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSSimpleExtension"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="JSSimpleExtension.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSSimpleExtension.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSSimpleExtensionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSSimpleExtension"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lpr b/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lpr new file mode 100644 index 00000000..76bc9722 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lpr @@ -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 JSSimpleExtension; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSSimpleExtension in 'uJSSimpleExtension.pas' {JSSimpleExtensionFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSSimpleExtensionFrm, JSSimpleExtensionFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lps b/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lps new file mode 100644 index 00000000..69fc9ed9 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/JSSimpleExtension.lps @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="JSSimpleExtension.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="40"/> + <CursorPos X="17" Y="58"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSSimpleExtension.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSSimpleExtensionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSSimpleExtension.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/cef.inc b/demos/Lazarus/JavaScript/JSSimpleExtension/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/uJSSimpleExtension.lfm b/demos/Lazarus/JavaScript/JSSimpleExtension/uJSSimpleExtension.lfm new file mode 100644 index 00000000..c6381467 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/uJSSimpleExtension.lfm @@ -0,0 +1,72 @@ +object JSSimpleExtensionFrm: TJSSimpleExtensionFrm + Left = 130 + Height = 589 + Top = 154 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSSimpleExtension.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 559 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas b/demos/Lazarus/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas new file mode 100644 index 00000000..e52bd35b --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleExtension/uJSSimpleExtension.pas @@ -0,0 +1,254 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSSimpleExtension; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +type + TJSSimpleExtensionFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSSimpleExtensionFrm: TJSSimpleExtensionFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFMiscFunctions; + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that shows the contents of 'test.myval' +// which was registered in the GlobalCEFApp.OnWebKitInitialized event. + +// 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 GlobalCEFApp_OnWebKitInitializedEvent; +var + TempExtensionCode : string; +begin + // This is the first JS extension example in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempExtensionCode := 'var test;' + + 'if (!test)' + + ' test = {};' + + '(function() {' + + ' test.myval = ' + quotedstr('My Value!') + ';' + + '})();'; + + CefRegisterExtension('v8/test', TempExtensionCode, nil); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnWebKitInitialized := GlobalCEFApp_OnWebKitInitializedEvent; +end; + +procedure TJSSimpleExtensionFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSSimpleExtensionFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSSimpleExtensionFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSSimpleExtensionFrm.FormShow(Sender: TObject); +begin + // 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 TJSSimpleExtensionFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSSimpleExtensionFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSSimpleExtensionFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSSimpleExtensionFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSSimpleExtension'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSSimpleExtensionFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSSimpleExtensionFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSSimpleExtensionFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSSimpleExtensionFrm.Chromium1Close( + Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSSimpleExtensionFrm.FormCloseQuery( + Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSSimpleExtensionFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSSimpleExtensionFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/00-Delete.bat b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lpi b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lpi new file mode 100644 index 00000000..1a6f6ce8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSSimpleWindowBinding"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="JSSimpleWindowBinding.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSSimpleWindowBinding.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSSimpleWindowBindingFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSSimpleWindowBinding"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lpr b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lpr new file mode 100644 index 00000000..d8bcf2a2 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lpr @@ -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 JSSimpleWindowBinding; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSSimpleWindowBinding in 'uJSSimpleWindowBinding.pas' {JSSimpleWindowBindingFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSSimpleWindowBindingFrm, JSSimpleWindowBindingFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lps b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lps new file mode 100644 index 00000000..08ad3174 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/JSSimpleWindowBinding.lps @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="JSSimpleWindowBinding.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="40"/> + <CursorPos X="17" Y="58"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSSimpleWindowBinding.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSSimpleWindowBindingFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSSimpleWindowBinding.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/cef.inc b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.lfm b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.lfm new file mode 100644 index 00000000..18eb0c95 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.lfm @@ -0,0 +1,72 @@ +object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm + Left = 147 + Height = 589 + Top = 185 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSSimpleWindowBinding.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 559 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas new file mode 100644 index 00000000..b594f831 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSSimpleWindowBinding/uJSSimpleWindowBinding.pas @@ -0,0 +1,246 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSSimpleWindowBinding; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, + uCEFConstants, uCEFv8Value, uCEFWinControl; + +type + TJSSimpleWindowBindingFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that shows the contents of 'window.myval' +// which was set in the GlobalCEFApp.OnContextCreated event. + +// 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 GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); +var + TempValue : ICEFv8Value; +begin + // This is the first JS Window Binding example in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempValue := TCefv8ValueRef.NewString('My Value!'); + + context.Global.SetValueByKey('myval', TempValue, V8_PROPERTY_ATTRIBUTE_NONE); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated; +end; + +procedure TJSSimpleWindowBindingFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSSimpleWindowBindingFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSSimpleWindowBindingFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSSimpleWindowBindingFrm.FormShow(Sender: TObject); +begin + // 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 TJSSimpleWindowBindingFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSSimpleWindowBindingFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSSimpleWindowBindingFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSSimpleWindowBindingFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSSimpleWindowBinding'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSSimpleWindowBindingFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSSimpleWindowBindingFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSSimpleWindowBindingFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSSimpleWindowBindingFrm.Chromium1Close( + Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSSimpleWindowBindingFrm.FormCloseQuery( + Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSSimpleWindowBindingFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSSimpleWindowBindingFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/00-Delete.bat b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lpi b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lpi new file mode 100644 index 00000000..1a6f6ce8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSSimpleWindowBinding"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="JSSimpleWindowBinding.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSSimpleWindowBinding.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSSimpleWindowBindingFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSSimpleWindowBinding"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lpr b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lpr new file mode 100644 index 00000000..f780ae0a --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lpr @@ -0,0 +1,81 @@ +// ************************************************************************ +// ***************************** 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 JSSimpleWindowBinding; + +{$MODE Delphi} + +{$I cef.inc} + +uses + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + uCEFApplication, + uJSSimpleWindowBinding in 'uJSSimpleWindowBinding.pas' {JSSimpleWindowBindingFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + GlobalCEFApp := TCefApplication.Create; + + // This is the same demo than the JSSimpleWindowBinding but using a different executable for the subprocesses. + // Notice that GlobalCEFApp.OnContextCreated is now defined in the SubProcess. + + // Follow these steps to test this demo : + // 1. Build the SubProcess project in this directory. + // 2. Copy the CEF binaries to the BIN directory in CEF4Delphi. + // 3. Build this project : JSSimpleWindowBinding + // 4. Run this demo : JSSimpleWindowBinding + + GlobalCEFApp.BrowserSubprocessPath := 'SubProcess.exe'; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSSimpleWindowBindingFrm, JSSimpleWindowBindingFrm); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lps b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lps new file mode 100644 index 00000000..abb36bcd --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/JSSimpleWindowBinding.lps @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="JSSimpleWindowBinding.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="42"/> + <CursorPos X="43" Y="46"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSSimpleWindowBinding.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSSimpleWindowBindingFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSSimpleWindowBinding.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lpi b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lpi new file mode 100644 index 00000000..bcd02ba8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lpi @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SubProcess"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="SubProcess.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\SubProcess"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lpr b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lpr new file mode 100644 index 00000000..d5483cff --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lpr @@ -0,0 +1,94 @@ +// ************************************************************************ +// ***************************** 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 SubProcess; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + WinApi.Windows, + {$ELSE} + LCLIntf, LCLType, LMessages, Forms, Interfaces, + {$ENDIF} + uCEFApplication, + uCEFConstants, + uCEFv8Value, + uCEFInterfaces; + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +procedure GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); +var + TempValue : ICEFv8Value; +begin + // This is the first JS Window Binding example in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempValue := TCefv8ValueRef.NewString('My Value!'); + + context.Global.SetValueByKey('myval', TempValue, V8_PROPERTY_ATTRIBUTE_NONE); +end; + +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated; + + // The main process and the subprocess *MUST* have the same FrameworkDirPath, ResourcesDirPath, + // LocalesDirPath, cache, cookies and UserDataPath paths + + // The demos are compiled into the BIN directory. Make sure SubProcess.exe and JSSimpleWindowBinding.exe are in that + // directory or this demo won't work. + + // In case you want to use custom directories for the CEF3 binaries, cache, cookies and user data. +{ + GlobalCEFApp.FrameworkDirPath := 'cef'; + GlobalCEFApp.ResourcesDirPath := 'cef'; + GlobalCEFApp.LocalesDirPath := 'cef\locales'; + GlobalCEFApp.cache := 'cef\cache'; + GlobalCEFApp.cookies := 'cef\cookies'; + GlobalCEFApp.UserDataPath := 'cef\User Data'; +} + + GlobalCEFApp.StartSubProcess; + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. + diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lps b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lps new file mode 100644 index 00000000..f62d6202 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/SubProcess.lps @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="SubProcess.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="22"/> + <CursorPos X="50" Y="48"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + </Units> + <JumpHistory Count="3" HistoryIndex="2"> + <Position1> + <Filename Value="SubProcess.lpr"/> + </Position1> + <Position2> + <Filename Value="SubProcess.lpr"/> + <Caret Line="56" Column="17" TopLine="38"/> + </Position2> + <Position3> + <Filename Value="SubProcess.lpr"/> + <Caret Line="48" Column="38" TopLine="25"/> + </Position3> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/cef.inc b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.lfm b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.lfm new file mode 100644 index 00000000..9b2babaa --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.lfm @@ -0,0 +1,72 @@ +object JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm + Left = 246 + Height = 589 + Top = 194 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSSimpleWindowBinding.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 559 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas new file mode 100644 index 00000000..0dc4032b --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingSubProcess/uJSSimpleWindowBinding.pas @@ -0,0 +1,232 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSSimpleWindowBinding; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, + uCEFConstants, uCEFv8Value, uCEFWinControl; + +type + TJSSimpleWindowBindingFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + FText : string; + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSSimpleWindowBindingFrm: TJSSimpleWindowBindingFrm; + +implementation + +{$R *.lfm} + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that shows the contents of 'window.myval' +// which was set in the GlobalCEFApp.OnContextCreated event. + +// 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 TJSSimpleWindowBindingFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSSimpleWindowBindingFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSSimpleWindowBindingFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSSimpleWindowBindingFrm.FormShow(Sender: TObject); +begin + // 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 TJSSimpleWindowBindingFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSSimpleWindowBindingFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSSimpleWindowBindingFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSSimpleWindowBindingFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSSimpleWindowBinding'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSSimpleWindowBindingFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSSimpleWindowBindingFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSSimpleWindowBindingFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSSimpleWindowBindingFrm.Chromium1Close( + Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSSimpleWindowBindingFrm.FormCloseQuery( + Sender: TObject; var CanClose: Boolean); +begin + if GlobalCEFApp.LibLoaded then + begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; + end + else + CanClose := True; +end; + +procedure TJSSimpleWindowBindingFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSSimpleWindowBindingFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/00-Delete.bat b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lpi b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lpi new file mode 100644 index 00000000..d5a4e93b --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSWindowBindingWithFunction"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="JSWindowBindingWithFunction.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSWindowBindingWithFunction.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSWindowBindingWithFunctionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSWindowBindingWithFunction"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lpr b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lpr new file mode 100644 index 00000000..9b4906c7 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 JSWindowBindingWithFunction; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSWindowBindingWithFunction in 'uJSWindowBindingWithFunction.pas' {JSWindowBindingWithFunctionFrm}, + uMyV8Handler in 'uMyV8Handler.pas'; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSWindowBindingWithFunctionFrm, JSWindowBindingWithFunctionFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lps b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lps new file mode 100644 index 00000000..666e49fe --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/JSWindowBindingWithFunction.lps @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="JSWindowBindingWithFunction.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="41"/> + <CursorPos X="17" Y="59"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSWindowBindingWithFunction.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSWindowBindingWithFunctionFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Handler.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSWindowBindingWithFunction.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/cef.inc b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.lfm b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.lfm new file mode 100644 index 00000000..4088e964 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.lfm @@ -0,0 +1,72 @@ +object JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm + Left = 159 + Height = 589 + Top = 206 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSWindowBindingWithFunction.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 559 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas new file mode 100644 index 00000000..2543c824 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uJSWindowBindingWithFunction.pas @@ -0,0 +1,251 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSWindowBindingWithFunction; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +type + TJSWindowBindingWithFunctionFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSWindowBindingWithFunctionFrm: TJSWindowBindingWithFunctionFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFv8Value, uMyV8Handler; + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that shows the result of 'window.myfunc()' +// which was set in the GlobalCEFApp.OnContextCreated event. + +// 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 GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); +var + TempHandler : ICefv8Handler; + TempFunction : ICefv8Value; +begin + // This is the JS Window Binding example with a function in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempHandler := TMyV8Handler.Create; + TempFunction := TCefv8ValueRef.NewFunction('myfunc', TempHandler); + + context.Global.SetValueByKey('myfunc', TempFunction, V8_PROPERTY_ATTRIBUTE_NONE); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated; +end; + +procedure TJSWindowBindingWithFunctionFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSWindowBindingWithFunctionFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSWindowBindingWithFunctionFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSWindowBindingWithFunctionFrm.FormShow(Sender: TObject); +begin + // 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 TJSWindowBindingWithFunctionFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSWindowBindingWithFunctionFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSWindowBindingWithFunctionFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSWindowBindingWithFunctionFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSWindowBindingWithFunction'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSWindowBindingWithFunctionFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSWindowBindingWithFunctionFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSWindowBindingWithFunctionFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSWindowBindingWithFunctionFrm.Chromium1Close( + Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSWindowBindingWithFunctionFrm.FormCloseQuery( + Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSWindowBindingWithFunctionFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSWindowBindingWithFunctionFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas new file mode 100644 index 00000000..44c50cd2 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithFunction/uMyV8Handler.pas @@ -0,0 +1,73 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMyV8Handler; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + uCEFTypes, uCEFInterfaces, uCEFv8Value, uCEFv8Handler; + +type + TMyV8Handler = class(TCefv8HandlerOwn) + protected + function Execute(const name: ustring; const obj: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override; + end; + +implementation + +function TMyV8Handler.Execute(const name : ustring; + const obj : ICefv8Value; + const arguments : TCefv8ValueArray; + var retval : ICefv8Value; + var exception : ustring): Boolean; +begin + if (name = 'myfunc') then + begin + retval := TCefv8ValueRef.NewString('My Value!'); + Result := True; + end + else + Result := False; +end; + + +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/00-Delete.bat b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lpi b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lpi new file mode 100644 index 00000000..e049a634 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="JSWindowBindingWithObject"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="JSWindowBindingWithObject.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uJSWindowBindingWithObject.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSWindowBindingWithObjectFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Accessor.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\..\bin\JSWindowBindingWithObject"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lpr b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lpr new file mode 100644 index 00000000..980ac630 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 JSWindowBindingWithObject; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uJSWindowBindingWithObject in 'uJSWindowBindingWithObject.pas' {JSWindowBindingWithObjectFrm}, + uMyV8Accessor in 'uMyV8Accessor.pas'; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TJSWindowBindingWithObjectFrm, JSWindowBindingWithObjectFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lps b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lps new file mode 100644 index 00000000..43c88862 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/JSWindowBindingWithObject.lps @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="JSWindowBindingWithObject.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="41"/> + <CursorPos X="17" Y="59"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uJSWindowBindingWithObject.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="JSWindowBindingWithObjectFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uMyV8Accessor.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uJSWindowBindingWithObject.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/cef.inc b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.lfm b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.lfm new file mode 100644 index 00000000..4d68aaf7 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.lfm @@ -0,0 +1,72 @@ +object JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm + Left = 106 + Height = 589 + Top = 133 + Width = 978 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 589 + ClientWidth = 978 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 30 + Top = 0 + Width = 978 + Align = alTop + BevelOuter = bvNone + ClientHeight = 30 + ClientWidth = 978 + Enabled = False + TabOrder = 0 + object Edit1: TEdit + Left = 0 + Height = 30 + Top = 0 + Width = 947 + Align = alClient + TabOrder = 0 + Text = 'file:///JSWindowBindingWithObject.html' + end + object GoBtn: TButton + Left = 947 + Height = 30 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 559 + Top = 30 + Width = 978 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 32 + top = 224 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 288 + end +end diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas new file mode 100644 index 00000000..8023017f --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uJSWindowBindingWithObject.pas @@ -0,0 +1,252 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uJSWindowBindingWithObject; + +{$MODE Delphi} + +{$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, Vcl.ComCtrls, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +type + TJSWindowBindingWithObjectFrm = class(TForm) + NavControlPnl: TPanel; + Edit1: TEdit; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + Timer1: TTimer; + procedure FormShow(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Timer1Timer(Sender: TObject); + 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 FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + JSWindowBindingWithObjectFrm: TJSWindowBindingWithObjectFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFv8Value, uMyV8Accessor, uCEFMiscFunctions; + +// The CEF3 document describing JavaScript integration is here : +// https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + +// The HTML file in this demo has a button that shows the contents of 'window.myobj.myval' +// which was set in the GlobalCEFApp.OnContextCreated event. + +// 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 GlobalCEFApp_OnContextCreated(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context); +var + TempAccessor : ICefV8Accessor; + TempObject : ICefv8Value; +begin + // This is the first JS Window Binding example in the "JavaScript Integration" wiki page at + // https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration.md + + TempAccessor := TMyV8Accessor.Create; + TempObject := TCefv8ValueRef.NewObject(TempAccessor, nil); + TempObject.SetValueByKey('myval', TCefv8ValueRef.NewString('My Value!'), V8_PROPERTY_ATTRIBUTE_NONE); + + context.Global.SetValueByKey('myobj', TempObject, V8_PROPERTY_ATTRIBUTE_NONE); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextCreated := GlobalCEFApp_OnContextCreated; +end; + +procedure TJSWindowBindingWithObjectFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(Edit1.Text); +end; + +procedure TJSWindowBindingWithObjectFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TJSWindowBindingWithObjectFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TJSWindowBindingWithObjectFrm.FormShow(Sender: TObject); +begin + // 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 TJSWindowBindingWithObjectFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSWindowBindingWithObjectFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TJSWindowBindingWithObjectFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TJSWindowBindingWithObjectFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'JSWindowBindingWithObject'; + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TJSWindowBindingWithObjectFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TJSWindowBindingWithObjectFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TJSWindowBindingWithObjectFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TJSWindowBindingWithObjectFrm.Chromium1Close( + Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TJSWindowBindingWithObjectFrm.FormCloseQuery( + Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TJSWindowBindingWithObjectFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TJSWindowBindingWithObjectFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +end. diff --git a/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas new file mode 100644 index 00000000..bcc231d1 --- /dev/null +++ b/demos/Lazarus/JavaScript/JSWindowBindingWithObject/uMyV8Accessor.pas @@ -0,0 +1,92 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMyV8Accessor; + +{$MODE Delphi} + +{$I cef.inc} + +interface + +uses + uCEFv8Value, uCEFv8Accessor, uCEFInterfaces, uCEFTypes; + +type + TMyV8Accessor = class(TCefV8AccessorOwn) + protected + FMyVal : ustring; + + function Get(const name: ustring; const obj: ICefv8Value; out retval : ICefv8Value; var exception: ustring): Boolean; override; + function Put(const name: ustring; const obj, value: ICefv8Value; var exception: ustring): Boolean; override; + end; + +implementation + +function TMyV8Accessor.Get(const name : ustring; + const obj : ICefv8Value; + out retval : ICefv8Value; + var exception : ustring): Boolean; +begin + if (name = 'myval') then + begin + retval := TCefv8ValueRef.NewString(FMyVal); + Result := True; + end + else + Result := False; +end; + +function TMyV8Accessor.Put(const name : ustring; + const obj : ICefv8Value; + const value : ICefv8Value; + var exception : ustring): Boolean; +begin + if (name = 'myval') then + begin + if value.IsString then + FMyVal := value.GetStringValue + else + exception := 'Invalid value type'; + + Result := True; + end + else + Result := False; +end; + +end. diff --git a/demos/Lazarus/MiniBrowser/00-Delete.bat b/demos/Lazarus/MiniBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/MiniBrowser/MiniBrowser.lpi b/demos/Lazarus/MiniBrowser/MiniBrowser.lpi new file mode 100644 index 00000000..b6dcc087 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/MiniBrowser.lpi @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="MiniBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="4"> + <Unit0> + <Filename Value="MiniBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uMiniBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MiniBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uPreferences.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="PreferencesFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit2> + <Unit3> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit3> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\MiniBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="4"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + <Item4> + <Name Value="EThread"/> + </Item4> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/MiniBrowser/MiniBrowser.lpr b/demos/Lazarus/MiniBrowser/MiniBrowser.lpr new file mode 100644 index 00000000..de17f297 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/MiniBrowser.lpr @@ -0,0 +1,83 @@ +// ************************************************************************ +// ***************************** 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 MiniBrowser; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Windows, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uCEFTypes, + uCEFConstants, + uMiniBrowser in 'uMiniBrowser.pas' {MiniBrowserFrm}, + uPreferences in 'uPreferences.pas' {PreferencesFrm}, + uSimpleTextViewer in 'uSimpleTextViewer.pas' {SimpleTextViewerFrm}; + +{.$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + GlobalCEFApp := TCefApplication.Create; + + GlobalCEFApp.LogFile := 'debug.log'; + GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TMiniBrowserFrm, MiniBrowserFrm); + Application.CreateForm(TPreferencesFrm, PreferencesFrm); + Application.CreateForm(TSimpleTextViewerFrm, SimpleTextViewerFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/MiniBrowser/MiniBrowser.lps b/demos/Lazarus/MiniBrowser/MiniBrowser.lps new file mode 100644 index 00000000..7b4752de --- /dev/null +++ b/demos/Lazarus/MiniBrowser/MiniBrowser.lps @@ -0,0 +1,173 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="6"> + <Unit0> + <Filename Value="MiniBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="38"/> + <CursorPos X="18" Y="50"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMiniBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MiniBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="573"/> + <CursorPos X="52" Y="601"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uPreferences.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="PreferencesFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="3"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="uSimpleTextViewer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleTextViewerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="4"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + <Unit4> + <Filename Value="..\..\..\source\uCEFChromium.pas"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <TopLine Value="2356"/> + <CursorPos X="41" Y="2374"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit4> + <Unit5> + <Filename Value="C:\lazarus\lcl\interfaces\win32\win32object.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="396"/> + <CursorPos X="77" Y="404"/> + <UsageCount Value="10"/> + </Unit5> + </Units> + <JumpHistory Count="24" HistoryIndex="23"> + <Position1> + <Filename Value="uMiniBrowser.pas"/> + </Position1> + <Position2> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="51" Column="83" TopLine="51"/> + </Position2> + <Position3> + <Filename Value="uSimpleTextViewer.pas"/> + </Position3> + <Position4> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="51" Column="83" TopLine="33"/> + </Position4> + <Position5> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="266" Column="8" TopLine="237"/> + </Position5> + <Position6> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="252" Column="76" TopLine="81"/> + </Position6> + <Position7> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="251" Column="76" TopLine="229"/> + </Position7> + <Position8> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="659" Column="10" TopLine="627"/> + </Position8> + <Position9> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="674" Column="20" TopLine="637"/> + </Position9> + <Position10> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="701" Column="32" TopLine="676"/> + </Position10> + <Position11> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="755" Column="28" TopLine="726"/> + </Position11> + <Position12> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="844" Column="42" TopLine="807"/> + </Position12> + <Position13> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="564" TopLine="553"/> + </Position13> + <Position14> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="576" Column="79" TopLine="51"/> + </Position14> + <Position15> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="310" Column="64" TopLine="305"/> + </Position15> + <Position16> + <Filename Value="..\..\..\source\uCEFChromium.pas"/> + <Caret Line="537" Column="19" TopLine="517"/> + </Position16> + <Position17> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="310" Column="64" TopLine="305"/> + </Position17> + <Position18> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="182" Column="15" TopLine="160"/> + </Position18> + <Position19> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="763" Column="26" TopLine="756"/> + </Position19> + <Position20> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="768" Column="69" TopLine="749"/> + </Position20> + <Position21> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="769" Column="69" TopLine="750"/> + </Position21> + <Position22> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="768" Column="69" TopLine="749"/> + </Position22> + <Position23> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="162" Column="61" TopLine="143"/> + </Position23> + <Position24> + <Filename Value="uMiniBrowser.pas"/> + <Caret Line="601" Column="52" TopLine="573"/> + </Position24> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/MiniBrowser/cef.inc b/demos/Lazarus/MiniBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm b/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm new file mode 100644 index 00000000..4f8b5d6d --- /dev/null +++ b/demos/Lazarus/MiniBrowser/uMiniBrowser.lfm @@ -0,0 +1,354 @@ +object MiniBrowserFrm: TMiniBrowserFrm + Left = 51 + Height = 712 + Top = 127 + Width = 1184 + Caption = 'MiniBrowser' + ClientHeight = 712 + ClientWidth = 1184 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object Splitter1: TSplitter + Left = 1179 + Height = 663 + Top = 25 + Width = 5 + Align = alRight + ResizeAnchor = akRight + Visible = False + end + object NavControlPnl: TPanel + Left = 0 + Height = 25 + Top = 0 + Width = 1184 + Align = alTop + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 1184 + Enabled = False + TabOrder = 1 + object NavButtonPnl: TPanel + Left = 0 + Height = 25 + Top = 0 + Width = 133 + Align = alLeft + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 133 + TabOrder = 0 + object BackBtn: TButton + Left = 8 + Height = 25 + Top = 0 + Width = 25 + Caption = '3' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = BackBtnClick + ParentFont = False + TabOrder = 0 + end + object ForwardBtn: TButton + Left = 39 + Height = 25 + Top = 0 + Width = 25 + Caption = '4' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = ForwardBtnClick + ParentFont = False + TabOrder = 1 + end + object ReloadBtn: TButton + Left = 70 + Height = 25 + Top = 0 + Width = 25 + Caption = 'q' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = ReloadBtnClick + ParentFont = False + TabOrder = 2 + end + object StopBtn: TButton + Left = 101 + Height = 25 + Top = 0 + Width = 25 + Caption = '=' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = StopBtnClick + ParentFont = False + TabOrder = 3 + end + end + object URLEditPnl: TPanel + Left = 133 + Height = 25 + Top = 0 + Width = 978 + Align = alClient + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 978 + TabOrder = 1 + object URLCbx: TComboBox + Left = 0 + Height = 21 + Top = 3 + Width = 978 + Anchors = [akTop, akLeft, akRight, akBottom] + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'https://www.google.com' + 'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_alert' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_loc_assign' + 'https://www.w3schools.com/html/html5_video.asp' + 'http://www.adobe.com/software/flash/about/' + 'http://isflashinstalled.com/' + 'http://html5test.com/' + 'https://webrtc.github.io/samples/src/content/devices/input-output/' + 'https://test.webrtc.org/' + 'https://www.w3schools.com/' + 'http://webglsamples.org/' + 'https://get.webgl.org/' + 'https://www.briskbard.com' + 'https://www.youtube.com' + 'https://html5demos.com/drag/' + 'https://developers.google.com/maps/documentation/javascript/examples/streetview-embed?hl=fr' + 'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe_name' + 'http://www-db.deis.unibo.it/courses/TW/DOCS/w3schools/html/tryit.asp-filename=tryhtml5_html_manifest.html' + 'https://www.browserleaks.com/webrtc' + 'https://frames-per-second.appspot.com/' + 'chrome://version/' + 'chrome://net-internals/' + 'chrome://tracing/' + 'chrome://appcache-internals/' + 'chrome://blob-internals/' + 'chrome://view-http-cache/' + 'chrome://credits/' + 'chrome://histograms/' + 'chrome://media-internals/' + 'chrome://kill' + 'chrome://crash' + 'chrome://hang' + 'chrome://shorthang' + 'chrome://gpuclean' + 'chrome://gpucrash' + 'chrome://gpuhang' + 'chrome://extensions-support' + ) + TabOrder = 0 + Text = 'https://www.google.com' + end + end + object ConfigPnl: TPanel + Left = 1111 + Height = 25 + Top = 0 + Width = 73 + Align = alRight + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 73 + TabOrder = 2 + object ConfigBtn: TButton + Left = 40 + Height = 25 + Top = 0 + Width = 25 + Caption = '≡' + Font.CharSet = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -17 + Font.Name = 'Arial' + Font.Style = [fsBold] + OnClick = ConfigBtnClick + ParentFont = False + TabOrder = 0 + end + object GoBtn: TButton + Left = 8 + Height = 25 + Top = 0 + Width = 25 + Caption = 'â–º' + Font.CharSet = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -17 + Font.Name = 'Arial' + Font.Style = [fsBold] + OnClick = GoBtnClick + ParentFont = False + TabOrder = 1 + end + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 663 + Top = 25 + Width = 1179 + Align = alClient + TabStop = True + TabOrder = 0 + end + object DevTools: TCEFWindowParent + Left = 1184 + Height = 663 + Top = 25 + Width = 0 + Align = alRight + TabOrder = 2 + Visible = False + end + object StatusPnl: TPanel + Left = 0 + Height = 24 + Top = 688 + Width = 1184 + Align = alBottom + BevelOuter = bvLowered + TabOrder = 4 + end + object Chromium1: TChromium + OnTextResultAvailable = Chromium1TextResultAvailable + OnPdfPrintFinished = Chromium1PdfPrintFinished + OnPrefsAvailable = Chromium1PrefsAvailable + OnResolvedHostAvailable = Chromium1ResolvedHostAvailable + OnNavigationVisitorResultAvailable = Chromium1NavigationVisitorResultAvailable + OnLoadEnd = Chromium1LoadEnd + OnLoadError = Chromium1LoadError + OnLoadingStateChange = Chromium1LoadingStateChange + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnPreKeyEvent = Chromium1PreKeyEvent + OnKeyEvent = Chromium1KeyEvent + OnAddressChange = Chromium1AddressChange + OnTitleChange = Chromium1TitleChange + OnFullScreenModeChange = Chromium1FullScreenModeChange + OnStatusMessage = Chromium1StatusMessage + OnLoadingProgressChange = Chromium1LoadingProgressChange + OnBeforeDownload = Chromium1BeforeDownload + OnDownloadUpdated = Chromium1DownloadUpdated + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + OnBeforeResourceLoad = Chromium1BeforeResourceLoad + OnResourceResponse = Chromium1ResourceResponse + OnCertificateError = Chromium1CertificateError + left = 32 + top = 224 + end + object PopupMenu1: TPopupMenu + OnPopup = PopupMenu1Popup + left = 32 + top = 168 + object DevTools1: TMenuItem + Caption = 'DevTools' + OnClick = DevTools1Click + end + object N4: TMenuItem + Caption = '-' + end + object Openfile1: TMenuItem + Caption = 'Open file with a FILE URL...' + OnClick = Openfile1Click + end + object OpenfilewithaDAT1: TMenuItem + Caption = 'Open file with a DATA URL...' + OnClick = OpenfilewithaDAT1Click + end + object N2: TMenuItem + Caption = '-' + end + object Print1: TMenuItem + Caption = 'Print' + OnClick = Print1Click + end + object PrintinPDF1: TMenuItem + Caption = 'Print to PDF' + OnClick = PrintinPDF1Click + end + object N3: TMenuItem + Caption = '-' + end + object Zoom1: TMenuItem + Caption = 'Zoom' + object Inczoom1: TMenuItem + Caption = 'Inc zoom' + OnClick = Inczoom1Click + end + object Deczoom1: TMenuItem + Caption = 'Dec zoom' + OnClick = Deczoom1Click + end + object Resetzoom1: TMenuItem + Caption = 'Reset zoom' + OnClick = Resetzoom1Click + end + end + object N1: TMenuItem + Caption = '-' + end + object Preferences1: TMenuItem + Caption = 'Preferences...' + OnClick = Preferences1Click + end + object Resolvehost1: TMenuItem + Caption = 'Resolve host...' + OnClick = Resolvehost1Click + end + object N5: TMenuItem + Caption = '-' + end + object Memoryinfo1: TMenuItem + Caption = 'Memory info...' + OnClick = Memoryinfo1Click + end + end + object SaveDialog1: TSaveDialog + left = 32 + top = 112 + end + object ApplicationEvents1: TApplicationProperties + left = 32 + top = 56 + end + object OpenDialog1: TOpenDialog + Filter = 'HTML files|*.htm;*.html|Text files|*.txt|PDF files|*.pdf|Image files|*.jpg;*.jpeg;*.png;*.bmp;*.gif' + left = 32 + top = 280 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 32 + top = 344 + end +end diff --git a/demos/Lazarus/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus/MiniBrowser/uMiniBrowser.pas new file mode 100644 index 00000000..859dcb4f --- /dev/null +++ b/demos/Lazarus/MiniBrowser/uMiniBrowser.pas @@ -0,0 +1,1239 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMiniBrowser; + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, ActiveX, ShlObj, + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants, + uCEFWinControl; + +const + MINIBROWSER_SHOWDEVTOOLS = WM_APP + $101; + MINIBROWSER_HIDEDEVTOOLS = WM_APP + $102; + MINIBROWSER_COPYHTML = WM_APP + $103; + MINIBROWSER_SHOWRESPONSE = WM_APP + $104; + MINIBROWSER_COPYFRAMEIDS = WM_APP + $105; + MINIBROWSER_COPYFRAMENAMES = WM_APP + $106; + MINIBROWSER_SAVEPREFERENCES = WM_APP + $107; + MINIBROWSER_COPYALLTEXT = WM_APP + $108; + MINIBROWSER_TAKESNAPSHOT = WM_APP + $109; + MINIBROWSER_SHOWNAVIGATION = WM_APP + $10A; + + MINIBROWSER_HOMEPAGE = 'https://www.google.com'; + + MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS = MENU_ID_USER_FIRST + 1; + MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS = MENU_ID_USER_FIRST + 2; + MINIBROWSER_CONTEXTMENU_COPYHTML = MENU_ID_USER_FIRST + 3; + MINIBROWSER_CONTEXTMENU_JSWRITEDOC = MENU_ID_USER_FIRST + 4; + MINIBROWSER_CONTEXTMENU_JSPRINTDOC = MENU_ID_USER_FIRST + 5; + MINIBROWSER_CONTEXTMENU_SHOWRESPONSE = MENU_ID_USER_FIRST + 6; + MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS = MENU_ID_USER_FIRST + 7; + MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES = MENU_ID_USER_FIRST + 8; + MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES = MENU_ID_USER_FIRST + 9; + MINIBROWSER_CONTEXTMENU_COPYALLTEXT = MENU_ID_USER_FIRST + 10; + MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT = MENU_ID_USER_FIRST + 11; + MINIBROWSER_CONTEXTMENU_GETNAVIGATION = MENU_ID_USER_FIRST + 12; + MINIBROWSER_CONTEXTMENU_MUTEAUDIO = MENU_ID_USER_FIRST + 13; + MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO = MENU_ID_USER_FIRST + 14; + +type + + { TMiniBrowserFrm } + + TMiniBrowserFrm = class(TForm) + NavControlPnl: TPanel; + NavButtonPnl: TPanel; + StatusPnl: TPanel; + URLEditPnl: TPanel; + BackBtn: TButton; + ForwardBtn: TButton; + ReloadBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + StopBtn: TButton; + DevTools: TCEFWindowParent; + Splitter1: TSplitter; + URLCbx: TComboBox; + ConfigPnl: TPanel; + ConfigBtn: TButton; + PopupMenu1: TPopupMenu; + DevTools1: TMenuItem; + N1: TMenuItem; + Preferences1: TMenuItem; + GoBtn: TButton; + N2: TMenuItem; + PrintinPDF1: TMenuItem; + Print1: TMenuItem; + N3: TMenuItem; + Zoom1: TMenuItem; + Inczoom1: TMenuItem; + Deczoom1: TMenuItem; + Resetzoom1: TMenuItem; + SaveDialog1: TSaveDialog; + ApplicationEvents1: TApplicationProperties; + OpenDialog1: TOpenDialog; + N4: TMenuItem; + Openfile1: TMenuItem; + Resolvehost1: TMenuItem; + Timer1: TTimer; + OpenfilewithaDAT1: TMenuItem; + N5: TMenuItem; + Memoryinfo1: TMenuItem; + procedure FormShow(Sender: TObject); + procedure BackBtnClick(Sender: TObject); + procedure ForwardBtnClick(Sender: TObject); + procedure ReloadBtnClick(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; + const browser: ICefBrowser); + procedure Chromium1LoadingStateChange(Sender: TObject; + const browser: ICefBrowser; isLoading, canGoBack, + canGoForward: Boolean); + procedure Chromium1TitleChange(Sender: TObject; + const browser: ICefBrowser; const title: ustring); + procedure Chromium1AddressChange(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const url: ustring); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1StatusMessage(Sender: TObject; + const browser: ICefBrowser; const value: ustring); + procedure Chromium1TextResultAvailable(Sender: TObject; + const aText: ustring); + procedure PopupMenu1Popup(Sender: TObject); + procedure DevTools1Click(Sender: TObject); + procedure Preferences1Click(Sender: TObject); + procedure ConfigBtnClick(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure PrintinPDF1Click(Sender: TObject); + procedure Print1Click(Sender: TObject); + procedure Inczoom1Click(Sender: TObject); + procedure Deczoom1Click(Sender: TObject); + procedure Resetzoom1Click(Sender: TObject); + procedure Chromium1FullScreenModeChange(Sender: TObject; + const browser: ICefBrowser; fullscreen: Boolean); + procedure Chromium1PreKeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out isKeyboardShortcut, Result: Boolean); + procedure Chromium1KeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out Result: Boolean); + procedure ApplicationEvents1Message(var Msg: tagMSG; + var Handled: Boolean); + procedure Openfile1Click(Sender: TObject); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); + procedure Chromium1PdfPrintFinished(Sender: TObject; + aResultOK: Boolean); + procedure Chromium1ResourceResponse(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; const response: ICefResponse; + out Result: Boolean); + procedure StopBtnClick(Sender: TObject); + procedure Resolvehost1Click(Sender: TObject); + procedure Chromium1ResolvedHostAvailable(Sender: TObject; + result: Integer; const resolvedIps: TStrings); + procedure Timer1Timer(Sender: TObject); + procedure Chromium1PrefsAvailable(Sender: TObject; aResultOK: Boolean); + procedure Chromium1BeforeDownload(Sender: TObject; + const browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; + const callback: ICefBeforeDownloadCallback); + procedure Chromium1DownloadUpdated(Sender: TObject; + const browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure Chromium1BeforeResourceLoad(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; const callback: ICefRequestCallback; + out Result: TCefReturnValue); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + procedure Chromium1RenderCompMsg(var aMessage : TMessage; var aHandled: Boolean); + procedure Chromium1LoadingProgressChange(Sender: TObject; + const browser: ICefBrowser; const progress: Double); + procedure OpenfilewithaDAT1Click(Sender: TObject); + procedure Chromium1LoadEnd(Sender: TObject; const browser: ICefBrowser; + const frame: ICefFrame; httpStatusCode: Integer); + procedure Memoryinfo1Click(Sender: TObject); + procedure Chromium1LoadError(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + errorCode: Integer; const errorText, failedUrl: ustring); + procedure Chromium1CertificateError(Sender: TObject; + const browser: ICefBrowser; certError: Integer; + const requestUrl: ustring; const sslInfo: ICefSslInfo; + const callback: ICefRequestCallback; out Result: Boolean); + procedure Chromium1NavigationVisitorResultAvailable( + const entry: ICefNavigationEntry; current: Boolean; index, total: Integer; + var aResult: Boolean); + + protected + FResponse : TStringList; + FRequest : TStringList; + FNavigation : TStringList; + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure AddURL(const aURL : string); + + procedure ShowDevTools(aPoint : TPoint); overload; + procedure ShowDevTools; overload; + procedure HideDevTools; + + procedure HandleKeyUp(const aMsg : TMsg; var aHandled : boolean); + procedure HandleKeyDown(const aMsg : TMsg; var aHandled : boolean); + + procedure InspectRequest(const aRequest : ICefRequest); + procedure InspectResponse(const aResponse : ICefResponse); + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + procedure ShowDevToolsMsg(var aMessage : TMessage); message MINIBROWSER_SHOWDEVTOOLS; + procedure HideDevToolsMsg(var aMessage : TMessage); message MINIBROWSER_HIDEDEVTOOLS; + procedure CopyAllTextMsg(var aMessage : TMessage); message MINIBROWSER_COPYALLTEXT; + procedure CopyHTMLMsg(var aMessage : TMessage); message MINIBROWSER_COPYHTML; + procedure CopyFramesIDsMsg(var aMessage : TMessage); message MINIBROWSER_COPYFRAMEIDS; + procedure CopyFramesNamesMsg(var aMessage : TMessage); message MINIBROWSER_COPYFRAMENAMES; + procedure ShowResponseMsg(var aMessage : TMessage); message MINIBROWSER_SHOWRESPONSE; + procedure ShowNavigationMsg(var aMessage : TMessage); message MINIBROWSER_SHOWNAVIGATION; + procedure SavePreferencesMsg(var aMessage : TMessage); message MINIBROWSER_SAVEPREFERENCES; + procedure TakeSnapshotMsg(var aMessage : TMessage); message MINIBROWSER_TAKESNAPSHOT; + 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; + + public + procedure ShowStatusText(const aText : string); + + end; + +var + MiniBrowserFrm : TMiniBrowserFrm; + +implementation + +{$R *.lfm} + +uses + uPreferences, uCefStringMultimap, uCEFMiscFunctions, uSimpleTextViewer; + +// 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 TMiniBrowserFrm.BackBtnClick(Sender: TObject); +begin + Chromium1.GoBack; +end; + +procedure TMiniBrowserFrm.ForwardBtnClick(Sender: TObject); +begin + Chromium1.GoForward; +end; + +procedure TMiniBrowserFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(URLCbx.Text); +end; + +procedure TMiniBrowserFrm.ReloadBtnClick(Sender: TObject); +begin + Chromium1.Reload; +end; + +procedure TMiniBrowserFrm.Resetzoom1Click(Sender: TObject); +begin + Chromium1.ResetZoomStep; +end; + +procedure TMiniBrowserFrm.Resolvehost1Click(Sender: TObject); +var + TempURL : string; +begin + TempURL := inputbox('Resolve host', 'URL :', 'http://google.com'); + if (length(TempURL) > 0) then Chromium1.ResolveHost(TempURL); +end; + +procedure TMiniBrowserFrm.Chromium1AddressChange(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; const url: ustring); +begin + if Chromium1.IsSameBrowser(browser) then AddURL(url); +end; + +procedure TMiniBrowserFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + if Chromium1.IsSameBrowser(browser) then + PostMessage(Handle, CEF_AFTERCREATED, 0, 0) + else + SendMessage(browser.Host.WindowHandle, WM_SETICON, 1, application.Icon.Handle); // Use the same icon in the popup window +end; + +procedure TMiniBrowserFrm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + // The main browser is being destroyed + if (Chromium1.BrowserId = 0) then + begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); + end; +end; + +procedure TMiniBrowserFrm.Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + if not(Chromium1.IsSameBrowser(browser)) then exit; + + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT, 'Take snapshot...'); + model.AddItem(MINIBROWSER_CONTEXTMENU_GETNAVIGATION, 'Get navigation entries'); + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_COPYALLTEXT, 'Copy displayed text to clipboard'); + model.AddItem(MINIBROWSER_CONTEXTMENU_COPYHTML, 'Copy HTML to clipboard'); + model.AddItem(MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS, 'Copy HTML frame identifiers to clipboard'); + model.AddItem(MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES, 'Copy HTML frame names to clipboard'); + + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES, 'Save preferences as...'); + model.AddSeparator; + model.AddItem(MINIBROWSER_CONTEXTMENU_JSWRITEDOC, 'Modify HTML document'); + model.AddItem(MINIBROWSER_CONTEXTMENU_JSPRINTDOC, 'Print using Javascript'); + model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWRESPONSE, 'Show server headers'); + + if DevTools.Visible then + model.AddItem(MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS, 'Hide DevTools') + else + model.AddItem(MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS, 'Show DevTools'); + + if Chromium1.AudioMuted then + model.AddItem(MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO, 'Unmute audio') + else + model.AddItem(MINIBROWSER_CONTEXTMENU_MUTEAUDIO, 'Mute audio'); +end; + +function PathToMyDocuments : string; +var + Allocator : IMalloc; + Path : pchar; + idList : PItemIDList; +begin + Result := ''; + Path := nil; + idList := nil; + + try + if (SHGetMalloc(Allocator) = S_OK) then + begin + GetMem(Path, MAX_PATH); + if (SHGetSpecialFolderLocation(0, CSIDL_PERSONAL, idList) = S_OK) and + SHGetPathFromIDList(idList, Path) then + Result := string(Path); + end; + finally + if (Path <> nil) then FreeMem(Path); + if (idList <> nil) then Allocator.Free(idList); + end; +end; + +procedure TMiniBrowserFrm.Chromium1BeforeDownload(Sender: TObject; + const browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const suggestedName: ustring; + const callback: ICefBeforeDownloadCallback); +var + TempMyDocuments, TempFullPath, TempName : string; +begin + if not(Chromium1.IsSameBrowser(browser)) or + (downloadItem = nil) or + not(downloadItem.IsValid) then + exit; + + TempMyDocuments := PathToMyDocuments; + + if (length(suggestedName) > 0) then + TempName := suggestedName + else + TempName := 'DownloadedFile'; + + if (length(TempMyDocuments) > 0) then + TempFullPath := IncludeTrailingPathDelimiter(TempMyDocuments) + TempName + else + TempFullPath := TempName; + + callback.cont(TempFullPath, False); +end; + +procedure TMiniBrowserFrm.Chromium1BeforeResourceLoad(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; const callback: ICefRequestCallback; + out Result: TCefReturnValue); +begin + Result := RV_CONTINUE; + + if Chromium1.IsSameBrowser(browser) and + (frame <> nil) and + frame.IsMain then + InspectRequest(request); +end; + +procedure TMiniBrowserFrm.Chromium1CertificateError(Sender: TObject; + const browser: ICefBrowser; certError: Integer; + const requestUrl: ustring; const sslInfo: ICefSslInfo; + const callback: ICefRequestCallback; out Result: Boolean); +begin + CefDebugLog('Certificate error code:' + inttostr(certError) + + ' - URL:' + requestUrl, CEF_LOG_SEVERITY_ERROR); + Result := False; +end; + +procedure TMiniBrowserFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + if (browser <> nil) and (Chromium1.BrowserId = browser.Identifier) then + begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; + end; +end; + +procedure TMiniBrowserFrm.Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); +var + TempParam : WParam; +begin + Result := False; + + if not(Chromium1.IsSameBrowser(browser)) then exit; + + case commandId of + MINIBROWSER_CONTEXTMENU_HIDEDEVTOOLS : + PostMessage(Handle, MINIBROWSER_HIDEDEVTOOLS, 0, 0); + + MINIBROWSER_CONTEXTMENU_SHOWDEVTOOLS : + begin + TempParam := ((params.XCoord and $FFFF) shl 16) or (params.YCoord and $FFFF); + PostMessage(Handle, MINIBROWSER_SHOWDEVTOOLS, TempParam, 0); + end; + + MINIBROWSER_CONTEXTMENU_COPYALLTEXT : + PostMessage(Handle, MINIBROWSER_COPYALLTEXT, 0, 0); + + MINIBROWSER_CONTEXTMENU_COPYHTML : + PostMessage(Handle, MINIBROWSER_COPYHTML, 0, 0); + + MINIBROWSER_CONTEXTMENU_COPYFRAMEIDS : + PostMessage(Handle, MINIBROWSER_COPYFRAMEIDS, 0, 0); + + MINIBROWSER_CONTEXTMENU_COPYFRAMENAMES : + PostMessage(Handle, MINIBROWSER_COPYFRAMENAMES, 0, 0); + + MINIBROWSER_CONTEXTMENU_SHOWRESPONSE : + PostMessage(Handle, MINIBROWSER_SHOWRESPONSE, 0, 0); + + MINIBROWSER_CONTEXTMENU_SAVEPREFERENCES : + PostMessage(Handle, MINIBROWSER_SAVEPREFERENCES, 0, 0); + + MINIBROWSER_CONTEXTMENU_TAKESNAPSHOT : + PostMessage(Handle, MINIBROWSER_TAKESNAPSHOT, 0, 0); + + MINIBROWSER_CONTEXTMENU_GETNAVIGATION : + begin + FNavigation.Clear; + Chromium1.GetNavigationEntries(False); + end; + + MINIBROWSER_CONTEXTMENU_JSWRITEDOC : + if (browser <> nil) and (browser.MainFrame <> nil) then + browser.MainFrame.ExecuteJavaScript( + 'var css = ' + chr(39) + '@page {size: A4; margin: 0;} @media print {html, body {width: 210mm; height: 297mm;}}' + chr(39) + '; ' + + 'var style = document.createElement(' + chr(39) + 'style' + chr(39) + '); ' + + 'style.type = ' + chr(39) + 'text/css' + chr(39) + '; ' + + 'style.appendChild(document.createTextNode(css)); ' + + 'document.head.appendChild(style);', + 'about:blank', 0); + + MINIBROWSER_CONTEXTMENU_JSPRINTDOC : + if (browser <> nil) and (browser.MainFrame <> nil) then + browser.MainFrame.ExecuteJavaScript('window.print();', 'about:blank', 0); + + MINIBROWSER_CONTEXTMENU_UNMUTEAUDIO : + Chromium1.AudioMuted := False; + + MINIBROWSER_CONTEXTMENU_MUTEAUDIO : + Chromium1.AudioMuted := True; + end; +end; + +procedure TMiniBrowserFrm.Chromium1DownloadUpdated(Sender: TObject; + const browser: ICefBrowser; const downloadItem: ICefDownloadItem; + const callback: ICefDownloadItemCallback); +var + TempString : string; +begin + if not(Chromium1.IsSameBrowser(browser)) then exit; + + if downloadItem.IsComplete then + ShowStatusText(downloadItem.FullPath + ' completed') + else + if downloadItem.IsCanceled then + ShowStatusText(downloadItem.FullPath + ' canceled') + else + if downloadItem.IsInProgress then + begin + if (downloadItem.PercentComplete >= 0) then + TempString := downloadItem.FullPath + ' : ' + inttostr(downloadItem.PercentComplete) + '%' + else + TempString := downloadItem.FullPath + ' : ' + inttostr(downloadItem.ReceivedBytes) + ' bytes received'; + + ShowStatusText(TempString); + end; +end; + +procedure TMiniBrowserFrm.Chromium1FullScreenModeChange(Sender: TObject; + const browser: ICefBrowser; fullscreen: Boolean); +begin + if not(Chromium1.IsSameBrowser(browser)) then exit; + + // This event is executed in a CEF thread and this can cause problems when + // you change the 'Enabled' and 'Visible' properties from VCL components. + // It's recommended to change the 'Enabled' and 'Visible' properties + // in the main application thread and not in a CEF thread. + // It's much safer to use PostMessage to send a message to the main form with + // all this information and update those properties in the procedure handling + // that message. + + if fullscreen then + begin + NavControlPnl.Visible := False; + + if (WindowState = wsMaximized) then WindowState := wsNormal; + + BorderIcons := []; + BorderStyle := bsNone; + WindowState := wsMaximized; + end + else + begin + BorderIcons := [biSystemMenu, biMinimize, biMaximize]; + BorderStyle := bsSizeable; + WindowState := wsNormal; + + NavControlPnl.Visible := True; + end; +end; + +procedure TMiniBrowserFrm.Chromium1KeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out Result: Boolean); +var + TempMsg : TMsg; +begin + Result := False; + + if (event <> nil) and (osEvent <> nil) then + case osEvent.Message of + WM_KEYUP : + begin + TempMsg := osEvent^; + + HandleKeyUp(TempMsg, Result); + end; + + WM_KEYDOWN : + begin + TempMsg := osEvent^; + + HandleKeyDown(TempMsg, Result); + end; + end; +end; + +procedure TMiniBrowserFrm.ApplicationEvents1Message(var Msg: tagMSG; + var Handled: Boolean); +begin + case Msg.message of + WM_KEYUP : HandleKeyUp(Msg, Handled); + WM_KEYDOWN : HandleKeyDown(Msg, Handled); + end; +end; + +procedure TMiniBrowserFrm.HandleKeyUp(const aMsg : TMsg; var aHandled : boolean); +var + TempMessage : TMessage; + TempKeyMsg : TWMKey; +begin + TempMessage.Msg := aMsg.message; + TempMessage.wParam := aMsg.wParam; + TempMessage.lParam := aMsg.lParam; + TempKeyMsg := TWMKey(TempMessage); + + if (TempKeyMsg.CharCode = VK_F12) then + begin + aHandled := True; + + if DevTools.Visible then + PostMessage(Handle, MINIBROWSER_HIDEDEVTOOLS, 0, 0) + else + PostMessage(Handle, MINIBROWSER_SHOWDEVTOOLS, 0, 0); + end; +end; + +procedure TMiniBrowserFrm.HandleKeyDown(const aMsg : TMsg; var aHandled : boolean); +var + TempMessage : TMessage; + TempKeyMsg : TWMKey; +begin + TempMessage.Msg := aMsg.message; + TempMessage.wParam := aMsg.wParam; + TempMessage.lParam := aMsg.lParam; + TempKeyMsg := TWMKey(TempMessage); + + if (TempKeyMsg.CharCode = VK_F12) then aHandled := True; +end; + +procedure TMiniBrowserFrm.Chromium1LoadEnd(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + httpStatusCode: Integer); +begin + if frame.IsMain then + StatusPnl.Caption := 'main frame loaded : ' + quotedstr(frame.name) + else + StatusPnl.Caption := 'frame loaded : ' + quotedstr(frame.name); +end; + +procedure TMiniBrowserFrm.Chromium1LoadError(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); +begin + CefDebugLog('Error code:' + inttostr(errorCode) + + ' - Error text :' + quotedstr(errorText) + + ' - URL:' + failedUrl, CEF_LOG_SEVERITY_ERROR); +end; + +procedure TMiniBrowserFrm.Chromium1LoadingProgressChange(Sender: TObject; + const browser: ICefBrowser; const progress: Double); +begin + StatusPnl.Caption := 'Loading... ' + FloatToStrF(progress * 100, ffFixed, 3, 0) + '%'; +end; + +procedure TMiniBrowserFrm.Chromium1LoadingStateChange(Sender: TObject; + const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean); +begin + if not(Chromium1.IsSameBrowser(browser)) or FClosing then exit; + + // This event is executed in a CEF thread and this can cause problems when + // you change the 'Enabled' and 'Visible' properties from VCL components. + // It's recommended to change the 'Enabled' and 'Visible' properties + // in the main application thread and not in a CEF thread. + // It's much safer to use PostMessage to send a message to the main form with + // all this information and update those properties in the procedure handling + // that message. + + BackBtn.Enabled := canGoBack; + ForwardBtn.Enabled := canGoForward; + + if isLoading then + begin + StatusPnl.Caption := 'Loading...'; + ReloadBtn.Enabled := False; + StopBtn.Enabled := True; + end + else + begin + StatusPnl.Caption := 'Finished'; + ReloadBtn.Enabled := True; + StopBtn.Enabled := False; + end; +end; + +procedure TMiniBrowserFrm.Chromium1NavigationVisitorResultAvailable( + const entry: ICefNavigationEntry; current: Boolean; index, total: Integer; + var aResult: Boolean); +begin + if (entry <> nil) and entry.IsValid then FNavigation.Add(entry.Url); + + if (index < pred(total)) then + aResult := True + else + begin + aResult := False; + PostMessage(Handle, MINIBROWSER_SHOWNAVIGATION, 0, 0); + end; +end; + +procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean); +begin + if aResultOK then + showmessage('The PDF file was generated successfully') + else + showmessage('There was a problem generating the PDF file.'); +end; + +procedure TMiniBrowserFrm.Chromium1PrefsAvailable(Sender: TObject; aResultOK: Boolean); +begin + if aResultOK then + showmessage('The preferences file was generated successfully') + else + showmessage('There was a problem generating the preferences file.'); +end; + +procedure TMiniBrowserFrm.Chromium1PreKeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out isKeyboardShortcut, Result: Boolean); +begin + Result := False; + + if (event <> nil) and + (event.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and + (event.windows_key_code = VK_F12) then + isKeyboardShortcut := True; +end; + +procedure TMiniBrowserFrm.Chromium1RenderCompMsg(var aMessage : TMessage; var aHandled: Boolean); +begin + if not(FClosing) and (aMessage.Msg = WM_MOUSEMOVE) then + begin + StatusPnl.Caption := 'x : ' + inttostr(aMessage.lParam and $FFFF) + ' - ' + + 'y : ' + inttostr((aMessage.lParam and $FFFF0000) shr 16); + end; +end; + +procedure TMiniBrowserFrm.Chromium1ResolvedHostAvailable(Sender: TObject; + result: Integer; const resolvedIps: TStrings); +begin + if (result = ERR_NONE) then + StatusPnl.Caption := 'Resolved IPs : ' + resolvedIps.CommaText + else + StatusPnl.Caption := 'There was a problem resolving the host.' + CRLF + + 'Error code : ' + inttostr(result); +end; + +procedure TMiniBrowserFrm.InspectRequest(const aRequest : ICefRequest); +var + TempHeaderMap : ICefStringMultimap; + i, j : integer; +begin + if (aRequest <> nil) then + begin + FRequest.Clear; + + TempHeaderMap := TCefStringMultimapOwn.Create; + aRequest.GetHeaderMap(TempHeaderMap); + + i := 0; + j := TempHeaderMap.Size; + + while (i < j) do + begin + FRequest.Add(TempHeaderMap.Key[i] + '=' + TempHeaderMap.Value[i]); + inc(i); + end; + end; +end; + +procedure TMiniBrowserFrm.InspectResponse(const aResponse : ICefResponse); +var + TempHeaderMap : ICefStringMultimap; + i, j : integer; +begin + if (aResponse <> nil) then + begin + FResponse.Clear; + + TempHeaderMap := TCefStringMultimapOwn.Create; + aResponse.GetHeaderMap(TempHeaderMap); + + i := 0; + j := TempHeaderMap.Size; + + while (i < j) do + begin + FResponse.Add(TempHeaderMap.Key[i] + '=' + TempHeaderMap.Value[i]); + inc(i); + end; + end; +end; + +procedure TMiniBrowserFrm.Memoryinfo1Click(Sender: TObject); +const + BYTES_PER_MEGABYTE = 1024 * 1024; +var + TempMessage : string; +begin + TempMessage := 'Total memory used by this application : ' + inttostr(GlobalCEFApp.UsedMemory div BYTES_PER_MEGABYTE) + ' Mb' + CRLF + + 'Total system memory : ' + inttostr(GlobalCEFApp.TotalSystemMemory div BYTES_PER_MEGABYTE) + ' Mb' + CRLF + + 'Available physical memory : ' + inttostr(GlobalCEFApp.AvailableSystemMemory div BYTES_PER_MEGABYTE) + ' Mb' + CRLF + + 'Memory load : ' + inttostr(GlobalCEFApp.SystemMemoryLoad) + ' %'; + + MessageDlg(TempMessage, mtInformation, [mbOK], 0); +end; + +procedure TMiniBrowserFrm.Chromium1ResourceResponse(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; const response: ICefResponse; + out Result: Boolean); +begin + Result := False; + + if Chromium1.IsSameBrowser(browser) and + (frame <> nil) and + frame.IsMain then + InspectResponse(response); +end; + +procedure TMiniBrowserFrm.ShowStatusText(const aText : string); +begin + if not(FClosing) then StatusPnl.Caption := aText; +end; + +procedure TMiniBrowserFrm.StopBtnClick(Sender: TObject); +begin + Chromium1.StopLoad; +end; + +procedure TMiniBrowserFrm.Chromium1StatusMessage(Sender: TObject; + const browser: ICefBrowser; const value: ustring); +begin + if Chromium1.IsSameBrowser(browser) then ShowStatusText(value); +end; + +procedure TMiniBrowserFrm.Chromium1TextResultAvailable(Sender: TObject; const aText: ustring); +begin + clipboard.AsText := aText; +end; + +procedure TMiniBrowserFrm.Chromium1TitleChange(Sender: TObject; + const browser: ICefBrowser; const title: ustring); +begin + if not(Chromium1.IsSameBrowser(browser)) then exit; + + if (title <> '') then + caption := 'MiniBrowser - ' + title + else + caption := 'MiniBrowser'; +end; + +procedure TMiniBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TMiniBrowserFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; + FResponse := TStringList.Create; + FRequest := TStringList.Create; + FNavigation := TStringList.Create; + Chromium1.DefaultURL := MINIBROWSER_HOMEPAGE; +end; + +procedure TMiniBrowserFrm.FormDestroy(Sender: TObject); +begin + FResponse.Free; + FRequest.Free; + FNavigation.Free; +end; + +procedure TMiniBrowserFrm.FormShow(Sender: TObject); +begin + ShowStatusText('Initializing browser. Please wait...'); + + // WebRTC's IP leaking can lowered/avoided by setting these preferences + // To test this go to https://www.browserleaks.com/webrtc + Chromium1.WebRTCIPHandlingPolicy := hpDisableNonProxiedUDP; + Chromium1.WebRTCMultipleRoutes := STATE_DISABLED; + Chromium1.WebRTCNonproxiedUDP := STATE_DISABLED; + + // 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 TMiniBrowserFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TMiniBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + CEFWindowParent1.UpdateSize; + NavControlPnl.Enabled := True; +end; + +procedure TMiniBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TMiniBrowserFrm.AddURL(const aURL : string); +begin + if (URLCbx.Items.IndexOf(aURL) < 0) then URLCbx.Items.Add(aURL); + + URLCbx.Text := aURL; +end; + +procedure TMiniBrowserFrm.ShowDevToolsMsg(var aMessage : TMessage); +var + TempPoint : TPoint; +begin + TempPoint.x := (aMessage.wParam shr 16) and $FFFF; + TempPoint.y := aMessage.wParam and $FFFF; + ShowDevTools(TempPoint); +end; + +procedure TMiniBrowserFrm.HideDevToolsMsg(var aMessage : TMessage); +begin + HideDevTools; + Chromium1.SetFocus(True); +end; + +procedure TMiniBrowserFrm.Inczoom1Click(Sender: TObject); +begin + Chromium1.IncZoomStep; +end; + +procedure TMiniBrowserFrm.Openfile1Click(Sender: TObject); +begin + OpenDialog1.Filter := 'Any file (*.*)|*.*'; + + if OpenDialog1.Execute then + begin + // This is a quick solution to load files. The file URL should be properly encoded. + Chromium1.LoadURL('file:///' + OpenDialog1.FileName); + end; +end; + +procedure TMiniBrowserFrm.OpenfilewithaDAT1Click(Sender: TObject); +var + TempDATA : string; + TempFile : TMemoryStream; +begin + TempFile := nil; + + try + try + OpenDialog1.Filter := 'HTML files (*.html)|*.HTML;*.HTM|PDF files (*.pdf)|*.PDF'; + + if OpenDialog1.Execute then + begin + // Use TByteStream instead of TMemoryStream if your Delphi version supports it. + TempFile := TMemoryStream.Create; + TempFile.LoadFromFile(OpenDialog1.FileName); + + if (OpenDialog1.FilterIndex = 1) then + TempDATA := 'data:text/html;charset=utf-8;base64,' + CefBase64Encode(TempFile.Memory, TempFile.Size) + else + TempDATA := 'data:application/pdf;charset=utf-8;base64,' + CefBase64Encode(TempFile.Memory, TempFile.Size); + + Chromium1.LoadURL(TempDATA); + end; + except + on e : exception do + if CustomExceptionHandler('TMiniBrowserFrm.OpenfilewithaDAT1Click', e) then raise; + end; + finally + if (TempFile <> nil) then FreeAndNil(TempFile); + end; +end; + +procedure TMiniBrowserFrm.PopupMenu1Popup(Sender: TObject); +begin + if DevTools.Visible then + DevTools1.Caption := 'Hide DevTools' + else + DevTools1.Caption := 'Show DevTools'; +end; + +procedure TMiniBrowserFrm.Preferences1Click(Sender: TObject); +begin + case Chromium1.ProxyScheme of + psSOCKS4 : PreferencesFrm.ProxySchemeCb.ItemIndex := 1; + psSOCKS5 : PreferencesFrm.ProxySchemeCb.ItemIndex := 2; + else PreferencesFrm.ProxySchemeCb.ItemIndex := 0; + end; + + PreferencesFrm.ProxyTypeCbx.ItemIndex := Chromium1.ProxyType; + PreferencesFrm.ProxyServerEdt.Text := Chromium1.ProxyServer; + PreferencesFrm.ProxyPortEdt.Text := inttostr(Chromium1.ProxyPort); + PreferencesFrm.ProxyUsernameEdt.Text := Chromium1.ProxyUsername; + PreferencesFrm.ProxyPasswordEdt.Text := Chromium1.ProxyPassword; + PreferencesFrm.ProxyScriptURLEdt.Text := Chromium1.ProxyScriptURL; + PreferencesFrm.ProxyByPassListEdt.Text := Chromium1.ProxyByPassList; + PreferencesFrm.HeaderNameEdt.Text := Chromium1.CustomHeaderName; + PreferencesFrm.HeaderValueEdt.Text := Chromium1.CustomHeaderValue; + + if (PreferencesFrm.ShowModal = mrOk) then + begin + Chromium1.ProxyType := PreferencesFrm.ProxyTypeCbx.ItemIndex; + Chromium1.ProxyServer := PreferencesFrm.ProxyServerEdt.Text; + Chromium1.ProxyPort := strtoint(PreferencesFrm.ProxyPortEdt.Text); + Chromium1.ProxyUsername := PreferencesFrm.ProxyUsernameEdt.Text; + Chromium1.ProxyPassword := PreferencesFrm.ProxyPasswordEdt.Text; + Chromium1.ProxyScriptURL := PreferencesFrm.ProxyScriptURLEdt.Text; + Chromium1.ProxyByPassList := PreferencesFrm.ProxyByPassListEdt.Text; + Chromium1.CustomHeaderName := PreferencesFrm.HeaderNameEdt.Text; + Chromium1.CustomHeaderValue := PreferencesFrm.HeaderValueEdt.Text; + + case PreferencesFrm.ProxySchemeCb.ItemIndex of + 1 : Chromium1.ProxyScheme := psSOCKS4; + 2 : Chromium1.ProxyScheme := psSOCKS5; + else Chromium1.ProxyScheme := psHTTP; + end; + + Chromium1.UpdatePreferences; + end; +end; + +procedure TMiniBrowserFrm.Print1Click(Sender: TObject); +begin + Chromium1.Print; +end; + +procedure TMiniBrowserFrm.PrintinPDF1Click(Sender: TObject); +begin + SaveDialog1.DefaultExt := 'pdf'; + SaveDialog1.Filter := 'PDF files (*.pdf)|*.PDF'; + + if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then + Chromium1.PrintToPDF(SaveDialog1.FileName, Chromium1.DocumentURL, Chromium1.DocumentURL); +end; + +procedure TMiniBrowserFrm.ConfigBtnClick(Sender: TObject); +var + TempPoint : TPoint; +begin + TempPoint.x := ConfigBtn.left; + TempPoint.y := ConfigBtn.top + ConfigBtn.Height; + TempPoint := ConfigPnl.ClientToScreen(TempPoint); + + PopupMenu1.Popup(TempPoint.x, TempPoint.y); +end; + +procedure TMiniBrowserFrm.CopyHTMLMsg(var aMessage : TMessage); +begin + Chromium1.RetrieveHTML; +end; + +procedure TMiniBrowserFrm.CopyAllTextMsg(var aMessage : TMessage); +begin + Chromium1.RetrieveText; +end; + +procedure TMiniBrowserFrm.CopyFramesIDsMsg(var aMessage : TMessage); +var + i : NativeUInt; + TempCount : NativeUInt; + TempArray : TCefFrameIdentifierArray; + TempString : string; +begin + TempCount := Chromium1.FrameCount; + + if Chromium1.GetFrameIdentifiers(TempCount, TempArray) then + begin + TempString := ''; + i := 0; + + while (i < TempCount) do + begin + TempString := TempString + inttostr(TempArray[i]) + CRLF; + inc(i); + end; + + clipboard.AsText := TempString; + end; +end; + +procedure TMiniBrowserFrm.CopyFramesNamesMsg(var aMessage : TMessage); +var + TempSL : TStringList; +begin + try + TempSL := TStringList.Create; + + if Chromium1.GetFrameNames(TStrings(TempSL)) then clipboard.AsText := TempSL.Text; + finally + FreeAndNil(TempSL); + end; +end; + +procedure TMiniBrowserFrm.ShowResponseMsg(var aMessage : TMessage); +begin + SimpleTextViewerFrm.Memo1.Lines.Clear; + + SimpleTextViewerFrm.Memo1.Lines.Add('--------------------------'); + SimpleTextViewerFrm.Memo1.Lines.Add('Request headers : '); + SimpleTextViewerFrm.Memo1.Lines.Add('--------------------------'); + if (FRequest <> nil) then SimpleTextViewerFrm.Memo1.Lines.AddStrings(FRequest); + + SimpleTextViewerFrm.Memo1.Lines.Add(''); + + SimpleTextViewerFrm.Memo1.Lines.Add('--------------------------'); + SimpleTextViewerFrm.Memo1.Lines.Add('Response headers : '); + SimpleTextViewerFrm.Memo1.Lines.Add('--------------------------'); + if (FResponse <> nil) then SimpleTextViewerFrm.Memo1.Lines.AddStrings(FResponse); + + SimpleTextViewerFrm.ShowModal; +end; + +procedure TMiniBrowserFrm.ShowNavigationMsg(var aMessage : TMessage); +begin + SimpleTextViewerFrm.Memo1.Lines.Clear; + SimpleTextViewerFrm.Memo1.Lines.AddStrings(FNavigation); + SimpleTextViewerFrm.ShowModal; +end; + +procedure TMiniBrowserFrm.SavePreferencesMsg(var aMessage : TMessage); +begin + SaveDialog1.DefaultExt := 'txt'; + SaveDialog1.Filter := 'Text files (*.txt)|*.TXT'; + + if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then + Chromium1.SavePreferences(SaveDialog1.FileName); +end; + +procedure TMiniBrowserFrm.TakeSnapshotMsg(var aMessage : TMessage); +var + TempBitmap : TBitmap; +begin + TempBitmap := nil; + + try + SaveDialog1.DefaultExt := 'bmp'; + SaveDialog1.Filter := 'Bitmap files (*.bmp)|*.BMP'; + + if SaveDialog1.Execute and + (length(SaveDialog1.FileName) > 0) and + Chromium1.TakeSnapshot(TempBitmap) then + TempBitmap.SaveToFile(SaveDialog1.FileName); + finally + if (TempBitmap <> nil) then FreeAndNil(TempBitmap); + end; +end; + +procedure TMiniBrowserFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TMiniBrowserFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TMiniBrowserFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TMiniBrowserFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TMiniBrowserFrm.Deczoom1Click(Sender: TObject); +begin + Chromium1.DecZoomStep; +end; + +procedure TMiniBrowserFrm.DevTools1Click(Sender: TObject); +begin + if DevTools.Visible then + HideDevTools + else + ShowDevTools; +end; + +procedure TMiniBrowserFrm.ShowDevTools(aPoint : TPoint); +begin + Splitter1.Visible := True; + DevTools.Visible := True; + DevTools.Width := Width div 4; + Chromium1.ShowDevTools(aPoint, DevTools); +end; + +procedure TMiniBrowserFrm.ShowDevTools; +var + TempPoint : TPoint; +begin + TempPoint.x := low(integer); + TempPoint.y := low(integer); + ShowDevTools(TempPoint); +end; + +procedure TMiniBrowserFrm.HideDevTools; +begin + Chromium1.CloseDevTools(DevTools); + Splitter1.Visible := False; + DevTools.Visible := False; + DevTools.Width := 0; +end; + +end. diff --git a/demos/Lazarus/MiniBrowser/uPreferences.lfm b/demos/Lazarus/MiniBrowser/uPreferences.lfm new file mode 100644 index 00000000..18aa9c11 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/uPreferences.lfm @@ -0,0 +1,223 @@ +object PreferencesFrm: TPreferencesFrm + Left = 0 + Height = 363 + Top = 0 + Width = 428 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'Preferences' + ClientHeight = 363 + ClientWidth = 428 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + FormStyle = fsStayOnTop + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object Button1: TButton + Left = 232 + Height = 25 + Top = 330 + Width = 75 + Caption = 'Ok' + ModalResult = 1 + TabOrder = 2 + end + object Button2: TButton + Left = 345 + Height = 25 + Top = 330 + Width = 75 + Caption = 'Cancel' + ModalResult = 2 + TabOrder = 3 + end + object GroupBox1: TGroupBox + Left = 8 + Height = 223 + Top = 8 + Width = 412 + Caption = ' Proxy ' + ClientHeight = 205 + ClientWidth = 408 + TabOrder = 0 + object ProxyTypeLbl: TLabel + Left = 12 + Height = 13 + Top = 12 + Width = 24 + Caption = 'Type' + ParentColor = False + end + object ProxyServerLbl: TLabel + Left = 12 + Height = 13 + Top = 41 + Width = 32 + Caption = 'Server' + ParentColor = False + end + object ProxyPortLbl: TLabel + Left = 12 + Height = 13 + Top = 68 + Width = 20 + Caption = 'Port' + ParentColor = False + end + object ProxyUsernameLbl: TLabel + Left = 12 + Height = 13 + Top = 95 + Width = 48 + Caption = 'Username' + ParentColor = False + end + object ProxyPasswordLbl: TLabel + Left = 12 + Height = 13 + Top = 122 + Width = 46 + Caption = 'Password' + ParentColor = False + end + object ProxyScriptURLLbl: TLabel + Left = 12 + Height = 13 + Top = 149 + Width = 49 + Caption = 'Script URL' + ParentColor = False + end + object ProxyByPassListLbl: TLabel + Left = 12 + Height = 13 + Top = 176 + Width = 50 + Caption = 'ByPass list' + ParentColor = False + end + object ProxyTypeCbx: TComboBox + Left = 108 + Height = 21 + Top = 9 + Width = 292 + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'Direct' + 'Autodetect' + 'System' + 'Fixed servers' + 'PAC script' + ) + Style = csDropDownList + TabOrder = 0 + Text = 'Direct' + end + object ProxyServerEdt: TEdit + Left = 184 + Height = 21 + Top = 38 + Width = 216 + TabOrder = 2 + end + object ProxyPortEdt: TEdit + Left = 108 + Height = 21 + Top = 65 + Width = 292 + MaxLength = 5 + NumbersOnly = True + TabOrder = 3 + Text = '80' + end + object ProxyUsernameEdt: TEdit + Left = 108 + Height = 21 + Top = 92 + Width = 292 + TabOrder = 4 + end + object ProxyPasswordEdt: TEdit + Left = 108 + Height = 21 + Top = 119 + Width = 292 + EchoMode = emPassword + PasswordChar = '*' + TabOrder = 5 + end + object ProxyScriptURLEdt: TEdit + Left = 108 + Height = 21 + Top = 146 + Width = 292 + TabOrder = 6 + end + object ProxyByPassListEdt: TEdit + Left = 108 + Height = 21 + Top = 173 + Width = 292 + TabOrder = 7 + end + object ProxySchemeCb: TComboBox + Left = 108 + Height = 21 + Top = 38 + Width = 70 + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'HTTP' + 'SOCKS4' + 'SOCKS5' + ) + Style = csDropDownList + TabOrder = 1 + Text = 'HTTP' + end + end + object GroupBox2: TGroupBox + Left = 8 + Height = 84 + Top = 237 + Width = 412 + Caption = ' Custom header ' + ClientHeight = 66 + ClientWidth = 408 + TabOrder = 1 + object HeaderNameLbl: TLabel + Left = 12 + Height = 13 + Top = 10 + Width = 27 + Caption = 'Name' + ParentColor = False + end + object HeaderValueLbl: TLabel + Left = 12 + Height = 13 + Top = 37 + Width = 26 + Caption = 'Value' + ParentColor = False + end + object HeaderNameEdt: TEdit + Left = 108 + Height = 21 + Top = 7 + Width = 292 + TabOrder = 0 + end + object HeaderValueEdt: TEdit + Left = 108 + Height = 21 + Top = 34 + Width = 292 + TabOrder = 1 + end + end +end diff --git a/demos/Lazarus/MiniBrowser/uPreferences.pas b/demos/Lazarus/MiniBrowser/uPreferences.pas new file mode 100644 index 00000000..a0df1e66 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/uPreferences.pas @@ -0,0 +1,93 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uPreferences; + +{$MODE Delphi} + +{$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; + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls; + {$ENDIF} + +type + TPreferencesFrm = class(TForm) + Button1: TButton; + Button2: TButton; + GroupBox1: TGroupBox; + ProxyTypeCbx: TComboBox; + ProxyTypeLbl: TLabel; + ProxyServerLbl: TLabel; + ProxyServerEdt: TEdit; + ProxyPortLbl: TLabel; + ProxyPortEdt: TEdit; + ProxyUsernameLbl: TLabel; + ProxyUsernameEdt: TEdit; + ProxyPasswordLbl: TLabel; + ProxyPasswordEdt: TEdit; + ProxyScriptURLEdt: TEdit; + ProxyScriptURLLbl: TLabel; + ProxyByPassListEdt: TEdit; + ProxyByPassListLbl: TLabel; + GroupBox2: TGroupBox; + HeaderNameEdt: TEdit; + HeaderNameLbl: TLabel; + HeaderValueEdt: TEdit; + HeaderValueLbl: TLabel; + ProxySchemeCb: TComboBox; + private + { Private declarations } + public + { Public declarations } + end; + +var + PreferencesFrm: TPreferencesFrm; + +implementation + +{$R *.lfm} + +end. diff --git a/demos/Lazarus/MiniBrowser/uSimpleTextViewer.lfm b/demos/Lazarus/MiniBrowser/uSimpleTextViewer.lfm new file mode 100644 index 00000000..54ab49b5 --- /dev/null +++ b/demos/Lazarus/MiniBrowser/uSimpleTextViewer.lfm @@ -0,0 +1,27 @@ +object SimpleTextViewerFrm: TSimpleTextViewerFrm + Left = 0 + Height = 572 + Top = 0 + Width = 694 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'Simple text viewer' + ClientHeight = 572 + ClientWidth = 694 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Position = poScreenCenter + LCLVersion = '2.0.1.0' + object Memo1: TMemo + Left = 0 + Height = 572 + Top = 0 + Width = 694 + Align = alClient + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end +end diff --git a/demos/Lazarus/MiniBrowser/uSimpleTextViewer.pas b/demos/Lazarus/MiniBrowser/uSimpleTextViewer.pas new file mode 100644 index 00000000..9db77fcb --- /dev/null +++ b/demos/Lazarus/MiniBrowser/uSimpleTextViewer.pas @@ -0,0 +1,33 @@ +unit uSimpleTextViewer; + +{$MODE Delphi} + +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; + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls; + {$ENDIF} + + +type + TSimpleTextViewerFrm = class(TForm) + Memo1: TMemo; + private + { Private declarations } + public + { Public declarations } + end; + +var + SimpleTextViewerFrm: TSimpleTextViewerFrm; + +implementation + +{$R *.lfm} + +end. diff --git a/demos/Lazarus/OSRExternalPumpBrowser/00-Delete.bat b/demos/Lazarus/OSRExternalPumpBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpi b/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpi new file mode 100644 index 00000000..68727c78 --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="OSRExternalPumpBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="OSRExternalPumpBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="OSRExternalPumpBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\OSRExternalPumpBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpr b/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpr new file mode 100644 index 00000000..9bb40aaa --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lpr @@ -0,0 +1,78 @@ +// ************************************************************************ +// ***************************** 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 OSRExternalPumpBrowser; + +{$MODE Delphi} + +{$I cef.inc} + +uses + Forms, Windows, + LCLIntf, LCLType, LMessages, Interfaces, + uCEFApplication, + uCEFWorkScheduler, + uOSRExternalPumpBrowser in 'uOSRExternalPumpBrowser.pas' {OSRExternalPumpBrowserFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TOSRExternalPumpBrowserFrm, OSRExternalPumpBrowserFrm); + Application.Run; + + // The form needs to be destroyed *BEFORE* stopping the scheduler. + OSRExternalPumpBrowserFrm.Free; + + GlobalCEFWorkScheduler.StopScheduler; + end; + + DestroyGlobalCEFApp; + DestroyGlobalCEFWorkScheduler; +end. diff --git a/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps b/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps new file mode 100644 index 00000000..57b12128 --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/OSRExternalPumpBrowser.lps @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="5"> + <Unit0> + <Filename Value="OSRExternalPumpBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="41"/> + <CursorPos X="63" Y="61"/> + <UsageCount Value="26"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="OSRExternalPumpBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="963"/> + <CursorPos X="63" Y="1004"/> + <UsageCount Value="26"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="..\..\..\source\uCEFApplication.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="412"/> + <CursorPos X="39" Y="425"/> + <UsageCount Value="11"/> + </Unit2> + <Unit3> + <Filename Value="..\..\..\source\uCEFInterfaces.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="157"/> + <CursorPos X="100" Y="168"/> + <UsageCount Value="11"/> + </Unit3> + <Unit4> + <Filename Value="C:\lazarus\lcl\lcltype.pp"/> + <UnitName Value="LCLType"/> + <EditorIndex Value="-1"/> + <TopLine Value="59"/> + <CursorPos X="32" Y="68"/> + <UsageCount Value="10"/> + </Unit4> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="197" Column="6" TopLine="179"/> + </Position1> + <Position2> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="40" Column="20" TopLine="121"/> + </Position2> + <Position3> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="92" Column="51" TopLine="81"/> + </Position3> + <Position4> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="629" Column="55" TopLine="604"/> + </Position4> + <Position5> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="92" Column="27" TopLine="71"/> + </Position5> + <Position6> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="313" Column="19" TopLine="289"/> + </Position6> + <Position7> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="93" Column="87" TopLine="82"/> + </Position7> + <Position8> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="237" Column="71" TopLine="234"/> + </Position8> + <Position9> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="97" Column="82" TopLine="86"/> + </Position9> + <Position10> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="316" Column="66" TopLine="313"/> + </Position10> + <Position11> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="101" Column="84" TopLine="90"/> + </Position11> + <Position12> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="346" TopLine="343"/> + </Position12> + <Position13> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="192" Column="54" TopLine="173"/> + </Position13> + <Position14> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="194" Column="47" TopLine="173"/> + </Position14> + <Position15> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="199" Column="13" TopLine="187"/> + </Position15> + <Position16> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="120" Column="5" TopLine="109"/> + </Position16> + <Position17> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="47" Column="39" TopLine="42"/> + </Position17> + <Position18> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="311" Column="51" TopLine="294"/> + </Position18> + <Position19> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="97" Column="43" TopLine="84"/> + </Position19> + <Position20> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="284" Column="57" TopLine="273"/> + </Position20> + <Position21> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="323" Column="23" TopLine="299"/> + </Position21> + <Position22> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="95" Column="36" TopLine="84"/> + </Position22> + <Position23> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="271" TopLine="270"/> + </Position23> + <Position24> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="286" Column="70" TopLine="270"/> + </Position24> + <Position25> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="307" Column="11" TopLine="295"/> + </Position25> + <Position26> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="322" TopLine="313"/> + </Position26> + <Position27> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="503" Column="53" TopLine="488"/> + </Position27> + <Position28> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="92" Column="27" TopLine="92"/> + </Position28> + <Position29> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="503" Column="11" TopLine="499"/> + </Position29> + <Position30> + <Filename Value="uOSRExternalPumpBrowser.pas"/> + <Caret Line="201" Column="11" TopLine="166"/> + </Position30> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/OSRExternalPumpBrowser/cef.inc b/demos/Lazarus/OSRExternalPumpBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.lfm b/demos/Lazarus/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.lfm new file mode 100644 index 00000000..aeca7f31 --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.lfm @@ -0,0 +1,147 @@ +object OSRExternalPumpBrowserFrm: TOSRExternalPumpBrowserFrm + Left = 293 + Height = 584 + Top = 210 + Width = 913 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 584 + ClientWidth = 913 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnHide = FormHide + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object NavControlPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 913 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 913 + Enabled = False + TabOrder = 0 + object ComboBox1: TComboBox + Left = 0 + Height = 21 + Top = 0 + Width = 844 + Align = alClient + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'https://www.google.com' + 'https://html5demos.com/drag' + 'https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_select_form' + 'https://www.briskbard.com' + 'https://frames-per-second.appspot.com/' + 'https://www.youtube.com' + ) + OnEnter = ComboBox1Enter + TabOrder = 0 + Text = 'https://www.google.com' + end + object Panel2: TPanel + Left = 844 + Height = 21 + Top = 0 + Width = 69 + Align = alRight + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 69 + TabOrder = 1 + object GoBtn: TButton + Left = 0 + Height = 21 + Top = 0 + Width = 31 + Align = alLeft + Caption = 'Go' + OnClick = GoBtnClick + OnEnter = GoBtnEnter + TabOrder = 0 + end + object SnapshotBtn: TButton + Left = 38 + Height = 21 + Hint = 'Take snapshot' + Top = 0 + Width = 31 + Align = alRight + Caption = 'µ' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -24 + Font.Name = 'Webdings' + OnClick = SnapshotBtnClick + OnEnter = SnapshotBtnEnter + ParentFont = False + ParentShowHint = False + ShowHint = True + TabOrder = 1 + end + end + end + object Panel1: TBufferPanel + Left = 0 + Height = 563 + Top = 21 + Width = 913 + OnIMECancelComposition = Panel1IMECancelComposition + OnIMECommitText = Panel1IMECommitText + OnIMESetComposition = Panel1IMESetComposition + Align = alClient + OnUTF8KeyPress = Panel1UTF8KeyPress + Caption = 'Panel1' + TabOrder = 1 + TabStop = True + OnClick = Panel1Click + OnEnter = Panel1Enter + OnExit = Panel1Exit + OnMouseDown = Panel1MouseDown + OnMouseMove = Panel1MouseMove + OnMouseUp = Panel1MouseUp + OnMouseWheel = Panel1MouseWheel + OnKeyDown = Panel1KeyDown + OnKeyUp = Panel1KeyUp + OnResize = Panel1Resize + end + object chrmosr: TChromium + OnTooltip = chrmosrTooltip + OnBeforePopup = chrmosrBeforePopup + OnAfterCreated = chrmosrAfterCreated + OnBeforeClose = chrmosrBeforeClose + OnGetViewRect = chrmosrGetViewRect + OnGetScreenPoint = chrmosrGetScreenPoint + OnGetScreenInfo = chrmosrGetScreenInfo + OnPopupShow = chrmosrPopupShow + OnPopupSize = chrmosrPopupSize + OnPaint = chrmosrPaint + OnCursorChange = chrmosrCursorChange + OnIMECompositionRangeChanged = chrmosrIMECompositionRangeChanged + left = 24 + top = 56 + end + object SaveDialog1: TSaveDialog + Title = 'Save snapshot' + DefaultExt = '.bmp' + Filter = 'Bitmap files (*.bmp)|*.BMP' + left = 24 + top = 278 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 24 + top = 206 + end +end diff --git a/demos/Lazarus/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas b/demos/Lazarus/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas new file mode 100644 index 00000000..5f1c8fdc --- /dev/null +++ b/demos/Lazarus/OSRExternalPumpBrowser/uOSRExternalPumpBrowser.pas @@ -0,0 +1,1010 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uOSRExternalPumpBrowser; + +{$MODE OBJFPC}{$H+} + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, LCLType, Variants, Classes, SyncObjs, Graphics, Controls, + Forms, Dialogs, StdCtrls, ExtCtrls, + uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel, + uCEFWorkScheduler, Types; + +type + + { TOSRExternalPumpBrowserFrm } + + TOSRExternalPumpBrowserFrm = class(TForm) + NavControlPnl: TPanel; + chrmosr: TChromium; + ComboBox1: TComboBox; + Panel2: TPanel; + GoBtn: TButton; + SnapshotBtn: TButton; + SaveDialog1: TSaveDialog; + Timer1: TTimer; + Panel1: TBufferPanel; + + procedure GoBtnClick(Sender: TObject); + procedure GoBtnEnter(Sender: TObject); + + procedure Panel1Enter(Sender: TObject); + procedure Panel1Exit(Sender: TObject); + procedure Panel1IMECancelComposition(Sender: TObject); + procedure Panel1IMECommitText(Sender: TObject; const aText: ustring; const replacement_range: PCefRange; relative_cursor_pos: integer); + procedure Panel1IMESetComposition(Sender: TObject; const aText: ustring; const underlines: TCefCompositionUnderlineDynArray; const replacement_range, selection_range: TCefRange); + procedure Panel1Resize(Sender: TObject); + procedure Panel1Click(Sender: TObject); + procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); + procedure Panel1MouseLeave(Sender: TObject); + procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); + procedure Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char); + + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure FormHide(Sender: TObject); + procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + + procedure chrmosrPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer); + procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; aCursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo); + procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect); + procedure chrmosrGetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean); + procedure chrmosrGetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean); + procedure chrmosrPopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean); + procedure chrmosrPopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect); + procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean); + procedure chrmosrBeforePopup(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 chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); + + procedure SnapshotBtnClick(Sender: TObject); + procedure SnapshotBtnEnter(Sender: TObject); + + procedure Timer1Timer(Sender: TObject); + procedure ComboBox1Enter(Sender: TObject); + + protected + FbFirst : boolean; + FPopUpBitmap : TBitmap; + FPopUpRect : TRect; + FShowPopUp : boolean; + FResizing : boolean; + FPendingResize : boolean; + FCanClose : boolean; + FClosing : boolean; + FResizeCS : TCriticalSection; + FIMECS : TCriticalSection; + FDeviceBounds : TCefRectDynArray; + FSelectedRange : TCefRange; + + FLastClickCount : integer; + FLastClickTime : integer; + FLastClickPoint : TPoint; + FLastClickButton : TMouseButton; + + function getModifiers(Shift: TShiftState): TCefEventFlags; + function GetButton(Button: TMouseButton): TCefMouseButtonType; + procedure DoResize; + procedure InitializeLastClick; + function CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean; + + procedure WMMove(var aMessage : TWMMove); message WM_MOVE; + procedure WMMoving(var aMessage : TMessage); message WM_MOVING; + procedure WMCaptureChanged(var aMessage : TMessage); message WM_CAPTURECHANGED; + procedure WMCancelMode(var aMessage : TMessage); message WM_CANCELMODE; + procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; + procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; + procedure WMSysChar(var aMessage: TMessage); message WM_SYSCHAR; + procedure WMSysKeyDown(var aMessage: TMessage); message WM_SYSKEYDOWN; + procedure WMSysKeyUp(var aMessage: TMessage); message WM_SYSKEYUP; + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE; + procedure PendingInvalidateMsg(var aMessage : TMessage); message CEF_PENDINGINVALIDATE; + procedure RangeChangedMsg(var aMessage : TMessage); message CEF_IMERANGECHANGED; + + public + { Public declarations } + end; + +var + OSRExternalPumpBrowserFrm : TOSRExternalPumpBrowserFrm; + +// This is a simple browser in OSR mode (off-screen rendering). +// It was necessary to destroy the browser following the destruction sequence described in +// the MDIBrowser demo but in OSR mode there are some modifications. + +// This is the destruction sequence in OSR mode : +// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True). +// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to +// set "Result" to false and CEF3 will destroy the internal browser immediately. +// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed. +// Now we set FCanClose to True and send WM_CLOSE to the form. + +procedure CreateGlobalCEFApp; +procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64); + +implementation + +{$R *.lfm} + +uses + Math, + uCEFMiscFunctions, uCEFApplication; + +procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64); +begin + if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS); +end; + +procedure CreateGlobalCEFApp; +begin + // TCEFWorkScheduler will call cef_do_message_loop_work when + // it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event. + // GlobalCEFWorkScheduler needs to be created before the + // GlobalCEFApp.StartMainProcess call. + GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil); + + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.WindowlessRenderingEnabled := True; + GlobalCEFApp.EnableHighDPISupport := True; + GlobalCEFApp.ExternalMessagePump := True; + GlobalCEFApp.MultiThreadedMessageLoop := False; + GlobalCEFApp.OnScheduleMessagePumpWork := @GlobalCEFApp_OnScheduleMessagePumpWork; +end; + +procedure TOSRExternalPumpBrowserFrm.GoBtnClick(Sender: TObject); +begin + FResizeCS.Acquire; + FResizing := False; + FPendingResize := False; + FResizeCS.Release; + + chrmosr.LoadURL(ComboBox1.Text); +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrIMECompositionRangeChanged( Sender : TObject; + const browser : ICefBrowser; + const selected_range : PCefRange; + character_boundsCount : NativeUInt; + const character_bounds : PCefRect); +var + TempPRect : PCefRect; + i : NativeUInt; +begin + try + FIMECS.Acquire; + + // TChromium.OnIMECompositionRangeChanged is triggered in a different thread + // and all functions using a IMM context need to be executed in the same + // thread, in this case the main thread. We need to save the parameters and + // send a message to the form to execute Panel1.ChangeCompositionRange in + // the main thread. + + if (FDeviceBounds <> nil) then + begin + Finalize(FDeviceBounds); + FDeviceBounds := nil; + end; + + FSelectedRange := selected_range^; + + if (character_boundsCount > 0) then + begin + SetLength(FDeviceBounds, character_boundsCount); + + i := 0; + TempPRect := character_bounds; + + while (i < character_boundsCount) do + begin + FDeviceBounds[i] := TempPRect^; + LogicalToDevice(FDeviceBounds[i], GlobalCEFApp.DeviceScaleFactor); + + inc(TempPRect); + inc(i); + end; + end; + + PostMessage(Handle, CEF_IMERANGECHANGED, 0, 0); + finally + FIMECS.Release; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.GoBtnEnter(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char); +var + TempKeyEvent : TCefKeyEvent; + TempString : UnicodeString; +begin + if Panel1.Focused then + begin + TempString := UTF8Decode(UTF8Key); + + if (length(TempString) > 0) then + begin + TempKeyEvent.kind := KEYEVENT_CHAR; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(WParam(TempString[1]), 0); + TempKeyEvent.windows_key_code := ord(TempString[1]); + TempKeyEvent.native_key_code := 0; + TempKeyEvent.is_system_key := ord(False); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrCursorChange(Sender : TObject; + const browser : ICefBrowser; + aCursor : HICON; + cursorType : TCefCursorType; + const customCursorInfo : PCefCursorInfo); +begin + Panel1.Cursor := GefCursorToWindowsCursor(cursorType); +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrGetScreenInfo(Sender : TObject; + const browser : ICefBrowser; + var screenInfo : TCefScreenInfo; + out Result : Boolean); +var + TempRect : TCEFRect; +begin + if (GlobalCEFApp <> nil) then + begin + TempRect.x := 0; + TempRect.y := 0; + TempRect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor); + TempRect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor); + + screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor; + screenInfo.depth := 0; + screenInfo.depth_per_component := 0; + screenInfo.is_monochrome := Ord(False); + screenInfo.rect := TempRect; + screenInfo.available_rect := TempRect; + + Result := True; + end + else + Result := False; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrGetScreenPoint(Sender: TObject; + const browser: ICefBrowser; viewX, viewY: Integer; var screenX, + screenY: Integer; out Result: Boolean); +var + TempScreenPt, TempViewPt : TPoint; +begin + if (GlobalCEFApp <> nil) then + begin + TempViewPt.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor); + TempViewPt.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor); + TempScreenPt := Panel1.ClientToScreen(TempViewPt); + screenX := TempScreenPt.x; + screenY := TempScreenPt.y; + Result := True; + end + else + Result := False; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrGetViewRect(Sender : TObject; + const browser : ICefBrowser; + var rect : TCefRect); +begin + if (GlobalCEFApp <> nil) then + begin + rect.x := 0; + rect.y := 0; + rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor); + rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrPaint(Sender: TObject; const browser: ICefBrowser; + kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; + const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, + aHeight: Integer); +var + src, dst: PByte; + i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer; + n : NativeUInt; + TempWidth, TempHeight : integer; + TempBufferBits : Pointer; + TempForcedResize : boolean; + TempBitmap : TBitmap; +begin + try + FResizeCS.Acquire; + TempForcedResize := False; + + if Panel1.BeginBufferDraw then + begin + if (kind = PET_POPUP) then + begin + if (FPopUpBitmap = nil) or + (aWidth <> FPopUpBitmap.Width) or + (aHeight <> FPopUpBitmap.Height) then + begin + if (FPopUpBitmap <> nil) then FPopUpBitmap.Free; + + FPopUpBitmap := TBitmap.Create; + FPopUpBitmap.PixelFormat := pf32bit; + FPopUpBitmap.HandleType := bmDIB; + FPopUpBitmap.Width := aWidth; + FPopUpBitmap.Height := aHeight; + end; + + TempBitmap := FPopUpBitmap; + TempBitmap.BeginUpdate; + + TempWidth := FPopUpBitmap.Width; + TempHeight := FPopUpBitmap.Height; + end + else + begin + TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False)); + + TempBitmap := Panel1.Buffer; + TempBitmap.BeginUpdate; + + TempWidth := Panel1.BufferWidth; + TempHeight := Panel1.BufferHeight; + end; + + if (TempBufferBits <> nil) then + begin + SrcStride := aWidth * SizeOf(TRGBQuad); + n := 0; + + while (n < dirtyRectsCount) do + begin + if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then + begin + TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad); + + if (TempLineSize > 0) then + begin + TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad); + TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad)); + + src := @PByte(buffer)[TempSrcOffset]; + + i := 0; + j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y); + + while (i < j) do + begin + TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i]; + dst := @PByte(TempBufferBits)[TempDstOffset]; + + Move(src^, dst^, TempLineSize); + + Inc(src, SrcStride); + inc(i); + end; + end; + end; + + inc(n); + end; + + TempBitmap.EndUpdate; + + if FShowPopup and (FPopUpBitmap <> nil) then + Panel1.BufferDraw(FPopUpRect.Left, FPopUpRect.Top, FPopUpBitmap); + end; + + Panel1.EndBufferDraw; + + if HandleAllocated then PostMessage(Handle, CEF_PENDINGINVALIDATE, 0, 0); + + if (kind = PET_VIEW) then + begin + if (TempForcedResize or FPendingResize) and + HandleAllocated then + PostMessage(Handle, CEF_PENDINGRESIZE, 0, 0); + + FResizing := False; + FPendingResize := False; + end; + end; + finally + FResizeCS.Release; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrPopupShow(Sender : TObject; + const browser : ICefBrowser; + aShow : Boolean); +begin + if aShow then + FShowPopUp := True + else + begin + FShowPopUp := False; + FPopUpRect := rect(0, 0, 0, 0); + + if (chrmosr <> nil) then chrmosr.Invalidate(PET_VIEW); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrPopupSize(Sender : TObject; + const browser : ICefBrowser; + const rect : PCefRect); +begin + if (GlobalCEFApp <> nil) then + begin + LogicalToDevice(rect^, GlobalCEFApp.DeviceScaleFactor); + + FPopUpRect.Left := rect^.x; + FPopUpRect.Top := rect^.y; + FPopUpRect.Right := rect^.x + rect^.width - 1; + FPopUpRect.Bottom := rect^.y + rect^.height - 1; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean); +begin + Panel1.hint := aText; + Panel1.ShowHint := (length(aText) > 0); + Result := True; +end; + +procedure TOSRExternalPumpBrowserFrm.ComboBox1Enter(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); +end; + +function TOSRExternalPumpBrowserFrm.getModifiers(Shift: TShiftState): TCefEventFlags; +begin + Result := EVENTFLAG_NONE; + + if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN; + if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN; + if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN; + if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON; + if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON; + if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON; +end; + +function TOSRExternalPumpBrowserFrm.GetButton(Button: TMouseButton): TCefMouseButtonType; +begin + case Button of + TMouseButton.mbRight : Result := MBT_RIGHT; + TMouseButton.mbMiddle : Result := MBT_MIDDLE; + else Result := MBT_LEFT; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.NotifyMoveOrResizeStarted; +end; + +procedure TOSRExternalPumpBrowserFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.NotifyMoveOrResizeStarted; +end; + +procedure TOSRExternalPumpBrowserFrm.WMCaptureChanged(var aMessage : TMessage); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent; +end; + +procedure TOSRExternalPumpBrowserFrm.WMCancelMode(var aMessage : TMessage); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent; +end; + +procedure TOSRExternalPumpBrowserFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TOSRExternalPumpBrowserFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TOSRExternalPumpBrowserFrm.WMSysChar(var aMessage: TMessage); +var + TempKeyEvent : TCefKeyEvent; +begin + inherited; + + if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then + begin + TempKeyEvent.kind := KEYEVENT_CHAR; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); + TempKeyEvent.windows_key_code := aMessage.wParam; + TempKeyEvent.native_key_code := aMessage.lParam; + TempKeyEvent.is_system_key := ord(True); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.WMSysKeyDown(var aMessage: TMessage); +var + TempKeyEvent : TCefKeyEvent; +begin + inherited; + + if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then + begin + TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); + TempKeyEvent.windows_key_code := aMessage.wParam; + TempKeyEvent.native_key_code := aMessage.lParam; + TempKeyEvent.is_system_key := ord(True); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.WMSysKeyUp(var aMessage: TMessage); +var + TempKeyEvent : TCefKeyEvent; +begin + inherited; + + if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then + begin + TempKeyEvent.kind := KEYEVENT_KEYUP; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); + TempKeyEvent.windows_key_code := aMessage.wParam; + TempKeyEvent.native_key_code := aMessage.lParam; + TempKeyEvent.is_system_key := ord(True); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'Simple Lazarus OSR Browser'; + NavControlPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TOSRExternalPumpBrowserFrm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer); +begin + if (chrmosr <> nil) then + begin + chrmosr.NotifyScreenInfoChanged; + chrmosr.WasResized; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + chrmosr.CloseBrowser(True); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.FormCreate(Sender: TObject); +begin + FbFirst := False; + FPopUpBitmap := nil; + FPopUpRect := rect(0, 0, 0, 0); + FShowPopUp := False; + FResizing := False; + FPendingResize := False; + FCanClose := False; + FClosing := False; + FDeviceBounds := nil; + + FSelectedRange.from := 0; + FSelectedRange.to_ := 0; + + FResizeCS := TCriticalSection.Create; + FIMECS := TCriticalSection.Create; + + InitializeLastClick; +end; + +procedure TOSRExternalPumpBrowserFrm.FormDestroy(Sender: TObject); +begin + chrmosr.ShutdownDragAndDrop; + + if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap); + if (FResizeCS <> nil) then FreeAndNil(FResizeCS); + if (FIMECS <> nil) then FreeAndNil(FIMECS); + + if (FDeviceBounds <> nil) then + begin + Finalize(FDeviceBounds); + FDeviceBounds := nil; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.FormHide(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); + chrmosr.WasHidden(True); +end; + +procedure TOSRExternalPumpBrowserFrm.FormShow(Sender: TObject); +begin + if chrmosr.Initialized then + begin + chrmosr.WasHidden(False); + chrmosr.SendFocusEvent(True); + end + else + begin + // opaque white background color + chrmosr.Options.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); + + // The IME handler needs to be created when Panel1 has a valid handle + // and before the browser creation. + // You can skip this if the user doesn't need an "Input Method Editor". + Panel1.CreateIMEHandler; + + if chrmosr.CreateBrowser(nil, '') then + chrmosr.InitializeDragAndDrop(Panel1) + else + Timer1.Enabled := True; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1Click(Sender: TObject); +begin + Panel1.SetFocus; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + TempEvent : TCefMouseEvent; + TempTime : integer; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + Panel1.SetFocus; + + if not(CancelPreviousClick(x, y, TempTime)) and (Button = FLastClickButton) then + inc(FLastClickCount) + else + begin + FLastClickPoint.x := x; + FLastClickPoint.y := y; + FLastClickCount := 1; + end; + + FLastClickTime := TempTime; + FLastClickButton := Button; + + TempEvent.x := X; + TempEvent.y := Y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, FLastClickCount); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1MouseLeave(Sender: TObject); +var + TempEvent : TCefMouseEvent; + TempPoint : TPoint; + TempTime : integer; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + GetCursorPos(TempPoint); + TempPoint := Panel1.ScreenToclient(TempPoint); + + if CancelPreviousClick(TempPoint.x, TempPoint.y, TempTime) then InitializeLastClick; + + TempEvent.x := TempPoint.x; + TempEvent.y := TempPoint.y; + TempEvent.modifiers := GetCefMouseModifiers; + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseMoveEvent(@TempEvent, True); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); +var + TempEvent : TCefMouseEvent; + TempTime : integer; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + if CancelPreviousClick(x, y, TempTime) then InitializeLastClick; + + TempEvent.x := x; + TempEvent.y := y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseMoveEvent(@TempEvent, False); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + TempEvent : TCefMouseEvent; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + TempEvent.x := X; + TempEvent.y := Y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, FLastClickCount); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1Resize(Sender: TObject); +begin + DoResize; +end; + +procedure TOSRExternalPumpBrowserFrm.PendingResizeMsg(var aMessage : TMessage); +begin + DoResize; +end; + +procedure TOSRExternalPumpBrowserFrm.PendingInvalidateMsg(var aMessage : TMessage); +begin + Panel1.Invalidate; +end; + +procedure TOSRExternalPumpBrowserFrm.RangeChangedMsg(var aMessage : TMessage); +begin + try + FIMECS.Acquire; + Panel1.ChangeCompositionRange(FSelectedRange, FDeviceBounds); + finally + FIMECS.Release; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.DoResize; +begin + try + FResizeCS.Acquire; + + if FResizing then + FPendingResize := True + else + if Panel1.BufferIsResized then + chrmosr.Invalidate(PET_VIEW) + else + begin + FResizing := True; + chrmosr.WasResized; + end; + finally + FResizeCS.Release; + end; +end; + +procedure TOSRExternalPumpBrowserFrm.InitializeLastClick; +begin + FLastClickCount := 0; + FLastClickTime := 0; + FLastClickPoint.x := 0; + FLastClickPoint.y := 0; + FLastClickButton := mbLeft; +end; + +function TOSRExternalPumpBrowserFrm.CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean; +begin + aCurrentTime := GetMessageTime; + + Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or + (abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or + (cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime); +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1Enter(Sender: TObject); +begin + chrmosr.SendFocusEvent(True); +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1Exit(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1IMECancelComposition(Sender: TObject); +begin + chrmosr.IMECancelComposition; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1IMECommitText( Sender : TObject; + const aText : ustring; + const replacement_range : PCefRange; + relative_cursor_pos : Integer); +begin + chrmosr.IMECommitText(aText, replacement_range, relative_cursor_pos); +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1IMESetComposition( Sender : TObject; + const aText : ustring; + const underlines : TCefCompositionUnderlineDynArray; + const replacement_range : TCefRange; + const selection_range : TCefRange); +begin + chrmosr.IMESetComposition(aText, underlines, @replacement_range, @selection_range); +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +var + TempKeyEvent : TCefKeyEvent; +begin + if (Key <> 0) and (chrmosr <> nil) then + begin + TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN; + TempKeyEvent.modifiers := getModifiers(Shift); + TempKeyEvent.windows_key_code := Key; + TempKeyEvent.native_key_code := 0; + TempKeyEvent.is_system_key := ord(False); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); +var + TempKeyEvent : TCefKeyEvent; +begin + if (Key <> 0) and (chrmosr <> nil) then + begin + TempKeyEvent.kind := KEYEVENT_KEYUP; + TempKeyEvent.modifiers := getModifiers(Shift); + TempKeyEvent.windows_key_code := Key; + TempKeyEvent.native_key_code := 0; + TempKeyEvent.is_system_key := ord(False); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.Panel1MouseWheel(Sender: TObject; Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); +var + TempEvent : TCefMouseEvent; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + TempEvent.x := MousePos.x; + TempEvent.y := MousePos.y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseWheelEvent(@TempEvent, 0, WheelDelta); + end; +end; + +procedure TOSRExternalPumpBrowserFrm.SnapshotBtnClick(Sender: TObject); +begin + if SaveDialog1.Execute then Panel1.SaveToFile(SaveDialog1.FileName); +end; + +procedure TOSRExternalPumpBrowserFrm.SnapshotBtnEnter(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); +end; + +procedure TOSRExternalPumpBrowserFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + + if chrmosr.CreateBrowser(nil, '') then + chrmosr.InitializeDragAndDrop(Panel1) + else + if not(chrmosr.Initialized) then Timer1.Enabled := True; +end; + +end. diff --git a/demos/Lazarus/PopupBrowser/00-Delete.bat b/demos/Lazarus/PopupBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lpi b/demos/Lazarus/PopupBrowser/PopupBrowser.lpi similarity index 72% rename from demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lpi rename to demos/Lazarus/PopupBrowser/PopupBrowser.lpi index c24c6c23..e699448f 100644 --- a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lpi +++ b/demos/Lazarus/PopupBrowser/PopupBrowser.lpi @@ -4,16 +4,17 @@ <Version Value="11"/> <PathDelim Value="\"/> <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <Title Value="ToolBoxLazBrowser"/> - <Scaled Value="True"/> + <Title Value="PopupBrowser"/> + <UseAppBundle Value="False"/> <ResourceType Value="res"/> - <UseXPManifest Value="True"/> - <XPManifest> - <DpiAware Value="True"/> - </XPManifest> - <Icon Value="0"/> </General> <BuildModes Count="1"> <Item1 Name="Default" Default="True"/> @@ -36,19 +37,18 @@ </RequiredPackages> <Units Count="3"> <Unit0> - <Filename Value="ToolBoxLazBrowser.lpr"/> + <Filename Value="PopupBrowser.lpr"/> <IsPartOfProject Value="True"/> </Unit0> <Unit1> - <Filename Value="umainform.pas"/> + <Filename Value="uMainForm.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="MainForm"/> <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> - <UnitName Value="uMainForm"/> </Unit1> <Unit2> - <Filename Value="uchildform.pas"/> + <Filename Value="uChildForm.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="ChildForm"/> <HasResources Value="True"/> @@ -60,12 +60,17 @@ <Version Value="11"/> <PathDelim Value="\"/> <Target> - <Filename Value="..\..\bin\ToolBoxLazBrowser"/> + <Filename Value="..\..\..\bin\PopupBrowser"/> </Target> <SearchPaths> <IncludeFiles Value="$(ProjOutDir)"/> <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> <Linking> <Options> <Win32> @@ -73,6 +78,9 @@ </Win32> </Options> </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> </CompilerOptions> <Debugging> <Exceptions Count="3"> diff --git a/demos/Lazarus/PopupBrowser/PopupBrowser.lpr b/demos/Lazarus/PopupBrowser/PopupBrowser.lpr new file mode 100644 index 00000000..b3039166 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/PopupBrowser.lpr @@ -0,0 +1,78 @@ +// ************************************************************************ +// ***************************** 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 PopupBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + 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.WindowlessRenderingEnabled := True; + 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; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/PopupBrowser/PopupBrowser.lps b/demos/Lazarus/PopupBrowser/PopupBrowser.lps new file mode 100644 index 00000000..e0176a71 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/PopupBrowser.lps @@ -0,0 +1,185 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="4"> + <Unit0> + <Filename Value="PopupBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <TopLine Value="42"/> + <CursorPos X="3" Y="54"/> + <UsageCount Value="22"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <TopLine Value="261"/> + <CursorPos X="35" Y="280"/> + <UsageCount Value="22"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uChildForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ChildForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="37"/> + <CursorPos X="3" Y="50"/> + <UsageCount Value="22"/> + <Bookmarks Count="2"> + <Item0 X="64" Y="173" ID="2"/> + <Item1 Y="702" ID="1"/> + </Bookmarks> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\SimpleOSRBrowser\usimplelazosrbrowser.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="340"/> + <CursorPos X="30" Y="349"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit3> + </Units> + <JumpHistory Count="30" HistoryIndex="29"> + <Position1> + <Filename Value="uChildForm.pas"/> + <Caret Line="944" Column="3" TopLine="929"/> + </Position1> + <Position2> + <Filename Value="uChildForm.pas"/> + <Caret Line="84" Column="70" TopLine="73"/> + </Position2> + <Position3> + <Filename Value="uChildForm.pas"/> + <Caret Line="944" Column="28" TopLine="929"/> + </Position3> + <Position4> + <Filename Value="uChildForm.pas"/> + <Caret Line="83" Column="29" TopLine="72"/> + </Position4> + <Position5> + <Filename Value="uChildForm.pas"/> + <Caret Line="149" Column="74" TopLine="137"/> + </Position5> + <Position6> + <Filename Value="uChildForm.pas"/> + <Caret Line="84" Column="24" TopLine="73"/> + </Position6> + <Position7> + <Filename Value="uChildForm.pas"/> + <Caret Line="942" Column="31" TopLine="922"/> + </Position7> + <Position8> + <Filename Value="uChildForm.pas"/> + <Caret Line="107" Column="47" TopLine="104"/> + </Position8> + <Position9> + <Filename Value="uChildForm.pas"/> + <Caret Line="109" Column="23" TopLine="104"/> + </Position9> + <Position10> + <Filename Value="uChildForm.pas"/> + <Caret Line="145" Column="68" TopLine="125"/> + </Position10> + <Position11> + <Filename Value="uChildForm.pas"/> + <Caret Line="174" Column="21" TopLine="154"/> + </Position11> + <Position12> + <Filename Value="uChildForm.pas"/> + <Caret Line="175" Column="43" TopLine="155"/> + </Position12> + <Position13> + <Filename Value="uChildForm.pas"/> + <Caret Line="688" Column="24" TopLine="668"/> + </Position13> + <Position14> + <Filename Value="uChildForm.pas"/> + <Caret Line="109" Column="51" TopLine="102"/> + </Position14> + <Position15> + <Filename Value="uChildForm.pas"/> + <Caret Line="9" Column="72"/> + </Position15> + <Position16> + <Filename Value="uChildForm.pas"/> + <Caret Line="84" Column="52" TopLine="64"/> + </Position16> + <Position17> + <Filename Value="uChildForm.pas"/> + <Caret Line="943" Column="59" TopLine="923"/> + </Position17> + <Position18> + <Filename Value="uChildForm.pas"/> + <Caret Line="945" Column="9" TopLine="925"/> + </Position18> + <Position19> + <Filename Value="uChildForm.pas"/> + <Caret Line="84" Column="47" TopLine="73"/> + </Position19> + <Position20> + <Filename Value="uChildForm.pas"/> + <Caret Line="945" Column="4" TopLine="923"/> + </Position20> + <Position21> + <Filename Value="uChildForm.pas"/> + <Caret Line="114" Column="44" TopLine="96"/> + </Position21> + <Position22> + <Filename Value="uMainForm.pas"/> + <Caret Line="81" Column="34" TopLine="68"/> + </Position22> + <Position23> + <Filename Value="uMainForm.pas"/> + <Caret Line="126" Column="69" TopLine="106"/> + </Position23> + <Position24> + <Filename Value="uMainForm.pas"/> + <Caret Line="127" Column="44" TopLine="107"/> + </Position24> + <Position25> + <Filename Value="uMainForm.pas"/> + <Caret Line="248" Column="33" TopLine="241"/> + </Position25> + <Position26> + <Filename Value="uMainForm.pas"/> + <Caret Line="249" Column="20" TopLine="241"/> + </Position26> + <Position27> + <Filename Value="uMainForm.pas"/> + <Caret Line="269" Column="33" TopLine="262"/> + </Position27> + <Position28> + <Filename Value="uMainForm.pas"/> + <Caret Line="270" Column="20" TopLine="262"/> + </Position28> + <Position29> + <Filename Value="uMainForm.pas"/> + <Caret Line="271" Column="24" TopLine="262"/> + </Position29> + <Position30> + <Filename Value="uMainForm.pas"/> + <Caret Line="272" Column="31" TopLine="262"/> + </Position30> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/PopupBrowser/cef.inc b/demos/Lazarus/PopupBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/PopupBrowser/uChildForm.lfm b/demos/Lazarus/PopupBrowser/uChildForm.lfm new file mode 100644 index 00000000..3d0aa729 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/uChildForm.lfm @@ -0,0 +1,64 @@ +object ChildForm: TChildForm + Left = 550 + Height = 256 + Top = 146 + Width = 352 + Caption = 'Popup' + ClientHeight = 256 + ClientWidth = 352 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnClose = FormClose + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnHide = FormHide + OnShow = FormShow + Position = poScreenCenter + ShowInTaskBar = stAlways + LCLVersion = '2.0.2.0' + object Panel1: TBufferPanel + Left = 0 + Height = 256 + Top = 0 + Width = 352 + OnIMECancelComposition = Panel1IMECancelComposition + OnIMECommitText = Panel1IMECommitText + OnIMESetComposition = Panel1IMESetComposition + Align = alClient + OnUTF8KeyPress = Panel1UTF8KeyPress + Caption = 'Panel1' + Color = clWhite + ParentColor = False + TabOrder = 0 + TabStop = True + OnClick = Panel1Click + OnEnter = Panel1Enter + OnExit = Panel1Exit + OnMouseDown = Panel1MouseDown + OnMouseMove = Panel1MouseMove + OnMouseUp = Panel1MouseUp + OnMouseWheel = Panel1MouseWheel + OnKeyDown = Panel1KeyDown + OnKeyUp = Panel1KeyUp + OnResize = Panel1Resize + end + object chrmosr: TChromium + OnTitleChange = chrmosrTitleChange + OnTooltip = chrmosrTooltip + OnBeforePopup = chrmosrBeforePopup + OnBeforeClose = chrmosrBeforeClose + OnGetViewRect = chrmosrGetViewRect + OnGetScreenPoint = chrmosrGetScreenPoint + OnGetScreenInfo = chrmosrGetScreenInfo + OnPopupShow = chrmosrPopupShow + OnPopupSize = chrmosrPopupSize + OnPaint = chrmosrPaint + OnCursorChange = chrmosrCursorChange + OnIMECompositionRangeChanged = chrmosrIMECompositionRangeChanged + left = 24 + top = 56 + end +end diff --git a/demos/Lazarus/PopupBrowser/uChildForm.pas b/demos/Lazarus/PopupBrowser/uChildForm.pas new file mode 100644 index 00000000..29361d03 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/uChildForm.pas @@ -0,0 +1,956 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uChildForm; + +{$MODE OBJFPC}{$H+} + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, Variants, Types, LCLType, Classes, SyncObjs, + Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFBufferPanel, + uCEFChromiumEvents; + +const + CEF_SHOWCHILD = WM_APP + $A52; + +type + + { TChildForm } + + TChildForm = class(TForm) + chrmosr: TChromium; + Panel1: TBufferPanel; + + procedure Panel1Enter(Sender: TObject); + procedure Panel1Exit(Sender: TObject); + procedure Panel1IMECancelComposition(Sender: TObject); + procedure Panel1IMECommitText(Sender: TObject; const aText: ustring; const replacement_range: PCefRange; relative_cursor_pos: integer); + procedure Panel1IMESetComposition(Sender: TObject; const aText: ustring; const underlines: TCefCompositionUnderlineDynArray; const replacement_range, selection_range: TCefRange); + procedure Panel1Resize(Sender: TObject); + procedure Panel1Click(Sender: TObject); + procedure Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); + procedure Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); + procedure Panel1MouseLeave(Sender: TObject); + procedure Panel1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); + procedure Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char); + + procedure FormCreate(Sender: TObject); + procedure FormDestroy(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure FormHide(Sender: TObject); + procedure FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure FormClose(Sender: TObject; var aAction: TCloseAction); + + procedure chrmosrPaint(Sender: TObject; const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, aHeight: Integer); + procedure chrmosrCursorChange(Sender: TObject; const browser: ICefBrowser; aCursor: HICON; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo); + procedure chrmosrGetViewRect(Sender: TObject; const browser: ICefBrowser; var rect: TCefRect); + procedure chrmosrGetScreenPoint(Sender: TObject; const browser: ICefBrowser; viewX, viewY: Integer; var screenX, screenY: Integer; out Result: Boolean); + procedure chrmosrGetScreenInfo(Sender: TObject; const browser: ICefBrowser; var screenInfo: TCefScreenInfo; out Result: Boolean); + procedure chrmosrPopupShow(Sender: TObject; const browser: ICefBrowser; aShow: Boolean); + procedure chrmosrPopupSize(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect); + procedure chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean); + procedure chrmosrBeforePopup(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 chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); + procedure chrmosrTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); + + protected + FbFirst : boolean; + FPopUpBitmap : TBitmap; + FPopUpRect : TRect; + FShowPopUp : boolean; + FResizing : boolean; + FPendingResize : boolean; + FCanClose : boolean; + FClosing : boolean; + FClientInitialized : boolean; + FResizeCS : TCriticalSection; + FIMECS : TCriticalSection; + FDeviceBounds : TCefRectDynArray; + FSelectedRange : TCefRange; + FPopupFeatures : TCefPopupFeatures; + + FLastClickCount : integer; + FLastClickTime : integer; + FLastClickPoint : TPoint; + FLastClickButton : TMouseButton; + + function getModifiers(Shift: TShiftState): TCefEventFlags; + function GetButton(Button: TMouseButton): TCefMouseButtonType; + procedure DoResize; + procedure InitializeLastClick; + function CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean; + + procedure WMMove(var aMessage : TWMMove); message WM_MOVE; + procedure WMMoving(var aMessage : TMessage); message WM_MOVING; + procedure WMCaptureChanged(var aMessage : TMessage); message WM_CAPTURECHANGED; + procedure WMCancelMode(var aMessage : TMessage); message WM_CANCELMODE; + procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; + procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; + procedure WMSysChar(var aMessage: TMessage); message WM_SYSCHAR; + procedure WMSysKeyDown(var aMessage: TMessage); message WM_SYSKEYDOWN; + procedure WMSysKeyUp(var aMessage: TMessage); message WM_SYSKEYUP; + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure PendingResizeMsg(var aMessage : TMessage); message CEF_PENDINGRESIZE; + procedure PendingInvalidateMsg(var aMessage : TMessage); message CEF_PENDINGINVALIDATE; + procedure RangeChangedMsg(var aMessage : TMessage); message CEF_IMERANGECHANGED; + procedure ShowChildMsg(var aMessage : TMessage); message CEF_SHOWCHILD; + + public + 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 *.lfm} + +uses + Math, + uCEFMiscFunctions, uCEFApplication, uMainForm; + +// This is the destruction sequence in OSR mode : +// 1- FormCloseQuery sets CanClose to the initial FCanClose value (False) and calls chrmosr.CloseBrowser(True). +// 2- chrmosr.CloseBrowser(True) will trigger chrmosr.OnClose and we have to +// set "Result" to false and CEF3 will destroy the internal browser immediately. +// 3- chrmosr.OnBeforeClose is triggered because the internal browser was destroyed. +// Now we set FCanClose to True and send WM_CLOSE to the form. + +function TChildForm.CreateClientHandler(var windowInfo : TCefWindowInfo; + var client : ICefClient; + const targetFrameName : string; + const popupFeatures : TCefPopupFeatures) : boolean; +begin + Panel1.CreateIMEHandler; + chrmosr.InitializeDragAndDrop(Panel1); + + WindowInfoAsWindowless(windowInfo, 0, targetFrameName); + FPopupFeatures := popupFeatures; + FClientInitialized := chrmosr.CreateClientHandler(client); + Result := FClientInitialized; +end; + +procedure TChildForm.ApplyPopupFeatures; +begin + if (FPopupFeatures.xset <> 0) then chrmosr.SetFormLeftTo(FPopupFeatures.x); + if (FPopupFeatures.yset <> 0) then chrmosr.SetFormTopTo(FPopupFeatures.y); + if (FPopupFeatures.widthset <> 0) then chrmosr.ResizeFormWidthTo(FPopupFeatures.width); + if (FPopupFeatures.heightset <> 0) then chrmosr.ResizeFormHeightTo(FPopupFeatures.height); +end; + +procedure TChildForm.chrmosrIMECompositionRangeChanged( Sender : TObject; + const browser : ICefBrowser; + const selected_range : PCefRange; + character_boundsCount : NativeUInt; + const character_bounds : PCefRect); +var + TempPRect : PCefRect; + i : NativeUInt; +begin + try + FIMECS.Acquire; + + // TChromium.OnIMECompositionRangeChanged is triggered in a different thread + // and all functions using a IMM context need to be executed in the same + // thread, in this case the main thread. We need to save the parameters and + // send a message to the form to execute Panel1.ChangeCompositionRange in + // the main thread. + + if (FDeviceBounds <> nil) then + begin + Finalize(FDeviceBounds); + FDeviceBounds := nil; + end; + + FSelectedRange := selected_range^; + + if (character_boundsCount > 0) then + begin + SetLength(FDeviceBounds, character_boundsCount); + + i := 0; + TempPRect := character_bounds; + + while (i < character_boundsCount) do + begin + FDeviceBounds[i] := TempPRect^; + LogicalToDevice(FDeviceBounds[i], GlobalCEFApp.DeviceScaleFactor); + + inc(TempPRect); + inc(i); + end; + end; + + PostMessage(Handle, CEF_IMERANGECHANGED, 0, 0); + finally + FIMECS.Release; + end; +end; + +procedure TChildForm.chrmosrAfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TChildForm.chrmosrBeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TChildForm.Panel1UTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char); +var + TempKeyEvent : TCefKeyEvent; + TempString : UnicodeString; +begin + if Panel1.Focused then + begin + TempString := UTF8Decode(UTF8Key); + + if (length(TempString) > 0) then + begin + TempKeyEvent.kind := KEYEVENT_CHAR; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(WParam(TempString[1]), 0); + TempKeyEvent.windows_key_code := ord(TempString[1]); + TempKeyEvent.native_key_code := 0; + TempKeyEvent.is_system_key := ord(False); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; + end; +end; + +procedure TChildForm.chrmosrBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TChildForm.chrmosrCursorChange(Sender : TObject; + const browser : ICefBrowser; + aCursor : HICON; + cursorType : TCefCursorType; + const customCursorInfo : PCefCursorInfo); +begin + Panel1.Cursor := GefCursorToWindowsCursor(cursorType); +end; + +procedure TChildForm.chrmosrGetScreenInfo(Sender : TObject; + const browser : ICefBrowser; + var screenInfo : TCefScreenInfo; + out Result : Boolean); +var + TempRect : TCEFRect; +begin + if (GlobalCEFApp <> nil) then + begin + TempRect.x := 0; + TempRect.y := 0; + TempRect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor); + TempRect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor); + + screenInfo.device_scale_factor := GlobalCEFApp.DeviceScaleFactor; + screenInfo.depth := 0; + screenInfo.depth_per_component := 0; + screenInfo.is_monochrome := Ord(False); + screenInfo.rect := TempRect; + screenInfo.available_rect := TempRect; + + Result := True; + end + else + Result := False; +end; + +procedure TChildForm.chrmosrGetScreenPoint(Sender: TObject; + const browser: ICefBrowser; viewX, viewY: Integer; var screenX, + screenY: Integer; out Result: Boolean); +var + TempScreenPt, TempViewPt : TPoint; +begin + if (GlobalCEFApp <> nil) then + begin + TempViewPt.x := LogicalToDevice(viewX, GlobalCEFApp.DeviceScaleFactor); + TempViewPt.y := LogicalToDevice(viewY, GlobalCEFApp.DeviceScaleFactor); + TempScreenPt := Panel1.ClientToScreen(TempViewPt); + screenX := TempScreenPt.x; + screenY := TempScreenPt.y; + Result := True; + end + else + Result := False; +end; + +procedure TChildForm.chrmosrGetViewRect(Sender : TObject; + const browser : ICefBrowser; + var rect : TCefRect); +begin + if (GlobalCEFApp <> nil) then + begin + rect.x := 0; + rect.y := 0; + rect.width := DeviceToLogical(Panel1.Width, GlobalCEFApp.DeviceScaleFactor); + rect.height := DeviceToLogical(Panel1.Height, GlobalCEFApp.DeviceScaleFactor); + end; +end; + +procedure TChildForm.chrmosrPaint(Sender: TObject; const browser: ICefBrowser; + kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; + const dirtyRects: PCefRectArray; const buffer: Pointer; aWidth, + aHeight: Integer); +var + src, dst: PByte; + i, j, TempLineSize, TempSrcOffset, TempDstOffset, SrcStride : Integer; + n : NativeUInt; + TempWidth, TempHeight : integer; + TempBufferBits : Pointer; + TempForcedResize : boolean; + TempBitmap : TBitmap; +begin + try + FResizeCS.Acquire; + TempForcedResize := False; + + if Panel1.BeginBufferDraw then + begin + if (kind = PET_POPUP) then + begin + if (FPopUpBitmap = nil) or + (aWidth <> FPopUpBitmap.Width) or + (aHeight <> FPopUpBitmap.Height) then + begin + if (FPopUpBitmap <> nil) then FPopUpBitmap.Free; + + FPopUpBitmap := TBitmap.Create; + FPopUpBitmap.PixelFormat := pf32bit; + FPopUpBitmap.HandleType := bmDIB; + FPopUpBitmap.Width := aWidth; + FPopUpBitmap.Height := aHeight; + end; + + TempBitmap := FPopUpBitmap; + TempBitmap.BeginUpdate; + + TempWidth := FPopUpBitmap.Width; + TempHeight := FPopUpBitmap.Height; + end + else + begin + TempForcedResize := Panel1.UpdateBufferDimensions(aWidth, aHeight) or not(Panel1.BufferIsResized(False)); + + TempBitmap := Panel1.Buffer; + TempBitmap.BeginUpdate; + + TempWidth := Panel1.BufferWidth; + TempHeight := Panel1.BufferHeight; + end; + + if (TempBufferBits <> nil) then + begin + SrcStride := aWidth * SizeOf(TRGBQuad); + n := 0; + + while (n < dirtyRectsCount) do + begin + if (dirtyRects^[n].x >= 0) and (dirtyRects^[n].y >= 0) then + begin + TempLineSize := min(dirtyRects^[n].width, TempWidth - dirtyRects^[n].x) * SizeOf(TRGBQuad); + + if (TempLineSize > 0) then + begin + TempSrcOffset := ((dirtyRects^[n].y * aWidth) + dirtyRects^[n].x) * SizeOf(TRGBQuad); + TempDstOffset := (dirtyRects^[n].x * SizeOf(TRGBQuad)); + + src := @PByte(buffer)[TempSrcOffset]; + + i := 0; + j := min(dirtyRects^[n].height, TempHeight - dirtyRects^[n].y); + + while (i < j) do + begin + TempBufferBits := TempBitmap.Scanline[dirtyRects^[n].y + i]; + dst := @PByte(TempBufferBits)[TempDstOffset]; + + Move(src^, dst^, TempLineSize); + + Inc(src, SrcStride); + inc(i); + end; + end; + end; + + inc(n); + end; + + TempBitmap.EndUpdate; + + if FShowPopup and (FPopUpBitmap <> nil) then + Panel1.BufferDraw(FPopUpRect.Left, FPopUpRect.Top, FPopUpBitmap); + end; + + Panel1.EndBufferDraw; + + if HandleAllocated then PostMessage(Handle, CEF_PENDINGINVALIDATE, 0, 0); + + if (kind = PET_VIEW) then + begin + if (TempForcedResize or FPendingResize) and + HandleAllocated then + PostMessage(Handle, CEF_PENDINGRESIZE, 0, 0); + + FResizing := False; + FPendingResize := False; + end; + end; + finally + FResizeCS.Release; + end; +end; + +procedure TChildForm.chrmosrPopupShow(Sender : TObject; + const browser : ICefBrowser; + aShow : Boolean); +begin + if aShow then + FShowPopUp := True + else + begin + FShowPopUp := False; + FPopUpRect := rect(0, 0, 0, 0); + + if (chrmosr <> nil) then chrmosr.Invalidate(PET_VIEW); + end; +end; + +procedure TChildForm.chrmosrPopupSize(Sender : TObject; + const browser : ICefBrowser; + const rect : PCefRect); +begin + if (GlobalCEFApp <> nil) then + begin + LogicalToDevice(rect^, GlobalCEFApp.DeviceScaleFactor); + + FPopUpRect.Left := rect^.x; + FPopUpRect.Top := rect^.y; + FPopUpRect.Right := rect^.x + rect^.width - 1; + FPopUpRect.Bottom := rect^.y + rect^.height - 1; + end; +end; + +procedure TChildForm.chrmosrTooltip(Sender: TObject; const browser: ICefBrowser; var aText: ustring; out Result: Boolean); +begin + Panel1.hint := aText; + Panel1.ShowHint := (length(aText) > 0); + Result := True; +end; + +function TChildForm.getModifiers(Shift: TShiftState): TCefEventFlags; +begin + Result := EVENTFLAG_NONE; + + if (ssShift in Shift) then Result := Result or EVENTFLAG_SHIFT_DOWN; + if (ssAlt in Shift) then Result := Result or EVENTFLAG_ALT_DOWN; + if (ssCtrl in Shift) then Result := Result or EVENTFLAG_CONTROL_DOWN; + if (ssLeft in Shift) then Result := Result or EVENTFLAG_LEFT_MOUSE_BUTTON; + if (ssRight in Shift) then Result := Result or EVENTFLAG_RIGHT_MOUSE_BUTTON; + if (ssMiddle in Shift) then Result := Result or EVENTFLAG_MIDDLE_MOUSE_BUTTON; +end; + +function TChildForm.GetButton(Button: TMouseButton): TCefMouseButtonType; +begin + case Button of + TMouseButton.mbRight : Result := MBT_RIGHT; + TMouseButton.mbMiddle : Result := MBT_MIDDLE; + else Result := MBT_LEFT; + end; +end; + +procedure TChildForm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.NotifyMoveOrResizeStarted; +end; + +procedure TChildForm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.NotifyMoveOrResizeStarted; +end; + +procedure TChildForm.WMCaptureChanged(var aMessage : TMessage); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent; +end; + +procedure TChildForm.WMCancelMode(var aMessage : TMessage); +begin + inherited; + + if (chrmosr <> nil) then chrmosr.SendCaptureLostEvent; +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.WMSysChar(var aMessage: TMessage); +var + TempKeyEvent : TCefKeyEvent; +begin + inherited; + + if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then + begin + TempKeyEvent.kind := KEYEVENT_CHAR; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); + TempKeyEvent.windows_key_code := aMessage.wParam; + TempKeyEvent.native_key_code := aMessage.lParam; + TempKeyEvent.is_system_key := ord(True); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TChildForm.WMSysKeyDown(var aMessage: TMessage); +var + TempKeyEvent : TCefKeyEvent; +begin + inherited; + + if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then + begin + TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); + TempKeyEvent.windows_key_code := aMessage.wParam; + TempKeyEvent.native_key_code := aMessage.lParam; + TempKeyEvent.is_system_key := ord(True); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TChildForm.WMSysKeyUp(var aMessage: TMessage); +var + TempKeyEvent : TCefKeyEvent; +begin + inherited; + + if Panel1.Focused and (aMessage.wParam in [VK_BACK..VK_HELP]) then + begin + TempKeyEvent.kind := KEYEVENT_KEYUP; + TempKeyEvent.modifiers := GetCefKeyboardModifiers(aMessage.wParam, aMessage.lParam); + TempKeyEvent.windows_key_code := aMessage.wParam; + TempKeyEvent.native_key_code := aMessage.lParam; + TempKeyEvent.is_system_key := ord(True); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TChildForm.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'Popup Browser'; +end; + +procedure TChildForm.FormAfterMonitorDpiChanged(Sender: TObject; OldDPI, NewDPI: Integer); +begin + if (chrmosr <> nil) then + begin + chrmosr.NotifyScreenInfoChanged; + chrmosr.WasResized; + end; +end; + +procedure TChildForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + chrmosr.CloseBrowser(True); + end; +end; + +procedure TChildForm.FormCreate(Sender: TObject); +begin + FbFirst := False; + FPopUpBitmap := nil; + FPopUpRect := rect(0, 0, 0, 0); + FShowPopUp := False; + FResizing := False; + FPendingResize := False; + FCanClose := False; + FClosing := False; + FDeviceBounds := nil; + + FSelectedRange.from := 0; + FSelectedRange.to_ := 0; + + FResizeCS := TCriticalSection.Create; + FIMECS := TCriticalSection.Create; + + InitializeLastClick; +end; + +procedure TChildForm.FormDestroy(Sender: TObject); +begin + chrmosr.ShutdownDragAndDrop; + + if (FPopUpBitmap <> nil) then FreeAndNil(FPopUpBitmap); + if (FResizeCS <> nil) then FreeAndNil(FResizeCS); + if (FIMECS <> nil) then FreeAndNil(FIMECS); + + if (FDeviceBounds <> nil) then + begin + Finalize(FDeviceBounds); + FDeviceBounds := nil; + end; + + if FClientInitialized and TMainForm(Owner).HandleAllocated then + PostMessage(TMainForm(Owner).Handle, CEF_CHILDDESTROYED, 0, 0); +end; + +procedure TChildForm.FormHide(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); + chrmosr.WasHidden(True); +end; + +procedure TChildForm.FormShow(Sender: TObject); +begin + chrmosr.WasHidden(False); + chrmosr.SendFocusEvent(True); +end; + +procedure TChildForm.Panel1Click(Sender: TObject); +begin + Panel1.SetFocus; +end; + +procedure TChildForm.Panel1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + TempEvent : TCefMouseEvent; + TempTime : integer; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + Panel1.SetFocus; + + if not(CancelPreviousClick(x, y, TempTime)) and (Button = FLastClickButton) then + inc(FLastClickCount) + else + begin + FLastClickPoint.x := x; + FLastClickPoint.y := y; + FLastClickCount := 1; + end; + + FLastClickTime := TempTime; + FLastClickButton := Button; + + TempEvent.x := X; + TempEvent.y := Y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), False, FLastClickCount); + end; +end; + +procedure TChildForm.Panel1MouseLeave(Sender: TObject); +var + TempEvent : TCefMouseEvent; + TempPoint : TPoint; + TempTime : integer; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + GetCursorPos(TempPoint); + TempPoint := Panel1.ScreenToclient(TempPoint); + + if CancelPreviousClick(TempPoint.x, TempPoint.y, TempTime) then InitializeLastClick; + + TempEvent.x := TempPoint.x; + TempEvent.y := TempPoint.y; + TempEvent.modifiers := GetCefMouseModifiers; + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseMoveEvent(@TempEvent, True); + end; +end; + +procedure TChildForm.Panel1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); +var + TempEvent : TCefMouseEvent; + TempTime : integer; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + if CancelPreviousClick(x, y, TempTime) then InitializeLastClick; + + TempEvent.x := x; + TempEvent.y := y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseMoveEvent(@TempEvent, False); + end; +end; + +procedure TChildForm.Panel1MouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var + TempEvent : TCefMouseEvent; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + TempEvent.x := X; + TempEvent.y := Y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseClickEvent(@TempEvent, GetButton(Button), True, FLastClickCount); + end; +end; + +procedure TChildForm.Panel1Resize(Sender: TObject); +begin + DoResize; +end; + +procedure TChildForm.PendingResizeMsg(var aMessage : TMessage); +begin + DoResize; +end; + +procedure TChildForm.PendingInvalidateMsg(var aMessage : TMessage); +begin + Panel1.Invalidate; +end; + +procedure TChildForm.RangeChangedMsg(var aMessage : TMessage); +begin + try + FIMECS.Acquire; + Panel1.ChangeCompositionRange(FSelectedRange, FDeviceBounds); + finally + FIMECS.Release; + end; +end; + +procedure TChildForm.DoResize; +begin + try + FResizeCS.Acquire; + + if FResizing then + FPendingResize := True + else + if Panel1.BufferIsResized then + chrmosr.Invalidate(PET_VIEW) + else + begin + FResizing := True; + chrmosr.WasResized; + end; + finally + FResizeCS.Release; + end; +end; + +procedure TChildForm.InitializeLastClick; +begin + FLastClickCount := 0; + FLastClickTime := 0; + FLastClickPoint.x := 0; + FLastClickPoint.y := 0; + FLastClickButton := mbLeft; +end; + +function TChildForm.CancelPreviousClick(x, y : integer; var aCurrentTime : integer) : boolean; +begin + aCurrentTime := GetMessageTime; + + Result := (abs(FLastClickPoint.x - x) > (GetSystemMetrics(SM_CXDOUBLECLK) div 2)) or + (abs(FLastClickPoint.y - y) > (GetSystemMetrics(SM_CYDOUBLECLK) div 2)) or + (cardinal(aCurrentTime - FLastClickTime) > GetDoubleClickTime); +end; + +procedure TChildForm.Panel1Enter(Sender: TObject); +begin + chrmosr.SendFocusEvent(True); +end; + +procedure TChildForm.Panel1Exit(Sender: TObject); +begin + chrmosr.SendFocusEvent(False); +end; + +procedure TChildForm.Panel1IMECancelComposition(Sender: TObject); +begin + chrmosr.IMECancelComposition; +end; + +procedure TChildForm.Panel1IMECommitText( Sender : TObject; + const aText : ustring; + const replacement_range : PCefRange; + relative_cursor_pos : Integer); +begin + chrmosr.IMECommitText(aText, replacement_range, relative_cursor_pos); +end; + +procedure TChildForm.Panel1IMESetComposition( Sender : TObject; + const aText : ustring; + const underlines : TCefCompositionUnderlineDynArray; + const replacement_range : TCefRange; + const selection_range : TCefRange); +begin + chrmosr.IMESetComposition(aText, underlines, @replacement_range, @selection_range); +end; + +procedure TChildForm.Panel1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +var + TempKeyEvent : TCefKeyEvent; +begin + if (Key <> 0) and (chrmosr <> nil) then + begin + TempKeyEvent.kind := KEYEVENT_RAWKEYDOWN; + TempKeyEvent.modifiers := getModifiers(Shift); + TempKeyEvent.windows_key_code := Key; + TempKeyEvent.native_key_code := 0; + TempKeyEvent.is_system_key := ord(False); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TChildForm.Panel1KeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); +var + TempKeyEvent : TCefKeyEvent; +begin + if (Key <> 0) and (chrmosr <> nil) then + begin + TempKeyEvent.kind := KEYEVENT_KEYUP; + TempKeyEvent.modifiers := getModifiers(Shift); + TempKeyEvent.windows_key_code := Key; + TempKeyEvent.native_key_code := 0; + TempKeyEvent.is_system_key := ord(False); + TempKeyEvent.character := #0; + TempKeyEvent.unmodified_character := #0; + TempKeyEvent.focus_on_editable_field := ord(False); + + chrmosr.SendKeyEvent(@TempKeyEvent); + end; +end; + +procedure TChildForm.Panel1MouseWheel(Sender: TObject; Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); +var + TempEvent : TCefMouseEvent; +begin + if (GlobalCEFApp <> nil) and (chrmosr <> nil) then + begin + TempEvent.x := MousePos.x; + TempEvent.y := MousePos.y; + TempEvent.modifiers := getModifiers(Shift); + DeviceToLogical(TempEvent, GlobalCEFApp.DeviceScaleFactor); + chrmosr.SendMouseWheelEvent(@TempEvent, 0, WheelDelta); + end; +end; + +procedure TChildForm.chrmosrTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); +begin + Caption := title; +end; + +procedure TChildForm.FormClose(Sender: TObject; var aAction: TCloseAction); +begin + aAction := caFree; +end; + +procedure TChildForm.ShowChildMsg(var aMessage : TMessage); +begin + ApplyPopupFeatures; + Show; +end; + +end. diff --git a/demos/Lazarus/PopupBrowser/uMainForm.lfm b/demos/Lazarus/PopupBrowser/uMainForm.lfm new file mode 100644 index 00000000..7ab32d18 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/uMainForm.lfm @@ -0,0 +1,77 @@ +object MainForm: TMainForm + Left = 128 + Height = 624 + Top = 196 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 0 + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + TabOrder = 0 + Text = 'file:///PopupBrowser.html' + end + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + 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 + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 56 + top = 152 + end + object ApplicationProperties1: TApplicationProperties + left = 52 + top = 36 + end +end diff --git a/demos/Lazarus/PopupBrowser/uMainForm.pas b/demos/Lazarus/PopupBrowser/uMainForm.pas new file mode 100644 index 00000000..de722634 --- /dev/null +++ b/demos/Lazarus/PopupBrowser/uMainForm.pas @@ -0,0 +1,366 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMainForm; + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs, + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uChildForm, + uCEFWinControl, uCEFChromiumEvents; + +const + CEF_CREATENEXTCHILD = WM_APP + $A50; + CEF_CHILDDESTROYED = WM_APP + $A51; + +type + + { TMainForm } + + TMainForm = class(TForm) + AddressPnl: TPanel; + AddressEdt: TEdit; + ApplicationProperties1: TApplicationProperties; + 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); + procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); + + protected + FChildForm : TChildForm; + FCriticalSection : TCriticalSection; + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosingMainForm : boolean; // Set to True in the CloseQuery event. + FClosingChildren : boolean; // Set to True in the CloseQuery event. + + 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 BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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 *.lfm} + +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. + +// Destruction steps +// ================= +// 1. FormCloseQuery sets CanClose to FALSE and it closes all child forms. +// 2. When all the child forms are closed then FormCloseQuery is triggered again, sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event. +// 3. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event. +// 4. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. + + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + FClosingChildren := True; + Visible := False; + + if (PopupChildCount > 0) then + begin + ClosePopupChildren; + CanClose := False; + end + else + begin + CanClose := FCanClose; + + if not(FClosingMainForm) then + begin + FClosingMainForm := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; + end; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + FClosingChildren := False; + FClosingMainForm := False; + FCanClose := False; + FCriticalSection := TCriticalSection.Create; + + Chromium1.DefaultURL := AddressEdt.Text; + 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, + 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; +end; + +procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage); +begin + try + FCriticalSection.Acquire; + + if (FChildForm <> nil) then + begin + //FChildForm.ApplyPopupFeatures; + //FChildForm.Show; + PostMessage(FChildForm.Handle, CEF_SHOWCHILD, 0, 0); + end; + + FChildForm := TChildForm.Create(self); + finally + FCriticalSection.Release; + end; +end; + +procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage); +begin + if FClosingChildren 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.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +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. diff --git a/demos/Lazarus/PopupBrowser2/00-Delete.bat b/demos/Lazarus/PopupBrowser2/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/PopupBrowser2/PopupBrowser2.lpi b/demos/Lazarus/PopupBrowser2/PopupBrowser2.lpi new file mode 100644 index 00000000..52c7f148 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/PopupBrowser2.lpi @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="PopupBrowser2"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="PopupBrowser2.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uChildForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ChildForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\PopupBrowser2"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/PopupBrowser2/PopupBrowser2.lpr b/demos/Lazarus/PopupBrowser2/PopupBrowser2.lpr new file mode 100644 index 00000000..29fd1f9d --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/PopupBrowser2.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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, Interfaces, + 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; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/PopupBrowser2/PopupBrowser2.lps b/demos/Lazarus/PopupBrowser2/PopupBrowser2.lps new file mode 100644 index 00000000..26bc9f1e --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/PopupBrowser2.lps @@ -0,0 +1,190 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="8"> + <Unit0> + <Filename Value="PopupBrowser2.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="38"/> + <CursorPos X="3" Y="54"/> + <UsageCount Value="22"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="90"/> + <CursorPos X="11" Y="108"/> + <UsageCount Value="22"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uChildForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ChildForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <TopLine Value="231"/> + <CursorPos X="32" Y="250"/> + <UsageCount Value="22"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="7431"/> + <CursorPos Y="7444"/> + <UsageCount Value="10"/> + </Unit3> + <Unit4> + <Filename Value="..\..\..\source\uCEFChromium.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="1016"/> + <CursorPos Y="1028"/> + <UsageCount Value="10"/> + </Unit4> + <Unit5> + <Filename Value="..\..\..\source\uCEFMiscFunctions.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="526"/> + <CursorPos Y="538"/> + <UsageCount Value="10"/> + </Unit5> + <Unit6> + <Filename Value="C:\lazarus\lcl\include\customform.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="2319"/> + <CursorPos Y="2332"/> + <UsageCount Value="10"/> + </Unit6> + <Unit7> + <Filename Value="C:\lazarus\lcl\controls.pp"/> + <UnitName Value="Controls"/> + <EditorIndex Value="-1"/> + <TopLine Value="1623"/> + <CursorPos X="15" Y="1633"/> + <UsageCount Value="10"/> + </Unit7> + </Units> + <JumpHistory Count="25" HistoryIndex="24"> + <Position1> + <Filename Value="uMainForm.pas"/> + <Caret Line="292" TopLine="280"/> + </Position1> + <Position2> + <Filename Value="uMainForm.pas"/> + <Caret Line="294" TopLine="280"/> + </Position2> + <Position3> + <Filename Value="uMainForm.pas"/> + <Caret Line="295" Column="27" TopLine="280"/> + </Position3> + <Position4> + <Filename Value="uMainForm.pas"/> + <Caret Line="298" Column="15" TopLine="280"/> + </Position4> + <Position5> + <Filename Value="uMainForm.pas"/> + <Caret Line="86" Column="15" TopLine="75"/> + </Position5> + <Position6> + <Filename Value="uMainForm.pas"/> + <Caret Line="223" Column="26" TopLine="203"/> + </Position6> + <Position7> + <Filename Value="uMainForm.pas"/> + <Caret Line="224" Column="25" TopLine="204"/> + </Position7> + <Position8> + <Filename Value="uMainForm.pas"/> + <Caret Line="277" Column="13" TopLine="257"/> + </Position8> + <Position9> + <Filename Value="uMainForm.pas"/> + <Caret Line="292" Column="19" TopLine="272"/> + </Position9> + <Position10> + <Filename Value="uMainForm.pas"/> + <Caret Line="294" Column="19" TopLine="274"/> + </Position10> + <Position11> + <Filename Value="uMainForm.pas"/> + <Caret Line="295" Column="19" TopLine="275"/> + </Position11> + <Position12> + <Filename Value="uMainForm.pas"/> + <Caret Line="298" Column="15" TopLine="278"/> + </Position12> + <Position13> + <Filename Value="uMainForm.pas"/> + <Caret Line="86" Column="15" TopLine="75"/> + </Position13> + <Position14> + <Filename Value="uMainForm.pas"/> + <Caret Line="223" Column="26" TopLine="203"/> + </Position14> + <Position15> + <Filename Value="uMainForm.pas"/> + <Caret Line="224" Column="25" TopLine="204"/> + </Position15> + <Position16> + <Filename Value="uMainForm.pas"/> + <Caret Line="277" Column="13" TopLine="257"/> + </Position16> + <Position17> + <Filename Value="uMainForm.pas"/> + <Caret Line="292" TopLine="281"/> + </Position17> + <Position18> + <Filename Value="uMainForm.pas"/> + <Caret Line="295" TopLine="281"/> + </Position18> + <Position19> + <Filename Value="uChildForm.pas"/> + <Caret Line="62" Column="23" TopLine="54"/> + </Position19> + <Position20> + <Filename Value="uChildForm.pas"/> + <Caret Line="222" Column="3" TopLine="220"/> + </Position20> + <Position21> + <Filename Value="uChildForm.pas"/> + <Caret Line="77" Column="22" TopLine="48"/> + </Position21> + <Position22> + <Filename Value="uMainForm.pas"/> + <Caret Line="286" Column="54" TopLine="260"/> + </Position22> + <Position23> + <Filename Value="uMainForm.pas"/> + <Caret Line="98" Column="33" TopLine="77"/> + </Position23> + <Position24> + <Filename Value="uChildForm.pas"/> + <Caret Line="78" Column="22" TopLine="71"/> + </Position24> + <Position25> + <Filename Value="uChildForm.pas"/> + <Caret Line="253" Column="14" TopLine="231"/> + </Position25> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/PopupBrowser2/cef.inc b/demos/Lazarus/PopupBrowser2/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/PopupBrowser2/uChildForm.dfm b/demos/Lazarus/PopupBrowser2/uChildForm.dfm new file mode 100644 index 00000000..60805f42 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/uChildForm.dfm @@ -0,0 +1,36 @@ +object ChildForm: TChildForm + Left = 543 + Height = 256 + Top = 145 + Width = 352 + Caption = 'Popup' + ClientHeight = 256 + ClientWidth = 352 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnClose = FormClose + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poScreenCenter + ShowInTaskBar = stAlways + LCLVersion = '2.0.2.0' + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 256 + Top = 0 + Width = 352 + Align = alClient + TabOrder = 0 + end + object Chromium1: TChromium + OnTitleChange = Chromium1TitleChange + OnBeforePopup = Chromium1BeforePopup + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 24 + top = 56 + end +end diff --git a/demos/Lazarus/PopupBrowser2/uChildForm.pas b/demos/Lazarus/PopupBrowser2/uChildForm.pas new file mode 100644 index 00000000..65bccb97 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/uChildForm.pas @@ -0,0 +1,255 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uChildForm; + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, SyncObjs, + Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + uCEFChromium, uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFWindowParent, uCEFWinControl; + +const + CEF_SHOWCHILD = WM_APP + $A52; + +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; var aAction : TCefCloseBrowserAction); + 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; + procedure ShowChildMsg(var aMessage : TMessage); message CEF_SHOWCHILD; + + 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 + Math, + 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; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +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; + +procedure TChildForm.ShowChildMsg(var aMessage : TMessage); +begin + ApplyPopupFeatures; + Show; +end; + +end. diff --git a/demos/Lazarus/PopupBrowser2/uMainForm.lfm b/demos/Lazarus/PopupBrowser2/uMainForm.lfm new file mode 100644 index 00000000..0f388ab8 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/uMainForm.lfm @@ -0,0 +1,77 @@ +object MainForm: TMainForm + Left = 101 + Height = 624 + Top = 120 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 0 + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + TabOrder = 0 + Text = 'file:///PopupBrowser.html' + end + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + 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 + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 56 + top = 152 + end + object ApplicationProperties1: TApplicationProperties + left = 59 + top = 235 + end +end diff --git a/demos/Lazarus/PopupBrowser2/uMainForm.pas b/demos/Lazarus/PopupBrowser2/uMainForm.pas new file mode 100644 index 00000000..ab59a1b9 --- /dev/null +++ b/demos/Lazarus/PopupBrowser2/uMainForm.pas @@ -0,0 +1,368 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uMainForm; + +{$I cef.inc} + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, SyncObjs, + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uChildForm, + uCEFWinControl, uCEFChromiumEvents; + +const + CEF_CREATENEXTCHILD = WM_APP + $A50; + CEF_CHILDDESTROYED = WM_APP + $A51; + +type + + { TMainForm } + + TMainForm = class(TForm) + AddressPnl: TPanel; + AddressEdt: TEdit; + ApplicationProperties1: TApplicationProperties; + 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); + procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); + + protected + FChildForm : TChildForm; + FCriticalSection : TCriticalSection; + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosingMainForm : boolean; // Set to True in the CloseQuery event. + FClosingChildren : boolean; // Set to True in the CloseQuery event. + + 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 BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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 *.lfm} + +uses + uCEFApplication, uCEFMiscFunctions; + +// This is demo shows how to create popup windows in CEF. + +// You need to understand the SimpleBrowser2 demo 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. + +// Destruction steps +// ================= +// 1. FormCloseQuery sets CanClose to FALSE and it closes all child forms. +// 2. When all the child forms are closed then FormCloseQuery is triggered again, sets CanClose to FALSE calls TChromium.CloseBrowser which triggers the TChromium.OnClose event. +// 3. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event. +// 4. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. + + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + FClosingChildren := True; + Visible := False; + + if (PopupChildCount > 0) then + begin + ClosePopupChildren; + CanClose := False; + end + else + begin + CanClose := FCanClose; + + if not(FClosingMainForm) then + begin + FClosingMainForm := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; + end; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + FClosingChildren := False; + FClosingMainForm := False; + FCanClose := False; + FCriticalSection := TCriticalSection.Create; + + Chromium1.DefaultURL := AddressEdt.Text; + 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, + 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; +end; + +procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TMainForm.CreateNextChildMsg(var aMessage : TMessage); +begin + try + FCriticalSection.Acquire; + + if (FChildForm <> nil) then + begin + //FChildForm.ApplyPopupFeatures; + //FChildForm.Show; + PostMessage(FChildForm.Handle, CEF_SHOWCHILD, 0, 0); + end; + + FChildForm := TChildForm.Create(self); + finally + FCriticalSection.Release; + end; +end; + +procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage); +begin + if FClosingChildren 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.Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TMainForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction: TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +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. diff --git a/demos/Lazarus/PostInspectorBrowser/00-Delete.bat b/demos/Lazarus/PostInspectorBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lpi b/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lpi new file mode 100644 index 00000000..e4c75412 --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="PostInspectorBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="PostInspectorBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uPostInspectorBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\PostInspectorBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lpr b/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lpr new file mode 100644 index 00000000..f907e296 --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lpr @@ -0,0 +1,74 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2018 Salvador Díaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +program PostInspectorBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, uCEFConstants, + uPostInspectorBrowser in 'uPostInspectorBrowser.pas' {Form1}; + +//{$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +// If you don't add this flag the rederer process will crash when you try to load large images. +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TForm1, Form1); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lps b/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lps new file mode 100644 index 00000000..23e03af1 --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/PostInspectorBrowser.lps @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="PostInspectorBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="38"/> + <CursorPos X="3" Y="53"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uPostInspectorBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="91"/> + <CursorPos X="8" Y="122"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="3" HistoryIndex="2"> + <Position1> + <Filename Value="PostInspectorBrowser.lpr"/> + </Position1> + <Position2> + <Filename Value="uPostInspectorBrowser.pas"/> + <Caret Line="311" Column="52" TopLine="290"/> + </Position2> + <Position3> + <Filename Value="uPostInspectorBrowser.pas"/> + <Caret Line="122" Column="8" TopLine="91"/> + </Position3> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/PostInspectorBrowser/cef.inc b/demos/Lazarus/PostInspectorBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/PostInspectorBrowser/uPostInspectorBrowser.lfm b/demos/Lazarus/PostInspectorBrowser/uPostInspectorBrowser.lfm new file mode 100644 index 00000000..78529331 --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/uPostInspectorBrowser.lfm @@ -0,0 +1,98 @@ +object Form1: TForm1 + Left = 71 + Height = 699 + Top = 65 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 699 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object Splitter1: TSplitter + Cursor = crVSplit + Left = 0 + Height = 3 + Top = 469 + Width = 1038 + Align = alBottom + ResizeAnchor = akBottom + end + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 0 + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 0 + end + object AddressCb: TComboBox + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'https://www.w3schools.com/php/showphp.asp?filename=demo_form_post' + 'https://www.w3schools.com/php/showphp.asp?filename=demo_form_get' + ) + TabOrder = 1 + Text = 'https://www.w3schools.com/php/showphp.asp?filename=demo_form_post' + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 448 + Top = 21 + Width = 1038 + Align = alClient + TabOrder = 1 + end + object Memo1: TMemo + Left = 0 + Height = 227 + Top = 472 + Width = 1038 + Align = alBottom + ScrollBars = ssVertical + TabOrder = 2 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 56 + top = 88 + end + object Chromium1: TChromium + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + OnBeforeResourceLoad = Chromium1BeforeResourceLoad + left = 56 + top = 152 + end +end diff --git a/demos/Lazarus/PostInspectorBrowser/uPostInspectorBrowser.pas b/demos/Lazarus/PostInspectorBrowser/uPostInspectorBrowser.pas new file mode 100644 index 00000000..d7e6f29c --- /dev/null +++ b/demos/Lazarus/PostInspectorBrowser/uPostInspectorBrowser.pas @@ -0,0 +1,432 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uPostInspectorBrowser; + +{$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, + uCEFWinControl; + +const + CEF_SHOWDATA = WM_APP + $B00; + +type + TForm1 = class(TForm) + AddressPnl: TPanel; + GoBtn: TButton; + Timer1: TTimer; + Chromium1: TChromium; + CEFWindowParent1: TCEFWindowParent; + Memo1: TMemo; + AddressCb: TComboBox; + Splitter1: TSplitter; + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + 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); + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + procedure FormDestroy(Sender: TObject); + procedure Chromium1BeforeResourceLoad(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; const callback: ICefRequestCallback; + out Result: TCefReturnValue); + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + FRequestSL : TStringList; + FRequestCS : TCriticalSection; + + // You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned. + procedure WMMove(var aMessage : TWMMove); message WM_MOVE; + procedure WMMoving(var aMessage : TMessage); message WM_MOVING; + // You also have to handle these two messages to set GlobalCEFApp.OsmodalLoop + 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 BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + procedure ShowDataMsg(var aMessage : TMessage); message CEF_SHOWDATA; + + procedure HandleRequest(const request : ICefRequest; aIsMain : boolean); + procedure HandleHeaderMap(const request : ICefRequest); + procedure HandlePostData(const request : ICefRequest); + procedure HandlePostDataBytes(const aElement : ICefPostDataElement); + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +uses + uCEFApplication, uCefMiscFunctions, uCEFStringMultimap; + +// This demo shows how to inspect the data sent in all requests for all the resources. + +// We use the TChromium.OnBeforeResourceLoad event to handle the request but this event +// is executed in a different thread. This means that we have to protect the data with a +// critical section when we handle it. + +// After the request has been handled we send a custom message to the form (CEF_SHOWDATA) +// to add the information to the TMemo safely in the main thread. + + +// 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 TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; + + Chromium1.DefaultURL := AddressCb.Text; + + FRequestSL := TStringList.Create; + FRequestCS := TCriticalSection.Create; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + FRequestSL.Free; + FRequestCS.Free; +end; + +procedure TForm1.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 TForm1.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 TForm1.HandleRequest(const request : ICefRequest; aIsMain : boolean); +begin + try + if (FRequestCS <> nil) then FRequestCS.Acquire; + + if (FRequestSL <> nil) then + begin + FRequestSL.Add('--------------------'); + FRequestSL.Add('URL : ' + request.url); + FRequestSL.Add('Method : ' + request.Method); + FRequestSL.Add('Main frame : ' + BoolToStr(aIsMain, true)); + + HandleHeaderMap(request); + HandlePostData(request); + + PostMessage(Handle, CEF_SHOWDATA, 0, 0); + end; + finally + if (FRequestCS <> nil) then FRequestCS.Release; + end; +end; + +procedure TForm1.HandleHeaderMap(const request : ICefRequest); +var + TempHeaderMap : ICefStringMultimap; + i : NativeUInt; +begin + try + TempHeaderMap := TCefStringMultimapOwn.Create; + request.GetHeaderMap(TempHeaderMap); + + if (TempHeaderMap <> nil) and (TempHeaderMap.Size > 0) then + begin + FRequestSL.Add('--------------------'); + FRequestSL.Add('Headers :'); + + i := 0; + + while (i < TempHeaderMap.Size) do + begin + FRequestSL.Add(TempHeaderMap.Key[i] + '=' + TempHeaderMap.Value[i]); + inc(i); + end; + end; + except + on e : exception do + begin + if CustomExceptionHandler('TForm1.HandleHeaderMap', e) then raise; + end; + end; +end; + +procedure TForm1.HandlePostData(const request : ICefRequest); +var + TempPostData : ICefPostData; + TempElement : ICefPostDataElement; + TempList : IInterfaceList; + i : integer; +begin + try + TempPostData := request.PostData; + + if (TempPostData <> nil) and (TempPostData.GetCount > 0) then + begin + FRequestSL.Add('--------------------'); + FRequestSL.Add('POST data :'); + if TempPostData.HasExcludedElements then + FRequestSL.Add('Has excluded elements! (For example, multi-part file upload data.)'); + + TempList := TempPostData.GetElements(TempPostData.GetCount); + i := 0; + + while (i < TempList.Count) do + begin + TempElement := TempList.Items[i] as ICefPostDataElement; + FRequestSL.Add('Element : ' + inttostr(i)); + FRequestSL.Add('Size : ' + inttostr(TempElement.GetBytesCount)); + + case TempElement.GetType of + PDE_TYPE_BYTES : + begin + FRequestSL.Add('Type : Bytes'); + HandlePostDataBytes(TempElement); + end; + + PDE_TYPE_FILE : + begin + FRequestSL.Add('Type : File'); + // This element type can be read using a TBuffer like we do in HandlePostDataBytes + end + + else + FRequestSL.Add('Type : Empty'); + end; + + inc(i); + end; + end; + except + on e : exception do + if CustomExceptionHandler('TForm1.HandlePostData', e) then raise; + end; +end; + +procedure TForm1.HandlePostDataBytes(const aElement : ICefPostDataElement); +var + TempStream : TStringStream; + TempBuffer : TBytes; + TempSize : NativeUInt; +begin + TempStream := nil; + TempBuffer := nil; + + try + try + if (aElement <> nil) and (aElement.GetBytesCount > 0) then + begin + SetLength(TempBuffer, aElement.GetBytesCount); + TempSize := aElement.GetBytes(aElement.GetBytesCount, @TempBuffer[0]); + + if (TempSize > 0) then + begin + TempStream := TStringStream.Create(''); + TempStream.WriteBuffer(TempBuffer, TempSize); + TempStream.Seek(0, soBeginning); + FRequestSL.Add(TempStream.ReadString(TempSize)); + end; + end; + except + on e : exception do + if CustomExceptionHandler('TForm1.HandlePostDataBytes', e) then raise; + end; + finally + if (TempStream <> nil) then FreeAndNil(TempStream); + SetLength(TempBuffer, 0); + end; +end; + +procedure TForm1.Chromium1BeforeResourceLoad(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const request: ICefRequest; const callback: ICefRequestCallback; + out Result: TCefReturnValue); +begin + // This event is called before a resource request is loaded. + // The request object may be modified. + HandleRequest(request, frame.IsMain); + Result := RV_CONTINUE; +end; + +procedure TForm1.ShowDataMsg(var aMessage : TMessage); +begin + try + if (FRequestCS <> nil) then FRequestCS.Acquire; + + if (FRequestSL <> nil) then + begin + Memo1.lines.AddStrings(FRequestSL); + FRequestSL.Clear; + end; + finally + if (FRequestCS <> nil) then FRequestCS.Release; + // Scroll to the last memo line + SendMessage(Memo1.Handle, EM_LINESCROLL, 0, Memo1.Lines.Count); + end; +end; + +procedure TForm1.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TForm1.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TForm1.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'POST Inspector Browser'; + AddressPnl.Enabled := True; +end; + +procedure TForm1.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TForm1.GoBtnClick(Sender: TObject); +begin + // This will load the URL in the edit box + Chromium1.LoadURL(AddressCb.Text); +end; + +procedure TForm1.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1)) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TForm1.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TForm1.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TForm1.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TForm1.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/SchemeRegistrationBrowser/00-Delete.bat b/demos/Lazarus/SchemeRegistrationBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lpi b/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lpi new file mode 100644 index 00000000..5c27335c --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SchemeRegistrationBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="SchemeRegistrationBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uSchemeRegistrationBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SchemeRegistrationBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uHelloScheme.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\SchemeRegistrationBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lpr b/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lpr new file mode 100644 index 00000000..a9890d0d --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lpr @@ -0,0 +1,67 @@ +// ************************************************************************ +// ***************************** 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 SchemeRegistrationBrowser; + +{$I cef.inc} + +uses + Forms, Interfaces, + Windows, + uCEFApplication, + uSchemeRegistrationBrowser in 'uSchemeRegistrationBrowser.pas' {SchemeRegistrationBrowserFrm}, + uHelloScheme in 'uHelloScheme.pas'; + +//{$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TSchemeRegistrationBrowserFrm, SchemeRegistrationBrowserFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lps b/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lps new file mode 100644 index 00000000..93ce58c6 --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/SchemeRegistrationBrowser.lps @@ -0,0 +1,148 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="5"> + <Unit0> + <Filename Value="SchemeRegistrationBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="41"/> + <CursorPos X="46" Y="61"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uSchemeRegistrationBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SchemeRegistrationBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="222"/> + <CursorPos Y="227"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uHelloScheme.pas"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <TopLine Value="86"/> + <CursorPos Y="99"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="..\..\..\source\uCEFMiscFunctions.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="780"/> + <CursorPos Y="801"/> + <UsageCount Value="10"/> + </Unit3> + <Unit4> + <Filename Value="..\..\..\source\uCEFSchemeHandlerFactory.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="76"/> + <CursorPos Y="89"/> + <UsageCount Value="10"/> + </Unit4> + </Units> + <JumpHistory Count="21" HistoryIndex="20"> + <Position1> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="118" TopLine="115"/> + </Position1> + <Position2> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="119" TopLine="114"/> + </Position2> + <Position3> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="120" TopLine="114"/> + </Position3> + <Position4> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="121" TopLine="114"/> + </Position4> + <Position5> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="122" TopLine="114"/> + </Position5> + <Position6> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="124" TopLine="114"/> + </Position6> + <Position7> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="125" TopLine="114"/> + </Position7> + <Position8> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="126" TopLine="114"/> + </Position8> + <Position9> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="128" TopLine="114"/> + </Position9> + <Position10> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="129" TopLine="114"/> + </Position10> + <Position11> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="131" TopLine="114"/> + </Position11> + <Position12> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="133" TopLine="114"/> + </Position12> + <Position13> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="134" TopLine="114"/> + </Position13> + <Position14> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="148" TopLine="135"/> + </Position14> + <Position15> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="149" TopLine="135"/> + </Position15> + <Position16> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="150" TopLine="135"/> + </Position16> + <Position17> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="152" TopLine="135"/> + </Position17> + <Position18> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="154" TopLine="147"/> + </Position18> + <Position19> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="157" TopLine="147"/> + </Position19> + <Position20> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="160" TopLine="147"/> + </Position20> + <Position21> + <Filename Value="uHelloScheme.pas"/> + <Caret Line="118" TopLine="110"/> + </Position21> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/SchemeRegistrationBrowser/cef.inc b/demos/Lazarus/SchemeRegistrationBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/SchemeRegistrationBrowser/uHelloScheme.pas b/demos/Lazarus/SchemeRegistrationBrowser/uHelloScheme.pas new file mode 100644 index 00000000..b35e6620 --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/uHelloScheme.pas @@ -0,0 +1,210 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uHelloScheme; + +{$I cef.inc} + +interface +uses + Classes, Windows, SysUtils, + uCEFInterfaces, uCEFTypes, uCEFResourceHandler, uCEFMiscFunctions; + +type + THelloScheme = class(TCefResourceHandlerOwn) + private + FStream : TMemoryStream; + FMimeType : string; + FStatusText : string; + FStatus : Integer; + + protected + function ProcessRequest(const request: ICefRequest; const callback: ICefCallback): Boolean; override; + procedure GetResponseHeaders(const response: ICefResponse; out responseLength: Int64; out redirectUrl: ustring); override; + function ReadResponse(const dataOut: Pointer; bytesToRead: Integer; var bytesRead: Integer; const callback: ICefCallback): Boolean; override; + + public + constructor Create(const browser: ICefBrowser; const frame: ICefFrame; const schemeName: ustring; const request: ICefRequest); override; + destructor Destroy; override; + procedure AfterConstruction; override; + end; + +implementation + +constructor THelloScheme.Create(const browser : ICefBrowser; + const frame : ICefFrame; + const schemeName : ustring; + const request : ICefRequest); +begin + inherited Create(browser, frame, schemeName, request); + + FStream := nil; + FStatus := 0; + FMimeType := ''; + FStatusText := ''; +end; + +destructor THelloScheme.Destroy; +begin + if (FStream <> nil) then FreeAndNil(FStream); + + inherited Destroy; +end; + +procedure THelloScheme.AfterConstruction; +begin + inherited AfterConstruction; + + FStream := TMemoryStream.Create; +end; + +procedure THelloScheme.GetResponseHeaders(const response : ICefResponse; + out responseLength : Int64; + out redirectUrl : ustring); +begin + if (response <> nil) then + begin + response.Status := FStatus; + response.StatusText := FStatusText; + response.MimeType := FMimeType; + end; + + if (FStream <> nil) then + responseLength := FStream.Size + else + responseLength := 0; +end; + +function THelloScheme.ProcessRequest(const request : ICefRequest; const callback : ICefCallback): Boolean; +var + TempFilename, TempExt : string; + TempParts : TUrlParts; + TempFile : TFileStream; +begin + Result := False; + FStatus := 404; + FStatusText := 'ERROR'; + FMimeType := ''; + TempFile := nil; + + try + try + if (FStream <> nil) and (request <> nil) then + begin + TempFilename := ''; + FStream.Clear; + + if CefParseUrl(Request.URL, TempParts) then + begin + if (length(TempParts.path) > 0) and + (TempParts.path <> '/') then + begin + TempFilename := TempParts.path; + + if (length(TempFilename) > 0) and (TempFilename[1] = '/') then + TempFilename := copy(TempFilename, 2, length(TempFilename)); + + if (length(TempFilename) > 0) and (TempFilename[length(TempFilename)] = '/') then + TempFilename := copy(TempFilename, 1, length(TempFilename) - 1); + + if (length(TempFilename) > 0) and not(FileExists(TempFilename)) then + TempFilename := ''; + end; + + if (length(TempFilename) = 0) and + (length(TempParts.host) > 0) and + (TempParts.host <> '/') then + begin + TempFilename := TempParts.host; + + if (length(TempFilename) > 0) and (TempFilename[1] = '/') then + TempFilename := copy(TempFilename, 2, length(TempFilename)); + + if (length(TempFilename) > 0) and (TempFilename[length(TempFilename)] = '/') then + TempFilename := copy(TempFilename, 1, length(TempFilename) - 1); + + if (length(TempFilename) > 0) and not(FileExists(TempFilename)) then + TempFilename := ''; + end; + end; + + if (length(TempFilename) > 0) then + begin + TempExt := ExtractFileExt(TempFilename); + + if (length(TempExt) > 0) and (TempExt[1] = '.') then + TempExt := copy(TempExt, 2, length(TempExt)); + + Result := True; + FStatus := 200; + FStatusText := 'OK'; + FMimeType := CefGetMimeType(TempExt); + TempFile := TFileStream.Create(TempFilename, fmOpenRead); + TempFile.Seek(0, soFromBeginning); + FStream.LoadFromStream(TStream(TempFile)); + end; + + FStream.Seek(0, soFromBeginning); + end; + except + on e : exception do + if CustomExceptionHandler('THelloScheme.ProcessRequest', e) then raise; + end; + finally + if (callback <> nil) then callback.Cont; + if (TempFile <> nil) then FreeAndNil(TempFile); + end; +end; + +function THelloScheme.ReadResponse(const dataOut : Pointer; + bytesToRead : Integer; + var bytesRead : Integer; + const callback : ICefCallback): Boolean; +begin + if (FStream <> nil) and (DataOut <> nil) then + begin + // This function will be called several times because the stream is bigger + // than bytesToRead. Each time we will copy a chunk of the stream to + // DataOut. + BytesRead := FStream.Read(DataOut^, BytesToRead); + Result := (BytesRead > 0); + end + else + Result := False; +end; + +end. diff --git a/demos/Lazarus/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.lfm b/demos/Lazarus/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.lfm new file mode 100644 index 00000000..b68c42a2 --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.lfm @@ -0,0 +1,82 @@ +object SchemeRegistrationBrowserFrm: TSchemeRegistrationBrowserFrm + Left = 116 + Height = 652 + Top = 102 + Width = 980 + Caption = 'SchemeRegistrationBrowser' + ClientHeight = 652 + ClientWidth = 980 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object AddressBarPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 980 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 980 + DoubleBuffered = True + Enabled = False + ParentDoubleBuffered = False + TabOrder = 0 + object GoBtn: TButton + Left = 949 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 0 + end + object AddressCbx: TComboBox + Left = 0 + Height = 21 + Top = 0 + Width = 949 + Align = alClient + ItemHeight = 13 + ItemIndex = 1 + Items.Strings = ( + 'https://www.google.com' + 'hello://test.html' + ) + TabOrder = 1 + Text = 'hello://test.html' + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Height = 631 + Top = 21 + Width = 980 + Align = alClient + TabOrder = 1 + end + object Chromium1: TChromium + OnBeforeContextMenu = Chromium1BeforeContextMenu + OnContextMenuCommand = Chromium1ContextMenuCommand + OnBeforePopup = Chromium1BeforePopup + OnAfterCreated = Chromium1AfterCreated + OnBeforeClose = Chromium1BeforeClose + OnClose = Chromium1Close + left = 16 + top = 40 + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 16 + top = 96 + end +end diff --git a/demos/Lazarus/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas b/demos/Lazarus/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas new file mode 100644 index 00000000..024c1d8e --- /dev/null +++ b/demos/Lazarus/SchemeRegistrationBrowser/uSchemeRegistrationBrowser.pas @@ -0,0 +1,289 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) +{$mode delphi} + + +unit uSchemeRegistrationBrowser; + +{$I cef.inc} + +interface + +uses + {$IFDEF DELPHI16_UP} + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Menus, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, System.Types, Vcl.ComCtrls, Vcl.ClipBrd, + System.UITypes, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFSchemeRegistrar, + uCEFTypes, uCEFConstants, uCEFWinControl; + +const + MINIBROWSER_CONTEXTMENU_REGSCHEME = MENU_ID_USER_FIRST + 1; + MINIBROWSER_CONTEXTMENU_CLEARFACT = MENU_ID_USER_FIRST + 2; + +type + TSchemeRegistrationBrowserFrm = class(TForm) + AddressBarPnl: TPanel; + GoBtn: TButton; + CEFWindowParent1: TCEFWindowParent; + Chromium1: TChromium; + AddressCbx: TComboBox; + Timer1: TTimer; + procedure Chromium1AfterCreated(Sender: TObject; + const browser: ICefBrowser); + procedure Chromium1BeforeContextMenu(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); + procedure Chromium1ContextMenuCommand(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure FormCreate(Sender: TObject); + 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 FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1BeforeClose(Sender: TObject; + const browser: ICefBrowser); + private + { Private declarations } + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY; + 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; + public + { Public declarations } + end; + +var + SchemeRegistrationBrowserFrm: TSchemeRegistrationBrowserFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFSchemeHandlerFactory, uCEFMiscFunctions, uHelloScheme; + +// 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 GlobalCEFApp_OnRegCustomSchemes(const registrar: TCefSchemeRegistrarRef); +begin + registrar.AddCustomScheme('hello', CEF_SCHEME_OPTION_STANDARD or CEF_SCHEME_OPTION_LOCAL); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnRegCustomSchemes := GlobalCEFApp_OnRegCustomSchemes; +end; + +procedure TSchemeRegistrationBrowserFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +end; + +procedure TSchemeRegistrationBrowserFrm.Chromium1BeforeClose( + Sender: TObject; const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TSchemeRegistrationBrowserFrm.Chromium1BeforeContextMenu( + Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; const model: ICefMenuModel); +begin + model.AddItem(MINIBROWSER_CONTEXTMENU_REGSCHEME, 'Register scheme'); + model.AddItem(MINIBROWSER_CONTEXTMENU_CLEARFACT, 'Clear schemes'); +end; + +procedure TSchemeRegistrationBrowserFrm.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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TSchemeRegistrationBrowserFrm.Chromium1Close(Sender: TObject; + const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, 0, 0); + aAction := cbaDelay; +end; + +procedure TSchemeRegistrationBrowserFrm.Chromium1ContextMenuCommand( + Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; + const params: ICefContextMenuParams; commandId: Integer; + eventFlags: Cardinal; out Result: Boolean); +var + TempFactory: ICefSchemeHandlerFactory; +begin + Result := False; + + case commandId of + MINIBROWSER_CONTEXTMENU_REGSCHEME : + if (browser <> nil) and + (browser.host <> nil) and + (browser.host.RequestContext <> nil) then + begin + // You can register the Scheme Handler Factory in the DPR file or later, for example in a context menu command. + TempFactory := TCefSchemeHandlerFactoryOwn.Create(THelloScheme); + if not(browser.host.RequestContext.RegisterSchemeHandlerFactory('hello', '', TempFactory)) then + MessageDlg('RegisterSchemeHandlerFactory error !', mtError, [mbOk], 0); + end; + + MINIBROWSER_CONTEXTMENU_CLEARFACT : + if (browser <> nil) and + (browser.host <> nil) and + (browser.host.RequestContext <> nil) then + begin + if not(browser.host.RequestContext.ClearSchemeHandlerFactories) then + MessageDlg('ClearSchemeHandlerFactories error !', mtError, [mbOk], 0); + end; + end; +end; + +procedure TSchemeRegistrationBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + end; +end; + +procedure TSchemeRegistrationBrowserFrm.FormCreate(Sender: TObject); +begin + // You can register the Scheme Handler Factory here or later, for example in a context menu command. + CefRegisterSchemeHandlerFactory('hello', '', THelloScheme); +end; + +procedure TSchemeRegistrationBrowserFrm.FormShow(Sender: TObject); +begin + // 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 TSchemeRegistrationBrowserFrm.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(AddressCbx.Text); +end; + +procedure TSchemeRegistrationBrowserFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TSchemeRegistrationBrowserFrm.BrowserCreatedMsg(var aMessage : TMessage); +begin + CEFWindowParent1.UpdateSize; + AddressBarPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TSchemeRegistrationBrowserFrm.BrowserDestroyMsg(var aMessage : TMessage); +begin + CEFWindowParent1.Free; +end; + +procedure TSchemeRegistrationBrowserFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TSchemeRegistrationBrowserFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; +end; + +procedure TSchemeRegistrationBrowserFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TSchemeRegistrationBrowserFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/SimpleBrowser/00-Delete.bat b/demos/Lazarus/SimpleBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/SimpleBrowser/SimpleBrowser.lpi b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lpi new file mode 100644 index 00000000..9e6c1f21 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SimpleBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="SimpleBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="..\..\..\bin"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/SimpleBrowser/SimpleBrowser.lpr b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lpr new file mode 100644 index 00000000..2f5394ea --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lpr @@ -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 SimpleBrowser; + +{$I cef.inc} + +uses + Forms, Interfaces, + uCEFApplication, + uSimpleBrowser in 'uSimpleBrowser.pas' {Form1}; + + +//{$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + GlobalCEFApp := TCefApplication.Create; + + // In case you want to use custom directories for the CEF3 binaries, cache, cookies and user data. + +{ + GlobalCEFApp.FrameworkDirPath := 'cef'; + GlobalCEFApp.ResourcesDirPath := 'cef'; + GlobalCEFApp.LocalesDirPath := 'cef\locales'; + GlobalCEFApp.cache := 'cef\cache'; + GlobalCEFApp.cookies := 'cef\cookies'; + GlobalCEFApp.UserDataPath := 'cef\User Data'; +} + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps new file mode 100644 index 00000000..bf4ef1a9 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/SimpleBrowser.lps @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="SimpleBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <CursorPos X="8" Y="4"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="SimpleBrowser_D7.lpr"/> + <EditorIndex Value="-1"/> + <TopLine Value="40"/> + <CursorPos X="3" Y="48"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uSimpleBrowser.pas"/> + <Caret Line="4" Column="8"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/SimpleBrowser/cef.inc b/demos/Lazarus/SimpleBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/SimpleBrowser/uSimpleBrowser.lfm b/demos/Lazarus/SimpleBrowser/uSimpleBrowser.lfm new file mode 100644 index 00000000..114be9e4 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/uSimpleBrowser.lfm @@ -0,0 +1,68 @@ +object Form1: TForm1 + Left = 74 + Height = 624 + Top = 130 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object ChromiumWindow1: TChromiumWindow + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + Align = alClient + TabStop = True + TabOrder = 0 + OnClose = ChromiumWindow1Close + OnBeforeClose = ChromiumWindow1BeforeClose + OnAfterCreated = ChromiumWindow1AfterCreated + end + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 1 + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + TabOrder = 0 + Text = 'http://www.google.com' + end + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 56 + top = 88 + end +end diff --git a/demos/Lazarus/SimpleBrowser/uSimpleBrowser.pas b/demos/Lazarus/SimpleBrowser/uSimpleBrowser.pas new file mode 100644 index 00000000..141c8268 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser/uSimpleBrowser.pas @@ -0,0 +1,227 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uSimpleBrowser; + +{$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, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces, + uCEFWinControl; + +type + TForm1 = class(TForm) + ChromiumWindow1: TChromiumWindow; + AddressPnl: TPanel; + AddressEdt: TEdit; + GoBtn: TButton; + Timer1: TTimer; + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ChromiumWindow1AfterCreated(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure FormCreate(Sender: TObject); + procedure ChromiumWindow1Close(Sender: TObject); + procedure ChromiumWindow1BeforeClose(Sender: TObject); + private + // You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned. + procedure WMMove(var aMessage : TWMMove); message WM_MOVE; + procedure WMMoving(var aMessage : TMessage); message WM_MOVING; + // You also have to handle these two messages to set GlobalCEFApp.OsmodalLoop + procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; + procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; + + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure Chromium_OnBeforePopup(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); + + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +uses + uCEFApplication; + +// This is a demo with the simplest web browser you can build using CEF4Delphi and +// it doesn't show any sign of progress like other web browsers do. + +// Remember that it may take a few seconds to load if Windows update, your antivirus or +// any other windows service is using your hard drive. + +// Depending on your internet connection it may take longer than expected. + +// Please check that your firewall or antivirus are not blocking this application +// or the domain "google.com". If you don't live in the US, you'll be redirected to +// another domain which will take a little time too. + +// Destruction steps +// ================= +// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event. +// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event. +// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form. + + +procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + ChromiumWindow1.CloseBrowser(True); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + // For simplicity, this demo blocks all popup windows and new tabs + ChromiumWindow1.ChromiumBrowser.OnBeforePopup := Chromium_OnBeforePopup; + + // 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(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True; +end; + +procedure TForm1.ChromiumWindow1BeforeClose(Sender: TObject); +begin + FCanClose := True; + Close; +end; + +procedure TForm1.ChromiumWindow1Close(Sender: TObject); +begin + // DestroyChildWindow will destroy the child window created by CEF at the top of the Z order. + if not(ChromiumWindow1.DestroyChildWindow) then + begin + FCanClose := True; + Close; + end; +end; + +procedure TForm1.Chromium_OnBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject); +begin + // Now the browser is fully initialized we can load the initial web page. + Caption := 'Simple Browser'; + AddressPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TForm1.GoBtnClick(Sender: TObject); +begin + // This will load the URL in the edit box + ChromiumWindow1.LoadURL(AddressEdt.Text); +end; + +procedure TForm1.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(ChromiumWindow1.CreateBrowser) and not(ChromiumWindow1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TForm1.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TForm1.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TForm1.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TForm1.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/SimpleBrowser2/00-Delete.bat b/demos/Lazarus/SimpleBrowser2/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser2/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.ico b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.ico similarity index 100% rename from demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.ico rename to demos/Lazarus/SimpleBrowser2/SimpleBrowser2.ico diff --git a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lpi b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lpi similarity index 87% rename from demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lpi rename to demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lpi index 7ee3f522..ef8ffde5 100644 --- a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lpi +++ b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lpi @@ -6,7 +6,7 @@ <General> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <Title Value="SimpleLazarusBrowser"/> + <Title Value="SimpleBrowser2"/> <ResourceType Value="res"/> <UseXPManifest Value="True"/> <Icon Value="0"/> @@ -33,16 +33,16 @@ </RequiredPackages> <Units Count="2"> <Unit0> - <Filename Value="SimpleLazarusBrowser.lpr"/> + <Filename Value="SimpleBrowser2.lpr"/> <IsPartOfProject Value="True"/> </Unit0> <Unit1> - <Filename Value="usimplelazarusbrowser.pas"/> + <Filename Value="uSimpleBrowser2.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="Form1"/> <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> - <UnitName Value="uSimpleLazarusBrowser"/> + <UnitName Value="uSimpleBrowser2"/> </Unit1> </Units> </ProjectOptions> @@ -50,7 +50,7 @@ <Version Value="11"/> <PathDelim Value="\"/> <Target> - <Filename Value="..\..\bin\SimpleLazarusBrowser"/> + <Filename Value="..\..\..\bin\SimpleBrowser2"/> </Target> <SearchPaths> <IncludeFiles Value="$(ProjOutDir)"/> diff --git a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lpr b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lpr similarity index 95% rename from demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lpr rename to demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lpr index 1bff9ee5..dc6c1e13 100644 --- a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lpr +++ b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lpr @@ -1,4 +1,4 @@ -program SimpleLazarusBrowser; +program SimpleBrowser2; {$mode objfpc}{$H+} diff --git a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lps b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lps similarity index 99% rename from demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lps rename to demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lps index 81de5605..c6b0c1b6 100644 --- a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.lps +++ b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.lps @@ -26,6 +26,7 @@ <CursorPos X="27" Y="164"/> <UsageCount Value="43"/> <Loaded Value="True"/> + <LoadedDesigner Value="True"/> </Unit1> <Unit2> <Filename Value="..\..\source\uCEFChromium.pas"/> diff --git a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.res b/demos/Lazarus/SimpleBrowser2/SimpleBrowser2.res similarity index 100% rename from demos/SimpleLazarusBrowser/SimpleLazarusBrowser.res rename to demos/Lazarus/SimpleBrowser2/SimpleBrowser2.res diff --git a/demos/Lazarus/SimpleBrowser2/cef.inc b/demos/Lazarus/SimpleBrowser2/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SimpleBrowser2/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/SimpleLazarusBrowser/usimplelazarusbrowser.lfm b/demos/Lazarus/SimpleBrowser2/usimplelazarusbrowser.lfm similarity index 96% rename from demos/SimpleLazarusBrowser/usimplelazarusbrowser.lfm rename to demos/Lazarus/SimpleBrowser2/usimplelazarusbrowser.lfm index 9a7832e2..6bb85bb3 100644 --- a/demos/SimpleLazarusBrowser/usimplelazarusbrowser.lfm +++ b/demos/Lazarus/SimpleBrowser2/usimplelazarusbrowser.lfm @@ -1,7 +1,7 @@ object Form1: TForm1 - Left = 298 + Left = 201 Height = 574 - Top = 218 + Top = 182 Width = 878 Caption = 'Initializing browser. Please wait...' ClientHeight = 574 @@ -10,7 +10,7 @@ object Form1: TForm1 OnCreate = FormCreate OnShow = FormShow Position = poScreenCenter - LCLVersion = '2.0.0.3' + LCLVersion = '2.0.2.0' object AddressPnl: TPanel Left = 0 Height = 23 diff --git a/demos/SimpleLazarusBrowser/usimplelazarusbrowser.pas b/demos/Lazarus/SimpleBrowser2/usimplelazarusbrowser.pas similarity index 100% rename from demos/SimpleLazarusBrowser/usimplelazarusbrowser.pas rename to demos/Lazarus/SimpleBrowser2/usimplelazarusbrowser.pas diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/00-Delete.bat b/demos/Lazarus/SimpleExternalPumpBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj similarity index 100% rename from demos/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj rename to demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.dproj diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lpi b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lpi new file mode 100644 index 00000000..5f42b50d --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SimpleExternalPumpBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="SimpleExternalPumpBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleExternalPumpBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleExternalPumpBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\SimpleExternalPumpBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lpr b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lpr new file mode 100644 index 00000000..6ef38844 --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lpr @@ -0,0 +1,82 @@ +// ************************************************************************ +// ***************************** 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 SimpleExternalPumpBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, + uCEFWorkScheduler, + uSimpleExternalPumpBrowser in 'uSimpleExternalPumpBrowser.pas' {SimpleExternalPumpBrowserFrm}; + +//{$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 creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TSimpleExternalPumpBrowserFrm, SimpleExternalPumpBrowserFrm); + Application.Run; + + // The form needs to be destroyed *BEFORE* stopping the scheduler. + SimpleExternalPumpBrowserFrm.Free; + + GlobalCEFWorkScheduler.StopScheduler; + end; + + DestroyGlobalCEFApp; + DestroyGlobalCEFWorkScheduler; +end. diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lps b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lps new file mode 100644 index 00000000..2fa8f18e --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/SimpleExternalPumpBrowser.lps @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="SimpleExternalPumpBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="56"/> + <CursorPos X="3" Y="54"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleExternalPumpBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleExternalPumpBrowserFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="61"/> + <CursorPos X="8" Y="93"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="3" HistoryIndex="2"> + <Position1> + <Filename Value="SimpleExternalPumpBrowser.lpr"/> + </Position1> + <Position2> + <Filename Value="uSimpleExternalPumpBrowser.pas"/> + <Caret Line="53" Column="52" TopLine="35"/> + </Position2> + <Position3> + <Filename Value="uSimpleExternalPumpBrowser.pas"/> + <Caret Line="93" Column="8" TopLine="61"/> + </Position3> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/cef.inc b/demos/Lazarus/SimpleExternalPumpBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.lfm b/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.lfm new file mode 100644 index 00000000..f7620039 --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.lfm @@ -0,0 +1,88 @@ +object SimpleExternalPumpBrowserFrm: TSimpleExternalPumpBrowserFrm + Left = 119 + Height = 624 + Top = 128 + Width = 1038 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 0 + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 0 + end + object URLCbx: TComboBox + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'https://www.google.com' + 'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close' + 'https://www.w3schools.com/html/html5_video.asp' + 'http://www.adobe.com/software/flash/about/' + 'http://isflashinstalled.com/' + 'chrome://version/' + 'http://html5test.com/' + 'https://www.w3schools.com/' + 'http://webglsamples.org/' + 'https://get.webgl.org/' + 'https://www.youtube.com' + 'https://html5demos.com/drag/' + 'https://developers.google.com/maps/documentation/javascript/examples/streetview-embed?hl=fr' + 'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe_name' + 'https://www.browserleaks.com/webrtc' + 'https://frames-per-second.appspot.com/' + ) + TabOrder = 1 + Text = 'https://www.google.com' + end + end + object ChromiumWindow1: TChromiumWindow + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + Align = alClient + TabOrder = 1 + OnClose = ChromiumWindow1Close + OnBeforeClose = ChromiumWindow1BeforeClose + OnAfterCreated = ChromiumWindow1AfterCreated + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 56 + top = 88 + end +end diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.lfm.bak b/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.lfm.bak new file mode 100644 index 00000000..46fbbeb4 --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.lfm.bak @@ -0,0 +1,98 @@ +object SimpleExternalPumpBrowserFrm: TSimpleExternalPumpBrowserFrm + 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 + 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 GoBtn: TButton + Left = 1002 + Top = 5 + Width = 31 + Height = 20 + Margins.Left = 5 + Align = alRight + Caption = 'Go' + TabOrder = 0 + OnClick = GoBtnClick + end + object URLCbx: TComboBox + Left = 5 + Top = 5 + Width = 997 + Height = 21 + Align = alClient + ItemIndex = 0 + TabOrder = 1 + Text = 'https://www.google.com' + Items.Strings = ( + 'https://www.google.com' + + 'https://www.whatismybrowser.com/detect/what-http-headers-is-my-b' + + 'rowser-sending' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close' + 'https://www.w3schools.com/html/html5_video.asp' + 'http://www.adobe.com/software/flash/about/' + 'http://isflashinstalled.com/' + 'chrome://version/' + 'http://html5test.com/' + 'https://www.w3schools.com/' + 'http://webglsamples.org/' + 'https://get.webgl.org/' + 'https://www.youtube.com' + 'https://html5demos.com/drag/' + + 'https://developers.google.com/maps/documentation/javascript/exam' + + 'ples/streetview-embed?hl=fr' + + 'https://www.w3schools.com/Tags/tryit.asp?filename=tryhtml_iframe' + + '_name' + 'https://www.browserleaks.com/webrtc' + 'https://frames-per-second.appspot.com/') + end + end + object ChromiumWindow1: TChromiumWindow + Left = 0 + Top = 30 + Width = 1038 + Height = 594 + Align = alClient + TabOrder = 1 + OnClose = ChromiumWindow1Close + OnBeforeClose = ChromiumWindow1BeforeClose + OnAfterCreated = ChromiumWindow1AfterCreated + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + Left = 56 + Top = 88 + end +end diff --git a/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas b/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas new file mode 100644 index 00000000..f52f6554 --- /dev/null +++ b/demos/Lazarus/SimpleExternalPumpBrowser/uSimpleExternalPumpBrowser.pas @@ -0,0 +1,229 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uSimpleExternalPumpBrowser; + +{$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, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFTypes, uCEFConstants, uCEFInterfaces, uCEFWorkScheduler, + uCEFChromiumWindow {, Vcl.ComCtrls, Vcl.AppEvnts}; + +type + TSimpleExternalPumpBrowserFrm = class(TForm) + AddressPnl: TPanel; + GoBtn: TButton; + Timer1: TTimer; + URLCbx: TComboBox; + ChromiumWindow1: TChromiumWindow; + + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + + // These 3 TChromiumWindow events are called in the main app thread, so you can do whatever you want with the GUI. + procedure ChromiumWindow1AfterCreated(Sender: TObject); + procedure ChromiumWindow1BeforeClose(Sender: TObject); + procedure ChromiumWindow1Close(Sender: TObject); + procedure Chromium_OnBeforePopup(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 + FCanClose : boolean; + FClosing : boolean; + + 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; + end; + +var + SimpleExternalPumpBrowserFrm : TSimpleExternalPumpBrowserFrm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +uses + uCEFApplication; + +// This demo has a simple browser with a TChromiumWindow using the "External message pump" mode +// to schedule the cef_do_message_loop_work calls thanks to the TCEFWorkScheduler class. + +// It was necessary to destroy the browser with the following destruction sequence : +// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event. +// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event. +// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form. + +procedure GlobalCEFApp_OnScheduleMessagePumpWork(const aDelayMS : int64); +begin + if (GlobalCEFWorkScheduler <> nil) then GlobalCEFWorkScheduler.ScheduleMessagePumpWork(aDelayMS); +end; + +procedure CreateGlobalCEFApp; +begin + // TCEFWorkScheduler will call cef_do_message_loop_work when + // it's told in the GlobalCEFApp.OnScheduleMessagePumpWork event. + // GlobalCEFWorkScheduler needs to be created before the + // GlobalCEFApp.StartMainProcess call. + GlobalCEFWorkScheduler := TCEFWorkScheduler.Create(nil); + + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.ExternalMessagePump := True; + GlobalCEFApp.MultiThreadedMessageLoop := False; + GlobalCEFApp.OnScheduleMessagePumpWork := GlobalCEFApp_OnScheduleMessagePumpWork; +end; + +procedure TSimpleExternalPumpBrowserFrm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TSimpleExternalPumpBrowserFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + AddressPnl.Enabled := False; + ChromiumWindow1.CloseBrowser(True); + end; +end; + +procedure TSimpleExternalPumpBrowserFrm.FormShow(Sender: TObject); +begin + // For simplicity, this demo blocks all popup windows and new tabs + ChromiumWindow1.ChromiumBrowser.OnBeforePopup := Chromium_OnBeforePopup; + + // 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(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True; +end; + +procedure TSimpleExternalPumpBrowserFrm.Chromium_OnBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TSimpleExternalPumpBrowserFrm.ChromiumWindow1AfterCreated(Sender: TObject); +begin + Caption := 'Simple External Pump Browser'; + AddressPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TSimpleExternalPumpBrowserFrm.ChromiumWindow1BeforeClose(Sender: TObject); +begin + FCanClose := True; + Close; +end; + +procedure TSimpleExternalPumpBrowserFrm.ChromiumWindow1Close(Sender: TObject); +begin + // DestroyChildWindow will destroy the child window created by CEF at the top of the Z order. + if not(ChromiumWindow1.DestroyChildWindow) then + begin + FCanClose := True; + Close; + end; +end; + +procedure TSimpleExternalPumpBrowserFrm.GoBtnClick(Sender: TObject); +begin + ChromiumWindow1.LoadURL(URLCbx.Text); +end; + +procedure TSimpleExternalPumpBrowserFrm.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(ChromiumWindow1.CreateBrowser) and not(ChromiumWindow1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TSimpleExternalPumpBrowserFrm.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TSimpleExternalPumpBrowserFrm.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TSimpleExternalPumpBrowserFrm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TSimpleExternalPumpBrowserFrm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/SimpleOSRBrowser/00-Delete.bat b/demos/Lazarus/SimpleOSRBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SimpleOSRBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/SimpleLazarusBrowser/SimpleLazarusBrowser.ico b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.ico similarity index 100% rename from demos/SimpleLazarusBrowser/SimpleLazarusBrowser.ico rename to demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.ico diff --git a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpi b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lpi similarity index 91% rename from demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpi rename to demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lpi index a5ffe8a0..a5f34b45 100644 --- a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpi +++ b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lpi @@ -12,7 +12,7 @@ </Flags> <SessionStorage Value="InProjectDir"/> <MainUnit Value="0"/> - <Title Value="SimpleLazOSRBrowser"/> + <Title Value="SimpleOSRBrowser"/> <UseAppBundle Value="False"/> <ResourceType Value="res"/> <Icon Value="0"/> @@ -39,11 +39,11 @@ </RequiredPackages> <Units Count="2"> <Unit0> - <Filename Value="SimpleLazOSRBrowser.lpr"/> + <Filename Value="SimpleOSRBrowser.lpr"/> <IsPartOfProject Value="True"/> </Unit0> <Unit1> - <Filename Value="usimplelazosrbrowser.pas"/> + <Filename Value="uSimpleOSRBrowser.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="Form1"/> <HasResources Value="True"/> @@ -55,7 +55,7 @@ <Version Value="11"/> <PathDelim Value="\"/> <Target> - <Filename Value="..\..\bin\SimpleLazOSRBrowser"/> + <Filename Value="..\..\..\bin\SimpleOSRBrowser"/> </Target> <SearchPaths> <IncludeFiles Value="$(ProjOutDir)"/> diff --git a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpr b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lpr similarity index 98% rename from demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpr rename to demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lpr index c38e910f..5e1e9b92 100644 --- a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lpr +++ b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lpr @@ -35,7 +35,7 @@ * *) -program SimpleLazOSRBrowser; +program SimpleOSRBrowser; {$MODE OBJFPC}{$H+} diff --git a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lps b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lps similarity index 89% rename from demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lps rename to demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lps index a3a00840..19f1e285 100644 --- a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.lps +++ b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.lps @@ -4,23 +4,35 @@ <PathDelim Value="\"/> <Version Value="11"/> <BuildModes Active="Default"/> - <Units Count="25"> + <Units Count="27"> <Unit0> - <Filename Value="SimpleLazOSRBrowser.lpr"/> + <Filename Value="SimpleOSRBrowser.lpr"/> <IsPartOfProject Value="True"/> - <EditorIndex Value="1"/> - <TopLine Value="39"/> - <CursorPos X="46" Y="33"/> - <UsageCount Value="42"/> - <Loaded Value="True"/> + <UsageCount Value="20"/> <DefaultSyntaxHighlighter Value="Delphi"/> </Unit0> <Unit1> - <Filename Value="usimplelazosrbrowser.pas"/> + <Filename Value="uSimpleOSRBrowser.pas"/> <IsPartOfProject Value="True"/> <ComponentName Value="Form1"/> <HasResources Value="True"/> <ResourceBaseClass Value="Form"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="SimpleLazOSRBrowser.lpr"/> + <EditorIndex Value="-1"/> + <TopLine Value="39"/> + <CursorPos X="46" Y="33"/> + <UsageCount Value="42"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + <Unit3> + <Filename Value="usimplelazosrbrowser.pas"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> <IsVisibleTab Value="True"/> <TopLine Value="73"/> <CursorPos Y="100"/> @@ -31,8 +43,8 @@ <Loaded Value="True"/> <LoadedDesigner Value="True"/> <DefaultSyntaxHighlighter Value="Delphi"/> - </Unit1> - <Unit2> + </Unit3> + <Unit4> <Filename Value="..\..\..\..\..\..\..\..\stefan.otto\Downloads\CEF4Delphi-master\CEF4Delphi-master\demos\SimpleOSRBrowser\uSimpleOSRBrowser.pas"/> <ComponentName Value="Form1"/> <HasResources Value="True"/> @@ -41,15 +53,16 @@ <CursorPos X="67" Y="20"/> <UsageCount Value="9"/> <DefaultSyntaxHighlighter Value="Delphi"/> - </Unit2> - <Unit3> + </Unit4> + <Unit5> <Filename Value="..\..\source\uBufferPanel.pas"/> <EditorIndex Value="-1"/> <TopLine Value="32"/> <CursorPos Y="284"/> <UsageCount Value="17"/> - </Unit3> - <Unit4> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit5> + <Unit6> <Filename Value="..\..\..\..\lcl\lcltype.pp"/> <UnitName Value="LCLType"/> <EditorIndex Value="-1"/> @@ -57,118 +70,122 @@ <CursorPos X="3" Y="1320"/> <UsageCount Value="13"/> <DefaultSyntaxHighlighter Value="Delphi"/> - </Unit4> - <Unit5> + </Unit6> + <Unit7> <Filename Value="C:\lazarus\lcl\forms.pp"/> <UnitName Value="Forms"/> <EditorIndex Value="-1"/> <TopLine Value="243"/> <CursorPos X="43" Y="268"/> <UsageCount Value="11"/> - </Unit5> - <Unit6> + </Unit7> + <Unit8> <Filename Value="C:\lazarus\lcl\graphics.pp"/> <UnitName Value="Graphics"/> <EditorIndex Value="-1"/> <TopLine Value="1376"/> <CursorPos X="90" Y="1389"/> <UsageCount Value="11"/> - </Unit6> - <Unit7> + </Unit8> + <Unit9> <Filename Value="C:\lazarus\lcl\lclintf.pas"/> <UnitName Value="LCLIntf"/> <EditorIndex Value="-1"/> <UsageCount Value="10"/> - </Unit7> - <Unit8> + </Unit9> + <Unit10> <Filename Value="C:\lazarus\lcl\controls.pp"/> <UnitName Value="Controls"/> <EditorIndex Value="-1"/> <TopLine Value="1917"/> <CursorPos X="14" Y="2195"/> <UsageCount Value="11"/> - </Unit8> - <Unit9> + </Unit10> + <Unit11> <Filename Value="C:\lazarus\lcl\include\wincontrol.inc"/> <EditorIndex Value="-1"/> <TopLine Value="5880"/> <CursorPos Y="5898"/> <UsageCount Value="11"/> - </Unit9> - <Unit10> + </Unit11> + <Unit12> <Filename Value="C:\lazarus\lcl\widgetset\wscontrols.pp"/> <UnitName Value="WSControls"/> <EditorIndex Value="-1"/> <TopLine Value="329"/> <CursorPos Y="331"/> <UsageCount Value="10"/> - </Unit10> - <Unit11> + </Unit12> + <Unit13> <Filename Value="..\..\source\uCEFMiscFunctions.pas"/> <EditorIndex Value="-1"/> <TopLine Value="1220"/> <CursorPos Y="1231"/> <UsageCount Value="10"/> - </Unit11> - <Unit12> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit13> + <Unit14> <Filename Value="..\..\source\uCEFConstants.pas"/> <EditorIndex Value="-1"/> <TopLine Value="361"/> <CursorPos X="3" Y="384"/> <UsageCount Value="10"/> - </Unit12> - <Unit13> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit14> + <Unit15> <Filename Value="C:\lazarus\lcl\include\application.inc"/> <EditorIndex Value="-1"/> <TopLine Value="1696"/> <CursorPos X="3" Y="1701"/> <UsageCount Value="11"/> - </Unit13> - <Unit14> + </Unit15> + <Unit16> <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\win\wininc\defines.inc"/> <EditorIndex Value="-1"/> <TopLine Value="4867"/> <CursorPos X="6" Y="4753"/> <UsageCount Value="10"/> - </Unit14> - <Unit15> + </Unit16> + <Unit17> <Filename Value="C:\lazarus\lcl\extctrls.pp"/> <UnitName Value="ExtCtrls"/> <EditorIndex Value="-1"/> <TopLine Value="995"/> <CursorPos X="39" Y="1017"/> <UsageCount Value="10"/> - </Unit15> - <Unit16> + </Unit17> + <Unit18> <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\inc\ustringh.inc"/> <EditorIndex Value="-1"/> <TopLine Value="117"/> <CursorPos X="67" Y="141"/> <UsageCount Value="10"/> - </Unit16> - <Unit17> + </Unit18> + <Unit19> <Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\win64\system.pp"/> <UnitName Value="System"/> <EditorIndex Value="-1"/> <TopLine Value="551"/> <CursorPos X="15" Y="580"/> <UsageCount Value="10"/> - </Unit17> - <Unit18> + </Unit19> + <Unit20> <Filename Value="..\..\source\uCEFApplication.pas"/> <EditorIndex Value="-1"/> <TopLine Value="28"/> <CursorPos X="59" Y="1103"/> <UsageCount Value="10"/> - </Unit18> - <Unit19> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit20> + <Unit21> <Filename Value="..\..\source\uCEFChromium.pas"/> <EditorIndex Value="-1"/> <TopLine Value="559"/> <CursorPos Y="570"/> <UsageCount Value="10"/> - </Unit19> - <Unit20> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit21> + <Unit22> <Filename Value="..\..\source\uCEFOSRIMEHandler.pas"/> <EditorIndex Value="-1"/> <TopLine Value="97"/> @@ -178,33 +195,35 @@ <Item0 X="23" Y="177" ID="2"/> <Item1 X="58" Y="279" ID="1"/> </Bookmarks> - </Unit20> - <Unit21> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit22> + <Unit23> <Filename Value="..\..\source\uCEFTypes.pas"/> <EditorIndex Value="-1"/> <TopLine Value="264"/> <CursorPos X="35" Y="286"/> <UsageCount Value="10"/> - </Unit21> - <Unit22> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit23> + <Unit24> <Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm.pas"/> <EditorIndex Value="-1"/> <TopLine Value="286"/> <CursorPos X="33" Y="323"/> <UsageCount Value="10"/> - </Unit22> - <Unit23> + </Unit24> + <Unit25> <Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\imm_dyn.pas"/> <EditorIndex Value="-1"/> <CursorPos X="23" Y="17"/> <UsageCount Value="10"/> - </Unit23> - <Unit24> + </Unit25> + <Unit26> <Filename Value="C:\lazarus\fpc\3.0.4\source\packages\winunits-base\src\buildwinutilsbase.pp"/> <EditorIndex Value="-1"/> <CursorPos X="67" Y="17"/> <UsageCount Value="10"/> - </Unit24> + </Unit26> </Units> <JumpHistory Count="3" HistoryIndex="2"> <Position1> diff --git a/demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.res b/demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.res similarity index 100% rename from demos/SimpleLazOSRBrowser/SimpleLazOSRBrowser.res rename to demos/Lazarus/SimpleOSRBrowser/SimpleOSRBrowser.res diff --git a/demos/Lazarus/SimpleOSRBrowser/cef.inc b/demos/Lazarus/SimpleOSRBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SimpleOSRBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/SimpleLazOSRBrowser/usimplelazosrbrowser.lfm b/demos/Lazarus/SimpleOSRBrowser/usimplelazosrbrowser.lfm similarity index 100% rename from demos/SimpleLazOSRBrowser/usimplelazosrbrowser.lfm rename to demos/Lazarus/SimpleOSRBrowser/usimplelazosrbrowser.lfm diff --git a/demos/SimpleLazOSRBrowser/usimplelazosrbrowser.pas b/demos/Lazarus/SimpleOSRBrowser/usimplelazosrbrowser.pas similarity index 99% rename from demos/SimpleLazOSRBrowser/usimplelazosrbrowser.pas rename to demos/Lazarus/SimpleOSRBrowser/usimplelazosrbrowser.pas index 33b69822..34e5b809 100644 --- a/demos/SimpleLazOSRBrowser/usimplelazosrbrowser.pas +++ b/demos/Lazarus/SimpleOSRBrowser/usimplelazosrbrowser.pas @@ -1,4 +1,4 @@ -// ************************************************************************ +// ************************************************************************ // ***************************** CEF4Delphi ******************************* // ************************************************************************ // @@ -10,7 +10,7 @@ // For more information about CEF4Delphi visit : // https://www.briskbard.com/index.php?lang=en&pageid=cef // -// Copyright © 2019 Salvador Diaz Fau. All rights reserved. +// Copyright © 2019 Salvador Diaz Fau. All rights reserved. // // ************************************************************************ // ************ vvvv Original license and comments below vvvv ************* @@ -101,8 +101,9 @@ type procedure chrmosrIMECompositionRangeChanged(Sender: TObject; const browser: ICefBrowser; const selected_range: PCefRange; character_boundsCount: NativeUInt; const character_bounds: PCefRect); procedure SnapshotBtnClick(Sender: TObject); - procedure Timer1Timer(Sender: TObject); procedure SnapshotBtnEnter(Sender: TObject); + + procedure Timer1Timer(Sender: TObject); procedure ComboBox1Enter(Sender: TObject); protected diff --git a/demos/Lazarus/SimpleServer/00-Delete.bat b/demos/Lazarus/SimpleServer/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SimpleServer/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/SimpleServer/SimpleServer.lpi b/demos/Lazarus/SimpleServer/SimpleServer.lpi new file mode 100644 index 00000000..c50e3456 --- /dev/null +++ b/demos/Lazarus/SimpleServer/SimpleServer.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SimpleServer"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="SimpleServer.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleServer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleServerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\SimpleServer"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/SimpleServer/SimpleServer.lpr b/demos/Lazarus/SimpleServer/SimpleServer.lpr new file mode 100644 index 00000000..f36fb6ed --- /dev/null +++ b/demos/Lazarus/SimpleServer/SimpleServer.lpr @@ -0,0 +1,70 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2018 Salvador 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 SimpleServer; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + {$ELSE} + Forms, Interfaces, + {$ENDIF } + uCEFApplication, + uSimpleServer in 'uSimpleServer.pas' {SimpleServerFrm}; + +{.$R *.res} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TSimpleServerFrm, SimpleServerFrm); + Application.Run; + end; + + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. diff --git a/demos/Lazarus/SimpleServer/SimpleServer.lps b/demos/Lazarus/SimpleServer/SimpleServer.lps new file mode 100644 index 00000000..9c9e0c3f --- /dev/null +++ b/demos/Lazarus/SimpleServer/SimpleServer.lps @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="SimpleServer.lpr"/> + <IsPartOfProject Value="True"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleServer.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="SimpleServerFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="272"/> + <CursorPos X="46" Y="290"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="uSimpleServer.pas"/> + </Position1> + <Position2> + <Filename Value="uSimpleServer.pas"/> + <Caret Line="290" Column="36" TopLine="272"/> + </Position2> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/SimpleServer/cef.inc b/demos/Lazarus/SimpleServer/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SimpleServer/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/SimpleServer/uSimpleServer.lfm b/demos/Lazarus/SimpleServer/uSimpleServer.lfm new file mode 100644 index 00000000..7c3db54c --- /dev/null +++ b/demos/Lazarus/SimpleServer/uSimpleServer.lfm @@ -0,0 +1,124 @@ +object SimpleServerFrm: TSimpleServerFrm + Left = 0 + Height = 436 + Top = 0 + Width = 554 + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsSingle + Caption = 'Simple Server' + ClientHeight = 436 + ClientWidth = 554 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + Position = poScreenCenter + LCLVersion = '2.0.1.0' + object ButtonPnl: TPanel + Left = 0 + Height = 94 + Top = 0 + Width = 554 + Align = alTop + BevelOuter = bvNone + ClientHeight = 94 + ClientWidth = 554 + TabOrder = 0 + object AddressLbl: TLabel + Left = 14 + Height = 13 + Top = 11 + Width = 39 + Caption = 'Address' + ParentColor = False + end + object PortLbl: TLabel + Left = 14 + Height = 13 + Top = 39 + Width = 20 + Caption = 'Port' + ParentColor = False + end + object BacklogLbl: TLabel + Left = 14 + Height = 13 + Top = 68 + Width = 36 + Caption = 'Backlog' + ParentColor = False + end + object AddressEdt: TEdit + Left = 87 + Height = 21 + Top = 8 + Width = 211 + OnChange = AddressEdtChange + TabOrder = 0 + Text = '127.0.0.1' + end + object PortEdt: TSpinEdit + Left = 87 + Height = 22 + Top = 36 + Width = 211 + MaxValue = 65535 + MinValue = 1025 + TabOrder = 1 + Value = 8099 + end + object BacklogEdt: TSpinEdit + Left = 87 + Height = 22 + Top = 65 + Width = 211 + MaxValue = 512 + MinValue = 1 + TabOrder = 2 + Value = 10 + end + object StartBtn: TButton + Left = 312 + Height = 79 + Top = 8 + Width = 105 + Caption = 'Start' + OnClick = StartBtnClick + TabOrder = 3 + end + object StopBtn: TButton + Left = 434 + Height = 79 + Top = 8 + Width = 105 + Caption = 'Stop' + Enabled = False + OnClick = StopBtnClick + TabOrder = 4 + end + end + object ConnectionLogMem: TMemo + Left = 0 + Height = 342 + Top = 94 + Width = 554 + Align = alClient + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 1 + end + object CEFServerComponent1: TCEFServerComponent + OnServerCreated = CEFServerComponent1ServerCreated + OnServerDestroyed = CEFServerComponent1ServerDestroyed + OnClientConnected = CEFServerComponent1ClientConnected + OnClientDisconnected = CEFServerComponent1ClientDisconnected + OnHttpRequest = CEFServerComponent1HttpRequest + OnWebSocketRequest = CEFServerComponent1WebSocketRequest + OnWebSocketConnected = CEFServerComponent1WebSocketConnected + OnWebSocketMessage = CEFServerComponent1WebSocketMessage + left = 456 + top = 304 + end +end diff --git a/demos/Lazarus/SimpleServer/uSimpleServer.pas b/demos/Lazarus/SimpleServer/uSimpleServer.pas new file mode 100644 index 00000000..a30aed12 --- /dev/null +++ b/demos/Lazarus/SimpleServer/uSimpleServer.pas @@ -0,0 +1,325 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uSimpleServer; + +{$MODE Delphi} + +{$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.Samples.Spin, Vcl.ExtCtrls, System.Math, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, Spin, ExtCtrls, Math, + {$ENDIF} + uCEFInterfaces, uCEFServerComponent, uCEFTypes, uCEFMiscFunctions; + +type + TSimpleServerFrm = class(TForm) + CEFServerComponent1: TCEFServerComponent; + ButtonPnl: TPanel; + ConnectionLogMem: TMemo; + AddressLbl: TLabel; + AddressEdt: TEdit; + PortLbl: TLabel; + PortEdt: TSpinEdit; + BacklogLbl: TLabel; + BacklogEdt: TSpinEdit; + StartBtn: TButton; + StopBtn: TButton; + procedure StartBtnClick(Sender: TObject); + procedure AddressEdtChange(Sender: TObject); + procedure CEFServerComponent1ServerCreated(Sender: TObject; + const server: ICefServer); + procedure CEFServerComponent1ServerDestroyed(Sender: TObject; + const server: ICefServer); + procedure CEFServerComponent1ClientConnected(Sender: TObject; + const server: ICefServer; connection_id: Integer); + procedure CEFServerComponent1ClientDisconnected(Sender: TObject; + const server: ICefServer; connection_id: Integer); + procedure StopBtnClick(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure FormCreate(Sender: TObject); + procedure CEFServerComponent1HttpRequest(Sender: TObject; + const server: ICefServer; connection_id: Integer; + const client_address: ustring; const request: ICefRequest); + procedure CEFServerComponent1WebSocketConnected(Sender: TObject; + const server: ICefServer; connection_id: Integer); + procedure CEFServerComponent1WebSocketMessage(Sender: TObject; + const server: ICefServer; connection_id: Integer; + const data: Pointer; data_size: NativeUInt); + procedure CEFServerComponent1WebSocketRequest(Sender: TObject; + const server: ICefServer; connection_id: Integer; + const client_address: ustring; const request: ICefRequest; + const callback: ICefCallback); + protected + FClosing : boolean; + + function BufferToString(const aBuffer : TBytes) : string; + procedure ShowRequestInfo(const aRequest : ICefRequest); + procedure ShowPostDataInfo(const aPostData : ICefPostData); + public + { Public declarations } + end; + +var + SimpleServerFrm: TSimpleServerFrm; + +implementation + +{$R *.lfm} + +// Server capacity is limited and is intended to handle only a small number of +// simultaneous connections (e.g. for communicating between applications on localhost). + +// To test the HTTP server follow these steps : +// 1- Build and run this demo. +// 2- Click on the Start button. +// 3- Open your web browser and visit this address http://127.0.0.1:8099 +// 4- You should see some connection details in the server log and a "Hellow world" text in your web browser. + +// To test the websockets server follow these steps : +// 1- Build and run this demo. +// 2- Click on the "Start" button. +// 3- Open your web browser and visit this address https://www.websocket.org/echo.html +// 4- Type this in the "Location" field ws://127.0.0.1:8099 +// 5- Click the "Connect" button. +// 6- Click the "Send" button. +// 7- You should see some connection details in the server log and the default text message "Rock it with HTML5 WebSocket" + +procedure TSimpleServerFrm.AddressEdtChange(Sender: TObject); +begin + if not(CEFServerComponent1.IsRunning) then + StartBtn.Enabled := (length(trim(AddressEdt.Text)) > 0); +end; + +procedure TSimpleServerFrm.StartBtnClick(Sender: TObject); +begin + if (length(trim(AddressEdt.Text)) > 0) then + CEFServerComponent1.CreateServer(AddressEdt.Text, PortEdt.Value, BacklogEdt.Value); +end; + +procedure TSimpleServerFrm.StopBtnClick(Sender: TObject); +begin + CEFServerComponent1.Shutdown; +end; + +procedure TSimpleServerFrm.CEFServerComponent1ClientConnected( + Sender: TObject; const server: ICefServer; connection_id: Integer); +begin + ConnectionLogMem.Lines.Add('Client connected : ' + inttostr(connection_id)); +end; + +procedure TSimpleServerFrm.CEFServerComponent1ClientDisconnected( + Sender: TObject; const server: ICefServer; connection_id: Integer); +begin + ConnectionLogMem.Lines.Add('Client disconnected : ' + inttostr(connection_id)); +end; + +procedure TSimpleServerFrm.CEFServerComponent1HttpRequest(Sender: TObject; + const server: ICefServer; connection_id: Integer; + const client_address: ustring; const request: ICefRequest); +var + TempData : string; + TempParts : TUrlParts; +begin + ConnectionLogMem.Lines.Add('---------------------------------------'); + ConnectionLogMem.Lines.Add('HTTP request received from connection ' + inttostr(connection_id)); + ConnectionLogMem.Lines.Add('Client address : ' + client_address); + ShowRequestInfo(request); + ConnectionLogMem.Lines.Add('---------------------------------------'); + + if (request <> nil) and CefParseUrl(Request.URL, TempParts) then + begin + if (TempParts.path = '') or (TempParts.path = '/') then + begin + TempData := 'Hello world from Simple Server'; + CEFServerComponent1.SendHttp200response(connection_id, 'text/html', @TempData[1], length(TempData) * SizeOf(char)); + end + else + CEFServerComponent1.SendHttp404response(connection_id); + end + else + CEFServerComponent1.SendHttp404response(connection_id); +end; + +procedure TSimpleServerFrm.ShowRequestInfo(const aRequest : ICefRequest); +begin + if (aRequest = nil) then exit; + + ConnectionLogMem.Lines.Add('Request URL : ' + aRequest.URL); + ConnectionLogMem.Lines.Add('Request Method : ' + aRequest.Method); + + if (length(aRequest.ReferrerUrl) > 0) then + ConnectionLogMem.Lines.Add('Request Referrer : ' + aRequest.ReferrerUrl); + + ShowPostDataInfo(aRequest.PostData); +end; + +procedure TSimpleServerFrm.ShowPostDataInfo(const aPostData : ICefPostData); +var + i, j : integer; + TempLen : NativeUInt; + TempList : IInterfaceList; + TempElement : ICefPostDataElement; + TempBytes : TBytes; +begin + if (aPostData = nil) then exit; + + i := 0; + j := aPostData.GetCount; + + TempList := aPostData.GetElements(j); + + while (i < j) do + begin + TempElement := TempList.Items[i] as ICefPostDataElement; + + if (TempElement.GetBytesCount > 0) then + begin + SetLength(TempBytes, TempElement.GetBytesCount); + TempLen := TempElement.GetBytes(TempElement.GetBytesCount, @TempBytes[0]); + + if (TempLen > 0) then + begin + ConnectionLogMem.Lines.Add('Post contents length : ' + inttostr(TempLen)); + ConnectionLogMem.Lines.Add('Post contents sample : ' + BufferToString(TempBytes)); + end; + end; + + inc(i); + end; +end; + +function TSimpleServerFrm.BufferToString(const aBuffer : TBytes) : string; +var + i, j : integer; +begin + Result := ''; + + i := 0; + j := min(length(aBuffer), 5); + + while (i < j) do + begin + Result := Result + IntToHex(aBuffer[i], 2); + inc(i); + end; +end; + +procedure TSimpleServerFrm.CEFServerComponent1ServerCreated(Sender: TObject; const server: ICefServer); +begin + if CEFServerComponent1.Initialized then + begin + ConnectionLogMem.Lines.Add('Server created'); + StartBtn.Enabled := False; + StopBtn.Enabled := True; + end + else + ConnectionLogMem.Lines.Add('Server creation error!'); +end; + +procedure TSimpleServerFrm.CEFServerComponent1ServerDestroyed(Sender: TObject; const server: ICefServer); +begin + if FClosing then + PostMessage(Handle, WM_CLOSE, 0, 0) + else + begin + ConnectionLogMem.Lines.Add('Server destroyed'); + StartBtn.Enabled := True; + StopBtn.Enabled := False; + end; +end; + +procedure TSimpleServerFrm.CEFServerComponent1WebSocketConnected( + Sender: TObject; const server: ICefServer; connection_id: Integer); +begin + ConnectionLogMem.Lines.Add('Client connected : ' + inttostr(connection_id)); +end; + +procedure TSimpleServerFrm.CEFServerComponent1WebSocketMessage( + Sender: TObject; const server: ICefServer; connection_id: Integer; + const data: Pointer; data_size: NativeUInt); +var + TempStream : TStringStream; +begin + TempStream := nil; + + try + if (data_size > 0) and (data <> nil) then + begin + TempStream := TStringStream.Create(''); + TempStream.WriteBuffer(data^, data_size); + ConnectionLogMem.Lines.Add('Client message received : ' + quotedstr(TempStream.DataString)); + end; + finally + if (TempStream <> nil) then FreeAndNil(TempStream); + end; +end; + +procedure TSimpleServerFrm.CEFServerComponent1WebSocketRequest( + Sender: TObject; const server: ICefServer; connection_id: Integer; + const client_address: ustring; const request: ICefRequest; + const callback: ICefCallback); +begin + if (callback <> nil) then callback.cont; +end; + +procedure TSimpleServerFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + if CEFServerComponent1.Initialized then + begin + CanClose := False; + FClosing := True; + Visible := False; + CEFServerComponent1.Shutdown; + end + else + CanClose := True; +end; + +procedure TSimpleServerFrm.FormCreate(Sender: TObject); +begin + FClosing := False; +end; + +end. diff --git a/demos/Lazarus/SubProcess/00-Delete.bat b/demos/Lazarus/SubProcess/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/SubProcess/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/SubProcess/SimpleBrowser.lpi b/demos/Lazarus/SubProcess/SimpleBrowser.lpi new file mode 100644 index 00000000..639f4302 --- /dev/null +++ b/demos/Lazarus/SubProcess/SimpleBrowser.lpi @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SimpleBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="SimpleBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uCEFLoader.pas"/> + <IsPartOfProject Value="True"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\SimpleBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/SubProcess/SimpleBrowser.lpr b/demos/Lazarus/SubProcess/SimpleBrowser.lpr new file mode 100644 index 00000000..8412975b --- /dev/null +++ b/demos/Lazarus/SubProcess/SimpleBrowser.lpr @@ -0,0 +1,68 @@ +// ************************************************************************ +// ***************************** 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 SimpleBrowser; + +{$I cef.inc} + +uses + Forms, Interfaces, + Windows, + uCEFApplication, + uSimpleBrowser in 'uSimpleBrowser.pas' {Form1}, + uCEFLoader in 'uCEFLoader.pas'; + +//{$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. +// The IMAGE_FILE_LARGE_ADDRESS_AWARE constant is declared in WinApi.Windows. If you don't want to add +// WinApi.Windows to the 'uses' section in this file just replace the following line by +// {$SetPEFlags $20} +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + // This demo has the GlobalCEFApp creation, initialization and destruction in uCEFLoader.pas + // Read the code comments in uCEFLoader.pas for more details. + + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TForm1, Form1); + Application.Run; +end. diff --git a/demos/Lazarus/SubProcess/SimpleBrowser.lps b/demos/Lazarus/SubProcess/SimpleBrowser.lps new file mode 100644 index 00000000..76904869 --- /dev/null +++ b/demos/Lazarus/SubProcess/SimpleBrowser.lps @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="SimpleBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="42"/> + <CursorPos X="14" Y="44"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uSimpleBrowser.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="Form1"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <TopLine Value="69"/> + <CursorPos X="93" Y="76"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uCEFLoader.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="46"/> + <CursorPos X="65" Y="68"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="3" HistoryIndex="2"> + <Position1> + <Filename Value="SimpleBrowser.lpr"/> + </Position1> + <Position2> + <Filename Value="uSimpleBrowser.pas"/> + <Caret Line="92" Column="8" TopLine="68"/> + </Position2> + <Position3> + <Filename Value="SimpleBrowser.lpr"/> + <Caret Line="44" Column="14" TopLine="42"/> + </Position3> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/SubProcess/SubProcess.lpi b/demos/Lazarus/SubProcess/SubProcess.lpi new file mode 100644 index 00000000..d21b8985 --- /dev/null +++ b/demos/Lazarus/SubProcess/SubProcess.lpi @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="SubProcess"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="SubProcess.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uCEFLoader.pas"/> + <IsPartOfProject Value="True"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\SubProcess"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/SubProcess/SubProcess.lpr b/demos/Lazarus/SubProcess/SubProcess.lpr new file mode 100644 index 00000000..16449826 --- /dev/null +++ b/demos/Lazarus/SubProcess/SubProcess.lpr @@ -0,0 +1,77 @@ +// ************************************************************************ +// ***************************** 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 SubProcess; + +{$MODE Delphi} + +{$I cef.inc} + +uses + LCLIntf, LCLType, LMessages, Forms, Interfaces, + uCEFApplication; + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes +// to use up to 3GB of RAM. +{$SetPEFlags $20} + +begin + GlobalCEFApp := TCefApplication.Create; + + // The main process and the subprocess *MUST* have the same GlobalCEFApp + // properties and events, specially FrameworkDirPath, ResourcesDirPath, + // LocalesDirPath, cache, cookies and UserDataPath paths. + + // The demos are compiled into the BIN directory. Make sure SubProcess.exe + // and SimpleBrowser.exe are in that directory or this demo won't work. + + // In case you want to use custom directories for the CEF3 binaries, cache, + // cookies and user data. +{ + GlobalCEFApp.FrameworkDirPath := 'cef'; + GlobalCEFApp.ResourcesDirPath := 'cef'; + GlobalCEFApp.LocalesDirPath := 'cef\locales'; + GlobalCEFApp.cache := 'cef\cache'; + GlobalCEFApp.cookies := 'cef\cookies'; + GlobalCEFApp.UserDataPath := 'cef\User Data'; +} + + GlobalCEFApp.StartSubProcess; + GlobalCEFApp.Free; + GlobalCEFApp := nil; +end. + diff --git a/demos/Lazarus/SubProcess/SubProcess.lps b/demos/Lazarus/SubProcess/SubProcess.lps new file mode 100644 index 00000000..185da20b --- /dev/null +++ b/demos/Lazarus/SubProcess/SubProcess.lps @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="SubProcess.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="51"/> + <CursorPos X="18" Y="46"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uCEFLoader.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <TopLine Value="48"/> + <CursorPos X="29" Y="53"/> + <UsageCount Value="20"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="..\..\source\uCEFApplication.pas"/> + <EditorIndex Value="-1"/> + <TopLine Value="258"/> + <CursorPos X="19" Y="296"/> + <UsageCount Value="10"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="5" HistoryIndex="4"> + <Position1> + <Filename Value="SubProcess.lpr"/> + </Position1> + <Position2> + <Filename Value="SubProcess.lpr"/> + <Caret Line="48" Column="40" TopLine="33"/> + </Position2> + <Position3> + <Filename Value="SubProcess.lpr"/> + <Caret Line="80" TopLine="45"/> + </Position3> + <Position4> + <Filename Value="SubProcess.lpr"/> + <Caret Line="54" Column="17" TopLine="33"/> + </Position4> + <Position5> + <Filename Value="SubProcess.lpr"/> + <Caret Line="48" Column="50" TopLine="45"/> + </Position5> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/SubProcess/cef.inc b/demos/Lazarus/SubProcess/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/SubProcess/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/SubProcess/uCEFLoader.pas b/demos/Lazarus/SubProcess/uCEFLoader.pas new file mode 100644 index 00000000..e06a1eca --- /dev/null +++ b/demos/Lazarus/SubProcess/uCEFLoader.pas @@ -0,0 +1,84 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uCEFLoader; + +interface + +implementation + +uses + uCEFApplication; + + // Follow these steps to test this demo : + // 1. Build the SubProcess project in this directory. + // 2. Copy the CEF binaries to the BIN directory in CEF4Delphi. + // 3. Build this project : SimpleBrowser + // 4. Run this demo : SimpleBrowser + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + + // In case you want to use custom directories for the CEF3 binaries, cache, cookies and user data. + // If you don't set a cache directory the browser will use in-memory cache. + // The cache, cookies and user data directories must be writable. +{ + GlobalCEFApp.FrameworkDirPath := 'cef'; + GlobalCEFApp.ResourcesDirPath := 'cef'; + GlobalCEFApp.LocalesDirPath := 'cef\locales'; + GlobalCEFApp.cache := 'cef\cache'; + GlobalCEFApp.cookies := 'cef\cookies'; + GlobalCEFApp.UserDataPath := 'cef\User Data'; +} + + GlobalCEFApp.BrowserSubprocessPath := 'SubProcess.exe'; + + // This demo uses a different EXE for the subprocesses. + // With this configuration it's not necessary to have the + // GlobalCEFApp.StartMainProcess call in a if..then clause. + + GlobalCEFApp.StartMainProcess; +end; + +initialization + CreateGlobalCEFApp; + +finalization + DestroyGlobalCEFApp; + +end. diff --git a/demos/Lazarus/SubProcess/uSimpleBrowser.lfm b/demos/Lazarus/SubProcess/uSimpleBrowser.lfm new file mode 100644 index 00000000..993dfd98 --- /dev/null +++ b/demos/Lazarus/SubProcess/uSimpleBrowser.lfm @@ -0,0 +1,66 @@ +object Form1: TForm1 + Left = 49 + Height = 624 + Top = 86 + Width = 1038 + Caption = 'Simple Browser' + ClientHeight = 624 + ClientWidth = 1038 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object ChromiumWindow1: TChromiumWindow + Left = 0 + Height = 603 + Top = 21 + Width = 1038 + Align = alClient + TabOrder = 0 + OnClose = ChromiumWindow1Close + OnBeforeClose = ChromiumWindow1BeforeClose + OnAfterCreated = ChromiumWindow1AfterCreated + end + object AddressPnl: TPanel + Left = 0 + Height = 21 + Top = 0 + Width = 1038 + Align = alTop + BevelOuter = bvNone + ClientHeight = 21 + ClientWidth = 1038 + Enabled = False + TabOrder = 1 + object AddressEdt: TEdit + Left = 0 + Height = 21 + Top = 0 + Width = 1007 + Align = alClient + TabOrder = 0 + Text = 'http://www.google.com' + end + object GoBtn: TButton + Left = 1007 + Height = 21 + Top = 0 + Width = 31 + Align = alRight + Caption = 'Go' + OnClick = GoBtnClick + TabOrder = 1 + end + end + object Timer1: TTimer + Enabled = False + Interval = 300 + OnTimer = Timer1Timer + left = 80 + top = 88 + end +end diff --git a/demos/Lazarus/SubProcess/uSimpleBrowser.pas b/demos/Lazarus/SubProcess/uSimpleBrowser.pas new file mode 100644 index 00000000..49bd2a39 --- /dev/null +++ b/demos/Lazarus/SubProcess/uSimpleBrowser.pas @@ -0,0 +1,224 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uSimpleBrowser; + +{$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, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces, + uCEFWinControl; + +type + TForm1 = class(TForm) + ChromiumWindow1: TChromiumWindow; + AddressPnl: TPanel; + AddressEdt: TEdit; + GoBtn: TButton; + Timer1: TTimer; + procedure GoBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure ChromiumWindow1AfterCreated(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure ChromiumWindow1Close(Sender: TObject); + procedure ChromiumWindow1BeforeClose(Sender: TObject); + private + // You have to handle this two messages to call NotifyMoveOrResizeStarted or some page elements will be misaligned. + procedure WMMove(var aMessage : TWMMove); message WM_MOVE; + procedure WMMoving(var aMessage : TMessage); message WM_MOVING; + // You also have to handle these two messages to set GlobalCEFApp.OsmodalLoop + procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP; + procedure WMExitMenuLoop(var aMessage: TMessage); message WM_EXITMENULOOP; + protected + // Variables to control when can we destroy the form safely + FCanClose : boolean; // Set to True in TChromium.OnBeforeClose + FClosing : boolean; // Set to True in the CloseQuery event. + + procedure Chromium_OnBeforePopup(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); + + public + { Public declarations } + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +uses + uCEFApplication; + +// This is a demo with the simplest web browser you can build using CEF4Delphi and +// it doesn't show any sign of progress like other web browsers do. + +// Remember that it may take a few seconds to load if Windows update, your antivirus or +// any other windows service is using your hard drive. + +// Depending on your internet connection it may take longer than expected. + +// Please check that your firewall or antivirus are not blocking this application +// or the domain "google.com". If you don't live in the US, you'll be redirected to +// another domain which will take a little time too. + +// Destruction steps +// ================= +// 1. The FormCloseQuery event sets CanClose to False and calls TChromiumWindow.CloseBrowser, which triggers the TChromiumWindow.OnClose event. +// 2. The TChromiumWindow.OnClose event calls TChromiumWindow.DestroyChildWindow which triggers the TChromiumWindow.OnBeforeClose event. +// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form. + +procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + if GlobalCEFApp.LibLoaded then + begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + ChromiumWindow1.CloseBrowser(True); + end; + end + else + CanClose := True; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + Caption := 'Simple Browser - Initializing browser. Please wait...'; + + ChromiumWindow1.ChromiumBrowser.OnBeforePopup := Chromium_OnBeforePopup; + + // 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(ChromiumWindow1.CreateBrowser) then Timer1.Enabled := True; +end; + +procedure TForm1.ChromiumWindow1Close(Sender: TObject); +begin + // DestroyChildWindow will destroy the child window created by CEF at the top of the Z order. + if not(ChromiumWindow1.DestroyChildWindow) then + begin + FCanClose := True; + Close; + end; +end; + +procedure TForm1.ChromiumWindow1BeforeClose(Sender: TObject); +begin + FCanClose := True; + Close; +end; + +procedure TForm1.Chromium_OnBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +procedure TForm1.ChromiumWindow1AfterCreated(Sender: TObject); +begin + // Now the browser is fully initialized we can load the initial web page. + Caption := 'Simple Browser'; + AddressPnl.Enabled := True; + GoBtn.Click; +end; + +procedure TForm1.GoBtnClick(Sender: TObject); +begin + // This will load the URL in the edit box + ChromiumWindow1.LoadURL(AddressEdt.Text); +end; + +procedure TForm1.Timer1Timer(Sender: TObject); +begin + Timer1.Enabled := False; + if not(ChromiumWindow1.CreateBrowser) and not(ChromiumWindow1.Initialized) then + Timer1.Enabled := True; +end; + +procedure TForm1.WMMove(var aMessage : TWMMove); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TForm1.WMMoving(var aMessage : TMessage); +begin + inherited; + + if (ChromiumWindow1 <> nil) then ChromiumWindow1.NotifyMoveOrResizeStarted; +end; + +procedure TForm1.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TForm1.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; +end; + +end. diff --git a/demos/Lazarus/TabbedBrowser/00-Delete.bat b/demos/Lazarus/TabbedBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/TabbedBrowser/TabBrowser.lpi b/demos/Lazarus/TabbedBrowser/TabBrowser.lpi new file mode 100644 index 00000000..0964117c --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/TabBrowser.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="TabBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="TabBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\TabBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/TabbedBrowser/TabBrowser.lpr b/demos/Lazarus/TabbedBrowser/TabBrowser.lpr new file mode 100644 index 00000000..af72c290 --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/TabBrowser.lpr @@ -0,0 +1,73 @@ +// ************************************************************************ +// ***************************** 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 TabBrowser; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, Interfaces, + Windows, + {$ENDIF } + uCEFApplication, + uMainForm in 'uMainForm.pas' {MainForm}; + +//{$R *.res} + +{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE} + +begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TMainForm, MainForm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/TabbedBrowser/TabBrowser.lps b/demos/Lazarus/TabbedBrowser/TabBrowser.lps new file mode 100644 index 00000000..388ed0f6 --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/TabBrowser.lps @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="TabBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="37"/> + <CursorPos X="3" Y="53"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="110"/> + <CursorPos X="8" Y="127"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="TabBrowser.lpr"/> + </Position1> + <Position2> + <Filename Value="uMainForm.pas"/> + <Caret Line="127" Column="8" TopLine="110"/> + </Position2> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/TabbedBrowser/cef.inc b/demos/Lazarus/TabbedBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/TabbedBrowser/uMainForm.lfm b/demos/Lazarus/TabbedBrowser/uMainForm.lfm new file mode 100644 index 00000000..857e9b14 --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/uMainForm.lfm @@ -0,0 +1,196 @@ +object MainForm: TMainForm + Left = 344 + Height = 573 + Top = 127 + Width = 897 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 573 + ClientWidth = 897 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnShow = FormShow + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object ButtonPnl: TPanel + Left = 0 + Height = 25 + Top = 0 + Width = 897 + Align = alTop + BevelOuter = bvNone + Caption = 'ButtonPnl' + ClientHeight = 25 + ClientWidth = 897 + Enabled = False + TabOrder = 0 + object NavButtonPnl: TPanel + Left = 0 + Height = 25 + Top = 0 + Width = 183 + Align = alLeft + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 183 + TabOrder = 1 + object BackBtn: TButton + Left = 63 + Height = 25 + Top = 0 + Width = 25 + Caption = '3' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = BackBtnClick + ParentFont = False + TabOrder = 2 + end + object ForwardBtn: TButton + Left = 93 + Height = 25 + Top = 0 + Width = 25 + Caption = '4' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = ForwardBtnClick + ParentFont = False + TabOrder = 3 + end + object ReloadBtn: TButton + Left = 123 + Height = 25 + Top = 0 + Width = 25 + Caption = 'q' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = ReloadBtnClick + ParentFont = False + TabOrder = 4 + end + object StopBtn: TButton + Left = 153 + Height = 25 + Top = 0 + Width = 25 + Caption = '=' + Font.CharSet = SYMBOL_CHARSET + Font.Color = clWindowText + Font.Height = -19 + Font.Name = 'Webdings' + OnClick = StopBtnClick + ParentFont = False + TabOrder = 5 + end + object AddTabBtn: TButton + Left = 1 + Height = 25 + Top = 0 + Width = 25 + Caption = '+' + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Tahoma' + OnClick = AddTabBtnClick + ParentFont = False + TabOrder = 0 + end + object RemoveTabBtn: TButton + Left = 32 + Height = 25 + Top = 0 + Width = 25 + Caption = '-' + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Tahoma' + OnClick = RemoveTabBtnClick + ParentFont = False + TabOrder = 1 + end + end + object ConfigPnl: TPanel + Left = 865 + Height = 25 + Top = 0 + Width = 32 + Align = alRight + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 32 + TabOrder = 2 + object GoBtn: TButton + Left = 6 + Height = 25 + Top = 0 + Width = 25 + Caption = 'â–º' + Font.CharSet = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -17 + Font.Name = 'Arial' + Font.Style = [fsBold] + OnClick = GoBtnClick + ParentFont = False + TabOrder = 0 + end + end + object URLEditPnl: TPanel + Left = 183 + Height = 25 + Top = 0 + Width = 682 + Align = alClient + BevelOuter = bvNone + ClientHeight = 25 + ClientWidth = 682 + TabOrder = 0 + object URLCbx: TComboBox + Left = 0 + Height = 21 + Top = 3 + Width = 682 + Anchors = [akTop, akLeft, akRight, akBottom] + ItemHeight = 13 + ItemIndex = 0 + Items.Strings = ( + 'https://www.google.com' + 'https://www.whatismybrowser.com/detect/what-http-headers-is-my-browser-sending' + 'https://www.w3schools.com/js/tryit.asp?filename=tryjs_win_close' + 'https://www.w3schools.com/html/html5_video.asp' + 'http://www.adobe.com/software/flash/about/' + 'http://isflashinstalled.com/' + 'chrome://version/' + 'http://html5test.com/' + 'https://www.w3schools.com/' + 'http://webglsamples.org/' + 'https://www.youtube.com' + 'https://html5demos.com/drag/' + 'https://developers.google.com/maps/documentation/javascript/examples/streetview-embed?hl=fr' + ) + TabOrder = 0 + Text = 'https://www.google.com' + end + end + end + object PageControl1: TPageControl + Left = 0 + Height = 548 + Top = 25 + Width = 897 + Align = alClient + TabOrder = 1 + OnChange = PageControl1Change + end +end diff --git a/demos/Lazarus/TabbedBrowser/uMainForm.pas b/demos/Lazarus/TabbedBrowser/uMainForm.pas new file mode 100644 index 00000000..874fde6b --- /dev/null +++ b/demos/Lazarus/TabbedBrowser/uMainForm.pas @@ -0,0 +1,576 @@ +// ************************************************************************ +// ***************************** 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 © 2019 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit 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.ComCtrls, Vcl.Buttons, Vcl.ExtCtrls, Vcl.StdCtrls, + {$ELSE} + Windows, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, ComCtrls, Buttons, ExtCtrls, StdCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants; + +const + CEFBROWSER_DESTROYWNDPARENT = WM_APP + $100; + CEFBROWSER_DESTROYTAB = WM_APP + $101; + CEFBROWSER_INITIALIZED = WM_APP + $102; + CEFBROWSER_CHECKTAGGEDTABS = WM_APP + $103; + +type + TMainForm = class(TForm) + PageControl1: TPageControl; + ButtonPnl: TPanel; + NavButtonPnl: TPanel; + BackBtn: TButton; + ForwardBtn: TButton; + ReloadBtn: TButton; + StopBtn: TButton; + ConfigPnl: TPanel; + GoBtn: TButton; + URLEditPnl: TPanel; + URLCbx: TComboBox; + AddTabBtn: TButton; + RemoveTabBtn: TButton; + procedure AddTabBtnClick(Sender: TObject); + procedure RemoveTabBtnClick(Sender: TObject); + procedure FormShow(Sender: TObject); + procedure PageControl1Change(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure BackBtnClick(Sender: TObject); + procedure ForwardBtnClick(Sender: TObject); + procedure ReloadBtnClick(Sender: TObject); + procedure StopBtnClick(Sender: TObject); + procedure GoBtnClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + + protected + FClosingTab : boolean; + FCanClose : boolean; + FClosing : boolean; + + procedure Chromium_OnAfterCreated(Sender: TObject; const browser: ICefBrowser); + procedure Chromium_OnAddressChange(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring); + procedure Chromium_OnTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); + procedure Chromium_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); + procedure Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure Chromium_OnBeforePopup(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 BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; + procedure BrowserDestroyWindowParentMsg(var aMessage : TMessage); message CEFBROWSER_DESTROYWNDPARENT; + procedure BrowserDestroyTabMsg(var aMessage : TMessage); message CEFBROWSER_DESTROYTAB; + procedure BrowserCheckTaggedTabsMsg(var aMessage : TMessage); message CEFBROWSER_CHECKTAGGEDTABS; + procedure CEFInitializedMsg(var aMessage : TMessage); message CEFBROWSER_INITIALIZED; + 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; + + function AllTabSheetsAreTagged : boolean; + procedure CloseAllBrowsers; + function GetPageIndex(const aSender : TObject; var aPageIndex : integer) : boolean; + procedure NotifyMoveOrResizeStarted; + function SearchChromium(aPageIndex : integer; var aChromium : TChromium) : boolean; + function SearchWindowParent(aPageIndex : integer; var aWindowParent : TCEFWindowParent) : boolean; + + public + { Public declarations } + end; + +var + MainForm: TMainForm; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.lfm} + +// This is just a simplified demo with tab handling. +// It's not meant to be a complete browser or the best way to implement a tabbed browser. + +// In this demo all browsers share the buttons and URL combobox. +// All TChromium components share the same functions for their events sending the +// PageIndex of the Tab where they are included in the Message.lParam parameter if necessary. + +// For simplicity the Button panel and the PageControl are disabled while adding or removing tab sheets. +// The Form can't be closed if it's destroying a tab. + +// This is the destruction sequence when a user closes a tab sheet: +// 1. RemoveTabBtnClick calls TChromium.CloseBrowser of the selected tab which triggers a TChromium.OnClose event. +// 2. TChromium.OnClose sends a CEFBROWSER_DESTROYWNDPARENT message to destroy TCEFWindowParent in the main thread which triggers a TChromium.OnBeforeClose event. +// 3. TChromium.OnBeforeClose sends a CEFBROWSER_DESTROYTAB message to destroy the tab in the main thread. + +// This is the destruction sequence when the user closes the main form +// 1. FormCloseQuery hides the form and calls CloseAllBrowsers which calls TChromium.CloseBrowser in all tabs and triggers the TChromium.OnClose event. +// 2. TChromium.OnClose sends a CEFBROWSER_DESTROYWNDPARENT message to destroy TCEFWindowParent in the main thread which triggers a TChromium.OnBeforeClose event. +// 3. TChromium.OnBeforeClose sends a CEFBROWSER_CHECKTAGGEDTABS message to set the TAG property to 1 in the TabSheet containing the TChromium. Then sends WM_CLOSE in case all tabsheets have a TAG = 1. + +procedure GlobalCEFApp_OnContextInitialized; +begin + if (MainForm <> nil) and MainForm.HandleAllocated then + PostMessage(MainForm.Handle, CEFBROWSER_INITIALIZED, 0, 0); +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized; +end; + +procedure TMainForm.AddTabBtnClick(Sender: TObject); +var + TempSheet : TTabSheet; + TempWindowParent : TCEFWindowParent; + TempChromium : TChromium; +begin + ButtonPnl.Enabled := False; + PageControl1.Enabled := False; + + TempSheet := TTabSheet.Create(PageControl1); + TempSheet.Caption := 'New Tab'; + TempSheet.PageControl := PageControl1; + + TempWindowParent := TCEFWindowParent.Create(TempSheet); + TempWindowParent.Parent := TempSheet; + TempWindowParent.Color := clWhite; + TempWindowParent.Align := alClient; + + TempChromium := TChromium.Create(TempSheet); + TempChromium.OnAfterCreated := Chromium_OnAfterCreated; + TempChromium.OnAddressChange := Chromium_OnAddressChange; + TempChromium.OnTitleChange := Chromium_OnTitleChange; + TempChromium.OnClose := Chromium_OnClose; + TempChromium.OnBeforeClose := Chromium_OnBeforeClose; + TempChromium.OnBeforePopup := Chromium_OnBeforePopup; + + TempChromium.CreateBrowser(TempWindowParent, ''); +end; + +procedure TMainForm.RemoveTabBtnClick(Sender: TObject); +var + TempChromium : TChromium; +begin + if SearchChromium(PageControl1.TabIndex, TempChromium) then + begin + FClosingTab := True; + ButtonPnl.Enabled := False; + PageControl1.Enabled := False; + TempChromium.CloseBrowser(True); + end; +end; + +procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + if FClosingTab then + CanClose := False + else + if (PageControl1.PageCount = 0) then + CanClose := True + else + begin + CanClose := FCanClose; + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + + CloseAllBrowsers; + end; + end; +end; + +procedure TMainForm.CloseAllBrowsers; +var + i, j, k : integer; + TempComponent : TComponent; + TempSheet : TTabSheet; + TempCtnue : boolean; +begin + k := pred(PageControl1.PageCount); + + while (k >= 0) do + begin + TempSheet := PageControl1.Pages[k]; + TempCtnue := True; + i := 0; + j := TempSheet.ComponentCount; + + while (i < j) and TempCtnue do + begin + TempComponent := TempSheet.Components[i]; + + if (TempComponent <> nil) and (TempComponent is TChromium) then + begin + TChromium(TempComponent).CloseBrowser(True); + TempCtnue := False; + end + else + inc(i); + end; + + dec(k); + end; +end; + +procedure TMainForm.FormCreate(Sender: TObject); +begin + FClosingTab := False; + FCanClose := False; + FClosing := False; +end; + +procedure TMainForm.FormShow(Sender: TObject); +begin + if (GlobalCEFApp <> nil) and + GlobalCEFApp.GlobalContextInitialized and + not(ButtonPnl.Enabled) then + begin + ButtonPnl.Enabled := True; + Caption := 'Tab Browser'; + cursor := crDefault; + if (PageControl1.PageCount = 0) then AddTabBtn.Click; + end; +end; + +procedure TMainForm.ForwardBtnClick(Sender: TObject); +var + TempChromium : TChromium; +begin + if SearchChromium(PageControl1.TabIndex, TempChromium) then TempChromium.GoForward; +end; + +procedure TMainForm.GoBtnClick(Sender: TObject); +var + TempChromium : TChromium; +begin + if SearchChromium(PageControl1.TabIndex, TempChromium) then TempChromium.LoadURL(URLCbx.Text); +end; + +procedure TMainForm.ReloadBtnClick(Sender: TObject); +var + TempChromium : TChromium; +begin + if SearchChromium(PageControl1.TabIndex, TempChromium) then TempChromium.Reload; +end; + +procedure TMainForm.BackBtnClick(Sender: TObject); +var + TempChromium : TChromium; +begin + if SearchChromium(PageControl1.TabIndex, TempChromium) then TempChromium.GoBack; +end; + +procedure TMainForm.StopBtnClick(Sender: TObject); +var + TempChromium : TChromium; +begin + if SearchChromium(PageControl1.TabIndex, TempChromium) then TempChromium.StopLoad; +end; + +procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage); +var + TempWindowParent : TCEFWindowParent; + TempChromium : TChromium; +begin + ButtonPnl.Enabled := True; + PageControl1.Enabled := True; + + if SearchWindowParent(aMessage.lParam, TempWindowParent) then + TempWindowParent.UpdateSize; + + if SearchChromium(aMessage.lParam, TempChromium) then + TempChromium.LoadURL(URLCbx.Items[0]); +end; + +procedure TMainForm.BrowserDestroyWindowParentMsg(var aMessage : TMessage); +var + TempWindowParent : TCEFWindowParent; +begin + if SearchWindowParent(aMessage.lParam, TempWindowParent) then TempWindowParent.Free; +end; + +procedure TMainForm.BrowserDestroyTabMsg(var aMessage : TMessage); +begin + if (aMessage.lParam >= 0) and + (aMessage.lParam < PageControl1.PageCount) then + PageControl1.Pages[aMessage.lParam].Free; + + FClosingTab := False; + ButtonPnl.Enabled := True; + PageControl1.Enabled := True; +end; + +procedure TMainForm.BrowserCheckTaggedTabsMsg(var aMessage : TMessage); +begin + if (aMessage.lParam >= 0) and + (aMessage.lParam < PageControl1.PageCount) then + begin + PageControl1.Pages[aMessage.lParam].Tag := 1; + + if AllTabSheetsAreTagged then + begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); + end; + end; +end; + +function TMainForm.AllTabSheetsAreTagged : boolean; +var + i : integer; +begin + Result := True; + i := pred(PageControl1.PageCount); + + while (i >= 0) and Result do + if (PageControl1.Pages[i].Tag <> 1) then + Result := False + else + dec(i); +end; + +procedure TMainForm.Chromium_OnAfterCreated(Sender: TObject; const browser: ICefBrowser); +var + TempPageIndex : integer; +begin + if GetPageIndex(Sender, TempPageIndex) then + PostMessage(Handle, CEF_AFTERCREATED, 0, TempPageIndex); +end; + +procedure TMainForm.Chromium_OnAddressChange(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring); +var + TempPageIndex : integer; +begin + if not(FClosing) and + (PageControl1.TabIndex >= 0) and + GetPageIndex(Sender, TempPageIndex) and + (PageControl1.TabIndex = TempPageIndex) then + URLCbx.Text := url; +end; + +function TMainForm.GetPageIndex(const aSender : TObject; var aPageIndex : integer) : boolean; +begin + Result := False; + aPageIndex := -1; + + if (aSender <> nil) and + (aSender is TComponent) and + (TComponent(aSender).Owner <> nil) and + (TComponent(aSender).Owner is TTabSheet) then + begin + aPageIndex := TTabSheet(TComponent(aSender).Owner).PageIndex; + Result := True; + end; +end; + +procedure TMainForm.Chromium_OnTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); +var + TempPageIndex : integer; +begin + if not(FClosing) and GetPageIndex(Sender, TempPageIndex) then + PageControl1.Pages[TempPageIndex].Caption := title; +end; + +procedure TMainForm.Chromium_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +var + TempPageIndex : integer; +begin + if GetPageIndex(Sender, TempPageIndex) then + PostMessage(Handle, CEFBROWSER_DESTROYWNDPARENT, 0, TempPageIndex); +end; + +procedure TMainForm.Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); +var + TempPageIndex : integer; +begin + if GetPageIndex(Sender, TempPageIndex) then + begin + if FClosing then + PostMessage(Handle, CEFBROWSER_CHECKTAGGEDTABS, 0, TempPageIndex) + else + PostMessage(Handle, CEFBROWSER_DESTROYTAB, 0, TempPageIndex); + end; +end; + +procedure TMainForm.Chromium_OnBeforePopup(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); +begin + // For simplicity, this demo blocks all popup windows and new tabs + Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); +end; + +function TMainForm.SearchChromium(aPageIndex : integer; var aChromium : TChromium) : boolean; +var + i, j : integer; + TempComponent : TComponent; + TempSheet : TTabSheet; +begin + Result := False; + aChromium := nil; + + if (aPageIndex >= 0) and (aPageIndex < PageControl1.PageCount) then + begin + TempSheet := PageControl1.Pages[aPageIndex]; + i := 0; + j := TempSheet.ComponentCount; + + while (i < j) and not(Result) do + begin + TempComponent := TempSheet.Components[i]; + + if (TempComponent <> nil) and (TempComponent is TChromium) then + begin + aChromium := TChromium(TempComponent); + Result := True; + end + else + inc(i); + end; + end; +end; + +function TMainForm.SearchWindowParent(aPageIndex : integer; var aWindowParent : TCEFWindowParent) : boolean; +var + i, j : integer; + TempControl : TControl; + TempSheet : TTabSheet; +begin + Result := False; + aWindowParent := nil; + + if (aPageIndex >= 0) and (aPageIndex < PageControl1.PageCount) then + begin + TempSheet := PageControl1.Pages[aPageIndex]; + i := 0; + j := TempSheet.ControlCount; + + while (i < j) and not(Result) do + begin + TempControl := TempSheet.Controls[i]; + + if (TempControl <> nil) and (TempControl is TCEFWindowParent) then + begin + aWindowParent := TCEFWindowParent(TempControl); + Result := True; + end + else + inc(i); + end; + end; +end; + +procedure TMainForm.NotifyMoveOrResizeStarted; +var + i, j : integer; + TempChromium : TChromium; +begin + if not(showing) or (PageControl1 = nil) or FClosing then exit; + + i := 0; + j := PageControl1.PageCount; + + while (i < j) do + begin + if SearchChromium(i, TempChromium) then TempChromium.NotifyMoveOrResizeStarted; + + inc(i); + end; +end; + +procedure TMainForm.WMMove(var aMessage : TWMMove); +begin + inherited; + + NotifyMoveOrResizeStarted; +end; + +procedure TMainForm.WMMoving(var aMessage : TMessage); +begin + inherited; + + NotifyMoveOrResizeStarted; +end; + +procedure TMainForm.WMEnterMenuLoop(var aMessage: TMessage); +begin + inherited; + + if not(FClosing) and (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then + GlobalCEFApp.OsmodalLoop := True; +end; + +procedure TMainForm.WMExitMenuLoop(var aMessage: TMessage); +begin + inherited; + + if not(FClosing) and (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then + GlobalCEFApp.OsmodalLoop := False; +end; + +procedure TMainForm.PageControl1Change(Sender: TObject); +var + TempChromium : TChromium; +begin + if showing and SearchChromium(PageControl1.TabIndex, TempChromium) then + URLCbx.Text := TempChromium.DocumentURL; +end; + +procedure TMainForm.CEFInitializedMsg(var aMessage : TMessage); +begin + if not(ButtonPnl.Enabled) then + begin + ButtonPnl.Enabled := True; + Caption := 'Tab Browser'; + cursor := crDefault; + if (PageControl1.PageCount = 0) then AddTabBtn.Click; + end; +end; + +end. diff --git a/demos/Lazarus/ToolBoxBrowser/00-Delete.bat b/demos/Lazarus/ToolBoxBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/ToolBoxBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lpi b/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lpi new file mode 100644 index 00000000..9c0765ed --- /dev/null +++ b/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lpi @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="ToolBoxBrowser"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="3"> + <Unit0> + <Filename Value="ToolBoxBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + <Unit2> + <Filename Value="uChildForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ChildForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit2> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\ToolBoxBrowser"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lpr b/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lpr similarity index 76% rename from demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lpr rename to demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lpr index 4494ac2e..0b0075ba 100644 --- a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lpr +++ b/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lpr @@ -10,7 +10,7 @@ // For more information about CEF4Delphi visit : // https://www.briskbard.com/index.php?lang=en&pageid=cef // -// Copyright © 2019 Salvador Diaz Fau. All rights reserved. +// Copyright © 2018 Salvador Díaz Fau. All rights reserved. // // ************************************************************************ // ************ vvvv Original license and comments below vvvv ************* @@ -35,33 +35,35 @@ * *) -program ToolBoxLazBrowser; +program ToolBoxBrowser; -{$mode objfpc}{$H+} +{$MODE Delphi} + +{$I cef.inc} uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Interfaces, // this includes the LCL widgetset - Forms, uMainForm, - { you can add units after this } - uCEFApplication, uchildform; + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uMainForm in 'uMainForm.pas' {MainForm}, + uChildForm in 'uChildForm.pas' {ChildForm}; -{$R *.res} +{.$R *.RES} -{$IFDEF MSWINDOWS} - // CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. - {$SetPEFlags $20} -{$ENDIF} +{$SetPEFlags $20} begin + // GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89 + // https://github.com/salvadordf/CEF4Delphi/issues/89 CreateGlobalCEFApp; if GlobalCEFApp.StartMainProcess then begin - RequireDerivedFormResource:=True; - Application.Scaled:=True; Application.Initialize; Application.CreateForm(TMainForm, MainForm); Application.Run; @@ -69,4 +71,3 @@ begin DestroyGlobalCEFApp; end. - diff --git a/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lps b/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lps new file mode 100644 index 00000000..05ff2760 --- /dev/null +++ b/demos/Lazarus/ToolBoxBrowser/ToolBoxBrowser.lps @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="3"> + <Unit0> + <Filename Value="ToolBoxBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="41"/> + <CursorPos X="17" Y="58"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uMainForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="MainForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <EditorIndex Value="1"/> + <TopLine Value="106"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="uChildForm.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="ChildForm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="2"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit2> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="uMainForm.pas"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/ToolBoxBrowser/cef.inc b/demos/Lazarus/ToolBoxBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/ToolBoxBrowser/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/ToolBoxLazBrowser/uchildform.lfm b/demos/Lazarus/ToolBoxBrowser/uChildForm.lfm similarity index 61% rename from demos/ToolBoxLazBrowser/uchildform.lfm rename to demos/Lazarus/ToolBoxBrowser/uChildForm.lfm index 2909883a..88d5d25d 100644 --- a/demos/ToolBoxLazBrowser/uchildform.lfm +++ b/demos/Lazarus/ToolBoxBrowser/uChildForm.lfm @@ -1,24 +1,29 @@ object ChildForm: TChildForm - Left = 45 - Height = 503 - Top = 239 - Width = 800 - BorderIcons = [biSystemMenu, biMinimize] - BorderStyle = bsSingle - Caption = 'ChildForm' - ClientHeight = 503 - ClientWidth = 800 + Left = 0 + Height = 394 + Top = 0 + Width = 602 + BorderStyle = bsToolWindow + Caption = 'Browser' + ClientHeight = 394 + ClientWidth = 602 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' OnClose = FormClose OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy OnShow = FormShow + Position = poScreenCenter + ShowInTaskBar = stAlways LCLVersion = '2.0.2.0' object CEFWindowParent1: TCEFWindowParent Left = 0 - Height = 503 + Height = 394 Top = 0 - Width = 800 + Width = 602 Align = alClient TabOrder = 0 end @@ -29,7 +34,7 @@ object ChildForm: TChildForm OnAfterCreated = Chromium1AfterCreated OnBeforeClose = Chromium1BeforeClose OnClose = Chromium1Close - left = 80 - top = 53 + left = 184 + top = 128 end end diff --git a/demos/ToolBoxLazBrowser/uchildform.pas b/demos/Lazarus/ToolBoxBrowser/uChildForm.pas similarity index 69% rename from demos/ToolBoxLazBrowser/uchildform.pas rename to demos/Lazarus/ToolBoxBrowser/uChildForm.pas index 816671c4..23267a34 100644 --- a/demos/ToolBoxLazBrowser/uchildform.pas +++ b/demos/Lazarus/ToolBoxBrowser/uChildForm.pas @@ -35,40 +35,56 @@ * *) -unit uchildform; +unit uChildForm; -{$mode objfpc}{$H+} +{$MODE Delphi} + +{$I cef.inc} interface uses - Windows, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, LMessages, - uMainForm, - uCEFWindowParent, uCEFChromium, uCEFInterfaces, - uCEFConstants, uCEFTypes, uCEFWinControl, uCEFChromiumEvents; + {$IFDEF DELPHI16_UP} + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, + System.UITypes, + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, ExtCtrls, + {$ENDIF} + uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFConstants, uCEFTypes, uMainForm, + uCEFWinControl; type - - { TChildForm } - TChildForm = class(TForm) CEFWindowParent1: TCEFWindowParent; Chromium1: TChromium; - - procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); - procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); - procedure FormCreate(Sender: TObject); - procedure FormDestroy(Sender: TObject); procedure FormShow(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + procedure FormDestroy(Sender: TObject); + procedure Chromium1AfterCreated(Sender: TObject; + const browser: ICefBrowser); + procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; + var aAction : TCefCloseBrowserAction); + procedure Chromium1PreKeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out isKeyboardShortcut, Result: Boolean); + procedure Chromium1KeyEvent(Sender: TObject; + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out Result: Boolean); + procedure Chromium1BeforeClose(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); - procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); - procedure Chromium1BeforeClose(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); - procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); - procedure Chromium1KeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out Result: Boolean); - procedure Chromium1PreKeyEvent(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean; out Result: Boolean); - - private + private // Variables to control when can we destroy the form safely FCanClose : boolean; // Set to True in TChromium.OnBeforeClose FClosing : boolean; // Set to True in the CloseQuery event. @@ -94,7 +110,8 @@ implementation {$R *.lfm} -{$I cef.inc} +uses + uCEFApplication; // Destruction steps // ================= @@ -102,37 +119,12 @@ implementation // 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread. // 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. -uses - uCEFApplication; - -{ TChildForm } - -procedure TChildForm.FormCreate(Sender: TObject); -begin - FCanClose := False; - FClosing := False; -end; - -procedure TChildForm.FormDestroy(Sender: TObject); -begin - // Tell the main form that a child has been destroyed. - // The main form will check if this was the last child to close itself - PostMessage(MainForm.Handle, CEFBROWSER_CHILDDESTROYED, 0, 0); -end; - -procedure TChildForm.FormClose(Sender: TObject; var CloseAction: TCloseAction); -begin - CloseAction := TCloseAction.caFree; -end; - -procedure TChildForm.Chromium1AfterCreated(Sender: TObject; - const browser: ICefBrowser); +procedure TChildForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); begin PostMessage(Handle, CEFBROWSER_CREATED, 0, 0); end; -procedure TChildForm.Chromium1BeforeClose(Sender: TObject; - const browser: ICefBrowser); +procedure TChildForm.Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser); begin FCanClose := True; PostMessage(Handle, WM_CLOSE, 0, 0); @@ -150,23 +142,22 @@ begin Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]); end; -procedure TChildForm.Chromium1Close(Sender: TObject; - const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); +procedure TChildForm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction); begin PostMessage(Handle, CEFBROWSER_DESTROY, 0, 0); aAction := cbaDelay; end; procedure TChildForm.Chromium1KeyEvent(Sender: TObject; - const browser: ICefBrowser; const event: PCefKeyEvent; - osEvent: TCefEventHandle; out Result: Boolean); + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out Result: Boolean); var TempMsg : TMsg; begin Result := False; if (event <> nil) and (osEvent <> nil) then - case osEvent^.Message of + case osEvent.Message of WM_KEYUP : begin TempMsg := osEvent^; @@ -181,20 +172,55 @@ begin end; end; +procedure TChildForm.HandleKeyUp(const aMsg : TMsg; var aHandled : boolean); +var + TempMessage : TMessage; + TempKeyMsg : TWMKey; +begin + TempMessage.Msg := aMsg.message; + TempMessage.wParam := aMsg.wParam; + TempMessage.lParam := aMsg.lParam; + TempKeyMsg := TWMKey(TempMessage); + + if (TempKeyMsg.CharCode = VK_ESCAPE) then + begin + aHandled := True; + PostMessage(Handle, WM_CLOSE, 0, 0); + end; +end; + +procedure TChildForm.HandleKeyDown(const aMsg : TMsg; var aHandled : boolean); +var + TempMessage : TMessage; + TempKeyMsg : TWMKey; +begin + TempMessage.Msg := aMsg.message; + TempMessage.wParam := aMsg.wParam; + TempMessage.lParam := aMsg.lParam; + TempKeyMsg := TWMKey(TempMessage); + + if (TempKeyMsg.CharCode = VK_ESCAPE) then aHandled := True; +end; + procedure TChildForm.Chromium1PreKeyEvent(Sender: TObject; - const browser: ICefBrowser; const event: PCefKeyEvent; - osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean; out Result: Boolean - ); + const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: PMsg; + out isKeyboardShortcut, Result: Boolean); begin Result := False; if (event <> nil) and - (event^.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and - (event^.windows_key_code = VK_ESCAPE) then + (event.kind in [KEYEVENT_KEYDOWN, KEYEVENT_KEYUP]) and + (event.windows_key_code = VK_ESCAPE) then isKeyboardShortcut := True; end; -procedure TChildForm.FormCloseQuery(Sender: TObject; var CanClose: boolean); +procedure TChildForm.FormClose(Sender: TObject; var Action: TCloseAction); +begin + Action := caFree; +end; + +procedure TChildForm.FormCloseQuery(Sender: TObject; + var CanClose: Boolean); begin CanClose := FCanClose; @@ -205,30 +231,32 @@ begin end; end; +procedure TChildForm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + +procedure TChildForm.FormDestroy(Sender: TObject); +begin + // Tell the main form that a child has been destroyed. + // The main form will check if this was the last child to close itself + PostMessage(MainForm.Handle, CEFBROWSER_CHILDDESTROYED, 0, 0); +end; + procedure TChildForm.FormShow(Sender: TObject); begin Chromium1.CreateBrowser(CEFWindowParent1, ''); end; -procedure TChildForm.BrowserCreatedMsg(var aMessage: TMessage); -begin - CEFWindowParent1.UpdateSize; - Chromium1.LoadURL(UTF8Decode(FHomepage)); -end; - -procedure TChildForm.BrowserDestroyMsg(var aMessage: TMessage); -begin - CEFWindowParent1.Free; -end; - -procedure TChildForm.WMMove(var aMessage: TWMMove); +procedure TChildForm.WMMove(var aMessage : TWMMove); begin inherited; if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted; end; -procedure TChildForm.WMMoving(var aMessage: TMessage); +procedure TChildForm.WMMoving(var aMessage : TMessage); begin inherited; @@ -249,35 +277,15 @@ begin if (aMessage.wParam = 0) and (GlobalCEFApp <> nil) then GlobalCEFApp.OsmodalLoop := False; end; -procedure TChildForm.HandleKeyUp(const aMsg: TMsg; var aHandled: boolean); -var - TempMessage : TMessage; - TempKeyMsg : TWMKey; +procedure TChildForm.BrowserCreatedMsg(var aMessage : TMessage); begin - TempMessage.Msg := aMsg.message; - TempMessage.wParam := aMsg.wParam; - TempMessage.lParam := aMsg.lParam; - TempKeyMsg := TWMKey(TempMessage); - - if (TempKeyMsg.CharCode = VK_ESCAPE) then - begin - aHandled := True; - PostMessage(Handle, WM_CLOSE, 0, 0); - end; + CEFWindowParent1.UpdateSize; + Chromium1.LoadURL(FHomepage); end; -procedure TChildForm.HandleKeyDown(const aMsg: TMsg; var aHandled: boolean); -var - TempMessage : TMessage; - TempKeyMsg : TWMKey; +procedure TChildForm.BrowserDestroyMsg(var aMessage : TMessage); begin - TempMessage.Msg := aMsg.message; - TempMessage.wParam := aMsg.wParam; - TempMessage.lParam := aMsg.lParam; - TempKeyMsg := TWMKey(TempMessage); - - if (TempKeyMsg.CharCode = VK_ESCAPE) then aHandled := True; + CEFWindowParent1.Free; end; end. - diff --git a/demos/ToolBoxLazBrowser/umainform.lfm b/demos/Lazarus/ToolBoxBrowser/uMainForm.lfm similarity index 54% rename from demos/ToolBoxLazBrowser/umainform.lfm rename to demos/Lazarus/ToolBoxBrowser/uMainForm.lfm index b85799da..c8ffb9b5 100644 --- a/demos/ToolBoxLazBrowser/umainform.lfm +++ b/demos/Lazarus/ToolBoxBrowser/uMainForm.lfm @@ -1,41 +1,45 @@ object MainForm: TMainForm - Left = 242 - Height = 41 - Top = 250 - Width = 351 - BorderIcons = [biSystemMenu, biMinimize] + Left = 162 + Height = 37 + Top = 154 + Width = 357 + BorderIcons = [biSystemMenu] BorderStyle = bsSingle Caption = 'Initializing browser. Please wait...' - ClientHeight = 41 - ClientWidth = 351 + ClientHeight = 37 + ClientWidth = 357 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' OnCreate = FormCreate OnShow = FormShow Position = poScreenCenter - LCLVersion = '2.0.0.4' - object Panel1: TPanel + LCLVersion = '2.0.2.0' + object ButtonPnl: TPanel Left = 0 - Height = 41 + Height = 37 Top = 0 - Width = 351 + Width = 357 Align = alClient - Caption = 'Panel1' - ClientHeight = 41 - ClientWidth = 351 + BevelOuter = bvNone + ClientHeight = 37 + ClientWidth = 357 Enabled = False TabOrder = 0 object Edit1: TEdit Left = 8 - Height = 23 + Height = 21 Top = 8 - Width = 256 + Width = 286 TabOrder = 0 Text = 'https://www.google.com' end object Button1: TButton - Left = 268 + Left = 300 Height = 25 Top = 6 - Width = 75 + Width = 51 Caption = 'Open' OnClick = Button1Click TabOrder = 1 diff --git a/demos/ToolBoxLazBrowser/umainform.pas b/demos/Lazarus/ToolBoxBrowser/uMainForm.pas similarity index 85% rename from demos/ToolBoxLazBrowser/umainform.pas rename to demos/Lazarus/ToolBoxBrowser/uMainForm.pas index 046cb057..524bac58 100644 --- a/demos/ToolBoxLazBrowser/umainform.pas +++ b/demos/Lazarus/ToolBoxBrowser/uMainForm.pas @@ -37,15 +37,20 @@ unit uMainForm; -{$mode objfpc}{$H+} +{$MODE Delphi} {$I cef.inc} interface uses - Windows, Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, - ExtCtrls, LMessages; + {$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; + {$ELSE} + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, StdCtrls, ExtCtrls; + {$ENDIF} const CEFBROWSER_CREATED = WM_APP + $100; @@ -54,17 +59,14 @@ const CEFBROWSER_INITIALIZED = WM_APP + $103; type - - { TMainForm } - TMainForm = class(TForm) - Button1: TButton; + ButtonPnl: TPanel; Edit1: TEdit; - Panel1: TPanel; - procedure Button1Click(Sender: TObject); + Button1: TButton; procedure FormCreate(Sender: TObject); + procedure Button1Click(Sender: TObject); procedure FormShow(Sender: TObject); - private + private // Variables to control when can we destroy the form safely FCanClose : boolean; // Set to True when all the child forms are closed FClosing : boolean; // Set to True in the CloseQuery event. @@ -78,9 +80,8 @@ type procedure ChildDestroyedMsg(var aMessage : TMessage); message CEFBROWSER_CHILDDESTROYED; procedure CEFInitializedMsg(var aMessage : TMessage); message CEFBROWSER_INITIALIZED; - public - function CloseQuery: Boolean; override; - procedure GlobalCEFApp_OnContextInitialized; + public + function CloseQuery: Boolean; override; property ChildClosing : boolean read GetChildClosing; property ChildFormCount : integer read GetChildFormCount; @@ -103,39 +104,16 @@ uses // 1. Destroy all child forms // 2. Wait until all the child forms are closed before closing the main form and terminating the application. -procedure CreateGlobalCEFApp; -begin - GlobalCEFApp := TCefApplication.Create; - GlobalCEFApp.OnContextInitialized := @MainForm.GlobalCEFApp_OnContextInitialized; -end; - -{ TMainForm } - -procedure TMainForm.GlobalCEFApp_OnContextInitialized; +procedure GlobalCEFApp_OnContextInitialized; begin if (MainForm <> nil) and MainForm.HandleAllocated then PostMessage(MainForm.Handle, CEFBROWSER_INITIALIZED, 0, 0); end; -procedure TMainForm.FormCreate(Sender: TObject); +procedure CreateGlobalCEFApp; begin - FCanClose := False; - FClosing := False; -end; - -procedure TMainForm.Button1Click(Sender: TObject); -begin - CreateToolboxChild('Browser', Edit1.Text); -end; - -procedure TMainForm.FormShow(Sender: TObject); -begin - if (GlobalCEFApp <> nil) and GlobalCEFApp.GlobalContextInitialized then - begin - Caption := 'ToolBox Lazarus Browser'; - Panel1.Enabled := True; - cursor := crDefault; - end; + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized; end; procedure TMainForm.CreateToolboxChild(const ChildCaption, URL: string); @@ -148,6 +126,12 @@ begin TempChild.Show; end; +procedure TMainForm.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; +end; + procedure TMainForm.CloseAllChildForms; var i : integer; @@ -168,7 +152,7 @@ begin end; end; -function TMainForm.GetChildClosing: boolean; +function TMainForm.GetChildClosing : boolean; var i : integer; TempComponent : TComponent; @@ -196,7 +180,7 @@ begin end; end; -function TMainForm.GetChildFormCount: integer; +function TMainForm.GetChildFormCount : integer; var i : integer; TempComponent : TComponent; @@ -216,7 +200,12 @@ begin end; end; -procedure TMainForm.ChildDestroyedMsg(var aMessage: TMessage); +procedure TMainForm.Button1Click(Sender: TObject); +begin + CreateToolboxChild('Browser', Edit1.Text); +end; + +procedure TMainForm.ChildDestroyedMsg(var aMessage : TMessage); begin // If there are no more child forms we can destroy the main form if FClosing and (ChildFormCount = 0) then @@ -226,13 +215,6 @@ begin end; end; -procedure TMainForm.CEFInitializedMsg(var aMessage: TMessage); -begin - Caption := 'ToolBox Lazarus Browser'; - Panel1.Enabled := True; - cursor := crDefault; -end; - function TMainForm.CloseQuery: Boolean; begin if FClosing or ChildClosing then @@ -254,5 +236,21 @@ begin end; end; -end. +procedure TMainForm.CEFInitializedMsg(var aMessage : TMessage); +begin + Caption := 'ToolBox Browser'; + ButtonPnl.Enabled := True; + cursor := crDefault; +end; +procedure TMainForm.FormShow(Sender: TObject); +begin + if (GlobalCEFApp <> nil) and GlobalCEFApp.GlobalContextInitialized then + begin + Caption := 'ToolBox Browser'; + ButtonPnl.Enabled := True; + cursor := crDefault; + end; +end; + +end. diff --git a/demos/Lazarus/URLRequest/00-Delete.bat b/demos/Lazarus/URLRequest/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/URLRequest/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/URLRequest/URLRequest.lpi b/demos/Lazarus/URLRequest/URLRequest.lpi new file mode 100644 index 00000000..a51f3a44 --- /dev/null +++ b/demos/Lazarus/URLRequest/URLRequest.lpi @@ -0,0 +1,91 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasUsesSectionForAllUnits Value="False"/> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="URLRequest"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <RequiredPackages Count="2"> + <Item1> + <PackageName Value="CEF4Delphi_Lazarus"/> + </Item1> + <Item2> + <PackageName Value="LCL"/> + </Item2> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="URLRequest.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uURLRequest.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="URLRequestFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\URLRequest"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Parsing> + <SyntaxOptions> + <SyntaxMode Value="Delphi"/> + </SyntaxOptions> + </Parsing> + <Linking> + <Options> + <Win32> + <GraphicApplication Value="True"/> + </Win32> + </Options> + </Linking> + <Other> + <CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/> + </Other> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/demos/Lazarus/URLRequest/URLRequest.lpr b/demos/Lazarus/URLRequest/URLRequest.lpr new file mode 100644 index 00000000..e10af2d4 --- /dev/null +++ b/demos/Lazarus/URLRequest/URLRequest.lpr @@ -0,0 +1,75 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2018 Salvador Díaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +program URLRequest; + +{$MODE Delphi} + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + LCLIntf, LCLType, LMessages, Interfaces, + {$ENDIF } + uCEFApplication, + uURLRequest in 'uURLRequest.pas' {URLRequestFrm}; + +{.$R *.res} + +// CEF3 needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM. +// If you don't add this flag the rederer process will crash when you try to load large images. +{$SetPEFlags $20} + +begin + GlobalCEFApp := TCefApplication.Create; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TURLRequestFrm, URLRequestFrm); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/URLRequest/URLRequest.lps b/demos/Lazarus/URLRequest/URLRequest.lps new file mode 100644 index 00000000..1e853c49 --- /dev/null +++ b/demos/Lazarus/URLRequest/URLRequest.lps @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="5"> + <Unit0> + <Filename Value="URLRequest.lpr"/> + <IsPartOfProject Value="True"/> + <TopLine Value="49"/> + <CursorPos X="37" Y="55"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uURLRequest.pas"/> + <IsPartOfProject Value="True"/> + <ComponentName Value="URLRequestFrm"/> + <HasResources Value="True"/> + <ResourceBaseClass Value="Form"/> + <IsVisibleTab Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="101"/> + <CursorPos X="37" Y="58"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <LoadedDesigner Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + <Unit2> + <Filename Value="C:\lazarus\lcl\include\statuspanels.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="15"/> + <CursorPos Y="28"/> + <UsageCount Value="10"/> + </Unit2> + <Unit3> + <Filename Value="C:\lazarus\lcl\comctrls.pp"/> + <UnitName Value="ComCtrls"/> + <EditorIndex Value="-1"/> + <TopLine Value="60"/> + <CursorPos X="36" Y="74"/> + <UsageCount Value="10"/> + </Unit3> + <Unit4> + <Filename Value="C:\lazarus\lcl\include\statuspanel.inc"/> + <EditorIndex Value="-1"/> + <TopLine Value="122"/> + <CursorPos Y="132"/> + <UsageCount Value="10"/> + </Unit4> + </Units> + <JumpHistory Count="21" HistoryIndex="20"> + <Position1> + <Filename Value="uURLRequest.pas"/> + </Position1> + <Position2> + <Filename Value="uURLRequest.pas"/> + <Caret Line="75" Column="44" TopLine="65"/> + </Position2> + <Position3> + <Filename Value="uURLRequest.pas"/> + <Caret Line="84" Column="17" TopLine="69"/> + </Position3> + <Position4> + <Filename Value="uURLRequest.pas"/> + <Caret Line="70" Column="43" TopLine="53"/> + </Position4> + <Position5> + <Filename Value="uURLRequest.pas"/> + <Caret Line="233" TopLine="224"/> + </Position5> + <Position6> + <Filename Value="uURLRequest.pas"/> + <Caret Line="236" TopLine="224"/> + </Position6> + <Position7> + <Filename Value="uURLRequest.pas"/> + <Caret Line="233" TopLine="224"/> + </Position7> + <Position8> + <Filename Value="uURLRequest.pas"/> + <Caret Line="244" TopLine="236"/> + </Position8> + <Position9> + <Filename Value="uURLRequest.pas"/> + <Caret Line="248" TopLine="236"/> + </Position9> + <Position10> + <Filename Value="uURLRequest.pas"/> + <Caret Line="254" TopLine="236"/> + </Position10> + <Position11> + <Filename Value="uURLRequest.pas"/> + <Caret Line="79" Column="26" TopLine="63"/> + </Position11> + <Position12> + <Filename Value="uURLRequest.pas"/> + <Caret Line="263" TopLine="246"/> + </Position12> + <Position13> + <Filename Value="uURLRequest.pas"/> + <Caret Line="263" Column="27" TopLine="246"/> + </Position13> + <Position14> + <Filename Value="uURLRequest.pas"/> + <Caret Line="265" Column="35" TopLine="255"/> + </Position14> + <Position15> + <Filename Value="uURLRequest.pas"/> + <Caret Line="146" Column="58" TopLine="134"/> + </Position15> + <Position16> + <Filename Value="uURLRequest.pas"/> + <Caret Line="151" Column="16" TopLine="138"/> + </Position16> + <Position17> + <Filename Value="uURLRequest.pas"/> + <Caret Line="239" Column="42" TopLine="220"/> + </Position17> + <Position18> + <Filename Value="uURLRequest.pas"/> + <Caret Line="238" Column="42" TopLine="219"/> + </Position18> + <Position19> + <Filename Value="uURLRequest.pas"/> + <Caret Line="239" Column="42" TopLine="220"/> + </Position19> + <Position20> + <Filename Value="uURLRequest.pas"/> + <Caret Line="238" Column="42" TopLine="219"/> + </Position20> + <Position21> + <Filename Value="uURLRequest.pas"/> + <Caret Line="150" Column="54" TopLine="47"/> + </Position21> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/URLRequest/cef.inc b/demos/Lazarus/URLRequest/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Lazarus/URLRequest/cef.inc @@ -0,0 +1,409 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2017 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + + // The complete list of compiler versions is here : + // http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions + +{$DEFINE DELPHI_VERSION_UNKNOW} + +// Delphi 5 +{$IFDEF VER130} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} +{$ENDIF} + +// Delphi 6 +{$IFDEF VER140} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} +{$ENDIF} + +// Delphi 7 +{$IFDEF VER150} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} +{$ENDIF} + +// Delphi 8 +{$IFDEF VER160} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} +{$ENDIF} + +// Delphi 2005 +{$IFDEF VER170} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} +{$ENDIF} + +{$IFDEF VER180} + {$UNDEF DELPHI_VERSION_UNKNOW} + // Delphi 2007 + {$IFDEF VER185} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + // Delphi 2006 + {$ELSE} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$ENDIF} +{$ENDIF} + +// Delphi 2009 +{$IFDEF VER200} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} +{$ENDIF} + +//Delphi 2010 +{$IFDEF VER210} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} +{$ENDIF} + +// Delphi XE +{$IFDEF VER220} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} +{$ENDIF} + +// Delphi XE2 (First FireMonkey and 64bit compiler) +{$IFDEF VER230} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} +{$ENDIF} + +// Delphi XE3 +{$IFDEF VER240} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} +{$ENDIF} + +// Delphi XE4 +{$IFDEF VER250} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} +{$ENDIF} + +// Delphi XE5 +{$IFDEF VER260} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} +{$ENDIF} + +// Delphi XE6 +{$IFDEF VER270} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} +{$ENDIF} + +// Delphi XE7 +{$IFDEF VER280} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} +{$ENDIF} + +// Delphi XE8 +{$IFDEF VER290} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} +{$ENDIF VER290} + +// Rad Studio 10 - Delphi Seattle +{$IFDEF VER300} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} +{$ENDIF} + +// Rad Studio 10.1 - Delphi Berlin +{$IFDEF VER310} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} +{$ENDIF} + +// Rad Studio 10.2 - Delphi Tokyo +{$IFDEF VER320} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} +{$ENDIF} + +// Rad Studio 10.3 - Delphi Rio +{$IFDEF VER330} + {$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} + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} +{$ELSE} + {$IFDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$DEFINE DELPHI11_UP} + {$DEFINE DELPHI12_UP} + {$DEFINE DELPHI14_UP} + {$DEFINE DELPHI15_UP} + {$DEFINE DELPHI16_UP} + {$DEFINE DELPHI17_UP} + {$DEFINE DELPHI18_UP} + {$DEFINE DELPHI19_UP} + {$DEFINE DELPHI20_UP} + {$DEFINE DELPHI21_UP} + {$DEFINE DELPHI22_UP} + {$DEFINE DELPHI23_UP} + {$DEFINE DELPHI24_UP} + {$DEFINE DELPHI25_UP} + {$DEFINE DELPHI26_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + diff --git a/demos/Lazarus/URLRequest/uURLRequest.lfm b/demos/Lazarus/URLRequest/uURLRequest.lfm new file mode 100644 index 00000000..36afbac3 --- /dev/null +++ b/demos/Lazarus/URLRequest/uURLRequest.lfm @@ -0,0 +1,66 @@ +object URLRequestFrm: TURLRequestFrm + Left = 301 + Height = 116 + Top = 177 + Width = 494 + BorderIcons = [biSystemMenu] + BorderStyle = bsSingle + Caption = 'URL request' + ClientHeight = 116 + ClientWidth = 494 + Color = clBtnFace + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + Position = poScreenCenter + LCLVersion = '2.0.2.0' + object Label1: TLabel + Left = 16 + Height = 13 + Top = 19 + Width = 19 + Caption = 'URL' + ParentColor = False + end + object Edit1: TEdit + Left = 48 + Height = 21 + Top = 16 + Width = 433 + TabOrder = 0 + Text = 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf' + end + object DownloadBtn: TButton + Left = 16 + Height = 25 + Top = 51 + Width = 465 + Caption = 'Download' + OnClick = DownloadBtnClick + TabOrder = 1 + end + object StatusPnl: TPanel + Left = 0 + Height = 23 + Top = 93 + Width = 494 + Align = alBottom + BevelOuter = bvLowered + TabOrder = 2 + end + object SaveDialog1: TSaveDialog + left = 384 + top = 64 + end + object CEFUrlRequestClientComponent1: TCEFUrlRequestClientComponent + OnRequestComplete = CEFUrlRequestClientComponent1RequestComplete + OnDownloadProgress = CEFUrlRequestClientComponent1DownloadProgress + OnDownloadData = CEFUrlRequestClientComponent1DownloadData + OnCreateURLRequest = CEFUrlRequestClientComponent1CreateURLRequest + left = 80 + top = 64 + end +end diff --git a/demos/Lazarus/URLRequest/uURLRequest.pas b/demos/Lazarus/URLRequest/uURLRequest.pas new file mode 100644 index 00000000..c77d2575 --- /dev/null +++ b/demos/Lazarus/URLRequest/uURLRequest.pas @@ -0,0 +1,287 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based +// browser in Delphi applications. +// +// The original license of DCEF3 still applies to CEF4Delphi. +// +// For more information about CEF4Delphi visit : +// https://www.briskbard.com/index.php?lang=en&pageid=cef +// +// Copyright © 2019 Salvador Díaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest <hgourvest@gmail.com> + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uURLRequest; + +{$MODE Delphi} + +interface + +uses + LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, + Controls, Forms, Dialogs, ComCtrls, StdCtrls, ExtCtrls, + uCEFInterfaces, uCEFUrlRequestClientComponent, uCEFRequest, uCEFUrlRequest; + +const + URLREQUEST_SUCCESS = WM_APP + $101; + URLREQUEST_ERROR = WM_APP + $102; + +type + + { TURLRequestFrm } + + TURLRequestFrm = class(TForm) + Edit1: TEdit; + Label1: TLabel; + DownloadBtn: TButton; + StatusPnl: TPanel; + SaveDialog1: TSaveDialog; + CEFUrlRequestClientComponent1: TCEFUrlRequestClientComponent; + + procedure DownloadBtnClick(Sender: TObject); + + procedure FormDestroy(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); + + procedure CEFUrlRequestClientComponent1DownloadData(Sender: TObject; const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); + procedure CEFUrlRequestClientComponent1DownloadProgress(Sender: TObject; const request: ICefUrlRequest; current, total: Int64); + procedure CEFUrlRequestClientComponent1RequestComplete(Sender: TObject; const request: ICefUrlRequest); + procedure CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); + private + FStream : TMemoryStream; + FCanClose : boolean; + FClosing : boolean; + FDownloading : boolean; + FPendingURL : string; + + procedure URLRequestSuccessMsg(var aMessage : TMessage); message URLREQUEST_SUCCESS; + procedure URLRequestErrorMsg(var aMessage : TMessage); message URLREQUEST_ERROR; + + procedure SaveStreamToFile; + end; + +var + URLRequestFrm: TURLRequestFrm; + +implementation + +{$R *.lfm} + +// This is a simple URL request example to download small files using TCEFUrlRequestClientComponent. +// WARNING : If you try to download big files you may get an "Out of memory" exception. Replace TMemoryStream in that case. + +// All TCEFUrlRequestClientComponent events are executed in a different thread. Don't create or destroy VCL componets +// inside them. + +// To keep this demo as simple as possible, it's only allowed to download one file at a time. You can add as many requests +// as you want but then you would have to use a different way to store the data with synchronization objects. + +// It's much safer to cancel all requests before closing the app. +// This demo follows this destruction sequence in case there is a file download running : +// -------------------------------------------------------------------------------------- +// 1- Set CanClose to FALSE in the TForm.OnCloseQuery event and set FClosing to TRUE. +// 2- The next time TCEFUrlRequestClientComponent.OnDownloadProgress is executed we call request.Cancel, which triggers the +// TCEFUrlRequestClientComponent.OnRequestComplete event. +// 3- in the TCEFUrlRequestClientComponent.OnRequestComplete event we set FCanClose to TRUE and send WM_CLOSE to the form. + +uses + uCEFMiscFunctions, uCEFTypes, uCEFPostData, uCEFPostDataElement, uCEFConstants; + +procedure TURLRequestFrm.DownloadBtnClick(Sender: TObject); +var + TempURL, TempPath, TempName : string; + TempParts : TUrlParts; + i : integer; +begin + TempURL := trim(Edit1.Text); + + if (length(TempURL) > 0) then + begin + CefParseUrl(TempURL, TempParts); + TempPath := trim(TempParts.path); + TempName := ''; + + if (length(TempPath) > 0) then + begin + i := LastDelimiter('/', TempPath); + + if (i > 0) then + TempName := trim(copy(TempPath, succ(i), length(TempPath))) + else + TempName := TempPath; + end; + + if (length(TempName) > 0) then + SaveDialog1.FileName := TempName // This name should be decoded and sanitized before using it in Windows + else + SaveDialog1.FileName := 'UnknownFileName'; + + if SaveDialog1.Execute and + (length(SaveDialog1.FileName) > 0) then + begin + FPendingURL := TempURL; + DownloadBtn.Enabled := False; + StatusPnl.Caption := 'Downloading...'; + FStream.Clear; + + // TCEFUrlRequestClientComponent.AddURLRequest will trigger the + // TCEFUrlRequestClientComponent.OnCreateURLRequest event in the right + // thread where you can create your custom requests. + CEFUrlRequestClientComponent1.AddURLRequest; + end; + end; +end; + +procedure TURLRequestFrm.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + CanClose := FCanClose or not(FDownloading); + FClosing := True; +end; + +procedure TURLRequestFrm.FormCreate(Sender: TObject); +begin + FStream := TMemoryStream.Create; + FCanClose := False; + FClosing := False; + FDownloading := False; +end; + +procedure TURLRequestFrm.FormDestroy(Sender: TObject); +begin + if (FStream <> nil) then FreeAndNil(FStream); +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); +var + TempRequest : ICefRequest; + // TempPostData : ICefPostData; + // TempElement : ICefPostDataElement; +begin + try + if (length(FPendingURL) > 0) then + begin + FDownloading := True; + + // GET request example + // ------------------- + TempRequest := TCefRequestRef.New; + TempRequest.URL := FPendingURL; + TempRequest.Method := 'GET'; + TempRequest.Flags := UR_FLAG_ALLOW_STORED_CREDENTIALS; + + // POST request example + // -------------------- + // TempElement := TCefPostDataElementOwn.Create(True); + // TempElement.SetToFile('c:\myfile.txt'); + // + // TempPostData := TCefPostDataRef.New; + // TempPostData.AddElement := TempElement; + // + // TempRequest := TCefRequestRef.New; + // TempRequest.URL := FPendingURL; + // TempRequest.Method := 'POST'; + // TempRequest.PostData := TempPostData; + + // Set the "client" parameter to the TCEFUrlRequestClientComponent.Client property + // to use the TCEFUrlRequestClientComponent events. + // The "requestContext" parameter can be nil to use the global request context. + TCefUrlRequestRef.New(TempRequest, CEFUrlRequestClientComponent1.Client, nil); + end; + finally + TempRequest := nil; + end; +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData(Sender: TObject; const request: ICefUrlRequest; data: Pointer; dataLength: NativeUInt); +begin + try + if FClosing then + request.Cancel + else + if (data <> nil) and (dataLength > 0) then + FStream.WriteBuffer(data^, dataLength); + except + on e : exception do + if CustomExceptionHandler('TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData', e) then raise; + end; +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1DownloadProgress(Sender: TObject; const request: ICefUrlRequest; current, total: Int64); +begin + if FClosing then + request.Cancel + else + if (total > 0) then + StatusPnl.Caption := 'Downloading : ' + inttostr(round((current / total) * 100)) + ' %' + else + StatusPnl.Caption := 'Downloading : ' + inttostr(current) + ' bytes'; +end; + +procedure TURLRequestFrm.CEFUrlRequestClientComponent1RequestComplete(Sender: TObject; const request: ICefUrlRequest); +begin + FDownloading := False; + + // Use request.response here to get a ICefResponse interface with all the response headers, status, error code, etc. + + if FClosing then + begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); + end + else + if (request <> nil) and (request.RequestStatus = UR_SUCCESS) then + PostMessage(Handle, URLREQUEST_SUCCESS, 0, 0) + else + PostMessage(Handle, URLREQUEST_ERROR, 0, request.RequestError); +end; + +procedure TURLRequestFrm.URLRequestSuccessMsg(var aMessage : TMessage); +begin + DownloadBtn.Enabled := True; + StatusPnl.Caption := 'Download complete!'; + SaveStreamToFile; +end; + +procedure TURLRequestFrm.URLRequestErrorMsg(var aMessage : TMessage); +begin + DownloadBtn.Enabled := True; + StatusPnl.Caption := 'Download error : ' + inttostr(aMessage.lParam); +end; + +procedure TURLRequestFrm.SaveStreamToFile; +begin + try + FStream.SaveToFile(SaveDialog1.FileName); + FStream.Clear; + except + on e : exception do + if CustomExceptionHandler('TURLRequestFrm.SaveStreamToFile', e) then raise; + end; +end; + +end. diff --git a/demos/SimpleBrowser/SimpleBrowser_D7.cfg b/demos/SimpleBrowser/SimpleBrowser_D7.cfg deleted file mode 100644 index fa14b7c6..00000000 --- a/demos/SimpleBrowser/SimpleBrowser_D7.cfg +++ /dev/null @@ -1,39 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; --H+ --W+ --M --$M16384,1048576 --K$00400000 --E"..\..\bin" --LE"c:\program files\borland\delphi7\Projects\Bpl" --LN"c:\program files\borland\delphi7\Projects\Bpl" --w-UNSAFE_TYPE --w-UNSAFE_CODE --w-UNSAFE_CAST diff --git a/demos/SimpleBrowser2/SimpleBrowser2_D7.cfg b/demos/SimpleBrowser2/SimpleBrowser2_D7.cfg deleted file mode 100644 index fa14b7c6..00000000 --- a/demos/SimpleBrowser2/SimpleBrowser2_D7.cfg +++ /dev/null @@ -1,39 +0,0 @@ --$A8 --$B- --$C+ --$D+ --$E- --$F- --$G+ --$H+ --$I+ --$J- --$K- --$L+ --$M- --$N+ --$O+ --$P+ --$Q- --$R- --$S- --$T- --$U- --$V+ --$W- --$X+ --$YD --$Z1 --cg --AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; --H+ --W+ --M --$M16384,1048576 --K$00400000 --E"..\..\bin" --LE"c:\program files\borland\delphi7\Projects\Bpl" --LN"c:\program files\borland\delphi7\Projects\Bpl" --w-UNSAFE_TYPE --w-UNSAFE_CODE --w-UNSAFE_CAST diff --git a/demos/SubProcess/crash_reporter.cfg b/demos/SubProcess/crash_reporter.cfg deleted file mode 100644 index 13d85354..00000000 --- a/demos/SubProcess/crash_reporter.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[Config] -ExternalHandler=".\SubProcess.exe" - -[CrashKeys] -my_key1=medium -my_key2=medium \ No newline at end of file diff --git a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.ico b/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.ico deleted file mode 100644 index 0341321b..00000000 Binary files a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.ico and /dev/null differ diff --git a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lps b/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lps deleted file mode 100644 index 288ff002..00000000 --- a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.lps +++ /dev/null @@ -1,188 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<CONFIG> - <ProjectSession> - <PathDelim Value="\"/> - <Version Value="11"/> - <BuildModes Active="Default"/> - <Units Count="6"> - <Unit0> - <Filename Value="ToolBoxLazBrowser.lpr"/> - <IsPartOfProject Value="True"/> - <EditorIndex Value="-1"/> - <TopLine Value="35"/> - <CursorPos Y="67"/> - <UsageCount Value="21"/> - </Unit0> - <Unit1> - <Filename Value="umainform.pas"/> - <IsPartOfProject Value="True"/> - <ComponentName Value="MainForm"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="Form"/> - <UnitName Value="uMainForm"/> - <TopLine Value="81"/> - <CursorPos X="55" Y="52"/> - <UsageCount Value="21"/> - <Loaded Value="True"/> - <LoadedDesigner Value="True"/> - </Unit1> - <Unit2> - <Filename Value="uchildform.pas"/> - <IsPartOfProject Value="True"/> - <ComponentName Value="ChildForm"/> - <HasResources Value="True"/> - <ResourceBaseClass Value="Form"/> - <IsVisibleTab Value="True"/> - <EditorIndex Value="1"/> - <TopLine Value="152"/> - <CursorPos X="31" Y="163"/> - <UsageCount Value="21"/> - <Loaded Value="True"/> - <LoadedDesigner Value="True"/> - </Unit2> - <Unit3> - <Filename Value="..\..\source\uCEFTypes.pas"/> - <EditorIndex Value="-1"/> - <TopLine Value="225"/> - <CursorPos X="3" Y="239"/> - <UsageCount Value="10"/> - </Unit3> - <Unit4> - <Filename Value="..\..\source\uCEFApplication.pas"/> - <EditorIndex Value="-1"/> - <TopLine Value="396"/> - <CursorPos X="58" Y="408"/> - <UsageCount Value="10"/> - </Unit4> - <Unit5> - <Filename Value="..\..\source\uCEFInterfaces.pas"/> - <EditorIndex Value="-1"/> - <TopLine Value="151"/> - <CursorPos Y="164"/> - <UsageCount Value="10"/> - </Unit5> - </Units> - <JumpHistory Count="29" HistoryIndex="28"> - <Position1> - <Filename Value="uchildform.pas"/> - <Caret Line="61" Column="3" TopLine="54"/> - </Position1> - <Position2> - <Filename Value="uchildform.pas"/> - <Caret Line="72" Column="3" TopLine="55"/> - </Position2> - <Position3> - <Filename Value="uchildform.pas"/> - <Caret Line="28" Column="5" TopLine="21"/> - </Position3> - <Position4> - <Filename Value="uchildform.pas"/> - <Caret Line="89" Column="3" TopLine="85"/> - </Position4> - <Position5> - <Filename Value="uchildform.pas"/> - <Caret Line="97" Column="3" TopLine="87"/> - </Position5> - <Position6> - <Filename Value="uchildform.pas"/> - <Caret Line="107" Column="3" TopLine="90"/> - </Position6> - <Position7> - <Filename Value="uchildform.pas"/> - <Caret Line="122" Column="3" TopLine="94"/> - </Position7> - <Position8> - <Filename Value="uchildform.pas"/> - <Caret Line="107" Column="3" TopLine="100"/> - </Position8> - <Position9> - <Filename Value="uchildform.pas"/> - <Caret Line="101" Column="49" TopLine="84"/> - </Position9> - <Position10> - <Filename Value="uchildform.pas"/> - <Caret Line="29" Column="15" TopLine="6"/> - </Position10> - <Position11> - <Filename Value="uchildform.pas"/> - <Caret Line="124" Column="45" TopLine="121"/> - </Position11> - <Position12> - <Filename Value="uchildform.pas"/> - <Caret Line="33" Column="15" TopLine="15"/> - </Position12> - <Position13> - <Filename Value="uchildform.pas"/> - <Caret Line="158" Column="49" TopLine="152"/> - </Position13> - <Position14> - <Filename Value="uchildform.pas"/> - <Caret Line="22" Column="15" TopLine="21"/> - </Position14> - <Position15> - <Filename Value="uchildform.pas"/> - <Caret Line="46" Column="13" TopLine="33"/> - </Position15> - <Position16> - <Filename Value="uchildform.pas"/> - <Caret Line="47" Column="35" TopLine="33"/> - </Position16> - <Position17> - <Filename Value="uchildform.pas"/> - <Caret Line="133" Column="26" TopLine="119"/> - </Position17> - <Position18> - <Filename Value="uchildform.pas"/> - <Caret Line="167" Column="17" TopLine="146"/> - </Position18> - <Position19> - <Filename Value="uchildform.pas"/> - <Caret Line="160" Column="19" TopLine="153"/> - </Position19> - <Position20> - <Filename Value="uchildform.pas"/> - <Caret Line="167" Column="18" TopLine="153"/> - </Position20> - <Position21> - <Filename Value="uchildform.pas"/> - <Caret Line="191" Column="13" TopLine="176"/> - </Position21> - <Position22> - <Filename Value="umainform.pas"/> - <Caret Line="109" Column="41" TopLine="98"/> - </Position22> - <Position23> - <Filename Value="umainform.pas"/> - <Caret Line="107" Column="48" TopLine="93"/> - </Position23> - <Position24> - <Filename Value="umainform.pas"/> - <Caret Line="107" Column="41" TopLine="93"/> - </Position24> - <Position25> - <Filename Value="umainform.pas"/> - <Caret Line="135" Column="20" TopLine="111"/> - </Position25> - <Position26> - <Filename Value="umainform.pas"/> - <Caret Line="126" Column="44" TopLine="110"/> - </Position26> - <Position27> - <Filename Value="umainform.pas"/> - <Caret Line="70" Column="15" TopLine="56"/> - </Position27> - <Position28> - <Filename Value="uchildform.pas"/> - <Caret Line="214" Column="46" TopLine="187"/> - </Position28> - <Position29> - <Filename Value="uchildform.pas"/> - <Caret Line="67" Column="79" TopLine="59"/> - </Position29> - </JumpHistory> - <RunParams> - <FormatVersion Value="2"/> - <Modes Count="0" ActiveMode=""/> - </RunParams> - </ProjectSession> -</CONFIG> diff --git a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.res b/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.res deleted file mode 100644 index 1adb0406..00000000 Binary files a/demos/ToolBoxLazBrowser/ToolBoxLazBrowser.res and /dev/null differ diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index c3cc4fbc..bc1920d6 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,7 +21,7 @@ </CompilerOptions> <Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/> <License Value="MPL 1.1"/> - <Version Major="74" Minor="1" Release="16"/> + <Version Major="74" Minor="1" Release="19"/> <Files Count="139"> <Item1> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/> diff --git a/source/uCEFApplication.pas b/source/uCEFApplication.pas index d81c8f17..23413061 100644 --- a/source/uCEFApplication.pas +++ b/source/uCEFApplication.pas @@ -62,13 +62,13 @@ uses const CEF_SUPPORTED_VERSION_MAJOR = 74; CEF_SUPPORTED_VERSION_MINOR = 1; - CEF_SUPPORTED_VERSION_RELEASE = 16; + CEF_SUPPORTED_VERSION_RELEASE = 19; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = 74; CEF_CHROMEELF_VERSION_MINOR = 0; CEF_CHROMEELF_VERSION_RELEASE = 3729; - CEF_CHROMEELF_VERSION_BUILD = 131; + CEF_CHROMEELF_VERSION_BUILD = 157; {$IFDEF MSWINDOWS} LIBCEF_DLL = 'libcef.dll'; diff --git a/source/uCEFChromium.pas b/source/uCEFChromium.pas index f705c009..7937439d 100644 --- a/source/uCEFChromium.pas +++ b/source/uCEFChromium.pas @@ -487,7 +487,7 @@ type function doSavePreferences : boolean; virtual; procedure doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); virtual; function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual; - procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); + procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); virtual; public constructor Create(AOwner: TComponent); override; diff --git a/source/uCEFFMXChromium.pas b/source/uCEFFMXChromium.pas index 6e06f1c4..cf0fd5a0 100644 --- a/source/uCEFFMXChromium.pas +++ b/source/uCEFFMXChromium.pas @@ -454,7 +454,7 @@ type function doSavePreferences : boolean; virtual; procedure doResolvedHostAvailable(result: TCefErrorCode; const resolvedIps: TStrings); virtual; function doNavigationVisitorResultAvailable(const entry: ICefNavigationEntry; current: Boolean; index, total: Integer) : boolean; virtual; - procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); + procedure doDownloadImageFinished(const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage); virtual; public constructor Create(AOwner: TComponent); override; diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index f19e80c0..9fc6b39d 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -152,28 +152,28 @@ type // ******************************************* - TOnRegisterCustomSchemesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const registrar: TCefSchemeRegistrarRef) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnRenderThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnWebKitInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnBrowserCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnBrowserDestroyedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnContextCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnContextReleasedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnUncaughtExceptionEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnFocusedNodeChangedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnProcessMessageReceivedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage; var aHandled : boolean) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnContextInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnBeforeChildProcessLaunchEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const commandLine: ICefCommandLine) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnRenderProcessThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnScheduleMessagePumpWorkEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const delayMs: Int64) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnGetDataResourceEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnGetLocalizedStringEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(stringId: Integer; out stringVal: ustring; var aResult : Boolean) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnGetDataResourceForScaleEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; scaleFactor: TCefScaleFactor; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnCDMRegistrationCompleteEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(result : TCefCDMRegistrationError; const error_message : ustring) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnRenderLoadStart = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnRenderLoadEnd = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnRenderLoadError = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; - TOnRenderLoadingStateChange = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean) {$IFNDEF DELPHI12_UP}of object{$ENDIF}; + TOnRegisterCustomSchemesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const registrar: TCefSchemeRegistrarRef) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnWebKitInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnBrowserCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnBrowserDestroyedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnContextCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnContextReleasedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnUncaughtExceptionEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnFocusedNodeChangedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnProcessMessageReceivedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; sourceProcess: TCefProcessId; const message: ICefProcessMessage; var aHandled : boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF LCL} of object {$ENDIF} {$ENDIF}; + TOnContextInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; + TOnBeforeChildProcessLaunchEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const commandLine: ICefCommandLine) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderProcessThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnScheduleMessagePumpWorkEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const delayMs: Int64) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; + TOnGetDataResourceEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnGetLocalizedStringEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(stringId: Integer; out stringVal: ustring; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnGetDataResourceForScaleEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; scaleFactor: TCefScaleFactor; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnCDMRegistrationCompleteEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(result : TCefCDMRegistrationError; const error_message : ustring) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadStart = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadEnd = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadError = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadingStateChange = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; // ******************************************* // **** Callback procedures and functions **** diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 748ac7ab..e6de6174 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -1,10 +1,10 @@ { "UpdateLazPackages" : [ { - "ForceNotify" : true, - "InternalVersion" : 9, + "ForceNotify" : false, + "InternalVersion" : 10, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "74.1.16.0" + "Version" : "74.1.19.0" } ], "UpdatePackageData" : {