diff --git a/demos/Delphi_FMX/FMXTabbedBrowser/FMXTabbedBrowser.dproj b/demos/Delphi_FMX/FMXTabbedBrowser/FMXTabbedBrowser.dproj index d0069177..e86a526a 100644 --- a/demos/Delphi_FMX/FMXTabbedBrowser/FMXTabbedBrowser.dproj +++ b/demos/Delphi_FMX/FMXTabbedBrowser/FMXTabbedBrowser.dproj @@ -6,7 +6,7 @@ FMXTabbedBrowser.dpr True Debug - Win64 + Win32 3 Application diff --git a/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj b/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj index 49cd2805..8d7863f8 100644 --- a/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj +++ b/demos/Delphi_FMX/FMXToolBoxBrowser/FMXToolBoxBrowser.dproj @@ -6,7 +6,7 @@ FMXToolBoxBrowser.dpr True Debug - Win64 + Win32 3 Application diff --git a/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj b/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj index a05697cc..a8a7918e 100644 --- a/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj +++ b/demos/Delphi_FMX/SimpleFMXBrowser/SimpleFMXBrowser.dproj @@ -6,7 +6,7 @@ SimpleFMXBrowser.dpr True Debug - Win64 + Win32 3 Application diff --git a/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.dfm b/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.dfm index fbfd4e18..359e036f 100644 --- a/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.dfm +++ b/demos/Delphi_VCL/OAuth2Tester/uOAuth2TesterFrm.dfm @@ -3,7 +3,7 @@ object OAuth2TesterFrm: TOAuth2TesterFrm Top = 0 BorderIcons = [biSystemMenu, biMinimize] BorderStyle = bsSingle - Caption = 'OAuth 2.0 Browser' + Caption = 'OAuth 2.0 Tester' ClientHeight = 686 ClientWidth = 620 Color = clBtnFace diff --git a/demos/Delphi_VCL/TinyBrowser/00-DeleteDCUs.bat b/demos/Delphi_VCL/TinyBrowser/00-DeleteDCUs.bat new file mode 100644 index 00000000..a9a84095 --- /dev/null +++ b/demos/Delphi_VCL/TinyBrowser/00-DeleteDCUs.bat @@ -0,0 +1,18 @@ +del /s /q *.dcu +del /s /q *.exe +del /s /q *.res +del /s /q *.rsm +del /s /q *.log +del /s /q *.dsk +del /s /q *.identcache +del /s /q *.stat +del /s /q *.local +del /s /q *.~* +rmdir Win32\Debug +rmdir Win32\Release +rmdir Win32 +rmdir Win64\Debug +rmdir Win64\Release +rmdir Win64 +rmdir __history +rmdir __recovery diff --git a/demos/Delphi_VCL/TinyBrowser/TinyBrowser.dpr b/demos/Delphi_VCL/TinyBrowser/TinyBrowser.dpr new file mode 100644 index 00000000..c5f3921f --- /dev/null +++ b/demos/Delphi_VCL/TinyBrowser/TinyBrowser.dpr @@ -0,0 +1,56 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF 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 © 2020 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +program TinyBrowser; + +uses + uTinyBrowser in 'uTinyBrowser.pas', + uCEFApplicationCore; + +{$R *.res} + +begin + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + GlobalCEFApp.RunMessageLoop; + DestroyTinyBrowser; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Delphi_VCL/TinyBrowser/TinyBrowser.dproj b/demos/Delphi_VCL/TinyBrowser/TinyBrowser.dproj new file mode 100644 index 00000000..d50e5d42 --- /dev/null +++ b/demos/Delphi_VCL/TinyBrowser/TinyBrowser.dproj @@ -0,0 +1,988 @@ + + + {1D68E0C9-A421-451F-83EC-8AE197E0F21F} + 18.8 + VCL + TinyBrowser.dpr + True + Debug + Win64 + 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 + + + .\$(Platform)\$(Config) + ..\..\..\bin + false + false + false + false + false + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + $(BDS)\bin\delphi_PROJECTICON.ico + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png + $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + TinyBrowser + 3082 + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + + + DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;RESTComponents;vclFireDAC;IndyCore260;IndyProtocols260;FireDACDb2Driver;DataSnapFireDAC;svnui;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDAC;FireDACMSSQLDriver;vcltouch;VisualStyles_runtime;Componentes_UI;vcldb;bindcompfmx;svn;FireDACSqliteDriver;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;SVGPackage;soaprtl;DbxCommonDriver;FireDACIBDriver;fmx;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;FireDACCommon;bindcompvcl;IndySystem260;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;FireDACCommonDriver;CloudService;DataSnapClient;inet;DataSnapServerMidas;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Debug + true + CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= + 1033 + $(BDS)\bin\default_app.manifest + + + DBXSqliteDriver;bindcompdbx;fmxase;DBXDb2Driver;DBXInterBaseDriver;vcl;DBXSybaseASEDriver;vclactnband;RESTComponents;vclFireDAC;IndyCore260;IndyProtocols260;FireDACDb2Driver;DataSnapFireDAC;tethering;dsnapcon;FireDACADSDriver;FireDACMSAccDriver;fmxFireDAC;DBXMSSQLDriver;vclimg;FireDACInfxDriver;DatasnapConnectorsFreePascal;FireDAC;FireDACMSSQLDriver;vcltouch;VisualStyles_runtime;Componentes_UI;vcldb;bindcompfmx;FireDACSqliteDriver;FireDACPgDriver;DBXOracleDriver;inetdb;FireDACASADriver;DBXOdbcDriver;FireDACTDataDriver;SVGPackage;soaprtl;DbxCommonDriver;FireDACIBDriver;fmx;DataSnapServer;xmlrtl;soapmidas;DataSnapNativeClient;fmxobj;fmxdae;vclwinx;rtl;FireDACDSDriver;DbxClientDriver;DBXSybaseASADriver;CustomIPTransport;vcldsnap;dbexpress;FireDACDBXDriver;vclx;bindcomp;appanalytics;dsnap;DataSnapCommon;DBXInformixDriver;FireDACCommon;bindcompvcl;IndySystem260;RESTBackendComponents;DataSnapConnectors;VCLRESTComponents;soapserver;dbxcds;VclSmp;adortl;FireDACODBCDriver;DataSnapIndy10ServerTransport;vclie;CEF4Delphi_FMX;bindengine;DBXMySQLDriver;FireDACOracleDriver;dsnapxml;FireDACMySQLDriver;dbrtl;inetdbxpress;DBXFirebirdDriver;DataSnapProviderClient;FireDACMongoDBDriver;FireDACCommonODBC;FireDACCommonDriver;CloudService;DataSnapClient;inet;DataSnapServerMidas;$(DCC_UsePackage) + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + 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 + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + true + PerMonitorV2 + + + 1033 + (None) + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitorV2 + + + + MainSource + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + Delphi.Personality.12 + Application + + + + TinyBrowser.dpr + + + IP Abstraction Indy Implementation Design Time + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + TinyBrowser.exe + true + + + + + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + classes + 1 + + + classes + 1 + + + + + res\xml + 1 + + + res\xml + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\armeabi + 1 + + + library\lib\armeabi + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + library\lib\mips + 1 + + + library\lib\mips + 1 + + + + + library\lib\armeabi-v7a + 1 + + + library\lib\arm64-v8a + 1 + + + + + library\lib\armeabi-v7a + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\values-v21 + 1 + + + res\values-v21 + 1 + + + + + res\values + 1 + + + res\values + 1 + + + + + res\drawable + 1 + + + res\drawable + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-ldpi + 1 + + + res\drawable-ldpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-mdpi + 1 + + + res\drawable-mdpi + 1 + + + + + res\drawable-hdpi + 1 + + + res\drawable-hdpi + 1 + + + + + res\drawable-xhdpi + 1 + + + res\drawable-xhdpi + 1 + + + + + res\drawable-xxhdpi + 1 + + + res\drawable-xxhdpi + 1 + + + + + res\drawable-xxxhdpi + 1 + + + res\drawable-xxxhdpi + 1 + + + + + res\drawable-small + 1 + + + res\drawable-small + 1 + + + + + res\drawable-normal + 1 + + + res\drawable-normal + 1 + + + + + res\drawable-large + 1 + + + res\drawable-large + 1 + + + + + res\drawable-xlarge + 1 + + + res\drawable-xlarge + 1 + + + + + res\values + 1 + + + res\values + 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 + + + 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 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 1 + + + 1 + + + + + 1 + + + 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 + + + library\lib\arm64-v8a + 1 + + + 1 + + + 1 + + + 1 + + + 1 + + + Contents\MacOS + 1 + + + Contents\MacOS + 1 + + + 0 + + + + + library\lib\armeabi-v7a + 1 + + + + + 1 + + + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + Assets + 1 + + + Assets + 1 + + + + + + + + + + + + + + + True + True + + + 12 + + + + + diff --git a/demos/Delphi_VCL/TinyBrowser/cef.inc b/demos/Delphi_VCL/TinyBrowser/cef.inc new file mode 100644 index 00000000..8334dc78 --- /dev/null +++ b/demos/Delphi_VCL/TinyBrowser/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 + * 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/Delphi_VCL/TinyBrowser/uTinyBrowser.pas b/demos/Delphi_VCL/TinyBrowser/uTinyBrowser.pas new file mode 100644 index 00000000..44181241 --- /dev/null +++ b/demos/Delphi_VCL/TinyBrowser/uTinyBrowser.pas @@ -0,0 +1,270 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF 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 © 2020 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + +unit uTinyBrowser; + +{$I cef.inc} + +interface + +uses + {$IFDEF DELPHI16_UP} + System.Classes, + {$ELSE} + Classes, + {$ENDIF} + uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFApplication, uCEFChromium, + uCEFWindowComponent, uCEFBrowserViewComponent; + +procedure CreateGlobalCEFApp; +procedure DestroyTinyBrowser; + +implementation + +const + DEFAULT_WINDOW_VIEW_WIDTH = 1024; + DEFAULT_WINDOW_VIEW_HEIGHT = 768; + +type + TTinyBrowser = class(TComponent) + protected + FChromium : TChromium; + FCEFWindowComponent : TCEFWindowComponent; + FCEFBrowserViewComponent : TCEFBrowserViewComponent; + FHomepage : string; + + 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 extra_info: ICefDictionaryValue; var noJavascriptAccess, Result: Boolean); + procedure Chromium_OnTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); + + procedure CEFWindowComponent_OnWindowCreated(const Sender : TObject; const window : ICefWindow); + procedure CEFWindowComponent_OnCanClose(const Sender : TObject; const window : ICefWindow; var aResult : Boolean); + procedure CEFWindowComponent_OnGetPreferredSize(const Sender : TObject; const view : ICefView; var aResult : TCefSize); + + public + constructor Create(AOwner : TComponent); override; + procedure AfterConstruction; override; + procedure CreateTopLevelWindow; + + property Homepage : string read FHomepage write FHomepage; + end; + +var + TinyBrowser : TTinyBrowser = nil; + +// This demo uses the Views Framework in CEF to create a child window with a +// web browser. + +// CEF4Delphi has several components to facilitate the creation of several views +// and this demo uses these : + +// TCEFWindowComponent : Has a ICefWindow and a ICefWindowDelegate to call +// the methods of a "CefWindow" and the events from the "CefWindowDelegate". +// Read the linked documents bellow for more details about them. + +// TCEFBrowserViewComponent : Has a ICefBrowserView and a ICefBrowserViewDelegate +// to call the methods of a "CefBrowserView" and the events from the +// "CefBrowserViewDelegate". + +// TChromium : Is used to create the browser and to handle all its events. + +// All the views have a hierarchy and they inherit methods or events from their +// parents. See the diagram in the uCEFTypes.pas file (line 2900 aprox.) + +// This demo only creates a browser window without VCL or FMX. +// It doesn't use the default GlobalCEFApp.MultiThreadedMessageLoop and +// GlobalCEFApp.ExternalMessagePump is also disabled. For this reason we have to +// call GlobalCEFApp.RunMessageLoop to start the message loop and also call +// GlobalCEFApp.QuitMessageLoop when the browser is closed to stop the message +// loop. + +// The TinyBrowser instance is created in GlobalCEFApp.OnContextInitialized and +// it's destroyed before destroying GlobalCEFApp (see the DPR file). + +// Most of the methods in the Views Framework must be used in the CEF UI thread +// but most of the procedures used to create the CEF4Delphi components create a +// task if they are called in a different thread. The rest of the methods *MUST* +// be called in the CEF UI thread or they won't work. + +// TCEFWindowComponent.CreateTopLevelWindow triggers the +// TCEFWindowComponent.OnWindowCreated event which is executed in the CEF UI +// thread and you can use it to create the child views in the window, in this +// case a browser view. + +// TCEFWindowComponent.OnGetPreferredSize will alse be triggered when you create +// the window to get the window size in DIPs. + +// REFERENCES : +// ------------ +// https://bitbucket.org/chromiumembedded/cef/issues/1749 +// https://www.chromium.org/developers/design-documents/chromeviews +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefView.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefViewDelegate.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindow.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindowDelegate.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserView.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserViewDelegate.html + +constructor TTinyBrowser.Create(AOwner : TComponent); +begin + inherited Create(AOwner); + + FHomepage := 'about:blank'; + FChromium := nil; + FCEFWindowComponent := nil; + FCEFBrowserViewComponent := nil; +end; + +procedure TTinyBrowser.AfterConstruction; +begin + inherited AfterConstruction; + + FChromium := TChromium.Create(self); + FChromium.OnBeforeClose := Chromium_OnBeforeClose; + FChromium.OnBeforePopup := Chromium_OnBeforePopup; + FChromium.OnTitleChange := Chromium_OnTitleChange; + + FCEFBrowserViewComponent := TCEFBrowserViewComponent.Create(self); + + FCEFWindowComponent := TCEFWindowComponent.Create(self); + FCEFWindowComponent.OnWindowCreated := CEFWindowComponent_OnWindowCreated; + FCEFWindowComponent.OnCanClose := CEFWindowComponent_OnCanClose; + FCEFWindowComponent.OnGetPreferredSize := CEFWindowComponent_OnGetPreferredSize; +end; + +procedure TTinyBrowser.CreateTopLevelWindow; +begin + if (FCEFWindowComponent <> nil) then + FCEFWindowComponent.CreateTopLevelWindow; +end; + +procedure TTinyBrowser.Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + GlobalCEFApp.QuitMessageLoop; +end; + +procedure TTinyBrowser.Chromium_OnBeforePopup( 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 extra_info : ICefDictionaryValue; + 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 TTinyBrowser.Chromium_OnTitleChange( Sender : TObject; + const browser : ICefBrowser; + const title : ustring); +begin + FCEFWindowComponent.Title := title; +end; + +procedure TTinyBrowser.CEFWindowComponent_OnWindowCreated(const Sender : TObject; + const window : ICefWindow); +var + TempWorkArea : TCefRect; + TempPosition : TCefPoint; + TempDisplay : ICefDisplay; +begin + if FChromium.CreateBrowser(FHomepage, FCEFBrowserViewComponent) then + begin + FCEFWindowComponent.AddChildView(FCEFBrowserViewComponent.BrowserView); + FCEFWindowComponent.Show; + + // This centers the window on the screen + TempDisplay := FCEFWindowComponent.Display; + if (TempDisplay <> nil) then + begin + TempWorkArea := TempDisplay.WorkArea; + TempPosition.x := ((TempWorkArea.width - DEFAULT_WINDOW_VIEW_WIDTH) div 2) + TempWorkArea.x; + TempPosition.y := ((TempWorkArea.height - DEFAULT_WINDOW_VIEW_HEIGHT) div 2) + TempWorkArea.y; + + FCEFWindowComponent.Position := TempPosition; + end; + + FCEFBrowserViewComponent.RequestFocus; + end; +end; + +procedure TTinyBrowser.CEFWindowComponent_OnCanClose(const Sender : TObject; + const window : ICefWindow; + var aResult : Boolean); +begin + aResult := FChromium.TryCloseBrowser; +end; + +procedure TTinyBrowser.CEFWindowComponent_OnGetPreferredSize(const Sender : TObject; + const view : ICefView; + var aResult : TCefSize); +begin + // This is the initial window size + aResult.width := DEFAULT_WINDOW_VIEW_WIDTH; + aResult.height := DEFAULT_WINDOW_VIEW_HEIGHT; +end; + +procedure GlobalCEFApp_OnContextInitialized; +begin + TinyBrowser := TTinyBrowser.Create(nil); + TinyBrowser.Homepage := 'https://www.briskbard.com'; + TinyBrowser.CreateTopLevelWindow; +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.MultiThreadedMessageLoop := False; + GlobalCEFApp.ExternalMessagePump := False; + GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized; +end; + +procedure DestroyTinyBrowser; +begin + if (TinyBrowser <> nil) then + TinyBrowser.Free; +end; + +end. diff --git a/demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dpr b/demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dpr index 9e869d28..459dd75d 100644 --- a/demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dpr +++ b/demos/Delphi_VCL/ToolBoxBrowser2/ToolBoxBrowser2.dpr @@ -1,3 +1,40 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF 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 © 2020 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + program ToolBoxBrowser2; uses diff --git a/demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.pas b/demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.pas index 113f2a80..5ce3898d 100644 --- a/demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.pas +++ b/demos/Delphi_VCL/ToolBoxBrowser2/uMainForm.pas @@ -1,3 +1,40 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF 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 © 2020 Salvador Diaz Fau. All rights reserved. +// +// ************************************************************************ +// ************ vvvv Original license and comments below vvvv ************* +// ************************************************************************ +(* + * Delphi Chromium Embedded 3 + * + * Usage allowed under the restrictions of the Lesser GNU General Public License + * or alternatively the restrictions of the Mozilla Public License 1.1 + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + * the specific language governing rights and limitations under the License. + * + * Unit owner : Henri Gourvest + * Web site : http://www.progdigy.com + * Repository : http://code.google.com/p/delphichromiumembedded/ + * Group : http://groups.google.com/group/delphichromiumembedded + * + * Embarcadero Technologies, Inc is not permitted to use or redistribute + * this source code without explicit permission. + * + *) + unit uMainForm; interface diff --git a/demos/Lazarus/MiniBrowser/MiniBrowser.lps b/demos/Lazarus/MiniBrowser/MiniBrowser.lps index a03dc70f..7c4964fa 100644 --- a/demos/Lazarus/MiniBrowser/MiniBrowser.lps +++ b/demos/Lazarus/MiniBrowser/MiniBrowser.lps @@ -8,8 +8,9 @@ - - + + + @@ -20,7 +21,6 @@ - diff --git a/demos/Lazarus/MiniBrowser/backup/MiniBrowser.lps b/demos/Lazarus/MiniBrowser/backup/MiniBrowser.lps new file mode 100644 index 00000000..a03dc70f --- /dev/null +++ b/demos/Lazarus/MiniBrowser/backup/MiniBrowser.lps @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/demos/Lazarus/TinyBrowser/00-Delete.bat b/demos/Lazarus/TinyBrowser/00-Delete.bat new file mode 100644 index 00000000..0b5ba5c8 --- /dev/null +++ b/demos/Lazarus/TinyBrowser/00-Delete.bat @@ -0,0 +1,2 @@ +rmdir /S /Q lib +rmdir /S /Q backup diff --git a/demos/Lazarus/TinyBrowser/TinyBrowser.lpi b/demos/Lazarus/TinyBrowser/TinyBrowser.lpi new file mode 100644 index 00000000..889fb3f8 --- /dev/null +++ b/demos/Lazarus/TinyBrowser/TinyBrowser.lpi @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + <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="TinyBrowser.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + <Unit1> + <Filename Value="uTinyBrowser.pas"/> + <IsPartOfProject Value="True"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="..\..\..\bin\TinyBrowser"/> + </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/TinyBrowser/TinyBrowser.lpr b/demos/Lazarus/TinyBrowser/TinyBrowser.lpr new file mode 100644 index 00000000..093ae03b --- /dev/null +++ b/demos/Lazarus/TinyBrowser/TinyBrowser.lpr @@ -0,0 +1,59 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF 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 © 2020 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. + * + *) + +program TinyBrowser; + +{$MODE Delphi} + +uses + LCLIntf, LCLType, LMessages, Interfaces, + uTinyBrowser in 'uTinyBrowser.pas', + uCEFApplicationCore; + +{.$R *.res} + +begin + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + GlobalCEFApp.RunMessageLoop; + DestroyTinyBrowser; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Lazarus/TinyBrowser/TinyBrowser.lps b/demos/Lazarus/TinyBrowser/TinyBrowser.lps new file mode 100644 index 00000000..32fe548b --- /dev/null +++ b/demos/Lazarus/TinyBrowser/TinyBrowser.lps @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="TinyBrowser.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <TopLine Value="24"/> + <CursorPos X="33" Y="51"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit0> + <Unit1> + <Filename Value="uTinyBrowser.pas"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="1"/> + <TopLine Value="34"/> + <CursorPos X="30" Y="46"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + <DefaultSyntaxHighlighter Value="Delphi"/> + </Unit1> + </Units> + <JumpHistory Count="2" HistoryIndex="1"> + <Position1> + <Filename Value="TinyBrowser.lpr"/> + <Caret Line="48" Column="47" TopLine="34"/> + </Position1> + <Position2> + <Filename Value="uTinyBrowser.pas"/> + <Caret Line="209" Column="39" TopLine="197"/> + </Position2> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/demos/Lazarus/TinyBrowser/uTinyBrowser.pas b/demos/Lazarus/TinyBrowser/uTinyBrowser.pas new file mode 100644 index 00000000..e6d30c26 --- /dev/null +++ b/demos/Lazarus/TinyBrowser/uTinyBrowser.pas @@ -0,0 +1,266 @@ +// ************************************************************************ +// ***************************** CEF4Delphi ******************************* +// ************************************************************************ +// +// CEF4Delphi is based on DCEF3 which uses CEF 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 © 2020 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 uTinyBrowser; + +{$MODE Delphi} + +interface + +uses + Classes, + uCEFTypes, uCEFInterfaces, uCEFConstants, uCEFApplication, uCEFChromium, + uCEFWindowComponent, uCEFBrowserViewComponent; + +procedure CreateGlobalCEFApp; +procedure DestroyTinyBrowser; + +implementation + +const + DEFAULT_WINDOW_VIEW_WIDTH = 1024; + DEFAULT_WINDOW_VIEW_HEIGHT = 768; + +type + TTinyBrowser = class(TComponent) + protected + FChromium : TChromium; + FCEFWindowComponent : TCEFWindowComponent; + FCEFBrowserViewComponent : TCEFBrowserViewComponent; + FHomepage : string; + + 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 extra_info: ICefDictionaryValue; var noJavascriptAccess, Result: Boolean); + procedure Chromium_OnTitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring); + + procedure CEFWindowComponent_OnWindowCreated(const Sender : TObject; const window : ICefWindow); + procedure CEFWindowComponent_OnCanClose(const Sender : TObject; const window : ICefWindow; var aResult : Boolean); + procedure CEFWindowComponent_OnGetPreferredSize(const Sender : TObject; const view : ICefView; var aResult : TCefSize); + + public + constructor Create(AOwner : TComponent); override; + procedure AfterConstruction; override; + procedure CreateTopLevelWindow; + + property Homepage : string read FHomepage write FHomepage; + end; + +var + TinyBrowser : TTinyBrowser = nil; + +// This demo uses the Views Framework in CEF to create a child window with a +// web browser. + +// CEF4Delphi has several components to facilitate the creation of several views +// and this demo uses these : + +// TCEFWindowComponent : Has a ICefWindow and a ICefWindowDelegate to call +// the methods of a "CefWindow" and the events from the "CefWindowDelegate". +// Read the linked documents bellow for more details about them. + +// TCEFBrowserViewComponent : Has a ICefBrowserView and a ICefBrowserViewDelegate +// to call the methods of a "CefBrowserView" and the events from the +// "CefBrowserViewDelegate". + +// TChromium : Is used to create the browser and to handle all its events. + +// All the views have a hierarchy and they inherit methods or events from their +// parents. See the diagram in the uCEFTypes.pas file (line 2900 aprox.) + +// This demo only creates a browser window without VCL or FMX. +// It doesn't use the default GlobalCEFApp.MultiThreadedMessageLoop and +// GlobalCEFApp.ExternalMessagePump is also disabled. For this reason we have to +// call GlobalCEFApp.RunMessageLoop to start the message loop and also call +// GlobalCEFApp.QuitMessageLoop when the browser is closed to stop the message +// loop. + +// The TinyBrowser instance is created in GlobalCEFApp.OnContextInitialized and +// it's destroyed before destroying GlobalCEFApp (see the DPR file). + +// Most of the methods in the Views Framework must be used in the CEF UI thread +// but most of the procedures used to create the CEF4Delphi components create a +// task if they are called in a different thread. The rest of the methods *MUST* +// be called in the CEF UI thread or they won't work. + +// TCEFWindowComponent.CreateTopLevelWindow triggers the +// TCEFWindowComponent.OnWindowCreated event which is executed in the CEF UI +// thread and you can use it to create the child views in the window, in this +// case a browser view. + +// TCEFWindowComponent.OnGetPreferredSize will alse be triggered when you create +// the window to get the window size in DIPs. + +// REFERENCES : +// ------------ +// https://bitbucket.org/chromiumembedded/cef/issues/1749 +// https://www.chromium.org/developers/design-documents/chromeviews +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefView.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefViewDelegate.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindow.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefWindowDelegate.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserView.html +// https://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserViewDelegate.html + +constructor TTinyBrowser.Create(AOwner : TComponent); +begin + inherited Create(AOwner); + + FHomepage := 'about:blank'; + FChromium := nil; + FCEFWindowComponent := nil; + FCEFBrowserViewComponent := nil; +end; + +procedure TTinyBrowser.AfterConstruction; +begin + inherited AfterConstruction; + + FChromium := TChromium.Create(self); + FChromium.OnBeforeClose := Chromium_OnBeforeClose; + FChromium.OnBeforePopup := Chromium_OnBeforePopup; + FChromium.OnTitleChange := Chromium_OnTitleChange; + + FCEFBrowserViewComponent := TCEFBrowserViewComponent.Create(self); + + FCEFWindowComponent := TCEFWindowComponent.Create(self); + FCEFWindowComponent.OnWindowCreated := CEFWindowComponent_OnWindowCreated; + FCEFWindowComponent.OnCanClose := CEFWindowComponent_OnCanClose; + FCEFWindowComponent.OnGetPreferredSize := CEFWindowComponent_OnGetPreferredSize; +end; + +procedure TTinyBrowser.CreateTopLevelWindow; +begin + if (FCEFWindowComponent <> nil) then + FCEFWindowComponent.CreateTopLevelWindow; +end; + +procedure TTinyBrowser.Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser); +begin + GlobalCEFApp.QuitMessageLoop; +end; + +procedure TTinyBrowser.Chromium_OnBeforePopup( 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 extra_info : ICefDictionaryValue; + 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 TTinyBrowser.Chromium_OnTitleChange( Sender : TObject; + const browser : ICefBrowser; + const title : ustring); +begin + FCEFWindowComponent.Title := title; +end; + +procedure TTinyBrowser.CEFWindowComponent_OnWindowCreated(const Sender : TObject; + const window : ICefWindow); +var + TempWorkArea : TCefRect; + TempPosition : TCefPoint; + TempDisplay : ICefDisplay; +begin + if FChromium.CreateBrowser(FHomepage, FCEFBrowserViewComponent) then + begin + FCEFWindowComponent.AddChildView(FCEFBrowserViewComponent.BrowserView); + FCEFWindowComponent.Show; + + // This centers the window on the screen + TempDisplay := FCEFWindowComponent.Display; + if (TempDisplay <> nil) then + begin + TempWorkArea := TempDisplay.WorkArea; + TempPosition.x := ((TempWorkArea.width - DEFAULT_WINDOW_VIEW_WIDTH) div 2) + TempWorkArea.x; + TempPosition.y := ((TempWorkArea.height - DEFAULT_WINDOW_VIEW_HEIGHT) div 2) + TempWorkArea.y; + + FCEFWindowComponent.Position := TempPosition; + end; + + FCEFBrowserViewComponent.RequestFocus; + end; +end; + +procedure TTinyBrowser.CEFWindowComponent_OnCanClose(const Sender : TObject; + const window : ICefWindow; + var aResult : Boolean); +begin + aResult := FChromium.TryCloseBrowser; +end; + +procedure TTinyBrowser.CEFWindowComponent_OnGetPreferredSize(const Sender : TObject; + const view : ICefView; + var aResult : TCefSize); +begin + // This is the initial window size + aResult.width := DEFAULT_WINDOW_VIEW_WIDTH; + aResult.height := DEFAULT_WINDOW_VIEW_HEIGHT; +end; + +procedure GlobalCEFApp_OnContextInitialized; +begin + TinyBrowser := TTinyBrowser.Create(nil); + TinyBrowser.Homepage := 'https://www.briskbard.com'; + TinyBrowser.CreateTopLevelWindow; +end; + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.MultiThreadedMessageLoop := False; + GlobalCEFApp.ExternalMessagePump := False; + GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized; +end; + +procedure DestroyTinyBrowser; +begin + if (TinyBrowser <> nil) then + TinyBrowser.Free; +end; + +end. diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 9d761dea..79bae2e0 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,7 +2,7 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 137, + "InternalVersion" : 138, "Name" : "cef4delphi_lazarus.lpk", "Version" : "81.3.10.0" }