diff --git a/README.md b/README.md index 90041b61..e2d74a76 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,10 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro 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 84.3.8 which includes Chromium 84.0.4147.105. +CEF4Delphi uses CEF 84.3.10 which includes Chromium 84.0.4147.105. The CEF binaries used by CEF4Delphi are available for download at spotify : -* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.8%2Bgc8a556f%2Bchromium-84.0.4147.105_windows32.tar.bz2) -* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.8%2Bgc8a556f%2Bchromium-84.0.4147.105_windows64.tar.bz2) +* [32 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.10%2Bga46056b%2Bchromium-84.0.4147.105_windows32.tar.bz2) +* [64 bits](http://opensource.spotify.com/cefbuilds/cef_binary_84.3.10%2Bga46056b%2Bchromium-84.0.4147.105_windows64.tar.bz2) CEF4Delphi was developed and tested on Delphi 10.4 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.10/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. diff --git a/bin/hello/hello.html b/bin/hello/hello.html new file mode 100644 index 00000000..5ae53217 --- /dev/null +++ b/bin/hello/hello.html @@ -0,0 +1,3 @@ + +Hello World

Hello World!

+ \ No newline at end of file diff --git a/bin/hello/hello.png b/bin/hello/hello.png new file mode 100644 index 00000000..63ea0d20 Binary files /dev/null and b/bin/hello/hello.png differ diff --git a/bin/hello/manifest.json b/bin/hello/manifest.json new file mode 100644 index 00000000..aa83ed0a --- /dev/null +++ b/bin/hello/manifest.json @@ -0,0 +1,10 @@ +{ + "name": "Hello World", + "description" : "Hello World Extension", + "version": "1.0", + "browser_action": { + "default_popup": "hello.html", + "default_icon": "hello.png" + }, + "manifest_version": 2 +} diff --git a/bin/set_page_color/icon.png b/bin/set_page_color/icon.png new file mode 100644 index 00000000..46819c73 Binary files /dev/null and b/bin/set_page_color/icon.png differ diff --git a/bin/set_page_color/manifest.json b/bin/set_page_color/manifest.json new file mode 100644 index 00000000..b457c4f3 --- /dev/null +++ b/bin/set_page_color/manifest.json @@ -0,0 +1,12 @@ +{ + "name": "Set Page Color", + "description": "Change the current page color", + "version": "1.0", + "permissions": ["activeTab","tabs","webNavigation","http://*/*","https://*/*"], + "browser_action": { + "default_title": "Set this page's color.", + "default_icon": "icon.png", + "default_popup": "popup.html" + }, + "manifest_version": 2 +} diff --git a/bin/set_page_color/popup.html b/bin/set_page_color/popup.html new file mode 100644 index 00000000..bf1b42b3 --- /dev/null +++ b/bin/set_page_color/popup.html @@ -0,0 +1,55 @@ + + + + Set Page Color Popup + + + + +
red
+
blue
+
green
+
yellow
+ + diff --git a/bin/set_page_color/popup.js b/bin/set_page_color/popup.js new file mode 100644 index 00000000..bc405227 --- /dev/null +++ b/bin/set_page_color/popup.js @@ -0,0 +1,18 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +'use strict'; + +function click(e) { + chrome.tabs.executeScript(null, + {code:"document.body.style.backgroundColor='" + e.target.id + "'"}); + //window.close(); +} + +document.addEventListener('DOMContentLoaded', function () { + var divs = document.querySelectorAll('div'); + for (var i = 0; i < divs.length; i++) { + divs[i].addEventListener('click', click); + } +}); diff --git a/demos/Delphi_VCL/Extensions/HelloWorldExt/00-DeleteDCUs.bat b/demos/Delphi_VCL/Extensions/HelloWorldExt/00-DeleteDCUs.bat new file mode 100644 index 00000000..a9a84095 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/HelloWorldExt/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/Extensions/HelloWorldExt/HelloWorldExt.dpr b/demos/Delphi_VCL/Extensions/HelloWorldExt/HelloWorldExt.dpr new file mode 100644 index 00000000..4fbf8c3e --- /dev/null +++ b/demos/Delphi_VCL/Extensions/HelloWorldExt/HelloWorldExt.dpr @@ -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 + * 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 HelloWorldExt; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + Windows, + {$ENDIF } + uCEFApplication, + uHelloWorldExt in 'uHelloWorldExt.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 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TForm1, Form1); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Delphi_VCL/Extensions/HelloWorldExt/HelloWorldExt.dproj b/demos/Delphi_VCL/Extensions/HelloWorldExt/HelloWorldExt.dproj new file mode 100644 index 00000000..f4929391 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/HelloWorldExt/HelloWorldExt.dproj @@ -0,0 +1,1058 @@ + + + {55E00327-9D98-4DA3-A4E1-844942A01C6B} + 18.8 + VCL + HelloWorldExt.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 + HelloWorldExt + $(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 + 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= + PerMonitorV2 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitor + Debug + + + true + PerMonitorV2 + + + + MainSource + + +
Form1
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + HelloWorldExt.dpr + + + DBExpress Enterprise Data Explorer Integration + MWK - SVG + IP Abstraction Indy Implementation Design Time + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + HelloWorldExt.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 + + + 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/Extensions/HelloWorldExt/cef.inc b/demos/Delphi_VCL/Extensions/HelloWorldExt/cef.inc new file mode 100644 index 00000000..a4c8d038 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/HelloWorldExt/cef.inc @@ -0,0 +1,456 @@ +// ************************************************************************ +// ***************************** 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} + +// Rad Studio 10.4 - Delphi Sydney +{$IFDEF VER340} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$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} + {$DEFINE DELPHI27_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} + {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)} + {$DEFINE FPC_VER_320} + {$IFEND} +{$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} + {$DEFINE DELPHI27_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + +{$IF DEFINED(CPUX32) OR + DEFINED(CPU386) OR + DEFINED(CPUi386) OR + DEFINED(CPUPOWERPC32) OR + DEFINED(CPUSPARC32) OR + DEFINED(CPU32BITS) OR + DEFINED(CPUARM32) OR + DEFINED(WIN32) OR + DEFINED(IOS32) OR + DEFINED(MACOS32) OR + DEFINED(LINUX32) OR + DEFINED(POSIX32) OR + DEFINED(ANDROID32)} + {$DEFINE TARGET_32BITS} +{$IFEND} + diff --git a/demos/Delphi_VCL/Extensions/HelloWorldExt/uHelloWorldExt.dfm b/demos/Delphi_VCL/Extensions/HelloWorldExt/uHelloWorldExt.dfm new file mode 100644 index 00000000..4a4ccf72 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/HelloWorldExt/uHelloWorldExt.dfm @@ -0,0 +1,163 @@ +object Form1: TForm1 + Left = 0 + Top = 0 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1088 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object AddressPnl: TPanel + Left = 0 + Top = 0 + Width = 1088 + Height = 30 + Align = alTop + BevelOuter = bvNone + Enabled = False + Padding.Left = 5 + Padding.Top = 5 + Padding.Right = 5 + Padding.Bottom = 5 + TabOrder = 0 + object AddressEdt: TEdit + Left = 5 + Top = 5 + Width = 1047 + Height = 20 + Margins.Right = 5 + Align = alClient + TabOrder = 0 + Text = 'http://www.google.com' + ExplicitHeight = 21 + end + object GoBtn: TButton + Left = 1052 + Top = 5 + Width = 31 + Height = 20 + Margins.Left = 5 + Align = alRight + Caption = 'Go' + TabOrder = 1 + OnClick = GoBtnClick + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Top = 30 + Width = 824 + Height = 594 + Align = alClient + TabOrder = 1 + end + object ExtensionPnl: TPanel + Left = 824 + Top = 30 + Width = 264 + Height = 594 + Align = alRight + BevelOuter = bvNone + Padding.Left = 5 + Padding.Top = 5 + Padding.Right = 5 + Padding.Bottom = 5 + TabOrder = 2 + object ExtensionMem: TMemo + Left = 5 + Top = 97 + Width = 254 + Height = 222 + Align = alTop + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end + object Panel1: TPanel + Left = 5 + Top = 5 + Width = 254 + Height = 92 + Align = alTop + BevelOuter = bvNone + Padding.Bottom = 5 + TabOrder = 1 + object LoadExtensionBtn: TButton + Left = 0 + Top = 0 + Width = 254 + Height = 25 + Align = alTop + Caption = '1. Load extension' + TabOrder = 0 + OnClick = LoadExtensionBtnClick + end + object UnloadExtensionBtn: TButton + Left = 0 + Top = 62 + Width = 254 + Height = 25 + Align = alBottom + Caption = '3. Unload extension' + Enabled = False + TabOrder = 2 + OnClick = UnloadExtensionBtnClick + end + object LoadPopupPageBtn: TButton + Left = 0 + Top = 31 + Width = 254 + Height = 25 + Caption = '2. Load popup page' + TabOrder = 1 + OnClick = LoadPopupPageBtnClick + end + end + object CEFWindowParent2: TCEFWindowParent + Left = 5 + Top = 319 + Width = 254 + Height = 270 + Align = alClient + TabOrder = 2 + end + 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 + OnOpenUrlFromTab = Chromium1OpenUrlFromTab + Left = 56 + Top = 152 + end + object ExtensionChr: TChromium + OnLoadEnd = ExtensionChrLoadEnd + OnLoadError = ExtensionChrLoadError + OnBeforeClose = ExtensionChrBeforeClose + OnClose = ExtensionChrClose + OnExtensionLoadFailed = ExtensionChrExtensionLoadFailed + OnExtensionLoaded = ExtensionChrExtensionLoaded + OnExtensionUnloaded = ExtensionChrExtensionUnloaded + Left = 944 + Top = 392 + end +end diff --git a/demos/Delphi_VCL/Extensions/HelloWorldExt/uHelloWorldExt.pas b/demos/Delphi_VCL/Extensions/HelloWorldExt/uHelloWorldExt.pas new file mode 100644 index 00000000..b6ad4928 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/HelloWorldExt/uHelloWorldExt.pas @@ -0,0 +1,459 @@ +// ************************************************************************ +// ***************************** 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 uHelloWorldExt; + +{$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, uCEFConstants, uCEFTypes, + uCEFWinControl, uCEFSentinel, uCEFChromiumCore; + +const + CEF_EXT_LOADED = WM_APP + $B01; + CEF_EXT_UNLOADED = WM_APP + $B02; + CEF_EXT_ERROR = WM_APP + $B03; + CEF_EXT_POPUP_LOADED = WM_APP + $B04; + CEF_EXT_POPUP_ERROR = WM_APP + $B05; + + DESTROY_MAIN_WINDOWPARENT = 1; + DESTROY_EXT_WINDOWPARENT = 2; + +type + TForm1 = class(TForm) + AddressPnl: TPanel; + AddressEdt: TEdit; + GoBtn: TButton; + Timer1: TTimer; + Chromium1: TChromium; + CEFWindowParent1: TCEFWindowParent; + ExtensionChr: TChromium; + ExtensionPnl: TPanel; + ExtensionMem: TMemo; + Panel1: TPanel; + LoadExtensionBtn: TButton; + UnloadExtensionBtn: TButton; + CEFWindowParent2: TCEFWindowParent; + LoadPopupPageBtn: TButton; + + 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 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 extra_info: ICefDictionaryValue; var noJavascriptAccess, Result: Boolean); + procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean); + + procedure ExtensionChrExtensionLoaded(Sender: TObject; const extension: ICefExtension); + procedure ExtensionChrExtensionLoadFailed(Sender: TObject; result: Integer); + procedure ExtensionChrExtensionUnloaded(Sender: TObject; const extension: ICefExtension); + procedure ExtensionChrLoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); + procedure ExtensionChrLoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring); + procedure ExtensionChrClose(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); + procedure ExtensionChrBeforeClose(Sender: TObject; const browser: ICefBrowser); + + procedure GoBtnClick(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure LoadExtensionBtnClick(Sender: TObject); + procedure UnloadExtensionBtnClick(Sender: TObject); + procedure LoadPopupPageBtnClick(Sender: TObject); + + protected + FCanClose : boolean; + FClosing : boolean; + FExtension : ICefExtension; + + 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 ExtensionLoadedMsg(var aMessage : TMessage); message CEF_EXT_LOADED; + procedure ExtensionUnloadedMsg(var aMessage : TMessage); message CEF_EXT_UNLOADED; + procedure ExtensionErrorMsg(var aMessage : TMessage); message CEF_EXT_ERROR; + procedure ExtensionPopupLoadedMsg(var aMessage : TMessage); message CEF_EXT_POPUP_LOADED; + procedure ExtensionPopupErrorMsg(var aMessage : TMessage); message CEF_EXT_POPUP_ERROR; + + procedure UpdateButtons; + end; + +var + Form1: TForm1; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.dfm} + +uses + uCEFApplication, uCefMiscFunctions, uCEFJson; + +// This is a simple demo showing how to load, unload and show the popup page +// from a chrome extension. + +// This demo only allows to load the extension once. + +// The extension loaded is called "Hello World" and it's located in the +// CEF4Delphi\bin\hello directory. It only has a browser action popup html with +// the "Hello World" message and no other functionality. + +// It's necessary to unload the extension before you close the form. Notice that +// both TChromium components must be properly destroyed before allowing the form +// to close. + +// This demo is just a template for other demos and it has a browser loading +// google.com but in this case the extension doesn't use that browser. + +// Load chrome://extensions-support/ to get a list of supported APIs + +// Destruction steps +// ================= +// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser in both +// browsers which triggers the TChromium.OnClose event. +// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy +// CEFWindowParent1 and CEFWindowParent2 in the main thread, which triggers +// the TChromium.OnBeforeClose event. +// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.LogFile := 'debug.log'; + GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE; +end; + +procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + if (FExtension <> nil) then + begin + CanClose := False; + showmessage('Unload the extension before closing this demo'); + exit; + end; + + CanClose := FCanClose and + (CEFWindowParent1 = nil) and + ((CEFWindowParent2 = nil) or not(ExtensionChr.Initialized)); + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + ExtensionChr.CloseBrowser(True); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; + FExtension := nil; + Chromium1.DefaultURL := AddressEdt.Text; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + FExtension := nil; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + if not(Chromium1.CreateBrowser(CEFWindowParent1)) then + Timer1.Enabled := True; + + UpdateButtons; +end; + +procedure TForm1.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +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 extra_info: ICefDictionaryValue; + var noJavascriptAccess, 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, DESTROY_MAIN_WINDOWPARENT, 0); + aAction := cbaDelay; +end; + +procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; + userGesture: Boolean; out 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.ExtensionChrBeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); +end; + +procedure TForm1.ExtensionChrClose(Sender: TObject; const browser: ICefBrowser; + var aAction: TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, DESTROY_EXT_WINDOWPARENT, 0); + aAction := cbaDelay; +end; + +procedure TForm1.ExtensionChrExtensionLoaded(Sender: TObject; const extension: ICefExtension); +begin + FExtension := extension; + + PostMessage(Handle, CEF_EXT_LOADED, 0, 0); +end; + +procedure TForm1.ExtensionChrExtensionLoadFailed(Sender: TObject; result: Integer); +begin + PostMessage(Handle, CEF_EXT_ERROR, 0, result); +end; + +procedure TForm1.ExtensionChrExtensionUnloaded(Sender: TObject; const extension: ICefExtension); +begin + if (extension <> nil) and (FExtension <> nil) and extension.IsSame(FExtension) then + begin + FExtension := nil; + PostMessage(Handle, CEF_EXT_UNLOADED, 0, 0); + end; +end; + +procedure TForm1.ExtensionChrLoadEnd(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); +begin + PostMessage(Handle, CEF_EXT_POPUP_LOADED, 0, 0); +end; + +procedure TForm1.ExtensionChrLoadError(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); +begin + PostMessage(Handle, CEF_EXT_POPUP_ERROR, 0, errorCode); +end; + +procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'Hello World Extension Demo'; + AddressPnl.Enabled := True; +end; + +procedure TForm1.BrowserDestroyMsg(var aMessage : TMessage); +begin + case aMessage.WParam of + DESTROY_MAIN_WINDOWPARENT : FreeAndNil(CEFWindowParent1); + DESTROY_EXT_WINDOWPARENT : FreeAndNil(CEFWindowParent2); + end; +end; + +procedure TForm1.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(AddressEdt.Text); +end; + +procedure TForm1.UpdateButtons; +begin + // This demo only allows to load the extension once. + + if ExtensionChr.Initialized then + begin + LoadExtensionBtn.Enabled := False; + UnloadExtensionBtn.Enabled := (FExtension <> nil); + LoadPopupPageBtn.Enabled := False; + end + else + begin + LoadExtensionBtn.Enabled := (FExtension = nil); + UnloadExtensionBtn.Enabled := (FExtension <> nil); + LoadPopupPageBtn.Enabled := (FExtension <> nil); + end; +end; + +procedure TForm1.ExtensionLoadedMsg(var aMessage : TMessage); +var + TempManifest : TStringList; +begin + if (FExtension = nil) then exit; + + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension loaded successfully!'); + ExtensionMem.Lines.Add('Identifier: ' + FExtension.Identifier); + ExtensionMem.Lines.Add('Path: ' + FExtension.Path); + ExtensionMem.Lines.Add('IsLoaded: ' + BoolToStr(FExtension.IsLoaded, True)); + ExtensionMem.Lines.Add('Popup: ' + FExtension.BrowserActionPopup); + ExtensionMem.Lines.Add('Icon: ' + FExtension.BrowserActionIcon); + ExtensionMem.Lines.Add('URL: ' + FExtension.URL); + + TempManifest := TStringList.Create; + + if TCEFJson.Write(FExtension.Manifest, TempManifest) then + begin + ExtensionMem.Lines.Add('Manifest: ' + FExtension.Path); + ExtensionMem.Lines.AddStrings(TempManifest); + end; + + TempManifest.Free; + + UpdateButtons; +end; + +procedure TForm1.ExtensionUnloadedMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension unloaded successfully!'); + UpdateButtons; +end; + +procedure TForm1.ExtensionErrorMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension load failed. Result : ' + inttostr(aMessage.LParam)); + UpdateButtons; +end; + +procedure TForm1.ExtensionPopupLoadedMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension PopUp page loaded successfully!'); + UpdateButtons; +end; + +procedure TForm1.ExtensionPopupErrorMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension PopUp page load failed. Error code : ' + inttostr(aMessage.LParam)); + UpdateButtons; +end; + +procedure TForm1.LoadExtensionBtnClick(Sender: TObject); +var + TempExtensionDirectoryPath : ustring; +begin + if (FExtension = nil) then + begin + TempExtensionDirectoryPath := GetModulePath + 'hello'; + ExtensionChr.LoadExtension(TempExtensionDirectoryPath); + end; +end; + +procedure TForm1.LoadPopupPageBtnClick(Sender: TObject); +begin + if (FExtension = nil) or ExtensionChr.Initialized then exit; + + ExtensionChr.DefaultURL := FExtension.URL + FExtension.BrowserActionPopup; + ExtensionChr.CreateBrowser(CEFWindowParent2); +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.UnloadExtensionBtnClick(Sender: TObject); +begin + if (FExtension <> nil) then + FExtension.Unload; +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/Delphi_VCL/Extensions/PageColorExt/00-DeleteDCUs.bat b/demos/Delphi_VCL/Extensions/PageColorExt/00-DeleteDCUs.bat new file mode 100644 index 00000000..a9a84095 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/PageColorExt/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/Extensions/PageColorExt/PageColorExt.dpr b/demos/Delphi_VCL/Extensions/PageColorExt/PageColorExt.dpr new file mode 100644 index 00000000..4aa50b22 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/PageColorExt/PageColorExt.dpr @@ -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 + * 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 PageColorExt; + +{$I cef.inc} + +uses + {$IFDEF DELPHI16_UP} + Vcl.Forms, + WinApi.Windows, + {$ELSE} + Forms, + Windows, + {$ENDIF } + uCEFApplication, + uPageColorExt in 'uPageColorExt.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 + CreateGlobalCEFApp; + + if GlobalCEFApp.StartMainProcess then + begin + Application.Initialize; + {$IFDEF DELPHI11_UP} + Application.MainFormOnTaskbar := True; + {$ENDIF} + Application.CreateForm(TForm1, Form1); + Application.Run; + end; + + DestroyGlobalCEFApp; +end. diff --git a/demos/Delphi_VCL/Extensions/PageColorExt/PageColorExt.dproj b/demos/Delphi_VCL/Extensions/PageColorExt/PageColorExt.dproj new file mode 100644 index 00000000..af77d66c --- /dev/null +++ b/demos/Delphi_VCL/Extensions/PageColorExt/PageColorExt.dproj @@ -0,0 +1,1058 @@ + + + {55E00327-9D98-4DA3-A4E1-844942A01C6B} + 18.8 + VCL + PageColorExt.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 + PageColorExt + $(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 + 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= + PerMonitorV2 + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + true + PerMonitor + Debug + + + true + PerMonitorV2 + + + + MainSource + + +
Form1
+
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + Application + + + + PageColorExt.dpr + + + DBExpress Enterprise Data Explorer Integration + MWK - SVG + IP Abstraction Indy Implementation Design Time + Microsoft Office 2000 Sample Automation Server Wrapper Components + Microsoft Office XP Sample Automation Server Wrapper Components + + + + + + + PageColorExt.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 + + + 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/Extensions/PageColorExt/cef.inc b/demos/Delphi_VCL/Extensions/PageColorExt/cef.inc new file mode 100644 index 00000000..a4c8d038 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/PageColorExt/cef.inc @@ -0,0 +1,456 @@ +// ************************************************************************ +// ***************************** 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} + +// Rad Studio 10.4 - Delphi Sydney +{$IFDEF VER340} + {$UNDEF DELPHI_VERSION_UNKNOW} + {$DEFINE DELPHI5_UP} + {$DEFINE DELPHI6_UP} + {$DEFINE DELPHI7_UP} + {$DEFINE DELPHI8_UP} + {$DEFINE DELPHI9_UP} + {$DEFINE DELPHI10_UP} + {$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} + {$DEFINE DELPHI27_UP} +{$ENDIF} + +{$IFDEF FPC} + {$DEFINE SUPPORTS_INLINE} + {$IF DEFINED(FPC_FULLVERSION) AND (FPC_FULLVERSION >= 30200)} + {$DEFINE FPC_VER_320} + {$IFEND} +{$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} + {$DEFINE DELPHI27_UP} + {$ENDIF} +{$ENDIF} + +{$IFDEF DELPHI9_UP} + {$DEFINE SUPPORTS_INLINE} +{$ENDIF} + +{$IF DEFINED(CPUX32) OR + DEFINED(CPU386) OR + DEFINED(CPUi386) OR + DEFINED(CPUPOWERPC32) OR + DEFINED(CPUSPARC32) OR + DEFINED(CPU32BITS) OR + DEFINED(CPUARM32) OR + DEFINED(WIN32) OR + DEFINED(IOS32) OR + DEFINED(MACOS32) OR + DEFINED(LINUX32) OR + DEFINED(POSIX32) OR + DEFINED(ANDROID32)} + {$DEFINE TARGET_32BITS} +{$IFEND} + diff --git a/demos/Delphi_VCL/Extensions/PageColorExt/uPageColorExt.dfm b/demos/Delphi_VCL/Extensions/PageColorExt/uPageColorExt.dfm new file mode 100644 index 00000000..a1297adf --- /dev/null +++ b/demos/Delphi_VCL/Extensions/PageColorExt/uPageColorExt.dfm @@ -0,0 +1,164 @@ +object Form1: TForm1 + Left = 0 + Top = 0 + Caption = 'Initializing browser. Please wait...' + ClientHeight = 624 + ClientWidth = 1088 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnCloseQuery = FormCloseQuery + OnCreate = FormCreate + OnDestroy = FormDestroy + OnShow = FormShow + PixelsPerInch = 96 + TextHeight = 13 + object AddressPnl: TPanel + Left = 0 + Top = 0 + Width = 1088 + Height = 30 + Align = alTop + BevelOuter = bvNone + Enabled = False + Padding.Left = 5 + Padding.Top = 5 + Padding.Right = 5 + Padding.Bottom = 5 + TabOrder = 0 + object AddressEdt: TEdit + Left = 5 + Top = 5 + Width = 1047 + Height = 20 + Margins.Right = 5 + Align = alClient + TabOrder = 0 + Text = 'http://www.google.com' + ExplicitHeight = 21 + end + object GoBtn: TButton + Left = 1052 + Top = 5 + Width = 31 + Height = 20 + Margins.Left = 5 + Align = alRight + Caption = 'Go' + TabOrder = 1 + OnClick = GoBtnClick + end + end + object CEFWindowParent1: TCEFWindowParent + Left = 0 + Top = 30 + Width = 824 + Height = 594 + Align = alClient + TabOrder = 1 + end + object ExtensionPnl: TPanel + Left = 824 + Top = 30 + Width = 264 + Height = 594 + Align = alRight + BevelOuter = bvNone + Padding.Left = 5 + Padding.Top = 5 + Padding.Right = 5 + Padding.Bottom = 5 + TabOrder = 2 + object ExtensionMem: TMemo + Left = 5 + Top = 97 + Width = 254 + Height = 222 + Align = alTop + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 0 + end + object Panel1: TPanel + Left = 5 + Top = 5 + Width = 254 + Height = 92 + Align = alTop + BevelOuter = bvNone + Padding.Bottom = 5 + TabOrder = 1 + object LoadExtensionBtn: TButton + Left = 0 + Top = 0 + Width = 254 + Height = 25 + Align = alTop + Caption = '1. Load extension' + TabOrder = 0 + OnClick = LoadExtensionBtnClick + end + object UnloadExtensionBtn: TButton + Left = 0 + Top = 62 + Width = 254 + Height = 25 + Align = alBottom + Caption = '3. Unload extension' + Enabled = False + TabOrder = 2 + OnClick = UnloadExtensionBtnClick + end + object LoadPopupPageBtn: TButton + Left = 0 + Top = 31 + Width = 254 + Height = 25 + Caption = '2. Load popup page' + TabOrder = 1 + OnClick = LoadPopupPageBtnClick + end + end + object CEFWindowParent2: TCEFWindowParent + Left = 5 + Top = 319 + Width = 254 + Height = 270 + Align = alClient + TabOrder = 2 + end + 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 + OnOpenUrlFromTab = Chromium1OpenUrlFromTab + Left = 56 + Top = 152 + end + object ExtensionChr: TChromium + OnLoadEnd = ExtensionChrLoadEnd + OnLoadError = ExtensionChrLoadError + OnBeforeClose = ExtensionChrBeforeClose + OnClose = ExtensionChrClose + OnExtensionLoadFailed = ExtensionChrExtensionLoadFailed + OnExtensionLoaded = ExtensionChrExtensionLoaded + OnExtensionUnloaded = ExtensionChrExtensionUnloaded + OnExtensionGetActiveBrowser = ExtensionChrExtensionGetActiveBrowser + Left = 944 + Top = 392 + end +end diff --git a/demos/Delphi_VCL/Extensions/PageColorExt/uPageColorExt.pas b/demos/Delphi_VCL/Extensions/PageColorExt/uPageColorExt.pas new file mode 100644 index 00000000..27f9ecf0 --- /dev/null +++ b/demos/Delphi_VCL/Extensions/PageColorExt/uPageColorExt.pas @@ -0,0 +1,488 @@ +// ************************************************************************ +// ***************************** 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 uPageColorExt; + +{$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, uCEFConstants, uCEFTypes, + uCEFWinControl, uCEFSentinel, uCEFChromiumCore; + +const + CEF_EXT_LOADED = WM_APP + $B01; + CEF_EXT_UNLOADED = WM_APP + $B02; + CEF_EXT_ERROR = WM_APP + $B03; + CEF_EXT_POPUP_LOADED = WM_APP + $B04; + CEF_EXT_POPUP_ERROR = WM_APP + $B05; + CEF_EXT_CHECK_EXTENSION = WM_APP + $B06; + + DESTROY_MAIN_WINDOWPARENT = 1; + DESTROY_EXT_WINDOWPARENT = 2; + +type + TForm1 = class(TForm) + AddressPnl: TPanel; + AddressEdt: TEdit; + GoBtn: TButton; + Timer1: TTimer; + Chromium1: TChromium; + CEFWindowParent1: TCEFWindowParent; + ExtensionChr: TChromium; + ExtensionPnl: TPanel; + ExtensionMem: TMemo; + Panel1: TPanel; + LoadExtensionBtn: TButton; + UnloadExtensionBtn: TButton; + CEFWindowParent2: TCEFWindowParent; + LoadPopupPageBtn: TButton; + + 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 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 extra_info: ICefDictionaryValue; var noJavascriptAccess, Result: Boolean); + procedure Chromium1OpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean); + + procedure ExtensionChrExtensionLoaded(Sender: TObject; const extension: ICefExtension); + procedure ExtensionChrExtensionLoadFailed(Sender: TObject; result: Integer); + procedure ExtensionChrExtensionUnloaded(Sender: TObject; const extension: ICefExtension); + procedure ExtensionChrLoadEnd(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); + procedure ExtensionChrLoadError(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring); + procedure ExtensionChrClose(Sender: TObject; const browser: ICefBrowser; var aAction: TCefCloseBrowserAction); + procedure ExtensionChrBeforeClose(Sender: TObject; const browser: ICefBrowser); + procedure ExtensionChrExtensionGetActiveBrowser(Sender: TObject; const extension: ICefExtension; const browser: ICefBrowser; include_incognito: Boolean; var aRsltBrowser: ICefBrowser); + + procedure GoBtnClick(Sender: TObject); + procedure Timer1Timer(Sender: TObject); + procedure LoadExtensionBtnClick(Sender: TObject); + procedure UnloadExtensionBtnClick(Sender: TObject); + procedure LoadPopupPageBtnClick(Sender: TObject); + + protected + FCanClose : boolean; + FClosing : boolean; + FExtension : ICefExtension; + + 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 ExtensionLoadedMsg(var aMessage : TMessage); message CEF_EXT_LOADED; + procedure ExtensionUnloadedMsg(var aMessage : TMessage); message CEF_EXT_UNLOADED; + procedure ExtensionErrorMsg(var aMessage : TMessage); message CEF_EXT_ERROR; + procedure ExtensionPopupLoadedMsg(var aMessage : TMessage); message CEF_EXT_POPUP_LOADED; + procedure ExtensionPopupErrorMsg(var aMessage : TMessage); message CEF_EXT_POPUP_ERROR; + procedure CheckExtensionMsg(var aMessage : TMessage); message CEF_EXT_CHECK_EXTENSION; + + procedure UpdateButtons; + end; + +var + Form1: TForm1; + +procedure CreateGlobalCEFApp; + +implementation + +{$R *.dfm} + +uses + uCEFApplication, uCefMiscFunctions, uCEFJson; + +// This demo shows how to load an extension that modifies the background color +// of the active browser. + +// This demo only allows to load the extension once. + +// The extension loaded is called "Set Page Color" and it's located in the +// CEF4Delphi\bin\set_page_color directory. It only has a browser action popup +// html that allows you to select the page background color. + +// It's necessary to unload the extension before you close the form. Notice that +// both TChromium components must be properly destroyed before allowing the form +// to close. + +// Load chrome://extensions-support/ to get a list of supported APIs + +// Destruction steps +// ================= +// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser in both +// browsers which triggers the TChromium.OnClose event. +// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy +// CEFWindowParent1 and CEFWindowParent2 in the main thread, which triggers +// the TChromium.OnBeforeClose event. +// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form. + +procedure CreateGlobalCEFApp; +begin + GlobalCEFApp := TCefApplication.Create; + GlobalCEFApp.LogFile := 'debug.log'; + GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE; +end; + +procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); +begin + if (FExtension <> nil) and FExtension.IsLoaded then + begin + CanClose := False; + showmessage('Unload the extension before closing this demo'); + exit; + end + else + FExtension := nil; + + CanClose := FCanClose and + (CEFWindowParent1 = nil) and + ((CEFWindowParent2 = nil) or not(ExtensionChr.Initialized)); + + if not(FClosing) then + begin + FClosing := True; + Visible := False; + Chromium1.CloseBrowser(True); + ExtensionChr.CloseBrowser(True); + end; +end; + +procedure TForm1.FormCreate(Sender: TObject); +begin + FCanClose := False; + FClosing := False; + FExtension := nil; + Chromium1.DefaultURL := AddressEdt.Text; +end; + +procedure TForm1.FormDestroy(Sender: TObject); +begin + FExtension := nil; +end; + +procedure TForm1.FormShow(Sender: TObject); +begin + if not(Chromium1.CreateBrowser(CEFWindowParent1)) then + Timer1.Enabled := True; + + UpdateButtons; +end; + +procedure TForm1.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); +begin + PostMessage(Handle, CEF_AFTERCREATED, 0, 0); +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 extra_info: ICefDictionaryValue; + var noJavascriptAccess, 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, DESTROY_MAIN_WINDOWPARENT, 0); + aAction := cbaDelay; +end; + +procedure TForm1.Chromium1OpenUrlFromTab(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; + const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; + userGesture: Boolean; out 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.ExtensionChrBeforeClose(Sender: TObject; + const browser: ICefBrowser); +begin + if FClosing then + begin + FCanClose := True; + PostMessage(Handle, WM_CLOSE, 0, 0); + end + else + PostMessage(Handle, CEF_EXT_CHECK_EXTENSION, 0, 0); +end; + +procedure TForm1.ExtensionChrClose(Sender: TObject; const browser: ICefBrowser; + var aAction: TCefCloseBrowserAction); +begin + PostMessage(Handle, CEF_DESTROY, DESTROY_EXT_WINDOWPARENT, 0); + aAction := cbaDelay; +end; + +procedure TForm1.ExtensionChrExtensionGetActiveBrowser(Sender: TObject; + const extension: ICefExtension; const browser: ICefBrowser; + include_incognito: Boolean; var aRsltBrowser: ICefBrowser); +begin + if (Chromium1 <> nil) and Chromium1.Initialized then + aRsltBrowser := Chromium1.Browser; +end; + +procedure TForm1.ExtensionChrExtensionLoaded(Sender: TObject; const extension: ICefExtension); +begin + FExtension := extension; + + PostMessage(Handle, CEF_EXT_LOADED, 0, 0); +end; + +procedure TForm1.ExtensionChrExtensionLoadFailed(Sender: TObject; result: Integer); +begin + PostMessage(Handle, CEF_EXT_ERROR, 0, result); +end; + +procedure TForm1.ExtensionChrExtensionUnloaded(Sender: TObject; const extension: ICefExtension); +begin + if (extension <> nil) and (FExtension <> nil) and extension.IsSame(FExtension) then + begin + FExtension := nil; + PostMessage(Handle, CEF_EXT_UNLOADED, 0, 0); + end; +end; + +procedure TForm1.ExtensionChrLoadEnd(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer); +begin + PostMessage(Handle, CEF_EXT_POPUP_LOADED, 0, 0); +end; + +procedure TForm1.ExtensionChrLoadError(Sender: TObject; + const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; + const errorText, failedUrl: ustring); +begin + PostMessage(Handle, CEF_EXT_POPUP_ERROR, 0, errorCode); +end; + +procedure TForm1.BrowserCreatedMsg(var aMessage : TMessage); +begin + Caption := 'Set Page Color Extension Demo'; + AddressPnl.Enabled := True; +end; + +procedure TForm1.BrowserDestroyMsg(var aMessage : TMessage); +begin + case aMessage.WParam of + DESTROY_MAIN_WINDOWPARENT : FreeAndNil(CEFWindowParent1); + DESTROY_EXT_WINDOWPARENT : FreeAndNil(CEFWindowParent2); + end; +end; + +procedure TForm1.GoBtnClick(Sender: TObject); +begin + Chromium1.LoadURL(AddressEdt.Text); +end; + +procedure TForm1.UpdateButtons; +begin + // This demo only allows to load the extension once. + + if ExtensionChr.Initialized then + begin + LoadExtensionBtn.Enabled := False; + UnloadExtensionBtn.Enabled := (FExtension <> nil); + LoadPopupPageBtn.Enabled := False; + end + else + begin + LoadExtensionBtn.Enabled := (FExtension = nil) and (CEFWindowParent2 <> nil); + UnloadExtensionBtn.Enabled := (FExtension <> nil); + LoadPopupPageBtn.Enabled := (FExtension <> nil); + end; +end; + +procedure TForm1.ExtensionLoadedMsg(var aMessage : TMessage); +var + TempManifest : TStringList; +begin + if (FExtension = nil) then exit; + + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension loaded successfully!'); + ExtensionMem.Lines.Add('Identifier: ' + FExtension.Identifier); + ExtensionMem.Lines.Add('Path: ' + FExtension.Path); + ExtensionMem.Lines.Add('IsLoaded: ' + BoolToStr(FExtension.IsLoaded, True)); + ExtensionMem.Lines.Add('Popup: ' + FExtension.BrowserActionPopup); + ExtensionMem.Lines.Add('Icon: ' + FExtension.BrowserActionIcon); + ExtensionMem.Lines.Add('URL: ' + FExtension.URL); + + TempManifest := TStringList.Create; + + if TCEFJson.Write(FExtension.Manifest, TempManifest) then + begin + ExtensionMem.Lines.Add('Manifest: ' + FExtension.Path); + ExtensionMem.Lines.AddStrings(TempManifest); + end; + + TempManifest.Free; + + UpdateButtons; +end; + +procedure TForm1.ExtensionUnloadedMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension unloaded successfully!'); + UpdateButtons; +end; + +procedure TForm1.ExtensionErrorMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension load failed. Result : ' + inttostr(aMessage.LParam)); + UpdateButtons; +end; + +procedure TForm1.ExtensionPopupLoadedMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension PopUp page loaded successfully!'); + UpdateButtons; +end; + +procedure TForm1.ExtensionPopupErrorMsg(var aMessage : TMessage); +begin + ExtensionMem.Lines.Add('--------------------------------'); + ExtensionMem.Lines.Add('Extension PopUp page load failed. Error code : ' + inttostr(aMessage.LParam)); + UpdateButtons; +end; + +procedure TForm1.CheckExtensionMsg(var aMessage : TMessage); +begin + if (FExtension <> nil) and not(FExtension.IsLoaded) then + begin + FExtension := nil; + UpdateButtons; + end; +end; + +procedure TForm1.LoadExtensionBtnClick(Sender: TObject); +var + TempExtensionDirectoryPath : ustring; +begin + if (FExtension = nil) then + begin + TempExtensionDirectoryPath := GetModulePath + 'set_page_color'; + ExtensionChr.LoadExtension(TempExtensionDirectoryPath); + end; +end; + +procedure TForm1.LoadPopupPageBtnClick(Sender: TObject); +begin + if (FExtension = nil) or ExtensionChr.Initialized then exit; + + ExtensionChr.DefaultURL := FExtension.URL + FExtension.BrowserActionPopup; + ExtensionChr.CreateBrowser(CEFWindowParent2); +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.UnloadExtensionBtnClick(Sender: TObject); +begin + if (FExtension <> nil) and FExtension.IsLoaded then + FExtension.Unload + else + begin + FExtension := nil; + UpdateButtons; + end; +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/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index 5c07b26b..36b77db6 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,7 +21,7 @@ - + diff --git a/source/uCEFApplicationCore.pas b/source/uCEFApplicationCore.pas index bf74122f..98235da0 100644 --- a/source/uCEFApplicationCore.pas +++ b/source/uCEFApplicationCore.pas @@ -62,7 +62,7 @@ uses const CEF_SUPPORTED_VERSION_MAJOR = 84; CEF_SUPPORTED_VERSION_MINOR = 3; - CEF_SUPPORTED_VERSION_RELEASE = 8; + CEF_SUPPORTED_VERSION_RELEASE = 10; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = 84; diff --git a/source/uCEFChromiumCore.pas b/source/uCEFChromiumCore.pas index e03ca2f8..1e0b30b3 100644 --- a/source/uCEFChromiumCore.pas +++ b/source/uCEFChromiumCore.pas @@ -87,6 +87,7 @@ type FMediaObserverReg : ICefRegistration; FDevToolsMsgObserver : ICefDevToolsMessageObserver; FDevToolsMsgObserverReg : ICefRegistration; + FExtensionHandler : ICefExtensionHandler; FDefaultUrl : ustring; FOptions : TChromiumOptions; FFontOptions : TChromiumFontOptions; @@ -281,6 +282,16 @@ type FOnDevToolsAgentAttached : TOnDevToolsAgentAttachedEvent; FOnDevToolsAgentDetached : TOnDevToolsAgentDetachedEvent; + // ICefExtensionHandler + FOnExtensionLoadFailed : TOnExtensionLoadFailedEvent; + FOnExtensionLoaded : TOnExtensionLoadedEvent; + FOnExtensionUnloaded : TOnExtensionUnloadedEvent; + FOnExtensionBeforeBackgroundBrowser : TOnBeforeBackgroundBrowserEvent; + FOnExtensionBeforeBrowser : TOnBeforeBrowserEvent; + FOnExtensionGetActiveBrowser : TOnGetActiveBrowserEvent; + FOnExtensionCanAccessBrowser : TOnCanAccessBrowserEvent; + FOnExtensionGetExtensionResource : TOnGetExtensionResourceEvent; + // Custom FOnTextResultAvailable : TOnTextResultAvailableEvent; FOnPdfPrintFinished : TOnPdfPrintFinishedEvent; @@ -386,12 +397,14 @@ type procedure DestroyResourceRequestHandler; procedure DestroyMediaObserver; procedure DestroyDevToolsMsgObserver; + procedure DestroyExtensionHandler; procedure DestroyAllHandlersAndObservers; procedure CreateReqContextHandler; procedure CreateResourceRequestHandler; procedure CreateMediaObserver; procedure CreateDevToolsMsgObserver; + procedure CreateExtensionHandler; procedure InitializeEvents; procedure InitializeSettings(var aSettings : TCefBrowserSettings); @@ -578,6 +591,16 @@ type procedure doOnDevToolsAgentAttached(const browser: ICefBrowser); virtual; procedure doOnDevToolsAgentDetached(const browser: ICefBrowser); virtual; + // ICefExtensionHandler + procedure doOnExtensionLoadFailed(result: TCefErrorcode); + procedure doOnExtensionLoaded(const extension: ICefExtension); + procedure doOnExtensionUnloaded(const extension: ICefExtension); + function doOnExtensionBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; + function doOnExtensionBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; + procedure doOnExtensionGetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser: ICefBrowser); + function doOnExtensionCanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; + function doOnExtensionGetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; + // Custom procedure doCookiesDeleted(numDeleted : integer); virtual; procedure doPdfPrintFinished(aResultOK : boolean); virtual; @@ -623,6 +646,7 @@ type function MustCreateCookieAccessFilter : boolean; virtual; function MustCreateRequestContextHandler : boolean; virtual; function MustCreateMediaObserver : boolean; virtual; + function MustCreateExtensionHandler : boolean; virtual; property ParentFormHandle : TCefWindowHandle read GetParentFormHandle; @@ -773,6 +797,13 @@ type procedure CreateRoute(const source: ICefMediaSource; const sink: ICefMediaSink); procedure GetDeviceInfo(const aMediaSink: ICefMediaSink); + // ICefRequestContext methods for extensions + function LoadExtension(const root_directory: ustring; const manifest: ICefDictionaryValue = nil; const handler: ICefExtensionHandler = nil; const requestContext : ICefRequestContext = nil) : boolean; + function DidLoadExtension(const extension_id: ustring): boolean; + function HasExtension(const extension_id: ustring): boolean; + function GetExtensions(const extension_ids: TStringList): boolean; + function GetExtension(const extension_id: ustring): ICefExtension; + property DefaultUrl : ustring read FDefaultUrl write FDefaultUrl; property Options : TChromiumOptions read FOptions write FOptions; property FontOptions : TChromiumFontOptions read FFontOptions write FFontOptions; @@ -794,6 +825,7 @@ type property MediaObserverReg : ICefRegistration read FMediaObserverReg; property DevToolsMsgObserver : ICefDevToolsMessageObserver read FDevToolsMsgObserver; property DevToolsMsgObserverReg : ICefRegistration read FDevToolsMsgObserverReg; + property ExtensionHandler : ICefExtensionHandler read FExtensionHandler; property MultithreadApp : boolean read GetMultithreadApp; property IsLoading : boolean read GetIsLoading; property HasDocument : boolean read GetHasDocument; @@ -1011,6 +1043,16 @@ type property OnDevToolsEvent : TOnDevToolsEventEvent read FOnDevToolsEvent write FOnDevToolsEvent; property OnDevToolsAgentAttached : TOnDevToolsAgentAttachedEvent read FOnDevToolsAgentAttached write FOnDevToolsAgentAttached; property OnDevToolsAgentDetached : TOnDevToolsAgentDetachedEvent read FOnDevToolsAgentDetached write FOnDevToolsAgentDetached; + + // ICefExtensionHandler + property OnExtensionLoadFailed : TOnExtensionLoadFailedEvent read FOnExtensionLoadFailed write FOnExtensionLoadFailed; + property OnExtensionLoaded : TOnExtensionLoadedEvent read FOnExtensionLoaded write FOnExtensionLoaded; + property OnExtensionUnloaded : TOnExtensionUnloadedEvent read FOnExtensionUnloaded write FOnExtensionUnloaded; + property OnExtensionBeforeBackgroundBrowser : TOnBeforeBackgroundBrowserEvent read FOnExtensionBeforeBackgroundBrowser write FOnExtensionBeforeBackgroundBrowser; + property OnExtensionBeforeBrowser : TOnBeforeBrowserEvent read FOnExtensionBeforeBrowser write FOnExtensionBeforeBrowser; + property OnExtensionGetActiveBrowser : TOnGetActiveBrowserEvent read FOnExtensionGetActiveBrowser write FOnExtensionGetActiveBrowser; + property OnExtensionCanAccessBrowser : TOnCanAccessBrowserEvent read FOnExtensionCanAccessBrowser write FOnExtensionCanAccessBrowser; + property OnExtensionGetExtensionResource : TOnGetExtensionResourceEvent read FOnExtensionGetExtensionResource write FOnExtensionGetExtensionResource; end; TBrowserInfo = class @@ -1094,7 +1136,7 @@ uses uCEFDownloadImageCallBack, uCEFCookieManager, uCEFRequestContextHandler, uCEFCookieVisitor, uCEFSetCookieCallback, uCEFResourceRequestHandler, uCEFMediaObserver, uCEFMediaRouteCreateCallback ,uCEFDevToolsMessageObserver, - uCEFMediaSinkDeviceInfoCallback, uCEFJson; + uCEFMediaSinkDeviceInfoCallback, uCEFJson, uCEFExtensionHandler; constructor TChromiumCore.Create(AOwner: TComponent); begin @@ -1114,6 +1156,7 @@ begin FMediaObserverReg := nil; FDevToolsMsgObserver := nil; FDevToolsMsgObserverReg := nil; + FExtensionHandler := nil; FOptions := nil; FFontOptions := nil; FDefaultEncoding := ''; @@ -1438,8 +1481,23 @@ begin FDevToolsMsgObserver := nil; end; +procedure TChromiumCore.DestroyExtensionHandler; +begin + try + if (FExtensionHandler <> nil) then + begin + FExtensionHandler.RemoveReferences; + FExtensionHandler := nil; + end; + except + on e : exception do + if CustomExceptionHandler('TChromiumCore.DestroyExtensionHandler', e) then raise; + end; +end; + procedure TChromiumCore.DestroyAllHandlersAndObservers; begin + DestroyExtensionHandler; DestroyDevToolsMsgObserver; DestroyMediaObserver; DestroyResourceRequestHandler; @@ -1468,6 +1526,13 @@ begin FDevToolsMsgObserver := TCustomDevToolsMessageObserver.Create(self); end; +procedure TChromiumCore.CreateExtensionHandler; +begin + if MustCreateExtensionHandler and + (FExtensionHandler = nil) then + FExtensionHandler := TCustomExtensionHandler.Create(self); +end; + procedure TChromiumCore.CreateResourceRequestHandler; begin if MustCreateResourceRequestHandler and @@ -1522,6 +1587,7 @@ begin CreateResourceRequestHandler; CreateMediaObserver; CreateDevToolsMsgObserver; + CreateExtensionHandler; aClient := FHandler; Result := True; @@ -1662,6 +1728,16 @@ begin FOnDevToolsAgentAttached := nil; FOnDevToolsAgentDetached := nil; + // ICefExtensionHandler + FOnExtensionLoadFailed := nil; + FOnExtensionLoaded := nil; + FOnExtensionUnloaded := nil; + FOnExtensionBeforeBackgroundBrowser := nil; + FOnExtensionBeforeBrowser := nil; + FOnExtensionGetActiveBrowser := nil; + FOnExtensionCanAccessBrowser := nil; + FOnExtensionGetExtensionResource := nil; + // Custom FOnTextResultAvailable := nil; FOnPdfPrintFinished := nil; @@ -1720,6 +1796,7 @@ begin CreateResourceRequestHandler; CreateMediaObserver; CreateDevToolsMsgObserver; + CreateExtensionHandler; if (aContext = nil) then begin @@ -1771,13 +1848,14 @@ begin (BrowserId = 0) and (aBrowserViewComp <> nil) and (GlobalCEFApp <> nil) and - GlobalCEFApp.GlobalContextInitialized and + GlobalCEFApp.GlobalContextInitialized and CreateClientHandler(False) then begin GetSettings(FBrowserSettings); CreateResourceRequestHandler; CreateMediaObserver; CreateDevToolsMsgObserver; + CreateExtensionHandler; if (aContext = nil) then begin @@ -4524,6 +4602,18 @@ begin assigned(FOnDevToolsAgentDetached); end; +function TChromiumCore.MustCreateExtensionHandler : boolean; +begin + Result := assigned(FOnExtensionLoadFailed) or + assigned(FOnExtensionLoaded) or + assigned(FOnExtensionUnloaded) or + assigned(FOnExtensionBeforeBackgroundBrowser) or + assigned(FOnExtensionBeforeBrowser) or + assigned(FOnExtensionGetActiveBrowser) or + assigned(FOnExtensionCanAccessBrowser) or + assigned(FOnExtensionGetExtensionResource); +end; + {$IFDEF MSWINDOWS} procedure TChromiumCore.PrefsAvailableMsg(aResultOK : boolean); begin @@ -5291,6 +5381,85 @@ begin FOnDevToolsAgentDetached(self, browser); end; +procedure TChromiumCore.doOnExtensionLoadFailed(result: TCefErrorcode); +begin + if assigned(FOnExtensionLoadFailed) then + FOnExtensionLoadFailed(self, result); +end; + +procedure TChromiumCore.doOnExtensionLoaded(const extension: ICefExtension); +begin + if assigned(FOnExtensionLoaded) then + FOnExtensionLoaded(self, extension); +end; + +procedure TChromiumCore.doOnExtensionUnloaded(const extension: ICefExtension); +begin + if assigned(FOnExtensionUnloaded) then + FOnExtensionUnloaded(self, extension); +end; + +function TChromiumCore.doOnExtensionBeforeBackgroundBrowser(const extension : ICefExtension; + const url : ustring; + var client : ICefClient; + var settings : TCefBrowserSettings) : boolean; +begin + Result := False; + + if assigned(FOnExtensionBeforeBackgroundBrowser) then + FOnExtensionBeforeBackgroundBrowser(self, extension, url, client, settings, Result); +end; + +function TChromiumCore.doOnExtensionBeforeBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + const active_browser : ICefBrowser; + index : Integer; + const url : ustring; + active : boolean; + var windowInfo : TCefWindowInfo; + var client : ICefClient; + var settings : TCefBrowserSettings) : boolean; +begin + Result := False; + + if assigned(FOnExtensionBeforeBrowser) then + FOnExtensionBeforeBrowser(self, extension, browser, active_browser, index, url, + active, windowInfo, client, settings, Result); +end; + +procedure TChromiumCore.doOnExtensionGetActiveBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + include_incognito : boolean; + var aRsltBrowser : ICefBrowser); +begin + aRsltBrowser := nil; + + if assigned(FOnExtensionGetActiveBrowser) then + FOnExtensionGetActiveBrowser(self, extension, browser, include_incognito, aRsltBrowser); +end; + +function TChromiumCore.doOnExtensionCanAccessBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + include_incognito : boolean; + const target_browser : ICefBrowser): boolean; +begin + Result := False; + + if assigned(FOnExtensionCanAccessBrowser) then + FOnExtensionCanAccessBrowser(self, extension, browser, include_incognito, target_browser, Result); +end; + +function TChromiumCore.doOnExtensionGetExtensionResource(const extension : ICefExtension; + const browser : ICefBrowser; + const file_ : ustring; + const callback : ICefGetExtensionResourceCallback): boolean; +begin + Result := False; + + if assigned(FOnExtensionGetExtensionResource) then + FOnExtensionGetExtensionResource(self, extension, browser, file_, callback, Result); +end; + procedure TChromiumCore.doOnFullScreenModeChange(const browser : ICefBrowser; fullscreen : Boolean); begin @@ -6194,6 +6363,104 @@ begin end; end; +function TChromiumCore.LoadExtension(const root_directory : ustring; + const manifest : ICefDictionaryValue; + const handler : ICefExtensionHandler; + const requestContext : ICefRequestContext) : boolean; +var + TempContext : ICefRequestContext; + TempHandler : ICefExtensionHandler; +begin + Result := False; + + // The global context must be initalized to load extensions + // This TChromium must not be initialized before loading an extension. + if (GlobalCEFApp = nil) or + not(GlobalCEFApp.GlobalContextInitialized) or + Initialized then + exit; + + // We use a custom request context if available or the global request context if not. + if (requestContext <> nil) then + TempContext := requestContext + else + TempContext := TCefRequestContextRef.Global; + + if (handler <> nil) then + TempHandler := handler + else + begin + // All TChromium events must be assigned before calling LoadExtension. + CreateExtensionHandler; + TempHandler := FExtensionHandler; + end; + + if (TempContext <> nil) then + try + TempContext.LoadExtension(root_directory, manifest, TempHandler); + Result := True; + finally + TempHandler := nil; + end; +end; + +function TChromiumCore.DidLoadExtension(const extension_id: ustring): boolean; +var + TempContext : ICefRequestContext; +begin + Result := False; + + if Initialized then + begin + TempContext := Browser.Host.RequestContext; + Result := (TempContext <> nil) and + TempContext.DidLoadExtension(extension_id); + end; +end; + +function TChromiumCore.HasExtension(const extension_id: ustring): boolean; +var + TempContext : ICefRequestContext; +begin + Result := False; + + if Initialized then + begin + TempContext := Browser.Host.RequestContext; + Result := (TempContext <> nil) and + TempContext.HasExtension(extension_id); + end; +end; + +function TChromiumCore.GetExtensions(const extension_ids: TStringList): boolean; +var + TempContext : ICefRequestContext; +begin + Result := False; + + if Initialized and (extension_ids <> nil) then + begin + TempContext := Browser.Host.RequestContext; + Result := (TempContext <> nil) and + TempContext.GetExtensions(extension_ids); + end; +end; + +function TChromiumCore.GetExtension(const extension_id: ustring): ICefExtension; +var + TempContext : ICefRequestContext; +begin + Result := nil; + + if Initialized then + begin + TempContext := Browser.Host.RequestContext; + + if (TempContext <> nil) then + Result := TempContext.GetExtension(extension_id); + end; +end; + {$IFDEF MSWINDOWS} function TChromiumCore.CopyDCToBitmapStream(aSrcDC : HDC; const aSrcRect : TRect; var aStream : TStream) : boolean; var diff --git a/source/uCEFChromiumEvents.pas b/source/uCEFChromiumEvents.pas index 91c2ce73..215dc698 100644 --- a/source/uCEFChromiumEvents.pas +++ b/source/uCEFChromiumEvents.pas @@ -187,6 +187,16 @@ type TOnDevToolsAgentAttachedEvent = procedure(Sender: TObject; const browser: ICefBrowser) of object; TOnDevToolsAgentDetachedEvent = procedure(Sender: TObject; const browser: ICefBrowser) of object; + // ICefExtensionHandler + TOnExtensionLoadFailedEvent = procedure(Sender: TObject; result: TCefErrorcode) of object; + TOnExtensionLoadedEvent = procedure(Sender: TObject; const extension: ICefExtension) of object; + TOnExtensionUnloadedEvent = procedure(Sender: TObject; const extension: ICefExtension) of object; + TOnBeforeBackgroundBrowserEvent = procedure(Sender: TObject; const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings; var aResult : boolean) of object; + TOnBeforeBrowserEvent = procedure(Sender: TObject; const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var aResult : boolean) of object; + TOnGetActiveBrowserEvent = procedure(Sender: TObject; const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser : ICefBrowser) of object; + TOnCanAccessBrowserEvent = procedure(Sender: TObject; const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser; var aResult : boolean) of object; + TOnGetExtensionResourceEvent = procedure(Sender: TObject; const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback; var aResult : boolean) of object; + // Custom TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : ustring) of object; TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object; diff --git a/source/uCEFExtension.pas b/source/uCEFExtension.pas index 9e88d240..e6ba8f48 100644 --- a/source/uCEFExtension.pas +++ b/source/uCEFExtension.pas @@ -62,6 +62,16 @@ type function GetLoaderContext: ICefRequestContext; function IsLoaded : boolean; procedure unload; + function GetPopup(const aParent : ustring) : ustring; + function GetIcon(const aParent : ustring) : ustring; + function GetBrowserActionPopup : ustring; + function GetBrowserActionIcon : ustring; + function GetPageActionPopup : ustring; + function GetPageActionIcon : ustring; + function GetOptionsPage : ustring; + function GetOptionsUIPage : ustring; + function GetBackgroundPage : ustring; + function GetURL : ustring; public class function UnWrap(data: Pointer): ICefExtension; @@ -70,7 +80,8 @@ type implementation uses - uCEFMiscFunctions, uCEFLibFunctions, uCEFDictionaryValue, uCEFRequestContext, uCEFExtensionHandler; + uCEFMiscFunctions, uCEFLibFunctions, uCEFDictionaryValue, uCEFRequestContext, + uCEFExtensionHandler, uCEFJson; function TCefExtensionRef.GetIdentifier : ustring; begin @@ -112,6 +123,101 @@ begin PCefExtension(FData)^.unload(PCefExtension(FData)); end; +function TCefExtensionRef.GetPopup(const aParent : ustring) : ustring; +var + TempManifest, TempBrowserAction : ICefDictionaryValue; +begin + Result := ''; + TempManifest := GetManifest; + + if (TempManifest <> nil) and + TCEFJson.ReadDictionary(TempManifest, aParent, TempBrowserAction) then + TCEFJson.ReadString(TempBrowserAction, 'default_popup', Result); +end; + +function TCefExtensionRef.GetIcon(const aParent : ustring) : ustring; +var + TempManifest, TempBrowserAction, TempDefIcon : ICefDictionaryValue; + TempResult : ustring; +begin + Result := ''; + TempManifest := GetManifest; + + if (TempManifest <> nil) and + TCEFJson.ReadDictionary(TempManifest, aParent, TempBrowserAction) then + begin + if TCEFJson.ReadString(TempBrowserAction, 'default_icon', TempResult) then + Result := TempResult + else + if TCEFJson.ReadDictionary(TempManifest, 'default_icon', TempDefIcon) and + (TCEFJson.ReadString(TempDefIcon, '128', TempResult) or + TCEFJson.ReadString(TempDefIcon, '48', TempResult) or + TCEFJson.ReadString(TempDefIcon, '32', TempResult) or + TCEFJson.ReadString(TempDefIcon, '16', TempResult)) then + Result := TempResult + end; +end; + +function TCefExtensionRef.GetBrowserActionPopup : ustring; +begin + Result := GetPopup('browser_action'); +end; + +function TCefExtensionRef.GetBrowserActionIcon : ustring; +begin + Result := GetIcon('browser_action'); +end; + +function TCefExtensionRef.GetPageActionPopup : ustring; +begin + Result := GetPopup('page_action'); +end; + +function TCefExtensionRef.GetPageActionIcon : ustring; +begin + Result := GetIcon('page_action'); +end; + +function TCefExtensionRef.GetOptionsPage : ustring; +var + TempManifest : ICefDictionaryValue; +begin + Result := ''; + TempManifest := GetManifest; + + if (TempManifest <> nil) then + TCEFJson.ReadString(TempManifest, 'options_page', Result); +end; + +function TCefExtensionRef.GetOptionsUIPage : ustring; +var + TempManifest, TempOptions : ICefDictionaryValue; +begin + Result := ''; + TempManifest := GetManifest; + + if (TempManifest <> nil) and + TCEFJson.ReadDictionary(TempManifest, 'options_ui', TempOptions) then + TCEFJson.ReadString(TempOptions, 'page', Result); +end; + +function TCefExtensionRef.GetBackgroundPage : ustring; +var + TempManifest, TempBackground : ICefDictionaryValue; +begin + Result := ''; + TempManifest := GetManifest; + + if (TempManifest <> nil) and + TCEFJson.ReadDictionary(TempManifest, 'background', TempBackground) then + TCEFJson.ReadString(TempBackground, 'page', Result); +end; + +function TCefExtensionRef.GetURL : ustring; +begin + Result := 'chrome-extension://' + GetIdentifier + '/'; +end; + class function TCefExtensionRef.UnWrap(data: Pointer): ICefExtension; begin if (data <> nil) then diff --git a/source/uCEFExtensionHandler.pas b/source/uCEFExtensionHandler.pas index a7090dc1..465e7d42 100644 --- a/source/uCEFExtensionHandler.pas +++ b/source/uCEFExtensionHandler.pas @@ -1,4 +1,4 @@ -// ************************************************************************ +// ************************************************************************ // ***************************** CEF4Delphi ******************************* // ************************************************************************ // @@ -36,22 +36,22 @@ *) unit uCEFExtensionHandler; - -{$IFDEF FPC} + +{$IFDEF FPC} {$MODE OBJFPC}{$H+} {$ENDIF} {$IFNDEF CPUX64}{$ALIGN ON}{$ENDIF} {$MINENUMSIZE 4} -{$I cef.inc} - -interface - -uses - uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; - -type +{$I cef.inc} + +interface + +uses + uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; + +type TCefExtensionHandlerRef = class(TCefBaseRefCountedRef, ICefExtensionHandler) protected procedure OnExtensionLoadFailed(result: TCefErrorcode); @@ -59,61 +59,88 @@ type procedure OnExtensionUnloaded(const extension: ICefExtension); function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; - function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; + procedure GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser: ICefBrowser); function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; + procedure RemoveReferences; public class function UnWrap(data: Pointer): ICefExtensionHandler; - end; - - TCefExtensionHandlerOwn = class(TCefBaseRefCountedOwn, ICefExtensionHandler) + end; + + TCefExtensionHandlerOwn = class(TCefBaseRefCountedOwn, ICefExtensionHandler) protected procedure OnExtensionLoadFailed(result: TCefErrorcode); virtual; procedure OnExtensionLoaded(const extension: ICefExtension); virtual; procedure OnExtensionUnloaded(const extension: ICefExtension); virtual; function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; virtual; - function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; - function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; virtual; + function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; virtual; + procedure GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser: ICefBrowser); virtual; function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; virtual; function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; virtual; + procedure RemoveReferences; virtual; public constructor Create; virtual; - end; - -implementation - -uses - uCEFMiscFunctions, uCEFLibFunctions, uCEFGetExtensionResourceCallback, uCEFExtension, uCEFBrowser, uCEFClient; - - -// *************************************************************************** -// ************************ TCefExtensionHandlerRef ************************** -// *************************************************************************** - -procedure TCefExtensionHandlerRef.OnExtensionLoadFailed(result: TCefErrorcode); -begin - -end; - + end; + + TCustomExtensionHandler = class(TCefExtensionHandlerOwn) + protected + FEvents : Pointer; + + procedure OnExtensionLoadFailed(result: TCefErrorcode); override; + procedure OnExtensionLoaded(const extension: ICefExtension); override; + procedure OnExtensionUnloaded(const extension: ICefExtension); override; + function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; override; + function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; override; + procedure GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser: ICefBrowser); override; + function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; override; + function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; override; + procedure RemoveReferences; override; + + public + constructor Create(const events: IChromiumEvents); reintroduce; + destructor Destroy; override; + end; + +implementation + +uses + {$IFDEF DELPHI16_UP} + System.SysUtils, + {$ELSE} + SysUtils, + {$ENDIF} + uCEFMiscFunctions, uCEFLibFunctions, uCEFGetExtensionResourceCallback, + uCEFExtension, uCEFBrowser, uCEFClient; + + +// *************************************************************************** +// ************************ TCefExtensionHandlerRef ************************** +// *************************************************************************** + +procedure TCefExtensionHandlerRef.OnExtensionLoadFailed(result: TCefErrorcode); +begin + // +end; + procedure TCefExtensionHandlerRef.OnExtensionLoaded(const extension: ICefExtension); -begin - -end; +begin + // +end; procedure TCefExtensionHandlerRef.OnExtensionUnloaded(const extension: ICefExtension); -begin - -end; +begin + // +end; function TCefExtensionHandlerRef.OnBeforeBackgroundBrowser(const extension : ICefExtension; const url : ustring; var client : ICefClient; var settings : TCefBrowserSettings) : boolean; -begin - Result := False; -end; +begin + Result := False; +end; function TCefExtensionHandlerRef.OnBeforeBrowser(const extension : ICefExtension; const browser : ICefBrowser; @@ -125,78 +152,70 @@ function TCefExtensionHandlerRef.OnBeforeBrowser(const extension : ICefExte var client : ICefClient; var settings : TCefBrowserSettings) : boolean; begin - Result := True; + Result := False; end; -function TCefExtensionHandlerRef.GetActiveBrowser(const extension : ICefExtension; - const browser : ICefBrowser; - include_incognito : boolean): ICefBrowser; -begin - Result := TCefBrowserRef.UnWrap(PCefExtensionHandler(FData)^.get_active_browser(PCefExtensionHandler(FData), - CefGetData(extension), - CefGetData(browser), - Ord(include_incognito))); -end; +procedure TCefExtensionHandlerRef.GetActiveBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + include_incognito : boolean; + var aRsltBrowser : ICefBrowser); +begin + aRsltBrowser := nil; +end; function TCefExtensionHandlerRef.CanAccessBrowser(const extension : ICefExtension; const browser : ICefBrowser; include_incognito : boolean; const target_browser : ICefBrowser): boolean; -begin - Result := PCefExtensionHandler(FData)^.can_access_browser(PCefExtensionHandler(FData), - CefGetData(extension), - CefGetData(browser), - Ord(include_incognito), - CefGetData(target_browser)) <> 0; -end; +begin + Result := True; +end; function TCefExtensionHandlerRef.GetExtensionResource(const extension : ICefExtension; const browser : ICefBrowser; const file_ : ustring; const callback : ICefGetExtensionResourceCallback): boolean; -var - TempFile : TCefString; -begin - TempFile := CefString(file_); - Result := PCefExtensionHandler(FData)^.get_extension_resource(PCefExtensionHandler(FData), - CefGetData(extension), - CefGetData(browser), - @TempFile, - CefGetData(callback)) <> 0; -end; +begin + Result := False; +end; -class function TCefExtensionHandlerRef.UnWrap(data: Pointer): ICefExtensionHandler; +procedure TCefExtensionHandlerRef.RemoveReferences; +begin + // +end; + +class function TCefExtensionHandlerRef.UnWrap(data: Pointer): ICefExtensionHandler; begin if (data <> nil) then Result := Create(data) as ICefExtensionHandler else Result := nil; -end; - - -// *************************************************************************** -// ************************ TCefExtensionHandlerOwn ************************** -// *************************************************************************** - -procedure cef_extension_handler_on_extension_load_failed(self : PCefExtensionHandler; - result : TCefErrorcode); stdcall; -var +end; + + +// *************************************************************************** +// ************************ TCefExtensionHandlerOwn ************************** +// *************************************************************************** + +procedure cef_extension_handler_on_extension_load_failed(self : PCefExtensionHandler; + result : TCefErrorcode); stdcall; +var TempObject : TObject; begin - TempObject := CefGetObject(self); - - if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then - TCefExtensionHandlerOwn(TempObject).OnExtensionLoadFailed(result); -end; - + TempObject := CefGetObject(self); + + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then + TCefExtensionHandlerOwn(TempObject).OnExtensionLoadFailed(result); +end; + procedure cef_extension_handler_on_extension_loaded(self : PCefExtensionHandler; extension : PCefExtension); stdcall; var TempObject : TObject; begin - TempObject := CefGetObject(self); - - if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then + TempObject := CefGetObject(self); + + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then TCefExtensionHandlerOwn(TempObject).OnExtensionLoaded(TCefExtensionRef.UnWrap(extension)); end; @@ -205,9 +224,9 @@ procedure cef_extension_handler_on_extension_unloaded(self : PCefExtensionH var TempObject : TObject; begin - TempObject := CefGetObject(self); - - if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then + TempObject := CefGetObject(self); + + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then TCefExtensionHandlerOwn(TempObject).OnExtensionUnloaded(TCefExtensionRef.UnWrap(extension)); end; @@ -225,20 +244,21 @@ begin TempObject := CefGetObject(self); TempClient := TCefClientRef.UnWrap(client); - if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then + + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then Result := Ord(TCefExtensionHandlerOwn(TempObject).OnBeforeBackgroundBrowser(TCefExtensionRef.UnWrap(extension), - CefString(url), - TempClient, - settings^)); - - if (TempClient = nil) then + CefString(url), + TempClient, + settings^)); + + if (TempClient = nil) then client := nil else if not(TempClient.SameAs(client)) then client := TempClient.Wrap; - finally - TempClient := nil; - end; + finally + TempClient := nil; + end; end; function cef_extension_handler_on_before_browser( self : PCefExtensionHandler; @@ -258,27 +278,27 @@ begin try Result := Ord(True); TempObject := CefGetObject(self); - TempClient := TCefClientRef.UnWrap(client); + TempClient := TCefClientRef.UnWrap(client); - if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then - Result := Ord(TCefExtensionHandlerOwn(TempObject).OnBeforeBrowser(TCefExtensionRef.UnWrap(extension), - TCefBrowserRef.UnWrap(browser), - TCefBrowserRef.UnWrap(active_browser), - index, - CefString(url), - active <> 0, - windowInfo^, - TempClient, - settings^)); - - if (TempClient = nil) then + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then + Result := Ord(TCefExtensionHandlerOwn(TempObject).OnBeforeBrowser(TCefExtensionRef.UnWrap(extension), + TCefBrowserRef.UnWrap(browser), + TCefBrowserRef.UnWrap(active_browser), + index, + CefString(url), + active <> 0, + windowInfo^, + TempClient, + settings^)); + + if (TempClient = nil) then client := nil else if not(TempClient.SameAs(client)) then client := TempClient.Wrap; - finally - TempClient := nil; - end; + finally + TempClient := nil; + end; end; function cef_extension_handler_get_active_browser(self : PCefExtensionHandler; @@ -286,15 +306,25 @@ function cef_extension_handler_get_active_browser(self : PCefExtens browser : PCefBrowser; include_incognito : Integer): PCefBrowser; stdcall; var - TempObject : TObject; + TempObject : TObject; + TempBrowser : ICefBrowser; begin - Result := nil; - TempObject := CefGetObject(self); - + Result := nil; + TempBrowser := nil; + TempObject := CefGetObject(self); + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then - Result := CefGetData(TCefExtensionHandlerOwn(TempObject).GetActiveBrowser(TCefExtensionRef.UnWrap(extension), - TCefBrowserRef.UnWrap(browser), - include_incognito <> 0)); + try + TCefExtensionHandlerOwn(TempObject).GetActiveBrowser(TCefExtensionRef.UnWrap(extension), + TCefBrowserRef.UnWrap(browser), + include_incognito <> 0, + TempBrowser); + + if (TempBrowser <> nil) and (TempBrowser is TCefBrowserRef) then + Result := TCefBrowserRef(TempBrowser).wrap; + finally + TempBrowser := nil; + end; end; function cef_extension_handler_can_access_browser(self : PCefExtensionHandler; @@ -306,8 +336,8 @@ var TempObject : TObject; begin Result := Ord(True); - TempObject := CefGetObject(self); - + TempObject := CefGetObject(self); + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then Result := Ord(TCefExtensionHandlerOwn(TempObject).CanAccessBrowser(TCefExtensionRef.UnWrap(extension), TCefBrowserRef.UnWrap(browser), @@ -320,22 +350,22 @@ function cef_extension_handler_get_extension_resource( self : PCefExte browser : PCefBrowser; const file_ : PCefString; callback : PCefGetExtensionResourceCallback): Integer; stdcall; -var +var TempObject : TObject; begin Result := Ord(False); - TempObject := CefGetObject(self); - - if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then + TempObject := CefGetObject(self); + + if (TempObject <> nil) and (TempObject is TCefExtensionHandlerOwn) then Result := Ord(TCefExtensionHandlerOwn(TempObject).GetExtensionResource(TCefExtensionRef.UnWrap(extension), TCefBrowserRef.UnWrap(browser), CefString(file_), TCefGetExtensionResourceCallbackRef.UnWrap(callback))); end; - -constructor TCefExtensionHandlerOwn.Create; -begin - inherited CreateData(SizeOf(TCefExtensionHandler)); + +constructor TCefExtensionHandlerOwn.Create; +begin + inherited CreateData(SizeOf(TCefExtensionHandler)); with PCefExtensionHandler(FData)^ do begin @@ -348,21 +378,23 @@ begin can_access_browser := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_can_access_browser; get_extension_resource := {$IFDEF FPC}@{$ENDIF}cef_extension_handler_get_extension_resource; end; -end; - -procedure TCefExtensionHandlerOwn.OnExtensionLoadFailed(result: TCefErrorcode); -begin - -end; - +end; + +procedure TCefExtensionHandlerOwn.OnExtensionLoadFailed(result: TCefErrorcode); +begin + // +end; + procedure TCefExtensionHandlerOwn.OnExtensionLoaded(const extension: ICefExtension); begin - + + // end; procedure TCefExtensionHandlerOwn.OnExtensionUnloaded(const extension: ICefExtension); begin - + + // end; function TCefExtensionHandlerOwn.OnBeforeBackgroundBrowser(const extension : ICefExtension; @@ -370,7 +402,7 @@ function TCefExtensionHandlerOwn.OnBeforeBackgroundBrowser(const extension : ICe var client : ICefClient; var settings : TCefBrowserSettings) : boolean; begin - Result := True; + Result := False; end; function TCefExtensionHandlerOwn.OnBeforeBrowser(const extension : ICefExtension; @@ -383,14 +415,15 @@ function TCefExtensionHandlerOwn.OnBeforeBrowser(const extension : ICefExte var client : ICefClient; var settings : TCefBrowserSettings) : boolean; begin - Result := True; + Result := False; end; -function TCefExtensionHandlerOwn.GetActiveBrowser(const extension : ICefExtension; - const browser : ICefBrowser; - include_incognito : boolean): ICefBrowser; +procedure TCefExtensionHandlerOwn.GetActiveBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + include_incognito : boolean; + var aRsltBrowser : ICefBrowser); begin - Result := nil; + // end; function TCefExtensionHandlerOwn.CanAccessBrowser(const extension : ICefExtension; @@ -398,15 +431,179 @@ function TCefExtensionHandlerOwn.CanAccessBrowser(const extension : ICef include_incognito : boolean; const target_browser : ICefBrowser): boolean; begin - Result := True; + Result := True; end; function TCefExtensionHandlerOwn.GetExtensionResource(const extension : ICefExtension; const browser : ICefBrowser; const file_ : ustring; const callback : ICefGetExtensionResourceCallback): boolean; -begin - Result := False; -end; - -end. +begin + Result := False; +end; + +procedure TCefExtensionHandlerOwn.RemoveReferences; +begin + // +end; + +// *************************************************************************** +// ************************ TCustomExtensionHandler ************************** +// *************************************************************************** + +constructor TCustomExtensionHandler.Create(const events: IChromiumEvents); +begin + inherited Create; + + FEvents := Pointer(events); +end; + +destructor TCustomExtensionHandler.Destroy; +begin + RemoveReferences; + + inherited Destroy; +end; + +procedure TCustomExtensionHandler.RemoveReferences; +begin + FEvents := nil; +end; + +procedure TCustomExtensionHandler.OnExtensionLoadFailed(result: TCefErrorcode); +begin + try + if (FEvents <> nil) then + IChromiumEvents(FEvents).doOnExtensionLoadFailed(result); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.OnExtensionLoadFailed', e) then raise; + end; +end; + +procedure TCustomExtensionHandler.OnExtensionLoaded(const extension: ICefExtension); +begin + try + if (FEvents <> nil) then + IChromiumEvents(FEvents).doOnExtensionLoaded(extension); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.OnExtensionLoaded', e) then raise; + end; +end; + +procedure TCustomExtensionHandler.OnExtensionUnloaded(const extension: ICefExtension); +begin + try + if (FEvents <> nil) then + IChromiumEvents(FEvents).doOnExtensionUnloaded(extension); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.OnExtensionUnloaded', e) then raise; + end; +end; + +function TCustomExtensionHandler.OnBeforeBackgroundBrowser(const extension : ICefExtension; + const url : ustring; + var client : ICefClient; + var settings : TCefBrowserSettings) : boolean; +begin + Result := False; + + try + if (FEvents <> nil) then + Result := IChromiumEvents(FEvents).doOnExtensionBeforeBackgroundBrowser(extension, + url, + client, + settings); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.OnBeforeBackgroundBrowser', e) then raise; + end; +end; + +function TCustomExtensionHandler.OnBeforeBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + const active_browser : ICefBrowser; + index : Integer; + const url : ustring; + active : boolean; + var windowInfo : TCefWindowInfo; + var client : ICefClient; + var settings : TCefBrowserSettings) : boolean; +begin + Result := False; + + try + if (FEvents <> nil) then + Result := IChromiumEvents(FEvents).doOnExtensionBeforeBrowser(extension, + browser, + active_browser, + index, + url, + active, + windowInfo, + client, + settings); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.OnBeforeBrowser', e) then raise; + end; +end; + +procedure TCustomExtensionHandler.GetActiveBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + include_incognito : boolean; + var aRsltBrowser : ICefBrowser); +begin + try + if (FEvents <> nil) then + IChromiumEvents(FEvents).doOnExtensionGetActiveBrowser(extension, + browser, + include_incognito, + aRsltBrowser); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.GetActiveBrowser', e) then raise; + end; +end; + +function TCustomExtensionHandler.CanAccessBrowser(const extension : ICefExtension; + const browser : ICefBrowser; + include_incognito : boolean; + const target_browser : ICefBrowser): boolean; +begin + Result := True; + + try + if (FEvents <> nil) then + Result := IChromiumEvents(FEvents).doOnExtensionCanAccessBrowser(extension, + browser, + include_incognito, + target_browser); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.CanAccessBrowser', e) then raise; + end; +end; + +function TCustomExtensionHandler.GetExtensionResource(const extension : ICefExtension; + const browser : ICefBrowser; + const file_ : ustring; + const callback : ICefGetExtensionResourceCallback): boolean; +begin + Result := False; + + try + if (FEvents <> nil) then + Result := IChromiumEvents(FEvents).doOnExtensionGetExtensionResource(extension, + browser, + file_, + callback); + except + on e : exception do + if CustomExceptionHandler('TCustomExtensionHandler.GetExtensionResource', e) then raise; + end; +end; + +end. diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index 3108daa0..d0587227 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -440,6 +440,16 @@ type procedure doOnDevToolsAgentAttached(const browser: ICefBrowser); procedure doOnDevToolsAgentDetached(const browser: ICefBrowser); + // ICefExtensionHandler + procedure doOnExtensionLoadFailed(result: TCefErrorcode); + procedure doOnExtensionLoaded(const extension: ICefExtension); + procedure doOnExtensionUnloaded(const extension: ICefExtension); + function doOnExtensionBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; + function doOnExtensionBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; + procedure doOnExtensionGetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser: ICefBrowser); + function doOnExtensionCanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; + function doOnExtensionGetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; + // Custom procedure doCookiesDeleted(numDeleted : integer); procedure doPdfPrintFinished(aResultOK : boolean); @@ -1811,9 +1821,11 @@ type procedure OnExtensionUnloaded(const extension: ICefExtension); function OnBeforeBackgroundBrowser(const extension: ICefExtension; const url: ustring; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; function OnBeforeBrowser(const extension: ICefExtension; const browser, active_browser: ICefBrowser; index: Integer; const url: ustring; active: boolean; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings) : boolean; - function GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean): ICefBrowser; + procedure GetActiveBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; var aRsltBrowser: ICefBrowser); function CanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean; function GetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean; + + procedure RemoveReferences; // custom procedure to clear all references end; // TCefExtension @@ -1828,12 +1840,28 @@ type function GetLoaderContext : ICefRequestContext; function IsLoaded : boolean; procedure unload; + function GetBrowserActionPopup : ustring; + function GetBrowserActionIcon : ustring; + function GetPageActionPopup : ustring; + function GetPageActionIcon : ustring; + function GetOptionsPage : ustring; + function GetOptionsUIPage : ustring; + function GetBackgroundPage : ustring; + function GetURL : ustring; - property Identifier : ustring read GetIdentifier; - property Path : ustring read GetPath; - property Manifest : ICefDictionaryValue read GetManifest; - property Handler : ICefExtensionHandler read GetHandler; - property LoaderContext : ICefRequestContext read GetLoaderContext; + property Identifier : ustring read GetIdentifier; + property Path : ustring read GetPath; + property Manifest : ICefDictionaryValue read GetManifest; + property Handler : ICefExtensionHandler read GetHandler; + property LoaderContext : ICefRequestContext read GetLoaderContext; + property BrowserActionPopup : ustring read GetBrowserActionPopup; + property BrowserActionIcon : ustring read GetBrowserActionIcon; + property PageActionPopup : ustring read GetPageActionPopup; + property PageActionIcon : ustring read GetPageActionIcon; + property OptionsPage : ustring read GetOptionsPage; + property OptionsUIPage : ustring read GetOptionsUIPage; + property BackgroundPage : ustring read GetBackgroundPage; + property URL : ustring read GetURL; end; // TCefLoadHandler diff --git a/source/uCEFJson.pas b/source/uCEFJson.pas index b7b8aa48..518e0e88 100644 --- a/source/uCEFJson.pas +++ b/source/uCEFJson.pas @@ -63,7 +63,7 @@ type class function ReadBoolean(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : boolean) : boolean; class function ReadInteger(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : integer) : boolean; class function ReadDouble(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : double) : boolean; - class function ReadString(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : string) : boolean; + class function ReadString(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : ustring) : boolean; class function ReadBinary(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : ICefBinaryValue) : boolean; class function ReadDictionary(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : ICefDictionaryValue) : boolean; class function ReadList(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : ICefListValue) : boolean; @@ -142,7 +142,7 @@ begin end; end; -class function TCEFJson.ReadString(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : string) : boolean; +class function TCEFJson.ReadString(const aDictionary : ICefDictionaryValue; const aKey : string; var aValue : ustring) : boolean; var TempValue : ICefValue; begin diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index 2b7e84f9..ae0fa380 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 172, + "InternalVersion" : 173, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "84.3.8.0" + "Version" : "84.3.10.0" } ], "UpdatePackageData" : {