You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-06-12 22:07:39 +02:00
Update to CEF 104.4.18
This commit is contained in:
14
README.md
14
README.md
@ -3,15 +3,15 @@ CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chro
|
|||||||
|
|
||||||
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
|
CEF4Delphi is based on DCEF3 and fpCEF3. The original license of those projects still applies to CEF4Delphi. Read the license terms in the first lines of any *.pas file.
|
||||||
|
|
||||||
CEF4Delphi uses CEF 103.0.12 which includes Chromium 103.0.5060.134.
|
CEF4Delphi uses CEF 104.4.18 which includes Chromium 104.0.5112.81.
|
||||||
|
|
||||||
The CEF binaries used by CEF4Delphi are available for download at Spotify :
|
The CEF binaries used by CEF4Delphi are available for download at Spotify :
|
||||||
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_103.0.12%2Bg8eb56c7%2Bchromium-103.0.5060.134_windows32.tar.bz2)
|
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_104.4.18%2Bg2587cf2%2Bchromium-104.0.5112.81_windows32.tar.bz2)
|
||||||
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_103.0.12%2Bg8eb56c7%2Bchromium-103.0.5060.134_windows64.tar.bz2)
|
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_104.4.18%2Bg2587cf2%2Bchromium-104.0.5112.81_windows64.tar.bz2)
|
||||||
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_103.0.12%2Bg8eb56c7%2Bchromium-103.0.5060.134_linux64.tar.bz2)
|
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_104.4.18%2Bg2587cf2%2Bchromium-104.0.5112.81_linux64.tar.bz2)
|
||||||
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_103.0.12%2Bg8eb56c7%2Bchromium-103.0.5060.134_linuxarm.tar.bz2)
|
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_104.4.18%2Bg2587cf2%2Bchromium-104.0.5112.81_linux64.tar.bz2)
|
||||||
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_103.0.12%2Bg8eb56c7%2Bchromium-103.0.5060.134_linuxarm64.tar.bz2)
|
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_104.4.18%2Bg2587cf2%2Bchromium-104.0.5112.81_linuxarm64.tar.bz2)
|
||||||
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_103.0.12%2Bg8eb56c7%2Bchromium-103.0.5060.134_macosx64.tar.bz2)
|
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_104.4.18%2Bg2587cf2%2Bchromium-104.0.5112.81_macosx64.tar.bz2)
|
||||||
|
|
||||||
CEF4Delphi was developed and tested on Delphi 11.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.2/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
CEF4Delphi was developed and tested on Delphi 11.1 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3, Delphi 10.4 and Lazarus 2.2.2/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.
|
||||||
|
|
||||||
|
@ -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
|
@ -0,0 +1,75 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2018 Salvador D�az Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
program JSSharedMemoryProcMessage;
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF DELPHI16_UP}
|
||||||
|
Vcl.Forms,
|
||||||
|
WinApi.Windows,
|
||||||
|
{$ELSE}
|
||||||
|
Forms,
|
||||||
|
Windows,
|
||||||
|
{$ENDIF }
|
||||||
|
uCEFApplication,
|
||||||
|
uMainForm in 'uMainForm.pas' {MainForm};
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
|
begin
|
||||||
|
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||||
|
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
if GlobalCEFApp.StartMainProcess then
|
||||||
|
begin
|
||||||
|
//ReportMemoryLeaksOnShutdown := True;
|
||||||
|
|
||||||
|
Application.Initialize;
|
||||||
|
Application.MainFormOnTaskbar := True;
|
||||||
|
Application.CreateForm(TMainForm, MainForm);
|
||||||
|
Application.Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// This is not really necessary to fix the bug #89 but if you free GlobalCEFApp in a different unit
|
||||||
|
// then you can call 'FreeAndNil' without adding SysUtils to this DPR.
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
end.
|
File diff suppressed because it is too large
Load Diff
507
demos/Delphi_VCL/JavaScript/JSSharedMemoryProcMessage/cef.inc
Normal file
507
demos/Delphi_VCL/JavaScript/JSSharedMemoryProcMessage/cef.inc
Normal file
@ -0,0 +1,507 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2017 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
// The complete list of compiler versions is here :
|
||||||
|
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||||
|
|
||||||
|
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||||
|
|
||||||
|
// Delphi 5
|
||||||
|
{$IFDEF VER130}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 6
|
||||||
|
{$IFDEF VER140}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 7
|
||||||
|
{$IFDEF VER150}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 8
|
||||||
|
{$IFDEF VER160}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2005
|
||||||
|
{$IFDEF VER170}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
// Delphi 2007
|
||||||
|
{$IFDEF VER185}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
// Delphi 2006
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2009
|
||||||
|
{$IFDEF VER200}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
//Delphi 2010
|
||||||
|
{$IFDEF VER210}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE
|
||||||
|
{$IFDEF VER220}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||||
|
{$IFDEF VER230}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE3
|
||||||
|
{$IFDEF VER240}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE4
|
||||||
|
{$IFDEF VER250}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE5
|
||||||
|
{$IFDEF VER260}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE6
|
||||||
|
{$IFDEF VER270}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE7
|
||||||
|
{$IFDEF VER280}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE8
|
||||||
|
{$IFDEF VER290}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$ENDIF VER290}
|
||||||
|
|
||||||
|
// Rad Studio 10 - Delphi Seattle
|
||||||
|
{$IFDEF VER300}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.1 - Delphi Berlin
|
||||||
|
{$IFDEF VER310}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.2 - Delphi Tokyo
|
||||||
|
{$IFDEF VER320}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.3 - Delphi Rio
|
||||||
|
{$IFDEF VER330}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// 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}
|
||||||
|
|
||||||
|
// Rad Studio 11.0 - Delphi Alexandria
|
||||||
|
{$IFDEF VER350}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$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}
|
||||||
|
{$DEFINE DELPHI28_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}
|
||||||
|
{$DEFINE DELPHI28_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DELPHI9_UP}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IF DEFINED(CPUX32) OR
|
||||||
|
DEFINED(CPU32) 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}
|
||||||
|
{$ELSE}
|
||||||
|
{$IF DEFINED(CPUX64) OR
|
||||||
|
DEFINED(CPU64) OR
|
||||||
|
DEFINED(CPU64BITS) OR
|
||||||
|
DEFINED(CPUARM64) OR
|
||||||
|
DEFINED(WIN64) OR
|
||||||
|
DEFINED(IOS64) OR
|
||||||
|
DEFINED(MACOS64) OR
|
||||||
|
DEFINED(LINUX64) OR
|
||||||
|
DEFINED(POSIX64) OR
|
||||||
|
DEFINED(ANDROID64)}
|
||||||
|
{$DEFINE TARGET_64BITS}
|
||||||
|
{$IFEND}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Delphi uses MACOS for the new MacOSX and DARWIN is not defined
|
||||||
|
// FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
|
||||||
|
// We define MACOSX to avoid conflicts in both situations
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF MACOS}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
@ -0,0 +1,103 @@
|
|||||||
|
object MainForm: TMainForm
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Caption = 'JSSharedMemoryProcMessage'
|
||||||
|
ClientHeight = 579
|
||||||
|
ClientWidth = 878
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
Font.Style = []
|
||||||
|
Position = poScreenCenter
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
|
OnShow = FormShow
|
||||||
|
TextHeight = 13
|
||||||
|
object CEFWindowParent1: TCEFWindowParent
|
||||||
|
Left = 0
|
||||||
|
Top = 30
|
||||||
|
Width = 878
|
||||||
|
Height = 549
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
ExplicitHeight = 530
|
||||||
|
end
|
||||||
|
object AddressBarPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 878
|
||||||
|
Height = 30
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
DoubleBuffered = True
|
||||||
|
Enabled = False
|
||||||
|
Padding.Left = 5
|
||||||
|
Padding.Top = 5
|
||||||
|
Padding.Right = 5
|
||||||
|
Padding.Bottom = 5
|
||||||
|
ParentDoubleBuffered = False
|
||||||
|
TabOrder = 1
|
||||||
|
object AddressEdt: TEdit
|
||||||
|
Left = 5
|
||||||
|
Top = 5
|
||||||
|
Width = 740
|
||||||
|
Height = 20
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'https://www.google.com/'
|
||||||
|
ExplicitWidth = 754
|
||||||
|
ExplicitHeight = 21
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 745
|
||||||
|
Top = 5
|
||||||
|
Width = 128
|
||||||
|
Height = 20
|
||||||
|
Align = alRight
|
||||||
|
BevelOuter = bvNone
|
||||||
|
Padding.Left = 5
|
||||||
|
TabOrder = 1
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 5
|
||||||
|
Top = 0
|
||||||
|
Width = 31
|
||||||
|
Height = 20
|
||||||
|
Margins.Left = 5
|
||||||
|
Align = alLeft
|
||||||
|
Caption = 'Go'
|
||||||
|
TabOrder = 0
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
end
|
||||||
|
object SendMessageBtn: TButton
|
||||||
|
Left = 40
|
||||||
|
Top = 0
|
||||||
|
Width = 88
|
||||||
|
Height = 20
|
||||||
|
Align = alRight
|
||||||
|
Caption = 'Send message'
|
||||||
|
TabOrder = 1
|
||||||
|
OnClick = SendMessageBtnClick
|
||||||
|
ExplicitLeft = 39
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Chromium1: TChromium
|
||||||
|
OnProcessMessageReceived = Chromium1ProcessMessageReceived
|
||||||
|
OnBeforePopup = Chromium1BeforePopup
|
||||||
|
OnAfterCreated = Chromium1AfterCreated
|
||||||
|
OnBeforeClose = Chromium1BeforeClose
|
||||||
|
OnClose = Chromium1Close
|
||||||
|
Left = 16
|
||||||
|
Top = 40
|
||||||
|
end
|
||||||
|
object Timer1: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 300
|
||||||
|
OnTimer = Timer1Timer
|
||||||
|
Left = 16
|
||||||
|
Top = 96
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,392 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uMainForm;
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF DELPHI16_UP}
|
||||||
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
||||||
|
System.SyncObjs, System.Classes, Vcl.Graphics, Vcl.Menus, Vcl.Controls,
|
||||||
|
Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, System.Types,
|
||||||
|
Vcl.ComCtrls, Vcl.ClipBrd, System.UITypes,
|
||||||
|
{$ELSE}
|
||||||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, SyncObjs,
|
||||||
|
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
|
||||||
|
{$ENDIF}
|
||||||
|
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||||
|
uCEFConstants, uCEFWinControl, uCEFChromiumCore, uCEFChromiumEvents;
|
||||||
|
|
||||||
|
const
|
||||||
|
MINIBROWSER_SHOWMESSAGE = WM_APP + 1;
|
||||||
|
|
||||||
|
CUSTOMMESSAGENAME = 'sharedmemorymsg';
|
||||||
|
|
||||||
|
type
|
||||||
|
TDTVisitStatus = (dvsIdle, dvsGettingDocNodeID, dvsQueryingSelector, dvsSettingAttributeValue);
|
||||||
|
|
||||||
|
TMainForm = class(TForm)
|
||||||
|
CEFWindowParent1: TCEFWindowParent;
|
||||||
|
Chromium1: TChromium;
|
||||||
|
AddressBarPnl: TPanel;
|
||||||
|
AddressEdt: TEdit;
|
||||||
|
Timer1: TTimer;
|
||||||
|
Panel1: TPanel;
|
||||||
|
GoBtn: TButton;
|
||||||
|
SendMessageBtn: TButton;
|
||||||
|
|
||||||
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
procedure GoBtnClick(Sender: TObject);
|
||||||
|
procedure SendMessageBtnClick(Sender: TObject);
|
||||||
|
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
|
||||||
|
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
||||||
|
procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
|
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
|
||||||
|
protected
|
||||||
|
// Variables to control when can we destroy the form safely
|
||||||
|
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||||
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
|
|
||||||
|
// Critical section and fields to show information received in CEF events safely.
|
||||||
|
FCritSection : TCriticalSection;
|
||||||
|
FMsgContents : string;
|
||||||
|
|
||||||
|
function GetMsgContents : string;
|
||||||
|
procedure SetMsgContents(const aValue : string);
|
||||||
|
|
||||||
|
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||||
|
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||||
|
procedure ShowMessageMsg(var aMessage : TMessage); message MINIBROWSER_SHOWMESSAGE;
|
||||||
|
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||||
|
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||||
|
|
||||||
|
property MsgContents : string read GetMsgContents write SetMsgContents;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
MainForm: TMainForm;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFProcessMessage, uCEFMiscFunctions, uCEFSchemeRegistrar,
|
||||||
|
uCEFRenderProcessHandler, uCEFTask, uCEFSharedProcessMessageBuilder;
|
||||||
|
|
||||||
|
// This demo sends process messages between the browser process and the render process.
|
||||||
|
|
||||||
|
// Read the code comments in the JSExtension and DOMVisitor demos to know all
|
||||||
|
// the details about the Chromium processes and how to send messages between them.
|
||||||
|
|
||||||
|
// This demo sends process messages with a shared memory buffer created by
|
||||||
|
// TCefSharedProcessMessageBuilderRef.CreateBuilder when you click on the
|
||||||
|
// "Send message" button.
|
||||||
|
|
||||||
|
// TCefSharedProcessMessageBuilderRef.CreateBuilder can be used to create messages
|
||||||
|
// with a large shared memory buffer but this demo only uses one byte.
|
||||||
|
|
||||||
|
// The render process receives the message in GlobalCEFApp_OnProcessMessageReceived
|
||||||
|
// and sends back another message to the browser process
|
||||||
|
|
||||||
|
// The browser process receives the message in Chromium1ProcessMessageReceived
|
||||||
|
// and sends a custom Windows message to the main form to show a text message in
|
||||||
|
// the main application thread.
|
||||||
|
|
||||||
|
// Destruction steps
|
||||||
|
// =================
|
||||||
|
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which
|
||||||
|
// triggers the TChromium.OnClose event.
|
||||||
|
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy
|
||||||
|
// CEFWindowParent1 in the main thread, which triggers the
|
||||||
|
// TChromium.OnBeforeClose event.
|
||||||
|
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the
|
||||||
|
// form.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
sourceProcess : TCefProcessId;
|
||||||
|
const message_ : ICefProcessMessage;
|
||||||
|
var aHandled : boolean);
|
||||||
|
var
|
||||||
|
TempRegion : ICefSharedMemoryRegion;
|
||||||
|
TempData : Pbyte;
|
||||||
|
TempMsg : ICefProcessMessage;
|
||||||
|
TempResult : boolean;
|
||||||
|
begin
|
||||||
|
aHandled := False;
|
||||||
|
|
||||||
|
if (frame <> nil) and
|
||||||
|
frame.IsValid and
|
||||||
|
(message_ <> nil) and
|
||||||
|
(message_.name = CUSTOMMESSAGENAME) then
|
||||||
|
try
|
||||||
|
aHandled := True;
|
||||||
|
TempResult := False;
|
||||||
|
TempRegion := message_.SharedMemoryRegion;
|
||||||
|
|
||||||
|
if (TempRegion <> nil) and TempRegion.IsValid and (TempRegion.Size > 0) then
|
||||||
|
begin
|
||||||
|
// We send a message back to the browser process with a boolean value
|
||||||
|
// in the argument list.
|
||||||
|
TempData := TempRegion.Memory;
|
||||||
|
TempResult := (TempData^ = 42);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TempMsg := TCefProcessMessageRef.New(CUSTOMMESSAGENAME);
|
||||||
|
TempMsg.ArgumentList.SetBool(0, TempResult);
|
||||||
|
frame.SendProcessMessage(PID_BROWSER, TempMsg);
|
||||||
|
finally
|
||||||
|
TempRegion := nil;
|
||||||
|
TempMsg := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
begin
|
||||||
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||||
|
GlobalCEFApp.LogFile := 'debug.log';
|
||||||
|
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||||
|
|
||||||
|
// Delphi can only debug one process and it debugs the browser process by
|
||||||
|
// default. If you need to debug code executed in the render process you will
|
||||||
|
// need to use any of the methods described here :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
|
||||||
|
|
||||||
|
// Using the "Single process" mode is one of the ways to debug all the code
|
||||||
|
// because everything is executed in the browser process and Delphi won't have
|
||||||
|
// any problems. However, The "Single process" mode is unsupported by CEF and
|
||||||
|
// it causes unexpected issues. You should *ONLY* use it for debugging
|
||||||
|
// purposses.
|
||||||
|
//GlobalCEFApp.SingleProcess := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1BeforeClose(Sender: TObject;
|
||||||
|
const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
FCanClose := True;
|
||||||
|
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1BeforePopup(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||||
|
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||||
|
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||||
|
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||||
|
var settings: TCefBrowserSettings;
|
||||||
|
var extra_info: ICefDictionaryValue;
|
||||||
|
var noJavascriptAccess: Boolean;
|
||||||
|
var Result: Boolean);
|
||||||
|
begin
|
||||||
|
// For simplicity, this demo blocks all popup windows and new tabs
|
||||||
|
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1Close(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||||
|
aAction := cbaDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1ProcessMessageReceived(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId;
|
||||||
|
const message: ICefProcessMessage; out Result: Boolean);
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if (message <> nil) and (message.Name = CUSTOMMESSAGENAME) then
|
||||||
|
begin
|
||||||
|
if (message.ArgumentList <> nil) and
|
||||||
|
message.ArgumentList.GetBool(0) then
|
||||||
|
MsgContents := 'Messages received successfully!'
|
||||||
|
else
|
||||||
|
MsgContents := 'There was an error receiving the message';
|
||||||
|
|
||||||
|
// This event is executed in a CEF thread so we send a message to the main
|
||||||
|
// form to show the MsgContents value.
|
||||||
|
PostMessage(Handle, MINIBROWSER_SHOWMESSAGE, 0, 0);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormCloseQuery(Sender: TObject;
|
||||||
|
var CanClose: Boolean);
|
||||||
|
begin
|
||||||
|
CanClose := FCanClose;
|
||||||
|
|
||||||
|
if not(FClosing) then
|
||||||
|
begin
|
||||||
|
FClosing := True;
|
||||||
|
Visible := False;
|
||||||
|
Chromium1.CloseBrowser(True);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FCanClose := False;
|
||||||
|
FClosing := False;
|
||||||
|
|
||||||
|
FCritSection := TCriticalSection.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FreeAndNil(FCritSection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.DefaultUrl := AddressEdt.Text;
|
||||||
|
|
||||||
|
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
|
||||||
|
// If it's not initialized yet, we use a simple timer to create the browser later.
|
||||||
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.GoBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.LoadURL(AddressEdt.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
CEFWindowParent1.UpdateSize;
|
||||||
|
AddressBarPnl.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
CEFWindowParent1.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SendMessageBtnClick(Sender: TObject);
|
||||||
|
const
|
||||||
|
BUFFER_SIZE = 1; // Random buffer size for this demo
|
||||||
|
var
|
||||||
|
TempBuilder : ICefSharedProcessMessageBuilder;
|
||||||
|
TempMessage : ICefProcessMessage;
|
||||||
|
TempData : Pbyte;
|
||||||
|
begin
|
||||||
|
// The shared process builder can create process messages with a large buffer
|
||||||
|
// size but this demo only sends a byte.
|
||||||
|
TempBuilder := TCefSharedProcessMessageBuilderRef.CreateBuilder(CUSTOMMESSAGENAME, BUFFER_SIZE);
|
||||||
|
TempMessage := nil;
|
||||||
|
try
|
||||||
|
if assigned(TempBuilder) then
|
||||||
|
begin
|
||||||
|
TempData := TempBuilder.Memory;
|
||||||
|
TempData^ := 42; // Random value passed in the message
|
||||||
|
TempMessage := TempBuilder.Build;
|
||||||
|
Chromium1.SendProcessMessage(PID_RENDERER, TempMessage);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
TempMessage := nil;
|
||||||
|
TempBuilder := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.ShowMessageMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
showmessage(MsgContents);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WMMove(var aMessage : TWMMove);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WMMoving(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Timer1Timer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Timer1.Enabled := False;
|
||||||
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainForm.GetMsgContents : string;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if (FCritSection <> nil) then
|
||||||
|
try
|
||||||
|
FCritSection.Acquire;
|
||||||
|
Result := FMsgContents;
|
||||||
|
finally
|
||||||
|
FCritSection.Release;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SetMsgContents(const aValue : string);
|
||||||
|
begin
|
||||||
|
if (FCritSection <> nil) then
|
||||||
|
try
|
||||||
|
FCritSection.Acquire;
|
||||||
|
FMsgContents := aValue;
|
||||||
|
finally
|
||||||
|
FCritSection.Release;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -165,6 +165,8 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
|
|
||||||
'https://www.sede.fnmt.gob.es/certificados/persona-fisica/verific' +
|
'https://www.sede.fnmt.gob.es/certificados/persona-fisica/verific' +
|
||||||
'ar-estado'
|
'ar-estado'
|
||||||
|
'https://www.kirupa.com/html5/accessing_your_webcam_in_html5.htm'
|
||||||
|
'https://www.xdumaine.com/enumerateDevices/test/'
|
||||||
'chrome://version/'
|
'chrome://version/'
|
||||||
'chrome://net-internals/'
|
'chrome://net-internals/'
|
||||||
'chrome://tracing/'
|
'chrome://tracing/'
|
||||||
@ -285,6 +287,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnStatusMessage = Chromium1StatusMessage
|
OnStatusMessage = Chromium1StatusMessage
|
||||||
OnLoadingProgressChange = Chromium1LoadingProgressChange
|
OnLoadingProgressChange = Chromium1LoadingProgressChange
|
||||||
OnCursorChange = Chromium1CursorChange
|
OnCursorChange = Chromium1CursorChange
|
||||||
|
OnMediaAccessChange = Chromium1MediaAccessChange
|
||||||
OnCanDownload = Chromium1CanDownload
|
OnCanDownload = Chromium1CanDownload
|
||||||
OnBeforeDownload = Chromium1BeforeDownload
|
OnBeforeDownload = Chromium1BeforeDownload
|
||||||
OnDownloadUpdated = Chromium1DownloadUpdated
|
OnDownloadUpdated = Chromium1DownloadUpdated
|
||||||
@ -297,6 +300,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnResourceResponse = Chromium1ResourceResponse
|
OnResourceResponse = Chromium1ResourceResponse
|
||||||
OnFileDialog = Chromium1FileDialog
|
OnFileDialog = Chromium1FileDialog
|
||||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||||
|
OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission
|
||||||
Left = 32
|
Left = 32
|
||||||
Top = 224
|
Top = 224
|
||||||
end
|
end
|
||||||
|
@ -73,6 +73,7 @@ const
|
|||||||
MINIBROWSER_DTDATA_AVLBL = WM_APP + $10E;
|
MINIBROWSER_DTDATA_AVLBL = WM_APP + $10E;
|
||||||
MINIBROWSER_SHOWFILEDLG = WM_APP + $10F;
|
MINIBROWSER_SHOWFILEDLG = WM_APP + $10F;
|
||||||
MINIBROWSER_SELECTCERT = WM_APP + $110;
|
MINIBROWSER_SELECTCERT = WM_APP + $110;
|
||||||
|
MINIBROWSER_MEDIAACCESSRQST = WM_APP + $111;
|
||||||
|
|
||||||
MINIBROWSER_HOMEPAGE = 'https://www.google.com';
|
MINIBROWSER_HOMEPAGE = 'https://www.google.com';
|
||||||
|
|
||||||
@ -188,6 +189,8 @@ type
|
|||||||
procedure Chromium1SelectClientCertificate(Sender: TObject; const browser: ICefBrowser; isProxy: Boolean; const host: ustring; port: Integer; certificatesCount: NativeUInt; const certificates: TCefX509CertificateArray; const callback: ICefSelectClientCertificateCallback; var aResult: Boolean);
|
procedure Chromium1SelectClientCertificate(Sender: TObject; const browser: ICefBrowser; isProxy: Boolean; const host: ustring; port: Integer; certificatesCount: NativeUInt; const certificates: TCefX509CertificateArray; const callback: ICefSelectClientCertificateCallback; var aResult: Boolean);
|
||||||
procedure Chromium1CursorChange(Sender: TObject; const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult: Boolean);
|
procedure Chromium1CursorChange(Sender: TObject; const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult: Boolean);
|
||||||
procedure Chromium1CanDownload(Sender: TObject; const browser: ICefBrowser; const url, request_method: ustring; var aResult: Boolean);
|
procedure Chromium1CanDownload(Sender: TObject; const browser: ICefBrowser; const url, request_method: ustring; var aResult: Boolean);
|
||||||
|
procedure Chromium1MediaAccessChange(Sender: TObject; const browser: ICefBrowser; has_video_access, has_audio_access: Boolean);
|
||||||
|
procedure Chromium1RequestMediaAccessPermission(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: Cardinal; const callback: ICefMediaAccessCallback; var aResult: Boolean);
|
||||||
|
|
||||||
procedure BackBtnClick(Sender: TObject);
|
procedure BackBtnClick(Sender: TObject);
|
||||||
procedure ForwardBtnClick(Sender: TObject);
|
procedure ForwardBtnClick(Sender: TObject);
|
||||||
@ -230,6 +233,10 @@ type
|
|||||||
FCertificates : TCefX509CertificateArray;
|
FCertificates : TCefX509CertificateArray;
|
||||||
FAllowDownloads : boolean;
|
FAllowDownloads : boolean;
|
||||||
|
|
||||||
|
FMediaAccessCallback : ICefMediaAccessCallback;
|
||||||
|
FRequestingOrigin : string;
|
||||||
|
FRequestedPermissions : cardinal;
|
||||||
|
|
||||||
FResponse : TStringList;
|
FResponse : TStringList;
|
||||||
FRequest : TStringList;
|
FRequest : TStringList;
|
||||||
FNavigation : TStringList;
|
FNavigation : TStringList;
|
||||||
@ -275,6 +282,7 @@ type
|
|||||||
procedure DevToolsDataAvailableMsg(var aMessage : TMessage); message MINIBROWSER_DTDATA_AVLBL;
|
procedure DevToolsDataAvailableMsg(var aMessage : TMessage); message MINIBROWSER_DTDATA_AVLBL;
|
||||||
procedure ShowFileDialogMsg(var aMessage : TMessage); message MINIBROWSER_SHOWFILEDLG;
|
procedure ShowFileDialogMsg(var aMessage : TMessage); message MINIBROWSER_SHOWFILEDLG;
|
||||||
procedure SelectCertificateMsg(var aMessage : TMessage); message MINIBROWSER_SELECTCERT;
|
procedure SelectCertificateMsg(var aMessage : TMessage); message MINIBROWSER_SELECTCERT;
|
||||||
|
procedure MediaAccessRequestMsg(var aMessage : TMessage); message MINIBROWSER_MEDIAACCESSRQST;
|
||||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||||
@ -313,7 +321,6 @@ begin
|
|||||||
GlobalCEFApp.EnableGPU := True;
|
GlobalCEFApp.EnableGPU := True;
|
||||||
GlobalCEFApp.LogFile := 'debug.log';
|
GlobalCEFApp.LogFile := 'debug.log';
|
||||||
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||||
//GlobalCEFApp.ChromeRuntime := True;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject);
|
procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject);
|
||||||
@ -997,6 +1004,23 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1MediaAccessChange(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; has_video_access, has_audio_access: Boolean);
|
||||||
|
var
|
||||||
|
TempText : string;
|
||||||
|
begin
|
||||||
|
// This event is executed in a CEF thread and this can cause problems when
|
||||||
|
// you change the 'Enabled' and 'Visible' properties from VCL components.
|
||||||
|
// It's recommended to change the 'Enabled' and 'Visible' properties
|
||||||
|
// in the main application thread and not in a CEF thread.
|
||||||
|
// It's much safer to use PostMessage to send a message to the main form with
|
||||||
|
// all this information and update those properties in the procedure handling
|
||||||
|
// that message.
|
||||||
|
TempText := 'Video access : ' + BooltoStr(has_video_access, True) + ' - ' +
|
||||||
|
'Audio access : ' + BooltoStr(has_audio_access, True);
|
||||||
|
StatusBar1.Panels[1].Text := TempText;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1NavigationVisitorResultAvailable(Sender: TObject;
|
procedure TMiniBrowserFrm.Chromium1NavigationVisitorResultAvailable(Sender: TObject;
|
||||||
const entry: ICefNavigationEntry; current: Boolean; index, total: Integer;
|
const entry: ICefNavigationEntry; current: Boolean; index, total: Integer;
|
||||||
var aResult: Boolean);
|
var aResult: Boolean);
|
||||||
@ -1043,6 +1067,56 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1RequestMediaAccessPermission(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
const requesting_origin: ustring; requested_permissions: Cardinal;
|
||||||
|
const callback: ICefMediaAccessCallback; var aResult: Boolean);
|
||||||
|
begin
|
||||||
|
aResult := True;
|
||||||
|
FMediaAccessCallback := callback;
|
||||||
|
FRequestingOrigin := requesting_origin;
|
||||||
|
FRequestedPermissions := requested_permissions;
|
||||||
|
|
||||||
|
PostMessage(Handle, MINIBROWSER_MEDIAACCESSRQST, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.MediaAccessRequestMsg(var aMessage : TMessage);
|
||||||
|
var
|
||||||
|
TempMessage : string;
|
||||||
|
TempPermissions : TStringList;
|
||||||
|
begin
|
||||||
|
TempPermissions := TStringList.Create;
|
||||||
|
try
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Device audio');
|
||||||
|
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Device video');
|
||||||
|
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DESKTOP_AUDIO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Desktop audio');
|
||||||
|
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DESKTOP_VIDEO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Desktop video');
|
||||||
|
|
||||||
|
if assigned(FMediaAccessCallback) and (TempPermissions.Count > 0) then
|
||||||
|
begin
|
||||||
|
TempMessage := FRequestingOrigin +
|
||||||
|
' is asking for permission to access : ' + CRLF +
|
||||||
|
TempPermissions.Text + CRLF +
|
||||||
|
'Do you want allow it?';
|
||||||
|
|
||||||
|
if (MessageDlg(TempMessage, mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes) then
|
||||||
|
FMediaAccessCallback.cont(FRequestedPermissions)
|
||||||
|
else
|
||||||
|
FMediaAccessCallback.Cancel;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
TempPermissions.Free;
|
||||||
|
FMediaAccessCallback := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1ResolvedHostAvailable(Sender: TObject;
|
procedure TMiniBrowserFrm.Chromium1ResolvedHostAvailable(Sender: TObject;
|
||||||
result: Integer; const resolvedIps: TStrings);
|
result: Integer; const resolvedIps: TStrings);
|
||||||
begin
|
begin
|
||||||
@ -1271,6 +1345,7 @@ begin
|
|||||||
FRequest := TStringList.Create;
|
FRequest := TStringList.Create;
|
||||||
FNavigation := TStringList.Create;
|
FNavigation := TStringList.Create;
|
||||||
FSelectCertCallback := nil;
|
FSelectCertCallback := nil;
|
||||||
|
FMediaAccessCallback := nil;
|
||||||
FCertificates := nil;
|
FCertificates := nil;
|
||||||
FPendingMsgID := 0;
|
FPendingMsgID := 0;
|
||||||
FAllowDownloads := True;
|
FAllowDownloads := True;
|
||||||
@ -1300,6 +1375,7 @@ begin
|
|||||||
DestroyCertificates;
|
DestroyCertificates;
|
||||||
|
|
||||||
FSelectCertCallback := nil;
|
FSelectCertCallback := nil;
|
||||||
|
FMediaAccessCallback := nil;
|
||||||
FResponse.Free;
|
FResponse.Free;
|
||||||
FRequest.Free;
|
FRequest.Free;
|
||||||
FNavigation.Free;
|
FNavigation.Free;
|
||||||
|
@ -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
|
@ -0,0 +1,70 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2018 Salvador D�az Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
program JSSharedMemoryProcMessage;
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Forms,
|
||||||
|
Windows,
|
||||||
|
uCEFApplication,
|
||||||
|
uMainForm in 'uMainForm.pas' {MainForm};
|
||||||
|
|
||||||
|
{$R *.res}
|
||||||
|
|
||||||
|
{$SetPEFlags IMAGE_FILE_LARGE_ADDRESS_AWARE}
|
||||||
|
|
||||||
|
begin
|
||||||
|
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||||
|
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
if GlobalCEFApp.StartMainProcess then
|
||||||
|
begin
|
||||||
|
//ReportMemoryLeaksOnShutdown := True;
|
||||||
|
|
||||||
|
Application.Initialize;
|
||||||
|
Application.MainFormOnTaskbar := True;
|
||||||
|
Application.CreateForm(TMainForm, MainForm);
|
||||||
|
Application.Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// This is not really necessary to fix the bug #89 but if you free GlobalCEFApp in a different unit
|
||||||
|
// then you can call 'FreeAndNil' without adding SysUtils to this DPR.
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
end.
|
@ -0,0 +1,507 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2017 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
// The complete list of compiler versions is here :
|
||||||
|
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||||
|
|
||||||
|
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||||
|
|
||||||
|
// Delphi 5
|
||||||
|
{$IFDEF VER130}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 6
|
||||||
|
{$IFDEF VER140}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 7
|
||||||
|
{$IFDEF VER150}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 8
|
||||||
|
{$IFDEF VER160}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2005
|
||||||
|
{$IFDEF VER170}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
// Delphi 2007
|
||||||
|
{$IFDEF VER185}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
// Delphi 2006
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2009
|
||||||
|
{$IFDEF VER200}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
//Delphi 2010
|
||||||
|
{$IFDEF VER210}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE
|
||||||
|
{$IFDEF VER220}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||||
|
{$IFDEF VER230}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE3
|
||||||
|
{$IFDEF VER240}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE4
|
||||||
|
{$IFDEF VER250}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE5
|
||||||
|
{$IFDEF VER260}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE6
|
||||||
|
{$IFDEF VER270}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE7
|
||||||
|
{$IFDEF VER280}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE8
|
||||||
|
{$IFDEF VER290}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$ENDIF VER290}
|
||||||
|
|
||||||
|
// Rad Studio 10 - Delphi Seattle
|
||||||
|
{$IFDEF VER300}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.1 - Delphi Berlin
|
||||||
|
{$IFDEF VER310}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.2 - Delphi Tokyo
|
||||||
|
{$IFDEF VER320}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.3 - Delphi Rio
|
||||||
|
{$IFDEF VER330}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// 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}
|
||||||
|
|
||||||
|
// Rad Studio 11.0 - Delphi Alexandria
|
||||||
|
{$IFDEF VER350}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$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}
|
||||||
|
{$DEFINE DELPHI28_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}
|
||||||
|
{$DEFINE DELPHI28_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DELPHI9_UP}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IF DEFINED(CPUX32) OR
|
||||||
|
DEFINED(CPU32) 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}
|
||||||
|
{$ELSE}
|
||||||
|
{$IF DEFINED(CPUX64) OR
|
||||||
|
DEFINED(CPU64) OR
|
||||||
|
DEFINED(CPU64BITS) OR
|
||||||
|
DEFINED(CPUARM64) OR
|
||||||
|
DEFINED(WIN64) OR
|
||||||
|
DEFINED(IOS64) OR
|
||||||
|
DEFINED(MACOS64) OR
|
||||||
|
DEFINED(LINUX64) OR
|
||||||
|
DEFINED(POSIX64) OR
|
||||||
|
DEFINED(ANDROID64)}
|
||||||
|
{$DEFINE TARGET_64BITS}
|
||||||
|
{$IFEND}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Delphi uses MACOS for the new MacOSX and DARWIN is not defined
|
||||||
|
// FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
|
||||||
|
// We define MACOSX to avoid conflicts in both situations
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF MACOS}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
@ -0,0 +1,103 @@
|
|||||||
|
object MainForm: TMainForm
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Caption = 'JSSharedMemoryProcMessage'
|
||||||
|
ClientHeight = 579
|
||||||
|
ClientWidth = 878
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Charset = DEFAULT_CHARSET
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
Font.Style = []
|
||||||
|
Position = poScreenCenter
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
|
OnShow = FormShow
|
||||||
|
TextHeight = 13
|
||||||
|
object CEFWindowParent1: TCEFWindowParent
|
||||||
|
Left = 0
|
||||||
|
Top = 30
|
||||||
|
Width = 878
|
||||||
|
Height = 549
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
ExplicitHeight = 530
|
||||||
|
end
|
||||||
|
object AddressBarPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Top = 0
|
||||||
|
Width = 878
|
||||||
|
Height = 30
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
DoubleBuffered = True
|
||||||
|
Enabled = False
|
||||||
|
Padding.Left = 5
|
||||||
|
Padding.Top = 5
|
||||||
|
Padding.Right = 5
|
||||||
|
Padding.Bottom = 5
|
||||||
|
ParentDoubleBuffered = False
|
||||||
|
TabOrder = 1
|
||||||
|
object AddressEdt: TEdit
|
||||||
|
Left = 5
|
||||||
|
Top = 5
|
||||||
|
Width = 740
|
||||||
|
Height = 20
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'https://www.google.com/'
|
||||||
|
ExplicitWidth = 754
|
||||||
|
ExplicitHeight = 21
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 745
|
||||||
|
Top = 5
|
||||||
|
Width = 128
|
||||||
|
Height = 20
|
||||||
|
Align = alRight
|
||||||
|
BevelOuter = bvNone
|
||||||
|
Padding.Left = 5
|
||||||
|
TabOrder = 1
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 5
|
||||||
|
Top = 0
|
||||||
|
Width = 31
|
||||||
|
Height = 20
|
||||||
|
Margins.Left = 5
|
||||||
|
Align = alLeft
|
||||||
|
Caption = 'Go'
|
||||||
|
TabOrder = 0
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
end
|
||||||
|
object SendMessageBtn: TButton
|
||||||
|
Left = 40
|
||||||
|
Top = 0
|
||||||
|
Width = 88
|
||||||
|
Height = 20
|
||||||
|
Align = alRight
|
||||||
|
Caption = 'Send message'
|
||||||
|
TabOrder = 1
|
||||||
|
OnClick = SendMessageBtnClick
|
||||||
|
ExplicitLeft = 39
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Chromium1: TChromium
|
||||||
|
OnProcessMessageReceived = Chromium1ProcessMessageReceived
|
||||||
|
OnBeforePopup = Chromium1BeforePopup
|
||||||
|
OnAfterCreated = Chromium1AfterCreated
|
||||||
|
OnBeforeClose = Chromium1BeforeClose
|
||||||
|
OnClose = Chromium1Close
|
||||||
|
Left = 16
|
||||||
|
Top = 40
|
||||||
|
end
|
||||||
|
object Timer1: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 300
|
||||||
|
OnTimer = Timer1Timer
|
||||||
|
Left = 16
|
||||||
|
Top = 96
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,385 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uMainForm;
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, SyncObjs,
|
||||||
|
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
|
||||||
|
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||||
|
uCEFConstants, uCEFWinControl, uCEFChromiumCore, uCEFChromiumEvents;
|
||||||
|
|
||||||
|
const
|
||||||
|
MINIBROWSER_SHOWMESSAGE = WM_APP + 1;
|
||||||
|
|
||||||
|
CUSTOMMESSAGENAME = 'sharedmemorymsg';
|
||||||
|
|
||||||
|
type
|
||||||
|
TDTVisitStatus = (dvsIdle, dvsGettingDocNodeID, dvsQueryingSelector, dvsSettingAttributeValue);
|
||||||
|
|
||||||
|
TMainForm = class(TForm)
|
||||||
|
CEFWindowParent1: TCEFWindowParent;
|
||||||
|
Chromium1: TChromium;
|
||||||
|
AddressBarPnl: TPanel;
|
||||||
|
AddressEdt: TEdit;
|
||||||
|
Timer1: TTimer;
|
||||||
|
Panel1: TPanel;
|
||||||
|
GoBtn: TButton;
|
||||||
|
SendMessageBtn: TButton;
|
||||||
|
|
||||||
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
procedure GoBtnClick(Sender: TObject);
|
||||||
|
procedure SendMessageBtnClick(Sender: TObject);
|
||||||
|
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
|
||||||
|
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
||||||
|
procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
|
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
|
||||||
|
protected
|
||||||
|
// Variables to control when can we destroy the form safely
|
||||||
|
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||||
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
|
|
||||||
|
// Critical section and fields to show information received in CEF events safely.
|
||||||
|
FCritSection : TCriticalSection;
|
||||||
|
FMsgContents : string;
|
||||||
|
|
||||||
|
function GetMsgContents : string;
|
||||||
|
procedure SetMsgContents(const aValue : string);
|
||||||
|
|
||||||
|
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||||
|
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||||
|
procedure ShowMessageMsg(var aMessage : TMessage); message MINIBROWSER_SHOWMESSAGE;
|
||||||
|
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||||
|
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||||
|
|
||||||
|
property MsgContents : string read GetMsgContents write SetMsgContents;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
MainForm: TMainForm;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.dfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFProcessMessage, uCEFMiscFunctions, uCEFSchemeRegistrar,
|
||||||
|
uCEFRenderProcessHandler, uCEFTask, uCEFSharedProcessMessageBuilder;
|
||||||
|
|
||||||
|
// This demo sends process messages between the browser process and the render process.
|
||||||
|
|
||||||
|
// Read the code comments in the JSExtension and DOMVisitor demos to know all
|
||||||
|
// the details about the Chromium processes and how to send messages between them.
|
||||||
|
|
||||||
|
// This demo sends process messages with a shared memory buffer created by
|
||||||
|
// TCefSharedProcessMessageBuilderRef.CreateBuilder when you click on the
|
||||||
|
// "Send message" button.
|
||||||
|
|
||||||
|
// TCefSharedProcessMessageBuilderRef.CreateBuilder can be used to create messages
|
||||||
|
// with a large shared memory buffer but this demo only uses one byte.
|
||||||
|
|
||||||
|
// The render process receives the message in GlobalCEFApp_OnProcessMessageReceived
|
||||||
|
// and sends back another message to the browser process
|
||||||
|
|
||||||
|
// The browser process receives the message in Chromium1ProcessMessageReceived
|
||||||
|
// and sends a custom Windows message to the main form to show a text message in
|
||||||
|
// the main application thread.
|
||||||
|
|
||||||
|
// Destruction steps
|
||||||
|
// =================
|
||||||
|
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which
|
||||||
|
// triggers the TChromium.OnClose event.
|
||||||
|
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy
|
||||||
|
// CEFWindowParent1 in the main thread, which triggers the
|
||||||
|
// TChromium.OnBeforeClose event.
|
||||||
|
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the
|
||||||
|
// form.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
sourceProcess : TCefProcessId;
|
||||||
|
const message_ : ICefProcessMessage;
|
||||||
|
var aHandled : boolean);
|
||||||
|
var
|
||||||
|
TempRegion : ICefSharedMemoryRegion;
|
||||||
|
TempData : Pbyte;
|
||||||
|
TempMsg : ICefProcessMessage;
|
||||||
|
TempResult : boolean;
|
||||||
|
begin
|
||||||
|
aHandled := False;
|
||||||
|
|
||||||
|
if (frame <> nil) and
|
||||||
|
frame.IsValid and
|
||||||
|
(message_ <> nil) and
|
||||||
|
(message_.name = CUSTOMMESSAGENAME) then
|
||||||
|
try
|
||||||
|
aHandled := True;
|
||||||
|
TempResult := False;
|
||||||
|
TempRegion := message_.SharedMemoryRegion;
|
||||||
|
|
||||||
|
if (TempRegion <> nil) and TempRegion.IsValid and (TempRegion.Size > 0) then
|
||||||
|
begin
|
||||||
|
// We send a message back to the browser process with a boolean value
|
||||||
|
// in the argument list.
|
||||||
|
TempData := TempRegion.Memory;
|
||||||
|
TempResult := (TempData^ = 42);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TempMsg := TCefProcessMessageRef.New(CUSTOMMESSAGENAME);
|
||||||
|
TempMsg.ArgumentList.SetBool(0, TempResult);
|
||||||
|
frame.SendProcessMessage(PID_BROWSER, TempMsg);
|
||||||
|
finally
|
||||||
|
TempRegion := nil;
|
||||||
|
TempMsg := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
begin
|
||||||
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||||
|
GlobalCEFApp.LogFile := 'debug.log';
|
||||||
|
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||||
|
|
||||||
|
// Delphi can only debug one process and it debugs the browser process by
|
||||||
|
// default. If you need to debug code executed in the render process you will
|
||||||
|
// need to use any of the methods described here :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
|
||||||
|
|
||||||
|
// Using the "Single process" mode is one of the ways to debug all the code
|
||||||
|
// because everything is executed in the browser process and Delphi won't have
|
||||||
|
// any problems. However, The "Single process" mode is unsupported by CEF and
|
||||||
|
// it causes unexpected issues. You should *ONLY* use it for debugging
|
||||||
|
// purposses.
|
||||||
|
//GlobalCEFApp.SingleProcess := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1BeforeClose(Sender: TObject;
|
||||||
|
const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
FCanClose := True;
|
||||||
|
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1BeforePopup(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||||
|
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||||
|
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||||
|
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||||
|
var settings: TCefBrowserSettings;
|
||||||
|
var extra_info: ICefDictionaryValue;
|
||||||
|
var noJavascriptAccess: Boolean;
|
||||||
|
var Result: Boolean);
|
||||||
|
begin
|
||||||
|
// For simplicity, this demo blocks all popup windows and new tabs
|
||||||
|
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1Close(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||||
|
aAction := cbaDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1ProcessMessageReceived(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId;
|
||||||
|
const message: ICefProcessMessage; out Result: Boolean);
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if (message <> nil) and (message.Name = CUSTOMMESSAGENAME) then
|
||||||
|
begin
|
||||||
|
if (message.ArgumentList <> nil) and
|
||||||
|
message.ArgumentList.GetBool(0) then
|
||||||
|
MsgContents := 'Messages received successfully!'
|
||||||
|
else
|
||||||
|
MsgContents := 'There was an error receiving the message';
|
||||||
|
|
||||||
|
// This event is executed in a CEF thread so we send a message to the main
|
||||||
|
// form to show the MsgContents value.
|
||||||
|
PostMessage(Handle, MINIBROWSER_SHOWMESSAGE, 0, 0);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormCloseQuery(Sender: TObject;
|
||||||
|
var CanClose: Boolean);
|
||||||
|
begin
|
||||||
|
CanClose := FCanClose;
|
||||||
|
|
||||||
|
if not(FClosing) then
|
||||||
|
begin
|
||||||
|
FClosing := True;
|
||||||
|
Visible := False;
|
||||||
|
Chromium1.CloseBrowser(True);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FCanClose := False;
|
||||||
|
FClosing := False;
|
||||||
|
|
||||||
|
FCritSection := TCriticalSection.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FreeAndNil(FCritSection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.DefaultUrl := AddressEdt.Text;
|
||||||
|
|
||||||
|
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
|
||||||
|
// If it's not initialized yet, we use a simple timer to create the browser later.
|
||||||
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.GoBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.LoadURL(AddressEdt.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
CEFWindowParent1.UpdateSize;
|
||||||
|
AddressBarPnl.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
CEFWindowParent1.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SendMessageBtnClick(Sender: TObject);
|
||||||
|
const
|
||||||
|
BUFFER_SIZE = 1; // Random buffer size for this demo
|
||||||
|
var
|
||||||
|
TempBuilder : ICefSharedProcessMessageBuilder;
|
||||||
|
TempMessage : ICefProcessMessage;
|
||||||
|
TempData : Pbyte;
|
||||||
|
begin
|
||||||
|
// The shared process builder can create process messages with a large buffer
|
||||||
|
// size but this demo only sends a byte.
|
||||||
|
TempBuilder := TCefSharedProcessMessageBuilderRef.CreateBuilder(CUSTOMMESSAGENAME, BUFFER_SIZE);
|
||||||
|
TempMessage := nil;
|
||||||
|
try
|
||||||
|
if assigned(TempBuilder) then
|
||||||
|
begin
|
||||||
|
TempData := TempBuilder.Memory;
|
||||||
|
TempData^ := 42; // Random value passed in the message
|
||||||
|
TempMessage := TempBuilder.Build;
|
||||||
|
Chromium1.SendProcessMessage(PID_RENDERER, TempMessage);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
TempMessage := nil;
|
||||||
|
TempBuilder := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.ShowMessageMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
showmessage(MsgContents);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WMMove(var aMessage : TWMMove);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WMMoving(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Timer1Timer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Timer1.Enabled := False;
|
||||||
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainForm.GetMsgContents : string;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if (FCritSection <> nil) then
|
||||||
|
try
|
||||||
|
FCritSection.Acquire;
|
||||||
|
Result := FMsgContents;
|
||||||
|
finally
|
||||||
|
FCritSection.Release;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SetMsgContents(const aValue : string);
|
||||||
|
begin
|
||||||
|
if (FCritSection <> nil) then
|
||||||
|
try
|
||||||
|
FCritSection.Acquire;
|
||||||
|
FMsgContents := aValue;
|
||||||
|
finally
|
||||||
|
FCritSection.Release;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<CONFIG>
|
||||||
|
<ProjectOptions>
|
||||||
|
<Version Value="12"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<General>
|
||||||
|
<Flags>
|
||||||
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||||
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<MainUnitHasScaledStatement Value="False"/>
|
||||||
|
</Flags>
|
||||||
|
<SessionStorage Value="InProjectDir"/>
|
||||||
|
<Title Value="JSSharedMemoryProcMessage"/>
|
||||||
|
<UseAppBundle Value="False"/>
|
||||||
|
<ResourceType Value="res"/>
|
||||||
|
</General>
|
||||||
|
<BuildModes>
|
||||||
|
<Item Name="Default" Default="True"/>
|
||||||
|
</BuildModes>
|
||||||
|
<PublishOptions>
|
||||||
|
<Version Value="2"/>
|
||||||
|
<UseFileFilters Value="True"/>
|
||||||
|
</PublishOptions>
|
||||||
|
<RunParams>
|
||||||
|
<FormatVersion Value="2"/>
|
||||||
|
</RunParams>
|
||||||
|
<RequiredPackages>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="CEF4Delphi_Lazarus"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<PackageName Value="LCL"/>
|
||||||
|
</Item>
|
||||||
|
</RequiredPackages>
|
||||||
|
<Units>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="JSSharedMemoryProcMessage.lpr"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
</Unit>
|
||||||
|
<Unit>
|
||||||
|
<Filename Value="uMainForm.pas"/>
|
||||||
|
<IsPartOfProject Value="True"/>
|
||||||
|
<ComponentName Value="MainForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
|
<ResourceBaseClass Value="Form"/>
|
||||||
|
</Unit>
|
||||||
|
</Units>
|
||||||
|
</ProjectOptions>
|
||||||
|
<CompilerOptions>
|
||||||
|
<Version Value="11"/>
|
||||||
|
<PathDelim Value="\"/>
|
||||||
|
<Target>
|
||||||
|
<Filename Value="..\..\..\..\bin\JSSharedMemoryProcMessage"/>
|
||||||
|
</Target>
|
||||||
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
|
</SearchPaths>
|
||||||
|
<Parsing>
|
||||||
|
<SyntaxOptions>
|
||||||
|
<SyntaxMode Value="Delphi"/>
|
||||||
|
</SyntaxOptions>
|
||||||
|
</Parsing>
|
||||||
|
<Linking>
|
||||||
|
<Debugging>
|
||||||
|
<DebugInfoType Value="dsDwarf2Set"/>
|
||||||
|
</Debugging>
|
||||||
|
<Options>
|
||||||
|
<Win32>
|
||||||
|
<GraphicApplication Value="True"/>
|
||||||
|
</Win32>
|
||||||
|
</Options>
|
||||||
|
</Linking>
|
||||||
|
<Other>
|
||||||
|
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
|
||||||
|
</Other>
|
||||||
|
</CompilerOptions>
|
||||||
|
<Debugging>
|
||||||
|
<Exceptions>
|
||||||
|
<Item>
|
||||||
|
<Name Value="EAbort"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Name Value="ECodetoolError"/>
|
||||||
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<Name Value="EFOpenError"/>
|
||||||
|
</Item>
|
||||||
|
</Exceptions>
|
||||||
|
</Debugging>
|
||||||
|
</CONFIG>
|
@ -0,0 +1,73 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright © 2018 Salvador Díaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
program JSSharedMemoryProcMessage;
|
||||||
|
|
||||||
|
{$MODE Delphi}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Forms,
|
||||||
|
LCLIntf, LCLType, LMessages, Interfaces,
|
||||||
|
uCEFApplication,
|
||||||
|
uMainForm in 'uMainForm.pas' {MainForm};
|
||||||
|
|
||||||
|
{.$R *.res}
|
||||||
|
|
||||||
|
// CEF needs to set the LARGEADDRESSAWARE flag which allows 32-bit processes to use up to 3GB of RAM.
|
||||||
|
{$SetPEFlags $20}
|
||||||
|
|
||||||
|
begin
|
||||||
|
// GlobalCEFApp creation and initialization moved to a different unit to fix the memory leak described in the bug #89
|
||||||
|
// https://github.com/salvadordf/CEF4Delphi/issues/89
|
||||||
|
CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
if GlobalCEFApp.StartMainProcess then
|
||||||
|
begin
|
||||||
|
//ReportMemoryLeaksOnShutdown := True;
|
||||||
|
|
||||||
|
Application.Initialize;
|
||||||
|
Application.MainFormOnTaskbar := True;
|
||||||
|
Application.CreateForm(TMainForm, MainForm);
|
||||||
|
Application.Run;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// This is not really necessary to fix the bug #89 but if you free GlobalCEFApp in a different unit
|
||||||
|
// then you can call 'FreeAndNil' without adding SysUtils to this DPR.
|
||||||
|
DestroyGlobalCEFApp;
|
||||||
|
end.
|
@ -0,0 +1,507 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** CEF4Delphi *******************************
|
||||||
|
// ************************************************************************
|
||||||
|
//
|
||||||
|
// CEF4Delphi is based on DCEF3 which uses CEF3 to embed a chromium-based
|
||||||
|
// browser in Delphi applications.
|
||||||
|
//
|
||||||
|
// The original license of DCEF3 still applies to CEF4Delphi.
|
||||||
|
//
|
||||||
|
// For more information about CEF4Delphi visit :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef
|
||||||
|
//
|
||||||
|
// Copyright � 2017 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
// The complete list of compiler versions is here :
|
||||||
|
// http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Compiler_Versions
|
||||||
|
|
||||||
|
{$DEFINE DELPHI_VERSION_UNKNOW}
|
||||||
|
|
||||||
|
// Delphi 5
|
||||||
|
{$IFDEF VER130}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 6
|
||||||
|
{$IFDEF VER140}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 7
|
||||||
|
{$IFDEF VER150}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 8
|
||||||
|
{$IFDEF VER160}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2005
|
||||||
|
{$IFDEF VER170}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF VER180}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
// Delphi 2007
|
||||||
|
{$IFDEF VER185}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
// Delphi 2006
|
||||||
|
{$ELSE}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi 2009
|
||||||
|
{$IFDEF VER200}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
//Delphi 2010
|
||||||
|
{$IFDEF VER210}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE
|
||||||
|
{$IFDEF VER220}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE2 (First FireMonkey and 64bit compiler)
|
||||||
|
{$IFDEF VER230}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE3
|
||||||
|
{$IFDEF VER240}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE4
|
||||||
|
{$IFDEF VER250}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE5
|
||||||
|
{$IFDEF VER260}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE6
|
||||||
|
{$IFDEF VER270}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE7
|
||||||
|
{$IFDEF VER280}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Delphi XE8
|
||||||
|
{$IFDEF VER290}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$ENDIF VER290}
|
||||||
|
|
||||||
|
// Rad Studio 10 - Delphi Seattle
|
||||||
|
{$IFDEF VER300}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.1 - Delphi Berlin
|
||||||
|
{$IFDEF VER310}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.2 - Delphi Tokyo
|
||||||
|
{$IFDEF VER320}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// Rad Studio 10.3 - Delphi Rio
|
||||||
|
{$IFDEF VER330}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$DEFINE DELPHI12_UP}
|
||||||
|
{$DEFINE DELPHI14_UP}
|
||||||
|
{$DEFINE DELPHI15_UP}
|
||||||
|
{$DEFINE DELPHI16_UP}
|
||||||
|
{$DEFINE DELPHI17_UP}
|
||||||
|
{$DEFINE DELPHI18_UP}
|
||||||
|
{$DEFINE DELPHI19_UP}
|
||||||
|
{$DEFINE DELPHI20_UP}
|
||||||
|
{$DEFINE DELPHI21_UP}
|
||||||
|
{$DEFINE DELPHI22_UP}
|
||||||
|
{$DEFINE DELPHI23_UP}
|
||||||
|
{$DEFINE DELPHI24_UP}
|
||||||
|
{$DEFINE DELPHI25_UP}
|
||||||
|
{$DEFINE DELPHI26_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
// 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}
|
||||||
|
|
||||||
|
// Rad Studio 11.0 - Delphi Alexandria
|
||||||
|
{$IFDEF VER350}
|
||||||
|
{$UNDEF DELPHI_VERSION_UNKNOW}
|
||||||
|
{$DEFINE DELPHI5_UP}
|
||||||
|
{$DEFINE DELPHI6_UP}
|
||||||
|
{$DEFINE DELPHI7_UP}
|
||||||
|
{$DEFINE DELPHI8_UP}
|
||||||
|
{$DEFINE DELPHI9_UP}
|
||||||
|
{$DEFINE DELPHI10_UP}
|
||||||
|
{$DEFINE DELPHI11_UP}
|
||||||
|
{$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}
|
||||||
|
{$DEFINE DELPHI28_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}
|
||||||
|
{$DEFINE DELPHI28_UP}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IFDEF DELPHI9_UP}
|
||||||
|
{$DEFINE SUPPORTS_INLINE}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$IF DEFINED(CPUX32) OR
|
||||||
|
DEFINED(CPU32) 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}
|
||||||
|
{$ELSE}
|
||||||
|
{$IF DEFINED(CPUX64) OR
|
||||||
|
DEFINED(CPU64) OR
|
||||||
|
DEFINED(CPU64BITS) OR
|
||||||
|
DEFINED(CPUARM64) OR
|
||||||
|
DEFINED(WIN64) OR
|
||||||
|
DEFINED(IOS64) OR
|
||||||
|
DEFINED(MACOS64) OR
|
||||||
|
DEFINED(LINUX64) OR
|
||||||
|
DEFINED(POSIX64) OR
|
||||||
|
DEFINED(ANDROID64)}
|
||||||
|
{$DEFINE TARGET_64BITS}
|
||||||
|
{$IFEND}
|
||||||
|
{$IFEND}
|
||||||
|
|
||||||
|
// Delphi uses MACOS for the new MacOSX and DARWIN is not defined
|
||||||
|
// FPC uses DARWIN for the new MacOSX and MACOS is defined for the classic Macintosh OS (System 7)
|
||||||
|
// We define MACOSX to avoid conflicts in both situations
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$IFDEF DARWIN}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ELSE}
|
||||||
|
{$IFDEF MACOS}
|
||||||
|
{$DEFINE MACOSX}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
@ -0,0 +1,97 @@
|
|||||||
|
object MainForm: TMainForm
|
||||||
|
Left = 444
|
||||||
|
Height = 579
|
||||||
|
Top = 161
|
||||||
|
Width = 878
|
||||||
|
Caption = 'JSSharedMemoryProcMessage'
|
||||||
|
ClientHeight = 579
|
||||||
|
ClientWidth = 878
|
||||||
|
Color = clBtnFace
|
||||||
|
Font.Color = clWindowText
|
||||||
|
Font.Height = -11
|
||||||
|
Font.Name = 'Tahoma'
|
||||||
|
OnCloseQuery = FormCloseQuery
|
||||||
|
OnCreate = FormCreate
|
||||||
|
OnDestroy = FormDestroy
|
||||||
|
OnShow = FormShow
|
||||||
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '2.2.2.0'
|
||||||
|
object CEFWindowParent1: TCEFWindowParent
|
||||||
|
Left = 0
|
||||||
|
Height = 559
|
||||||
|
Top = 20
|
||||||
|
Width = 878
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object AddressBarPnl: TPanel
|
||||||
|
Left = 0
|
||||||
|
Height = 20
|
||||||
|
Top = 0
|
||||||
|
Width = 878
|
||||||
|
Align = alTop
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 20
|
||||||
|
ClientWidth = 878
|
||||||
|
DoubleBuffered = True
|
||||||
|
Enabled = False
|
||||||
|
ParentDoubleBuffered = False
|
||||||
|
TabOrder = 1
|
||||||
|
object AddressEdt: TEdit
|
||||||
|
Left = 0
|
||||||
|
Height = 20
|
||||||
|
Top = 0
|
||||||
|
Width = 750
|
||||||
|
Align = alClient
|
||||||
|
TabOrder = 0
|
||||||
|
Text = 'https://www.google.com/'
|
||||||
|
end
|
||||||
|
object Panel1: TPanel
|
||||||
|
Left = 750
|
||||||
|
Height = 20
|
||||||
|
Top = 0
|
||||||
|
Width = 128
|
||||||
|
Align = alRight
|
||||||
|
BevelOuter = bvNone
|
||||||
|
ClientHeight = 20
|
||||||
|
ClientWidth = 128
|
||||||
|
TabOrder = 1
|
||||||
|
object GoBtn: TButton
|
||||||
|
Left = 0
|
||||||
|
Height = 20
|
||||||
|
Top = 0
|
||||||
|
Width = 31
|
||||||
|
Align = alLeft
|
||||||
|
Caption = 'Go'
|
||||||
|
OnClick = GoBtnClick
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object SendMessageBtn: TButton
|
||||||
|
Left = 40
|
||||||
|
Height = 20
|
||||||
|
Top = 0
|
||||||
|
Width = 88
|
||||||
|
Align = alRight
|
||||||
|
Caption = 'Send message'
|
||||||
|
OnClick = SendMessageBtnClick
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
object Chromium1: TChromium
|
||||||
|
OnProcessMessageReceived = Chromium1ProcessMessageReceived
|
||||||
|
OnBeforePopup = Chromium1BeforePopup
|
||||||
|
OnAfterCreated = Chromium1AfterCreated
|
||||||
|
OnBeforeClose = Chromium1BeforeClose
|
||||||
|
OnClose = Chromium1Close
|
||||||
|
Left = 16
|
||||||
|
Top = 40
|
||||||
|
end
|
||||||
|
object Timer1: TTimer
|
||||||
|
Enabled = False
|
||||||
|
Interval = 300
|
||||||
|
OnTimer = Timer1Timer
|
||||||
|
Left = 16
|
||||||
|
Top = 96
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,387 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 © 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uMainForm;
|
||||||
|
|
||||||
|
{$MODE Delphi}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Menus, SyncObjs,
|
||||||
|
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
|
||||||
|
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
|
||||||
|
uCEFConstants, uCEFWinControl, uCEFChromiumCore, uCEFChromiumEvents;
|
||||||
|
|
||||||
|
const
|
||||||
|
MINIBROWSER_SHOWMESSAGE = WM_APP + 1;
|
||||||
|
|
||||||
|
CUSTOMMESSAGENAME = 'sharedmemorymsg';
|
||||||
|
|
||||||
|
type
|
||||||
|
TDTVisitStatus = (dvsIdle, dvsGettingDocNodeID, dvsQueryingSelector, dvsSettingAttributeValue);
|
||||||
|
|
||||||
|
TMainForm = class(TForm)
|
||||||
|
CEFWindowParent1: TCEFWindowParent;
|
||||||
|
Chromium1: TChromium;
|
||||||
|
AddressBarPnl: TPanel;
|
||||||
|
AddressEdt: TEdit;
|
||||||
|
Timer1: TTimer;
|
||||||
|
Panel1: TPanel;
|
||||||
|
GoBtn: TButton;
|
||||||
|
SendMessageBtn: TButton;
|
||||||
|
|
||||||
|
procedure Timer1Timer(Sender: TObject);
|
||||||
|
procedure GoBtnClick(Sender: TObject);
|
||||||
|
procedure SendMessageBtnClick(Sender: TObject);
|
||||||
|
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
|
procedure FormCreate(Sender: TObject);
|
||||||
|
procedure FormDestroy(Sender: TObject);
|
||||||
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
|
||||||
|
|
||||||
|
procedure Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
procedure Chromium1ProcessMessageReceived(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; out Result: Boolean);
|
||||||
|
procedure Chromium1BeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
|
||||||
|
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
|
||||||
|
protected
|
||||||
|
// Variables to control when can we destroy the form safely
|
||||||
|
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||||
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
|
|
||||||
|
// Critical section and fields to show information received in CEF events safely.
|
||||||
|
FCritSection : TCriticalSection;
|
||||||
|
FMsgContents : string;
|
||||||
|
|
||||||
|
function GetMsgContents : string;
|
||||||
|
procedure SetMsgContents(const aValue : string);
|
||||||
|
|
||||||
|
procedure BrowserCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
|
||||||
|
procedure BrowserDestroyMsg(var aMessage : TMessage); message CEF_DESTROY;
|
||||||
|
procedure ShowMessageMsg(var aMessage : TMessage); message MINIBROWSER_SHOWMESSAGE;
|
||||||
|
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||||
|
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||||
|
|
||||||
|
property MsgContents : string read GetMsgContents write SetMsgContents;
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
MainForm: TMainForm;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
{$R *.lfm}
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFProcessMessage, uCEFMiscFunctions, uCEFSchemeRegistrar,
|
||||||
|
uCEFRenderProcessHandler, uCEFTask, uCEFSharedProcessMessageBuilder;
|
||||||
|
|
||||||
|
// This demo sends process messages between the browser process and the render process.
|
||||||
|
|
||||||
|
// Read the code comments in the JSExtension and DOMVisitor demos to know all
|
||||||
|
// the details about the Chromium processes and how to send messages between them.
|
||||||
|
|
||||||
|
// This demo sends process messages with a shared memory buffer created by
|
||||||
|
// TCefSharedProcessMessageBuilderRef.CreateBuilder when you click on the
|
||||||
|
// "Send message" button.
|
||||||
|
|
||||||
|
// TCefSharedProcessMessageBuilderRef.CreateBuilder can be used to create messages
|
||||||
|
// with a large shared memory buffer but this demo only uses one byte.
|
||||||
|
|
||||||
|
// The render process receives the message in GlobalCEFApp_OnProcessMessageReceived
|
||||||
|
// and sends back another message to the browser process
|
||||||
|
|
||||||
|
// The browser process receives the message in Chromium1ProcessMessageReceived
|
||||||
|
// and sends a custom Windows message to the main form to show a text message in
|
||||||
|
// the main application thread.
|
||||||
|
|
||||||
|
// Destruction steps
|
||||||
|
// =================
|
||||||
|
// 1. FormCloseQuery sets CanClose to FALSE calls TChromium.CloseBrowser which
|
||||||
|
// triggers the TChromium.OnClose event.
|
||||||
|
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy
|
||||||
|
// CEFWindowParent1 in the main thread, which triggers the
|
||||||
|
// TChromium.OnBeforeClose event.
|
||||||
|
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the
|
||||||
|
// form.
|
||||||
|
|
||||||
|
procedure GlobalCEFApp_OnProcessMessageReceived(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
sourceProcess : TCefProcessId;
|
||||||
|
const message_ : ICefProcessMessage;
|
||||||
|
var aHandled : boolean);
|
||||||
|
var
|
||||||
|
TempRegion : ICefSharedMemoryRegion;
|
||||||
|
TempData : Pbyte;
|
||||||
|
TempMsg : ICefProcessMessage;
|
||||||
|
TempResult : boolean;
|
||||||
|
begin
|
||||||
|
aHandled := False;
|
||||||
|
|
||||||
|
if (frame <> nil) and
|
||||||
|
frame.IsValid and
|
||||||
|
(message_ <> nil) and
|
||||||
|
(message_.name = CUSTOMMESSAGENAME) then
|
||||||
|
try
|
||||||
|
aHandled := True;
|
||||||
|
TempResult := False;
|
||||||
|
TempRegion := message_.SharedMemoryRegion;
|
||||||
|
|
||||||
|
if (TempRegion <> nil) and TempRegion.IsValid and (TempRegion.Size > 0) then
|
||||||
|
begin
|
||||||
|
// We send a message back to the browser process with a boolean value
|
||||||
|
// in the argument list.
|
||||||
|
TempData := TempRegion.Memory;
|
||||||
|
TempResult := (TempData^ = 42);
|
||||||
|
end;
|
||||||
|
|
||||||
|
TempMsg := TCefProcessMessageRef.New(CUSTOMMESSAGENAME);
|
||||||
|
TempMsg.ArgumentList.SetBool(0, TempResult);
|
||||||
|
frame.SendProcessMessage(PID_BROWSER, TempMsg);
|
||||||
|
finally
|
||||||
|
TempRegion := nil;
|
||||||
|
TempMsg := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure CreateGlobalCEFApp;
|
||||||
|
begin
|
||||||
|
GlobalCEFApp := TCefApplication.Create;
|
||||||
|
GlobalCEFApp.OnProcessMessageReceived := GlobalCEFApp_OnProcessMessageReceived;
|
||||||
|
GlobalCEFApp.LogFile := 'debug.log';
|
||||||
|
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
|
||||||
|
|
||||||
|
// Delphi can only debug one process and it debugs the browser process by
|
||||||
|
// default. If you need to debug code executed in the render process you will
|
||||||
|
// need to use any of the methods described here :
|
||||||
|
// https://www.briskbard.com/index.php?lang=en&pageid=cef#debugging
|
||||||
|
|
||||||
|
// Using the "Single process" mode is one of the ways to debug all the code
|
||||||
|
// because everything is executed in the browser process and Delphi won't have
|
||||||
|
// any problems. However, The "Single process" mode is unsupported by CEF and
|
||||||
|
// it causes unexpected issues. You should *ONLY* use it for debugging
|
||||||
|
// purposses.
|
||||||
|
//GlobalCEFApp.SingleProcess := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1BeforeClose(Sender: TObject;
|
||||||
|
const browser: ICefBrowser);
|
||||||
|
begin
|
||||||
|
FCanClose := True;
|
||||||
|
PostMessage(Handle, WM_CLOSE, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1BeforePopup(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; const targetUrl,
|
||||||
|
targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition;
|
||||||
|
userGesture: Boolean; const popupFeatures: TCefPopupFeatures;
|
||||||
|
var windowInfo: TCefWindowInfo; var client: ICefClient;
|
||||||
|
var settings: TCefBrowserSettings;
|
||||||
|
var extra_info: ICefDictionaryValue;
|
||||||
|
var noJavascriptAccess: Boolean;
|
||||||
|
var Result: Boolean);
|
||||||
|
begin
|
||||||
|
// For simplicity, this demo blocks all popup windows and new tabs
|
||||||
|
Result := (targetDisposition in [WOD_NEW_FOREGROUND_TAB, WOD_NEW_BACKGROUND_TAB, WOD_NEW_POPUP, WOD_NEW_WINDOW]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1Close(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
|
||||||
|
begin
|
||||||
|
PostMessage(Handle, CEF_DESTROY, 0, 0);
|
||||||
|
aAction := cbaDelay;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Chromium1ProcessMessageReceived(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId;
|
||||||
|
const message: ICefProcessMessage; out Result: Boolean);
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if (message <> nil) and (message.Name = CUSTOMMESSAGENAME) then
|
||||||
|
begin
|
||||||
|
if (message.ArgumentList <> nil) and
|
||||||
|
message.ArgumentList.GetBool(0) then
|
||||||
|
MsgContents := 'Messages received successfully!'
|
||||||
|
else
|
||||||
|
MsgContents := 'There was an error receiving the message';
|
||||||
|
|
||||||
|
// This event is executed in a CEF thread so we send a message to the main
|
||||||
|
// form to show the MsgContents value.
|
||||||
|
PostMessage(Handle, MINIBROWSER_SHOWMESSAGE, 0, 0);
|
||||||
|
Result := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormCloseQuery(Sender: TObject;
|
||||||
|
var CanClose: Boolean);
|
||||||
|
begin
|
||||||
|
CanClose := FCanClose;
|
||||||
|
|
||||||
|
if not(FClosing) then
|
||||||
|
begin
|
||||||
|
FClosing := True;
|
||||||
|
Visible := False;
|
||||||
|
Chromium1.CloseBrowser(True);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormCreate(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FCanClose := False;
|
||||||
|
FClosing := False;
|
||||||
|
|
||||||
|
FCritSection := TCriticalSection.Create;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||||
|
begin
|
||||||
|
FreeAndNil(FCritSection);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.FormShow(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.DefaultUrl := AddressEdt.Text;
|
||||||
|
|
||||||
|
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
|
||||||
|
// If it's not initialized yet, we use a simple timer to create the browser later.
|
||||||
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) then Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.GoBtnClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Chromium1.LoadURL(AddressEdt.Text);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BrowserCreatedMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
CEFWindowParent1.UpdateSize;
|
||||||
|
AddressBarPnl.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.BrowserDestroyMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
CEFWindowParent1.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SendMessageBtnClick(Sender: TObject);
|
||||||
|
const
|
||||||
|
BUFFER_SIZE = 1; // Random buffer size for this demo
|
||||||
|
var
|
||||||
|
TempBuilder : ICefSharedProcessMessageBuilder;
|
||||||
|
TempMessage : ICefProcessMessage;
|
||||||
|
TempData : Pbyte;
|
||||||
|
begin
|
||||||
|
// The shared process builder can create process messages with a large buffer
|
||||||
|
// size but this demo only sends a byte.
|
||||||
|
TempBuilder := TCefSharedProcessMessageBuilderRef.CreateBuilder(CUSTOMMESSAGENAME, BUFFER_SIZE);
|
||||||
|
TempMessage := nil;
|
||||||
|
try
|
||||||
|
if assigned(TempBuilder) then
|
||||||
|
begin
|
||||||
|
TempData := TempBuilder.Memory;
|
||||||
|
TempData^ := 42; // Random value passed in the message
|
||||||
|
TempMessage := TempBuilder.Build;
|
||||||
|
Chromium1.SendProcessMessage(PID_RENDERER, TempMessage);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
TempMessage := nil;
|
||||||
|
TempBuilder := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.ShowMessageMsg(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
showmessage(MsgContents);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WMMove(var aMessage : TWMMove);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WMMoving(var aMessage : TMessage);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
|
||||||
|
if (Chromium1 <> nil) then Chromium1.NotifyMoveOrResizeStarted;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.Timer1Timer(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Timer1.Enabled := False;
|
||||||
|
if not(Chromium1.CreateBrowser(CEFWindowParent1, '')) and not(Chromium1.Initialized) then
|
||||||
|
Timer1.Enabled := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainForm.GetMsgContents : string;
|
||||||
|
begin
|
||||||
|
Result := '';
|
||||||
|
if (FCritSection <> nil) then
|
||||||
|
try
|
||||||
|
FCritSection.Acquire;
|
||||||
|
Result := FMsgContents;
|
||||||
|
finally
|
||||||
|
FCritSection.Release;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.SetMsgContents(const aValue : string);
|
||||||
|
begin
|
||||||
|
if (FCritSection <> nil) then
|
||||||
|
try
|
||||||
|
FCritSection.Acquire;
|
||||||
|
FMsgContents := aValue;
|
||||||
|
finally
|
||||||
|
FCritSection.Release;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -15,7 +15,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnDestroy = FormDestroy
|
OnDestroy = FormDestroy
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '2.2.0.4'
|
LCLVersion = '2.2.2.0'
|
||||||
object Splitter1: TSplitter
|
object Splitter1: TSplitter
|
||||||
Left = 1179
|
Left = 1179
|
||||||
Height = 663
|
Height = 663
|
||||||
@ -141,6 +141,8 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
'https://www.youtube.com'
|
'https://www.youtube.com'
|
||||||
'https://html5demos.com/drag/'
|
'https://html5demos.com/drag/'
|
||||||
'https://frames-per-second.appspot.com/'
|
'https://frames-per-second.appspot.com/'
|
||||||
|
'https://www.kirupa.com/html5/accessing_your_webcam_in_html5.htm'
|
||||||
|
'https://www.xdumaine.com/enumerateDevices/test/'
|
||||||
'chrome://version/'
|
'chrome://version/'
|
||||||
'chrome://net-internals/'
|
'chrome://net-internals/'
|
||||||
'chrome://tracing/'
|
'chrome://tracing/'
|
||||||
@ -258,6 +260,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnStatusMessage = Chromium1StatusMessage
|
OnStatusMessage = Chromium1StatusMessage
|
||||||
OnLoadingProgressChange = Chromium1LoadingProgressChange
|
OnLoadingProgressChange = Chromium1LoadingProgressChange
|
||||||
OnCursorChange = Chromium1CursorChange
|
OnCursorChange = Chromium1CursorChange
|
||||||
|
OnMediaAccessChange = Chromium1MediaAccessChange
|
||||||
OnCanDownload = Chromium1CanDownload
|
OnCanDownload = Chromium1CanDownload
|
||||||
OnBeforeDownload = Chromium1BeforeDownload
|
OnBeforeDownload = Chromium1BeforeDownload
|
||||||
OnDownloadUpdated = Chromium1DownloadUpdated
|
OnDownloadUpdated = Chromium1DownloadUpdated
|
||||||
@ -268,6 +271,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
|
|||||||
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
OnBeforeResourceLoad = Chromium1BeforeResourceLoad
|
||||||
OnResourceResponse = Chromium1ResourceResponse
|
OnResourceResponse = Chromium1ResourceResponse
|
||||||
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
OnDevToolsMethodResult = Chromium1DevToolsMethodResult
|
||||||
|
OnRequestMediaAccessPermission = Chromium1RequestMediaAccessPermission
|
||||||
Left = 32
|
Left = 32
|
||||||
Top = 224
|
Top = 224
|
||||||
end
|
end
|
||||||
|
@ -62,6 +62,7 @@ const
|
|||||||
MINIBROWSER_PDFPRINT_END = WM_APP + $10C;
|
MINIBROWSER_PDFPRINT_END = WM_APP + $10C;
|
||||||
MINIBROWSER_PREFS_AVLBL = WM_APP + $10D;
|
MINIBROWSER_PREFS_AVLBL = WM_APP + $10D;
|
||||||
MINIBROWSER_DTDATA_AVLBL = WM_APP + $10E;
|
MINIBROWSER_DTDATA_AVLBL = WM_APP + $10E;
|
||||||
|
MINIBROWSER_MEDIAACCESSRQST = WM_APP + $10F;
|
||||||
|
|
||||||
MINIBROWSER_HOMEPAGE = 'https://www.google.com';
|
MINIBROWSER_HOMEPAGE = 'https://www.google.com';
|
||||||
|
|
||||||
@ -147,6 +148,12 @@ type
|
|||||||
const result: ICefValue);
|
const result: ICefValue);
|
||||||
procedure Chromium1DownloadImageFinished(Sender: TObject;
|
procedure Chromium1DownloadImageFinished(Sender: TObject;
|
||||||
const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage);
|
const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage);
|
||||||
|
procedure Chromium1MediaAccessChange(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
procedure Chromium1RequestMediaAccessPermission(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
const requesting_origin: ustring; requested_permissions: cardinal;
|
||||||
|
const callback: ICefMediaAccessCallback; var aResult: boolean);
|
||||||
procedure Chromium1ZoomPctAvailable(Sender: TObject; const aZoomPct: double
|
procedure Chromium1ZoomPctAvailable(Sender: TObject; const aZoomPct: double
|
||||||
);
|
);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@ -257,6 +264,10 @@ type
|
|||||||
FHasShutdownReason : boolean;
|
FHasShutdownReason : boolean;
|
||||||
FAllowDownloads : boolean;
|
FAllowDownloads : boolean;
|
||||||
|
|
||||||
|
FMediaAccessCallback : ICefMediaAccessCallback;
|
||||||
|
FRequestingOrigin : string;
|
||||||
|
FRequestedPermissions : cardinal;
|
||||||
|
|
||||||
// Variables to control when can we destroy the form safely
|
// Variables to control when can we destroy the form safely
|
||||||
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
FCanClose : boolean; // Set to True in TChromium.OnBeforeClose
|
||||||
FClosing : boolean; // Set to True in the CloseQuery event.
|
FClosing : boolean; // Set to True in the CloseQuery event.
|
||||||
@ -292,6 +303,7 @@ type
|
|||||||
procedure PrintPDFEndMsg(var aMessage : TMessage); message MINIBROWSER_PDFPRINT_END;
|
procedure PrintPDFEndMsg(var aMessage : TMessage); message MINIBROWSER_PDFPRINT_END;
|
||||||
procedure PreferencesAvailableMsg(var aMessage : TMessage); message MINIBROWSER_PREFS_AVLBL;
|
procedure PreferencesAvailableMsg(var aMessage : TMessage); message MINIBROWSER_PREFS_AVLBL;
|
||||||
procedure DevToolsDataAvailableMsg(var aMessage : TMessage); message MINIBROWSER_DTDATA_AVLBL;
|
procedure DevToolsDataAvailableMsg(var aMessage : TMessage); message MINIBROWSER_DTDATA_AVLBL;
|
||||||
|
procedure MediaAccessRequestMsg(var aMessage : TMessage); message MINIBROWSER_MEDIAACCESSRQST;
|
||||||
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
procedure WMMove(var aMessage : TWMMove); message WM_MOVE;
|
||||||
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
procedure WMMoving(var aMessage : TMessage); message WM_MOVING;
|
||||||
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
procedure WMEnterMenuLoop(var aMessage: TMessage); message WM_ENTERMENULOOP;
|
||||||
@ -1093,6 +1105,7 @@ begin
|
|||||||
if FHasShutdownReason then
|
if FHasShutdownReason then
|
||||||
ShutdownBlockReasonDestroy(Application.Handle);
|
ShutdownBlockReasonDestroy(Application.Handle);
|
||||||
|
|
||||||
|
FMediaAccessCallback := nil;
|
||||||
FResponse.Free;
|
FResponse.Free;
|
||||||
FRequest.Free;
|
FRequest.Free;
|
||||||
FNavigation.Free;
|
FNavigation.Free;
|
||||||
@ -1269,6 +1282,43 @@ begin
|
|||||||
showmessage('There was an error in the DevTools method');
|
showmessage('There was an error in the DevTools method');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.MediaAccessRequestMsg(var aMessage : TMessage);
|
||||||
|
var
|
||||||
|
TempMessage : string;
|
||||||
|
TempPermissions : TStringList;
|
||||||
|
begin
|
||||||
|
TempPermissions := TStringList.Create;
|
||||||
|
try
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Device audio');
|
||||||
|
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Device video');
|
||||||
|
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DESKTOP_AUDIO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Desktop audio');
|
||||||
|
|
||||||
|
if ((FRequestedPermissions and CEF_MEDIA_PERMISSION_DESKTOP_VIDEO_CAPTURE) <> 0) then
|
||||||
|
TempPermissions.Add('Desktop video');
|
||||||
|
|
||||||
|
if assigned(FMediaAccessCallback) and (TempPermissions.Count > 0) then
|
||||||
|
begin
|
||||||
|
TempMessage := FRequestingOrigin +
|
||||||
|
' is asking for permission to access : ' + CRLF +
|
||||||
|
TempPermissions.Text + CRLF +
|
||||||
|
'Do you want allow it?';
|
||||||
|
|
||||||
|
if (MessageDlg(TempMessage, mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes) then
|
||||||
|
FMediaAccessCallback.cont(FRequestedPermissions)
|
||||||
|
else
|
||||||
|
FMediaAccessCallback.Cancel;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
TempPermissions.Free;
|
||||||
|
FMediaAccessCallback := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1DownloadImageFinished(Sender: TObject;
|
procedure TMiniBrowserFrm.Chromium1DownloadImageFinished(Sender: TObject;
|
||||||
const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage);
|
const imageUrl: ustring; httpStatusCode: Integer; const image: ICefImage);
|
||||||
var
|
var
|
||||||
@ -1333,6 +1383,36 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1MediaAccessChange(Sender: TObject;
|
||||||
|
const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
var
|
||||||
|
TempText : string;
|
||||||
|
begin
|
||||||
|
// This event is executed in a CEF thread and this can cause problems when
|
||||||
|
// you change the 'Enabled' and 'Visible' properties from VCL components.
|
||||||
|
// It's recommended to change the 'Enabled' and 'Visible' properties
|
||||||
|
// in the main application thread and not in a CEF thread.
|
||||||
|
// It's much safer to use PostMessage to send a message to the main form with
|
||||||
|
// all this information and update those properties in the procedure handling
|
||||||
|
// that message.
|
||||||
|
TempText := 'Video access : ' + BooltoStr(has_video_access, True) + ' - ' +
|
||||||
|
'Audio access : ' + BooltoStr(has_audio_access, True);
|
||||||
|
StatusPnl.Caption := TempText;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TMiniBrowserFrm.Chromium1RequestMediaAccessPermission(
|
||||||
|
Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame;
|
||||||
|
const requesting_origin: ustring; requested_permissions: cardinal;
|
||||||
|
const callback: ICefMediaAccessCallback; var aResult: boolean);
|
||||||
|
begin
|
||||||
|
aResult := True;
|
||||||
|
FMediaAccessCallback := callback;
|
||||||
|
FRequestingOrigin := requesting_origin;
|
||||||
|
FRequestedPermissions := requested_permissions;
|
||||||
|
|
||||||
|
PostMessage(Handle, MINIBROWSER_MEDIAACCESSRQST, 0, 0);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMiniBrowserFrm.Chromium1ZoomPctAvailable(Sender: TObject;
|
procedure TMiniBrowserFrm.Chromium1ZoomPctAvailable(Sender: TObject;
|
||||||
const aZoomPct: double);
|
const aZoomPct: double);
|
||||||
begin
|
begin
|
||||||
|
@ -66,15 +66,15 @@ uses
|
|||||||
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
|
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
|
||||||
|
|
||||||
const
|
const
|
||||||
CEF_SUPPORTED_VERSION_MAJOR = 103;
|
CEF_SUPPORTED_VERSION_MAJOR = 104;
|
||||||
CEF_SUPPORTED_VERSION_MINOR = 0;
|
CEF_SUPPORTED_VERSION_MINOR = 4;
|
||||||
CEF_SUPPORTED_VERSION_RELEASE = 12;
|
CEF_SUPPORTED_VERSION_RELEASE = 18;
|
||||||
CEF_SUPPORTED_VERSION_BUILD = 0;
|
CEF_SUPPORTED_VERSION_BUILD = 0;
|
||||||
|
|
||||||
CEF_CHROMEELF_VERSION_MAJOR = 103;
|
CEF_CHROMEELF_VERSION_MAJOR = 103;
|
||||||
CEF_CHROMEELF_VERSION_MINOR = 0;
|
CEF_CHROMEELF_VERSION_MINOR = 0;
|
||||||
CEF_CHROMEELF_VERSION_RELEASE = 5060;
|
CEF_CHROMEELF_VERSION_RELEASE = 5112;
|
||||||
CEF_CHROMEELF_VERSION_BUILD = 134;
|
CEF_CHROMEELF_VERSION_BUILD = 81;
|
||||||
|
|
||||||
{$IFDEF MSWINDOWS}
|
{$IFDEF MSWINDOWS}
|
||||||
LIBCEF_DLL = 'libcef.dll';
|
LIBCEF_DLL = 'libcef.dll';
|
||||||
@ -317,8 +317,9 @@ type
|
|||||||
function Load_cef_request_context_capi_h : boolean;
|
function Load_cef_request_context_capi_h : boolean;
|
||||||
function Load_cef_resource_bundle_capi_h : boolean;
|
function Load_cef_resource_bundle_capi_h : boolean;
|
||||||
function Load_cef_response_capi_h : boolean;
|
function Load_cef_response_capi_h : boolean;
|
||||||
function Load_cef_server_capi_h : boolean;
|
|
||||||
function Load_cef_scheme_capi_h : boolean;
|
function Load_cef_scheme_capi_h : boolean;
|
||||||
|
function Load_cef_server_capi_h : boolean;
|
||||||
|
function Load_cef_shared_process_message_builder_capi_h : boolean;
|
||||||
function Load_cef_ssl_info_capi_h : boolean;
|
function Load_cef_ssl_info_capi_h : boolean;
|
||||||
function Load_cef_stream_capi_h : boolean;
|
function Load_cef_stream_capi_h : boolean;
|
||||||
function Load_cef_task_capi_h : boolean;
|
function Load_cef_task_capi_h : boolean;
|
||||||
@ -698,7 +699,7 @@ begin
|
|||||||
|
|
||||||
// Fields used to set command line switches
|
// Fields used to set command line switches
|
||||||
FSingleProcess := False;
|
FSingleProcess := False;
|
||||||
FEnableMediaStream := True;
|
FEnableMediaStream := False;
|
||||||
FEnableSpeechInput := False;
|
FEnableSpeechInput := False;
|
||||||
FUseFakeUIForMediaStream := False;
|
FUseFakeUIForMediaStream := False;
|
||||||
FEnableUsermediaScreenCapturing := False;
|
FEnableUsermediaScreenCapturing := False;
|
||||||
@ -1917,7 +1918,8 @@ var
|
|||||||
i : integer;
|
i : integer;
|
||||||
TempFormatSettings : TFormatSettings;
|
TempFormatSettings : TFormatSettings;
|
||||||
begin
|
begin
|
||||||
ReplaceSwitch(aKeys, aValues, '--enable-media-stream', IntToStr(Ord(FEnableMediaStream)));
|
if FEnableMediaStream then
|
||||||
|
ReplaceSwitch(aKeys, aValues, '--enable-media-stream');
|
||||||
|
|
||||||
if FEnableSpeechInput then
|
if FEnableSpeechInput then
|
||||||
ReplaceSwitch(aKeys, aValues, '--enable-speech-input');
|
ReplaceSwitch(aKeys, aValues, '--enable-speech-input');
|
||||||
@ -2537,8 +2539,9 @@ begin
|
|||||||
Load_cef_request_context_capi_h and
|
Load_cef_request_context_capi_h and
|
||||||
Load_cef_resource_bundle_capi_h and
|
Load_cef_resource_bundle_capi_h and
|
||||||
Load_cef_response_capi_h and
|
Load_cef_response_capi_h and
|
||||||
Load_cef_server_capi_h and
|
|
||||||
Load_cef_scheme_capi_h and
|
Load_cef_scheme_capi_h and
|
||||||
|
Load_cef_server_capi_h and
|
||||||
|
Load_cef_shared_process_message_builder_capi_h and
|
||||||
Load_cef_ssl_info_capi_h and
|
Load_cef_ssl_info_capi_h and
|
||||||
Load_cef_stream_capi_h and
|
Load_cef_stream_capi_h and
|
||||||
Load_cef_task_capi_h and
|
Load_cef_task_capi_h and
|
||||||
@ -2813,13 +2816,6 @@ begin
|
|||||||
Result := assigned(cef_response_create);
|
Result := assigned(cef_response_create);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCefApplicationCore.Load_cef_server_capi_h : boolean;
|
|
||||||
begin
|
|
||||||
{$IFDEF FPC}Pointer({$ENDIF}cef_server_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_server_create');
|
|
||||||
|
|
||||||
Result := assigned(cef_server_create);
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TCefApplicationCore.Load_cef_scheme_capi_h : boolean;
|
function TCefApplicationCore.Load_cef_scheme_capi_h : boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC}Pointer({$ENDIF}cef_register_scheme_handler_factory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_scheme_handler_factory');
|
{$IFDEF FPC}Pointer({$ENDIF}cef_register_scheme_handler_factory{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_scheme_handler_factory');
|
||||||
@ -2829,6 +2825,20 @@ begin
|
|||||||
assigned(cef_clear_scheme_handler_factories);
|
assigned(cef_clear_scheme_handler_factories);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCefApplicationCore.Load_cef_server_capi_h : boolean;
|
||||||
|
begin
|
||||||
|
{$IFDEF FPC}Pointer({$ENDIF}cef_server_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_server_create');
|
||||||
|
|
||||||
|
Result := assigned(cef_server_create);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefApplicationCore.Load_cef_shared_process_message_builder_capi_h : boolean;
|
||||||
|
begin
|
||||||
|
{$IFDEF FPC}Pointer({$ENDIF}cef_shared_process_message_builder_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_shared_process_message_builder_create');
|
||||||
|
|
||||||
|
Result := assigned(cef_shared_process_message_builder_create);
|
||||||
|
end;
|
||||||
|
|
||||||
function TCefApplicationCore.Load_cef_ssl_info_capi_h : boolean;
|
function TCefApplicationCore.Load_cef_ssl_info_capi_h : boolean;
|
||||||
begin
|
begin
|
||||||
{$IFDEF FPC}Pointer({$ENDIF}cef_is_cert_status_error{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_is_cert_status_error');
|
{$IFDEF FPC}Pointer({$ENDIF}cef_is_cert_status_error{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_is_cert_status_error');
|
||||||
|
@ -180,6 +180,9 @@ type
|
|||||||
FOnRunContextMenu : TOnRunContextMenu;
|
FOnRunContextMenu : TOnRunContextMenu;
|
||||||
FOnContextMenuCommand : TOnContextMenuCommand;
|
FOnContextMenuCommand : TOnContextMenuCommand;
|
||||||
FOnContextMenuDismissed : TOnContextMenuDismissed;
|
FOnContextMenuDismissed : TOnContextMenuDismissed;
|
||||||
|
FOnRunQuickMenu : TOnRunQuickMenuEvent;
|
||||||
|
FOnQuickMenuCommand : TOnQuickMenuCommandEvent;
|
||||||
|
FOnQuickMenuDismissed : TOnQuickMenuDismissedEvent;
|
||||||
|
|
||||||
// ICefKeyboardHandler
|
// ICefKeyboardHandler
|
||||||
FOnPreKeyEvent : TOnPreKeyEvent;
|
FOnPreKeyEvent : TOnPreKeyEvent;
|
||||||
@ -196,6 +199,7 @@ type
|
|||||||
FOnAutoResize : TOnAutoResize;
|
FOnAutoResize : TOnAutoResize;
|
||||||
FOnLoadingProgressChange : TOnLoadingProgressChange;
|
FOnLoadingProgressChange : TOnLoadingProgressChange;
|
||||||
FOnCursorChange : TOnCursorChange;
|
FOnCursorChange : TOnCursorChange;
|
||||||
|
FOnMediaAccessChange : TOnMediaAccessChange;
|
||||||
|
|
||||||
// ICefDownloadHandler
|
// ICefDownloadHandler
|
||||||
FOnCanDownload : TOnCanDownloadEvent;
|
FOnCanDownload : TOnCanDownloadEvent;
|
||||||
@ -252,6 +256,8 @@ type
|
|||||||
FOnPopupSize : TOnPopupSize;
|
FOnPopupSize : TOnPopupSize;
|
||||||
FOnPaint : TOnPaint;
|
FOnPaint : TOnPaint;
|
||||||
FOnAcceleratedPaint : TOnAcceleratedPaint;
|
FOnAcceleratedPaint : TOnAcceleratedPaint;
|
||||||
|
FOnGetTouchHandleSize : TOnGetTouchHandleSize;
|
||||||
|
FOnTouchHandleStateChanged : TOnTouchHandleStateChanged;
|
||||||
FOnStartDragging : TOnStartDragging;
|
FOnStartDragging : TOnStartDragging;
|
||||||
FOnUpdateDragCursor : TOnUpdateDragCursor;
|
FOnUpdateDragCursor : TOnUpdateDragCursor;
|
||||||
FOnScrollOffsetChanged : TOnScrollOffsetChanged;
|
FOnScrollOffsetChanged : TOnScrollOffsetChanged;
|
||||||
@ -320,6 +326,11 @@ type
|
|||||||
// ICefCommandHandler
|
// ICefCommandHandler
|
||||||
FOnChromeCommand : TOnChromeCommandEvent;
|
FOnChromeCommand : TOnChromeCommandEvent;
|
||||||
|
|
||||||
|
// ICefPermissionHandler
|
||||||
|
FOnRequestMediaAccessPermission : TOnRequestMediaAccessPermissionEvent;
|
||||||
|
FOnShowPermissionPrompt : TOnShowPermissionPromptEvent;
|
||||||
|
FOnDismissPermissionPrompt : TOnDismissPermissionPromptEvent;
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
FOnTextResultAvailable : TOnTextResultAvailableEvent;
|
FOnTextResultAvailable : TOnTextResultAvailableEvent;
|
||||||
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
|
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
|
||||||
@ -520,6 +531,9 @@ type
|
|||||||
function doRunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean; virtual;
|
function doRunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean; virtual;
|
||||||
function doOnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; virtual;
|
function doOnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; virtual;
|
||||||
procedure doOnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual;
|
procedure doOnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual;
|
||||||
|
function doRunQuickMenu(const browser: ICefBrowser; const frame: ICefFrame; location: PCefPoint; size: PCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; const callback: ICefRunQuickMenuCallback): boolean; virtual;
|
||||||
|
function doOnQuickMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; command_id: integer; event_flags: TCefEventFlags): boolean; virtual;
|
||||||
|
procedure doOnQuickMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual;
|
||||||
|
|
||||||
// ICefKeyboardHandler
|
// ICefKeyboardHandler
|
||||||
function doOnPreKeyEvent(const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; virtual;
|
function doOnPreKeyEvent(const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean; virtual;
|
||||||
@ -536,6 +550,7 @@ type
|
|||||||
function doOnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; virtual;
|
function doOnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; virtual;
|
||||||
procedure doOnLoadingProgressChange(const browser: ICefBrowser; const progress: double); virtual;
|
procedure doOnLoadingProgressChange(const browser: ICefBrowser; const progress: double); virtual;
|
||||||
procedure doOnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean); virtual;
|
procedure doOnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean); virtual;
|
||||||
|
procedure doOnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean); virtual;
|
||||||
|
|
||||||
// ICefDownloadHandler
|
// ICefDownloadHandler
|
||||||
function doOnCanDownload(const browser: ICefBrowser; const url, request_method: ustring): boolean;
|
function doOnCanDownload(const browser: ICefBrowser; const url, request_method: ustring): boolean;
|
||||||
@ -592,6 +607,8 @@ type
|
|||||||
procedure doOnPopupSize(const browser: ICefBrowser; const rect: PCefRect); virtual;
|
procedure doOnPopupSize(const browser: ICefBrowser; const rect: PCefRect); virtual;
|
||||||
procedure doOnPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); virtual;
|
procedure doOnPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); virtual;
|
||||||
procedure doOnAcceleratedPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); virtual;
|
procedure doOnAcceleratedPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); virtual;
|
||||||
|
procedure doGetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize); virtual;
|
||||||
|
procedure doOnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState); virtual;
|
||||||
function doOnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; virtual;
|
function doOnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; virtual;
|
||||||
procedure doOnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation); virtual;
|
procedure doOnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation); virtual;
|
||||||
procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual;
|
procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual;
|
||||||
@ -657,6 +674,11 @@ type
|
|||||||
// ICefCommandHandler
|
// ICefCommandHandler
|
||||||
function doOnChromeCommand(const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition): boolean;
|
function doOnChromeCommand(const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition): boolean;
|
||||||
|
|
||||||
|
// ICefPermissionHandler
|
||||||
|
function doOnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefMediaAccessCallback): boolean;
|
||||||
|
function doOnShowPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefPermissionPromptCallback): boolean;
|
||||||
|
procedure doOnDismissPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult);
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
procedure GetSettings(var aSettings : TCefBrowserSettings);
|
procedure GetSettings(var aSettings : TCefBrowserSettings);
|
||||||
procedure doCookiesDeleted(numDeleted : integer); virtual;
|
procedure doCookiesDeleted(numDeleted : integer); virtual;
|
||||||
@ -707,6 +729,7 @@ type
|
|||||||
function MustCreateExtensionHandler : boolean; virtual;
|
function MustCreateExtensionHandler : boolean; virtual;
|
||||||
function MustCreatePrintHandler : boolean; virtual;
|
function MustCreatePrintHandler : boolean; virtual;
|
||||||
function MustCreateFrameHandler : boolean; virtual;
|
function MustCreateFrameHandler : boolean; virtual;
|
||||||
|
function MustCreatePermissionHandler : boolean; virtual;
|
||||||
|
|
||||||
property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;
|
property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;
|
||||||
|
|
||||||
@ -1007,6 +1030,9 @@ type
|
|||||||
property OnRunContextMenu : TOnRunContextMenu read FOnRunContextMenu write FOnRunContextMenu;
|
property OnRunContextMenu : TOnRunContextMenu read FOnRunContextMenu write FOnRunContextMenu;
|
||||||
property OnContextMenuCommand : TOnContextMenuCommand read FOnContextMenuCommand write FOnContextMenuCommand;
|
property OnContextMenuCommand : TOnContextMenuCommand read FOnContextMenuCommand write FOnContextMenuCommand;
|
||||||
property OnContextMenuDismissed : TOnContextMenuDismissed read FOnContextMenuDismissed write FOnContextMenuDismissed;
|
property OnContextMenuDismissed : TOnContextMenuDismissed read FOnContextMenuDismissed write FOnContextMenuDismissed;
|
||||||
|
property OnRunQuickMenu : TOnRunQuickMenuEvent read FOnRunQuickMenu write FOnRunQuickMenu;
|
||||||
|
property OnQuickMenuCommand : TOnQuickMenuCommandEvent read FOnQuickMenuCommand write FOnQuickMenuCommand;
|
||||||
|
property OnQuickMenuDismissed : TOnQuickMenuDismissedEvent read FOnQuickMenuDismissed write FOnQuickMenuDismissed;
|
||||||
|
|
||||||
// ICefKeyboardHandler
|
// ICefKeyboardHandler
|
||||||
property OnPreKeyEvent : TOnPreKeyEvent read FOnPreKeyEvent write FOnPreKeyEvent;
|
property OnPreKeyEvent : TOnPreKeyEvent read FOnPreKeyEvent write FOnPreKeyEvent;
|
||||||
@ -1023,6 +1049,7 @@ type
|
|||||||
property OnAutoResize : TOnAutoResize read FOnAutoResize write FOnAutoResize;
|
property OnAutoResize : TOnAutoResize read FOnAutoResize write FOnAutoResize;
|
||||||
property OnLoadingProgressChange : TOnLoadingProgressChange read FOnLoadingProgressChange write FOnLoadingProgressChange;
|
property OnLoadingProgressChange : TOnLoadingProgressChange read FOnLoadingProgressChange write FOnLoadingProgressChange;
|
||||||
property OnCursorChange : TOnCursorChange read FOnCursorChange write FOnCursorChange;
|
property OnCursorChange : TOnCursorChange read FOnCursorChange write FOnCursorChange;
|
||||||
|
property OnMediaAccessChange : TOnMediaAccessChange read FOnMediaAccessChange write FOnMediaAccessChange;
|
||||||
|
|
||||||
// ICefDownloadHandler
|
// ICefDownloadHandler
|
||||||
property OnCanDownload : TOnCanDownloadEvent read FOnCanDownload write FOnCanDownload;
|
property OnCanDownload : TOnCanDownloadEvent read FOnCanDownload write FOnCanDownload;
|
||||||
@ -1079,6 +1106,8 @@ type
|
|||||||
property OnPopupSize : TOnPopupSize read FOnPopupSize write FOnPopupSize;
|
property OnPopupSize : TOnPopupSize read FOnPopupSize write FOnPopupSize;
|
||||||
property OnPaint : TOnPaint read FOnPaint write FOnPaint;
|
property OnPaint : TOnPaint read FOnPaint write FOnPaint;
|
||||||
property OnAcceleratedPaint : TOnAcceleratedPaint read FOnAcceleratedPaint write FOnAcceleratedPaint;
|
property OnAcceleratedPaint : TOnAcceleratedPaint read FOnAcceleratedPaint write FOnAcceleratedPaint;
|
||||||
|
property OnGetTouchHandleSize : TOnGetTouchHandleSize read FOnGetTouchHandleSize write FOnGetTouchHandleSize;
|
||||||
|
property OnTouchHandleStateChanged : TOnTouchHandleStateChanged read FOnTouchHandleStateChanged write FOnTouchHandleStateChanged;
|
||||||
property OnStartDragging : TOnStartDragging read FOnStartDragging write FOnStartDragging;
|
property OnStartDragging : TOnStartDragging read FOnStartDragging write FOnStartDragging;
|
||||||
property OnUpdateDragCursor : TOnUpdateDragCursor read FOnUpdateDragCursor write FOnUpdateDragCursor;
|
property OnUpdateDragCursor : TOnUpdateDragCursor read FOnUpdateDragCursor write FOnUpdateDragCursor;
|
||||||
property OnScrollOffsetChanged : TOnScrollOffsetChanged read FOnScrollOffsetChanged write FOnScrollOffsetChanged;
|
property OnScrollOffsetChanged : TOnScrollOffsetChanged read FOnScrollOffsetChanged write FOnScrollOffsetChanged;
|
||||||
@ -1148,6 +1177,11 @@ type
|
|||||||
|
|
||||||
// ICefCommandHandler
|
// ICefCommandHandler
|
||||||
property OnChromeCommand : TOnChromeCommandEvent read FOnChromeCommand write FOnChromeCommand;
|
property OnChromeCommand : TOnChromeCommandEvent read FOnChromeCommand write FOnChromeCommand;
|
||||||
|
|
||||||
|
// ICefPermissionHandler
|
||||||
|
property OnRequestMediaAccessPermission : TOnRequestMediaAccessPermissionEvent read FOnRequestMediaAccessPermission write FOnRequestMediaAccessPermission;
|
||||||
|
property OnShowPermissionPrompt : TOnShowPermissionPromptEvent read FOnShowPermissionPrompt write FOnShowPermissionPrompt;
|
||||||
|
property OnDismissPermissionPrompt : TOnDismissPermissionPromptEvent read FOnDismissPermissionPrompt write FOnDismissPermissionPrompt;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TBrowserInfo = class
|
TBrowserInfo = class
|
||||||
@ -1735,6 +1769,9 @@ begin
|
|||||||
FOnRunContextMenu := nil;
|
FOnRunContextMenu := nil;
|
||||||
FOnContextMenuCommand := nil;
|
FOnContextMenuCommand := nil;
|
||||||
FOnContextMenuDismissed := nil;
|
FOnContextMenuDismissed := nil;
|
||||||
|
FOnRunQuickMenu := nil;
|
||||||
|
FOnQuickMenuCommand := nil;
|
||||||
|
FOnQuickMenuDismissed := nil;
|
||||||
|
|
||||||
// ICefKeyboardHandler
|
// ICefKeyboardHandler
|
||||||
FOnPreKeyEvent := nil;
|
FOnPreKeyEvent := nil;
|
||||||
@ -1751,6 +1788,7 @@ begin
|
|||||||
FOnAutoResize := nil;
|
FOnAutoResize := nil;
|
||||||
FOnLoadingProgressChange := nil;
|
FOnLoadingProgressChange := nil;
|
||||||
FOnCursorChange := nil;
|
FOnCursorChange := nil;
|
||||||
|
FOnMediaAccessChange := nil;
|
||||||
|
|
||||||
// ICefDownloadHandler
|
// ICefDownloadHandler
|
||||||
FOnCanDownload := nil;
|
FOnCanDownload := nil;
|
||||||
@ -1807,6 +1845,8 @@ begin
|
|||||||
FOnPopupSize := nil;
|
FOnPopupSize := nil;
|
||||||
FOnPaint := nil;
|
FOnPaint := nil;
|
||||||
FOnAcceleratedPaint := nil;
|
FOnAcceleratedPaint := nil;
|
||||||
|
FOnGetTouchHandleSize := nil;
|
||||||
|
FOnTouchHandleStateChanged := nil;
|
||||||
FOnStartDragging := nil;
|
FOnStartDragging := nil;
|
||||||
FOnUpdateDragCursor := nil;
|
FOnUpdateDragCursor := nil;
|
||||||
FOnScrollOffsetChanged := nil;
|
FOnScrollOffsetChanged := nil;
|
||||||
@ -1875,6 +1915,11 @@ begin
|
|||||||
// ICefCommandHandler
|
// ICefCommandHandler
|
||||||
FOnChromeCommand := nil;
|
FOnChromeCommand := nil;
|
||||||
|
|
||||||
|
// ICefPermissionHandler
|
||||||
|
FOnRequestMediaAccessPermission := nil;
|
||||||
|
FOnShowPermissionPrompt := nil;
|
||||||
|
FOnDismissPermissionPrompt := nil;
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
FOnTextResultAvailable := nil;
|
FOnTextResultAvailable := nil;
|
||||||
FOnPdfPrintFinished := nil;
|
FOnPdfPrintFinished := nil;
|
||||||
@ -4728,7 +4773,10 @@ begin
|
|||||||
Result := assigned(FOnBeforeContextMenu) or
|
Result := assigned(FOnBeforeContextMenu) or
|
||||||
assigned(FOnRunContextMenu) or
|
assigned(FOnRunContextMenu) or
|
||||||
assigned(FOnContextMenuCommand) or
|
assigned(FOnContextMenuCommand) or
|
||||||
assigned(FOnContextMenuDismissed);
|
assigned(FOnContextMenuDismissed) or
|
||||||
|
assigned(FOnRunQuickMenu) or
|
||||||
|
assigned(FOnQuickMenuCommand) or
|
||||||
|
assigned(FOnQuickMenuDismissed);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChromiumCore.MustCreateDialogHandler : boolean;
|
function TChromiumCore.MustCreateDialogHandler : boolean;
|
||||||
@ -4753,7 +4801,8 @@ begin
|
|||||||
assigned(FOnConsoleMessage) or
|
assigned(FOnConsoleMessage) or
|
||||||
assigned(FOnAutoResize) or
|
assigned(FOnAutoResize) or
|
||||||
assigned(FOnLoadingProgressChange) or
|
assigned(FOnLoadingProgressChange) or
|
||||||
assigned(FOnCursorChange);
|
assigned(FOnCursorChange) or
|
||||||
|
assigned(FOnMediaAccessChange);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChromiumCore.MustCreateDownloadHandler : boolean;
|
function TChromiumCore.MustCreateDownloadHandler : boolean;
|
||||||
@ -4874,6 +4923,13 @@ begin
|
|||||||
assigned(FOnMainFrameChanged);
|
assigned(FOnMainFrameChanged);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChromiumCore.MustCreatePermissionHandler : boolean;
|
||||||
|
begin
|
||||||
|
Result := assigned(FOnRequestMediaAccessPermission) or
|
||||||
|
assigned(FOnShowPermissionPrompt) or
|
||||||
|
assigned(FOnDismissPermissionPrompt);
|
||||||
|
end;
|
||||||
|
|
||||||
function TChromiumCore.MustCreateCommandHandler : boolean;
|
function TChromiumCore.MustCreateCommandHandler : boolean;
|
||||||
begin
|
begin
|
||||||
Result := assigned(FOnChromeCommand);
|
Result := assigned(FOnChromeCommand);
|
||||||
@ -5459,6 +5515,37 @@ begin
|
|||||||
FOnContextMenuDismissed(Self, browser, frame);
|
FOnContextMenuDismissed(Self, browser, frame);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChromiumCore.doRunQuickMenu(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
location : PCefPoint;
|
||||||
|
size : PCefSize;
|
||||||
|
edit_state_flags : TCefQuickMenuEditStateFlags;
|
||||||
|
const callback : ICefRunQuickMenuCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if assigned(FOnRunQuickMenu) then
|
||||||
|
FOnRunQuickMenu(Self, browser, frame, location^, size^, edit_state_flags, callback, Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TChromiumCore.doOnQuickMenuCommand(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
command_id : integer;
|
||||||
|
event_flags : TCefEventFlags): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if assigned(FOnQuickMenuCommand) then
|
||||||
|
FOnQuickMenuCommand(Self, browser, frame, command_id, event_flags, Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumCore.doOnQuickMenuDismissed(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame);
|
||||||
|
begin
|
||||||
|
if assigned(FOnQuickMenuDismissed) then
|
||||||
|
FOnQuickMenuDismissed(Self, browser, frame);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.doOnCursorChange(const browser : ICefBrowser;
|
procedure TChromiumCore.doOnCursorChange(const browser : ICefBrowser;
|
||||||
cursor_ : TCefCursorHandle;
|
cursor_ : TCefCursorHandle;
|
||||||
cursorType : TCefCursorType;
|
cursorType : TCefCursorType;
|
||||||
@ -5471,6 +5558,12 @@ begin
|
|||||||
FOnCursorChange(self, browser, cursor_, cursorType, customCursorInfo, aResult);
|
FOnCursorChange(self, browser, cursor_, cursorType, customCursorInfo, aResult);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumCore.doOnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
begin
|
||||||
|
if assigned(FOnMediaAccessChange) then
|
||||||
|
FOnMediaAccessChange(self, browser, has_video_access, has_audio_access);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.doOnDialogClosed(const browser: ICefBrowser);
|
procedure TChromiumCore.doOnDialogClosed(const browser: ICefBrowser);
|
||||||
begin
|
begin
|
||||||
if assigned(FOnDialogClosed) then
|
if assigned(FOnDialogClosed) then
|
||||||
@ -5843,7 +5936,9 @@ begin
|
|||||||
FOnMainFrameChanged(self, browser, old_frame, new_frame);
|
FOnMainFrameChanged(self, browser, old_frame, new_frame);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TChromiumCore.doOnChromeCommand(const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition): boolean;
|
function TChromiumCore.doOnChromeCommand(const browser : ICefBrowser;
|
||||||
|
command_id : integer;
|
||||||
|
disposition : TCefWindowOpenDisposition): boolean;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
@ -5851,6 +5946,38 @@ begin
|
|||||||
FOnChromeCommand(self, browser, command_id, disposition, Result);
|
FOnChromeCommand(self, browser, command_id, disposition, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TChromiumCore.doOnRequestMediaAccessPermission(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const requesting_origin : ustring;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
const callback : ICefMediaAccessCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if assigned(FOnRequestMediaAccessPermission) then
|
||||||
|
FOnRequestMediaAccessPermission(self, browser, frame, requesting_origin, requested_permissions, callback, Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TChromiumCore.doOnShowPermissionPrompt(const browser : ICefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
const requesting_origin : ustring;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
const callback : ICefPermissionPromptCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
|
||||||
|
if assigned(FOnShowPermissionPrompt) then
|
||||||
|
FOnShowPermissionPrompt(self, browser, prompt_id, requesting_origin, requested_permissions, callback, Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumCore.doOnDismissPermissionPrompt(const browser : ICefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
result : TCefPermissionRequestResult);
|
||||||
|
begin
|
||||||
|
if assigned(FOnDismissPermissionPrompt) then
|
||||||
|
FOnDismissPermissionPrompt(self, browser, prompt_id, result);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChromiumCore.doOnFullScreenModeChange(const browser : ICefBrowser;
|
procedure TChromiumCore.doOnFullScreenModeChange(const browser : ICefBrowser;
|
||||||
fullscreen : Boolean);
|
fullscreen : Boolean);
|
||||||
begin
|
begin
|
||||||
@ -6069,6 +6196,18 @@ begin
|
|||||||
FOnAcceleratedPaint(Self, browser, type_, dirtyRectsCount, dirtyRects, shared_handle);
|
FOnAcceleratedPaint(Self, browser, type_, dirtyRectsCount, dirtyRects, shared_handle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumCore.doGetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize);
|
||||||
|
begin
|
||||||
|
if assigned(FOnGetTouchHandleSize) then
|
||||||
|
FOnGetTouchHandleSize(Self, browser, orientation, size);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TChromiumCore.doOnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState);
|
||||||
|
begin
|
||||||
|
if assigned(FOnTouchHandleStateChanged) then
|
||||||
|
FOnTouchHandleStateChanged(Self, browser, state);
|
||||||
|
end;
|
||||||
|
|
||||||
function TChromiumCore.doOnSelectClientCertificate(const browser : ICefBrowser;
|
function TChromiumCore.doOnSelectClientCertificate(const browser : ICefBrowser;
|
||||||
isProxy : boolean;
|
isProxy : boolean;
|
||||||
const host : ustring;
|
const host : ustring;
|
||||||
|
@ -76,6 +76,9 @@ type
|
|||||||
TOnRunContextMenu = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback; var aResult : Boolean) of object;
|
TOnRunContextMenu = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback; var aResult : Boolean) of object;
|
||||||
TOnContextMenuCommand = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean) of object;
|
TOnContextMenuCommand = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags; out Result: Boolean) of object;
|
||||||
TOnContextMenuDismissed = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame) of object;
|
TOnContextMenuDismissed = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame) of object;
|
||||||
|
TOnRunQuickMenuEvent = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; location: TCefPoint; size: TCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; const callback: ICefRunQuickMenuCallback; var aResult : Boolean) of object;
|
||||||
|
TOnQuickMenuCommandEvent = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; command_id: integer; event_flags: TCefEventFlags; var aResult: Boolean) of object;
|
||||||
|
TOnQuickMenuDismissedEvent = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame) of object;
|
||||||
|
|
||||||
// ICefKeyboardHandler
|
// ICefKeyboardHandler
|
||||||
TOnPreKeyEvent = procedure(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean; out Result: Boolean) of object;
|
TOnPreKeyEvent = procedure(Sender: TObject; const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean; out Result: Boolean) of object;
|
||||||
@ -92,6 +95,7 @@ type
|
|||||||
TOnAutoResize = procedure(Sender: TObject; const browser: ICefBrowser; const new_size: PCefSize; out Result: Boolean) of object;
|
TOnAutoResize = procedure(Sender: TObject; const browser: ICefBrowser; const new_size: PCefSize; out Result: Boolean) of object;
|
||||||
TOnLoadingProgressChange = procedure(Sender: TObject; const browser: ICefBrowser; const progress: double) of object;
|
TOnLoadingProgressChange = procedure(Sender: TObject; const browser: ICefBrowser; const progress: double) of object;
|
||||||
TOnCursorChange = procedure(Sender: TObject; const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean) of Object;
|
TOnCursorChange = procedure(Sender: TObject; const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean) of Object;
|
||||||
|
TOnMediaAccessChange = procedure(Sender: TObject; const browser: ICefBrowser; has_video_access, has_audio_access: boolean) of Object;
|
||||||
|
|
||||||
// ICefDownloadHandler
|
// ICefDownloadHandler
|
||||||
TOnCanDownloadEvent = procedure(Sender: TObject; const browser: ICefBrowser; const url, request_method: ustring; var aResult: boolean) of object;
|
TOnCanDownloadEvent = procedure(Sender: TObject; const browser: ICefBrowser; const url, request_method: ustring; var aResult: boolean) of object;
|
||||||
@ -148,6 +152,8 @@ type
|
|||||||
TOnPopupSize = procedure(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect) of Object;
|
TOnPopupSize = procedure(Sender: TObject; const browser: ICefBrowser; const rect: PCefRect) of Object;
|
||||||
TOnPaint = procedure(Sender: TObject; const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer) of Object;
|
TOnPaint = procedure(Sender: TObject; const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer) of Object;
|
||||||
TOnAcceleratedPaint = procedure(Sender: TObject; const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer) of Object;
|
TOnAcceleratedPaint = procedure(Sender: TObject; const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer) of Object;
|
||||||
|
TOnGetTouchHandleSize = procedure(Sender: TObject; const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize) of Object;
|
||||||
|
TOnTouchHandleStateChanged = procedure(Sender: TObject; const browser: ICefBrowser; const state: TCefTouchHandleState) of Object;
|
||||||
TOnStartDragging = procedure(Sender: TObject; const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer; out Result: Boolean) of Object;
|
TOnStartDragging = procedure(Sender: TObject; const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer; out Result: Boolean) of Object;
|
||||||
TOnUpdateDragCursor = procedure(Sender: TObject; const browser: ICefBrowser; operation: TCefDragOperation) of Object;
|
TOnUpdateDragCursor = procedure(Sender: TObject; const browser: ICefBrowser; operation: TCefDragOperation) of Object;
|
||||||
TOnScrollOffsetChanged = procedure(Sender: TObject; const browser: ICefBrowser; x, y: Double) of Object;
|
TOnScrollOffsetChanged = procedure(Sender: TObject; const browser: ICefBrowser; x, y: Double) of Object;
|
||||||
@ -216,6 +222,11 @@ type
|
|||||||
// ICefCommandHandler
|
// ICefCommandHandler
|
||||||
TOnChromeCommandEvent = procedure(Sender: TObject; const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition; var aResult: boolean) of object;
|
TOnChromeCommandEvent = procedure(Sender: TObject; const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition; var aResult: boolean) of object;
|
||||||
|
|
||||||
|
// ICefPermissionHandler
|
||||||
|
TOnRequestMediaAccessPermissionEvent = procedure(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefMediaAccessCallback; var aResult: boolean) of object;
|
||||||
|
TOnShowPermissionPromptEvent = procedure(Sender: TObject; const browser: ICefBrowser; prompt_id: uint64; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefPermissionPromptCallback; var aResult: boolean) of object;
|
||||||
|
TOnDismissPermissionPromptEvent = procedure(Sender: TObject; const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult) of object;
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : ustring) of object;
|
TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : ustring) of object;
|
||||||
TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object;
|
||||||
|
@ -64,6 +64,7 @@ type
|
|||||||
procedure GetFindHandler(var aHandler : ICefFindHandler); virtual;
|
procedure GetFindHandler(var aHandler : ICefFindHandler); virtual;
|
||||||
procedure GetFocusHandler(var aHandler : ICefFocusHandler); virtual;
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler); virtual;
|
||||||
procedure GetFrameHandler(var aHandler : ICefFrameHandler); virtual;
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler); virtual;
|
||||||
|
procedure GetPermissionHandler(var aHandler: ICefPermissionHandler); virtual;
|
||||||
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
||||||
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
||||||
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
||||||
@ -91,6 +92,7 @@ type
|
|||||||
procedure GetFindHandler(var aHandler : ICefFindHandler); virtual;
|
procedure GetFindHandler(var aHandler : ICefFindHandler); virtual;
|
||||||
procedure GetFocusHandler(var aHandler : ICefFocusHandler); virtual;
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler); virtual;
|
||||||
procedure GetFrameHandler(var aHandler : ICefFrameHandler); virtual;
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler); virtual;
|
||||||
|
procedure GetPermissionHandler(var aHandler: ICefPermissionHandler); virtual;
|
||||||
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); virtual;
|
||||||
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
|
||||||
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
|
||||||
@ -126,6 +128,7 @@ type
|
|||||||
FFindHandler : ICefFindHandler;
|
FFindHandler : ICefFindHandler;
|
||||||
FPrintHandler : ICefPrintHandler;
|
FPrintHandler : ICefPrintHandler;
|
||||||
FFrameHandler : ICefFrameHandler;
|
FFrameHandler : ICefFrameHandler;
|
||||||
|
FPermissionHandler : ICefPermissionHandler;
|
||||||
|
|
||||||
procedure GetAudioHandler(var aHandler : ICefAudioHandler); override;
|
procedure GetAudioHandler(var aHandler : ICefAudioHandler); override;
|
||||||
procedure GetCommandHandler(var aHandler : ICefCommandHandler); override;
|
procedure GetCommandHandler(var aHandler : ICefCommandHandler); override;
|
||||||
@ -137,6 +140,7 @@ type
|
|||||||
procedure GetFindHandler(var aHandler : ICefFindHandler); override;
|
procedure GetFindHandler(var aHandler : ICefFindHandler); override;
|
||||||
procedure GetFocusHandler(var aHandler : ICefFocusHandler); override;
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler); override;
|
||||||
procedure GetFrameHandler(var aHandler : ICefFrameHandler); override;
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler); override;
|
||||||
|
procedure GetPermissionHandler(var aHandler: ICefPermissionHandler); override;
|
||||||
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); override;
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler); override;
|
||||||
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); override;
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); override;
|
||||||
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); override;
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); override;
|
||||||
@ -167,7 +171,7 @@ uses
|
|||||||
uCEFDisplayHandler, uCEFDownloadHandler, uCEFJsDialogHandler,
|
uCEFDisplayHandler, uCEFDownloadHandler, uCEFJsDialogHandler,
|
||||||
uCEFLifeSpanHandler, uCEFRequestHandler, uCEFRenderHandler, uCEFDragHandler,
|
uCEFLifeSpanHandler, uCEFRequestHandler, uCEFRenderHandler, uCEFDragHandler,
|
||||||
uCEFFindHandler, uCEFConstants, uCEFApplicationCore, uCEFFrame, uCEFAudioHandler,
|
uCEFFindHandler, uCEFConstants, uCEFApplicationCore, uCEFFrame, uCEFAudioHandler,
|
||||||
uCEFPrintHandler, uCEFFrameHandler, uCEFCommandHandler;
|
uCEFPrintHandler, uCEFFrameHandler, uCEFCommandHandler, uCEFPermissionHandler;
|
||||||
|
|
||||||
|
|
||||||
// ******************************************************
|
// ******************************************************
|
||||||
@ -232,6 +236,11 @@ begin
|
|||||||
aHandler := nil;
|
aHandler := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefClientRef.GetPermissionHandler(var aHandler: ICefPermissionHandler);
|
||||||
|
begin
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCefClientRef.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
procedure TCefClientRef.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
||||||
begin
|
begin
|
||||||
aHandler := nil;
|
aHandler := nil;
|
||||||
@ -573,6 +582,24 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function cef_client_own_get_permission_handler(self: PCefClient): PCefPermissionHandler; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
TempHandler : ICefPermissionHandler;
|
||||||
|
begin
|
||||||
|
Result := nil;
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
|
||||||
|
try
|
||||||
|
TempHandler := nil;
|
||||||
|
TCefClientOwn(TempObject).GetPermissionHandler(TempHandler);
|
||||||
|
if (TempHandler <> nil) then Result := TempHandler.Wrap;
|
||||||
|
finally
|
||||||
|
TempHandler := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function cef_client_own_on_process_message_received(self : PCefClient;
|
function cef_client_own_on_process_message_received(self : PCefClient;
|
||||||
browser : PCefBrowser;
|
browser : PCefBrowser;
|
||||||
frame : PCefFrame;
|
frame : PCefFrame;
|
||||||
@ -607,6 +634,7 @@ begin
|
|||||||
get_find_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_find_handler;
|
get_find_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_find_handler;
|
||||||
get_focus_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_focus_handler;
|
get_focus_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_focus_handler;
|
||||||
get_frame_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_frame_handler;
|
get_frame_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_frame_handler;
|
||||||
|
get_permission_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_permission_handler;
|
||||||
get_jsdialog_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_jsdialog_handler;
|
get_jsdialog_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_jsdialog_handler;
|
||||||
get_keyboard_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_keyboard_handler;
|
get_keyboard_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_keyboard_handler;
|
||||||
get_life_span_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_life_span_handler;
|
get_life_span_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_life_span_handler;
|
||||||
@ -668,6 +696,11 @@ begin
|
|||||||
aHandler := nil;
|
aHandler := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefClientOwn.GetPermissionHandler(var aHandler: ICefPermissionHandler);
|
||||||
|
begin
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCefClientOwn.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
procedure TCefClientOwn.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
||||||
begin
|
begin
|
||||||
aHandler := nil;
|
aHandler := nil;
|
||||||
@ -755,6 +788,7 @@ begin
|
|||||||
if events.MustCreateFindHandler then FFindHandler := TCustomFindHandler.Create(events);
|
if events.MustCreateFindHandler then FFindHandler := TCustomFindHandler.Create(events);
|
||||||
if events.MustCreatePrintHandler then FPrintHandler := TCustomPrintHandler.Create(events);
|
if events.MustCreatePrintHandler then FPrintHandler := TCustomPrintHandler.Create(events);
|
||||||
if events.MustCreateFrameHandler then FFrameHandler := TCustomFrameHandler.Create(events);
|
if events.MustCreateFrameHandler then FFrameHandler := TCustomFrameHandler.Create(events);
|
||||||
|
if events.MustCreatePermissionHandler then FPermissionHandler := TCustomPermissionHandler.Create(events);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -787,6 +821,7 @@ begin
|
|||||||
if (FFindHandler <> nil) then FFindHandler.RemoveReferences;
|
if (FFindHandler <> nil) then FFindHandler.RemoveReferences;
|
||||||
if (FPrintHandler <> nil) then FPrintHandler.RemoveReferences;
|
if (FPrintHandler <> nil) then FPrintHandler.RemoveReferences;
|
||||||
if (FFrameHandler <> nil) then FFrameHandler.RemoveReferences;
|
if (FFrameHandler <> nil) then FFrameHandler.RemoveReferences;
|
||||||
|
if (FPermissionHandler <> nil) then FPermissionHandler.RemoveReferences;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomClientHandler.InitializeVars;
|
procedure TCustomClientHandler.InitializeVars;
|
||||||
@ -808,6 +843,7 @@ begin
|
|||||||
FFindHandler := nil;
|
FFindHandler := nil;
|
||||||
FPrintHandler := nil;
|
FPrintHandler := nil;
|
||||||
FFrameHandler := nil;
|
FFrameHandler := nil;
|
||||||
|
FPermissionHandler := nil;
|
||||||
FEvents := nil;
|
FEvents := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -891,6 +927,14 @@ begin
|
|||||||
aHandler := nil;
|
aHandler := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomClientHandler.GetPermissionHandler(var aHandler: ICefPermissionHandler);
|
||||||
|
begin
|
||||||
|
if (FPermissionHandler <> nil) then
|
||||||
|
aHandler := FPermissionHandler
|
||||||
|
else
|
||||||
|
aHandler := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomClientHandler.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
procedure TCustomClientHandler.GetJsdialogHandler(var aHandler : ICefJsDialogHandler);
|
||||||
begin
|
begin
|
||||||
if (FJsDialogHandler <> nil) then
|
if (FJsDialogHandler <> nil) then
|
||||||
|
@ -624,12 +624,57 @@ const
|
|||||||
CEF_DOCKING_MODE_BOTTOM_LEFT = 3;
|
CEF_DOCKING_MODE_BOTTOM_LEFT = 3;
|
||||||
CEF_DOCKING_MODE_BOTTOM_RIGHT = 4;
|
CEF_DOCKING_MODE_BOTTOM_RIGHT = 4;
|
||||||
CEF_DOCKING_MODE_CUSTOM = 5;
|
CEF_DOCKING_MODE_CUSTOM = 5;
|
||||||
|
|
||||||
// /include/internal/cef_types.h (cef_show_state_t)
|
// /include/internal/cef_types.h (cef_show_state_t)
|
||||||
CEF_SHOW_STATE_NORMAL = 1;
|
CEF_SHOW_STATE_NORMAL = 1;
|
||||||
CEF_SHOW_STATE_MINIMIZED = 2;
|
CEF_SHOW_STATE_MINIMIZED = 2;
|
||||||
CEF_SHOW_STATE_MAXIMIZED = 3;
|
CEF_SHOW_STATE_MAXIMIZED = 3;
|
||||||
CEF_SHOW_STATE_FULLSCREEN = 4;
|
CEF_SHOW_STATE_FULLSCREEN = 4;
|
||||||
|
|
||||||
|
// /include/internal/cef_types.h (cef_quick_menu_edit_state_flags_t)
|
||||||
|
QM_EDITFLAG_NONE = 0;
|
||||||
|
QM_EDITFLAG_CAN_ELLIPSIS = 1 shl 0;
|
||||||
|
QM_EDITFLAG_CAN_CUT = 1 shl 1;
|
||||||
|
QM_EDITFLAG_CAN_COPY = 1 shl 2;
|
||||||
|
QM_EDITFLAG_CAN_PASTE = 1 shl 3;
|
||||||
|
|
||||||
|
// /include/internal/cef_types.h (cef_touch_handle_state_flags_t)
|
||||||
|
CEF_THS_FLAG_NONE = 0;
|
||||||
|
CEF_THS_FLAG_ENABLED = 1 shl 0;
|
||||||
|
CEF_THS_FLAG_ORIENTATION = 1 shl 1;
|
||||||
|
CEF_THS_FLAG_ORIGIN = 1 shl 2;
|
||||||
|
CEF_THS_FLAG_ALPHA = 1 shl 3;
|
||||||
|
|
||||||
|
// /include/internal/cef_types.h (cef_media_access_permission_types_t)
|
||||||
|
CEF_MEDIA_PERMISSION_NONE = 0;
|
||||||
|
CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE = 1 shl 0;
|
||||||
|
CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE = 1 shl 1;
|
||||||
|
CEF_MEDIA_PERMISSION_DESKTOP_AUDIO_CAPTURE = 1 shl 2;
|
||||||
|
CEF_MEDIA_PERMISSION_DESKTOP_VIDEO_CAPTURE = 1 shl 3;
|
||||||
|
|
||||||
|
// /include/internal/cef_types.h (cef_permission_request_types_t)
|
||||||
|
CEF_PERMISSION_TYPE_NONE = 0;
|
||||||
|
CEF_PERMISSION_TYPE_ACCESSIBILITY_EVENTS = 1 shl 0;
|
||||||
|
CEF_PERMISSION_TYPE_AR_SESSION = 1 shl 1;
|
||||||
|
CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM = 1 shl 2;
|
||||||
|
CEF_PERMISSION_TYPE_CAMERA_STREAM = 1 shl 3;
|
||||||
|
CEF_PERMISSION_TYPE_CLIPBOARD = 1 shl 4;
|
||||||
|
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 shl 5;
|
||||||
|
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 shl 6;
|
||||||
|
CEF_PERMISSION_TYPE_GEOLOCATION = 1 shl 7;
|
||||||
|
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 shl 8;
|
||||||
|
CEF_PERMISSION_TYPE_MIC_STREAM = 1 shl 9;
|
||||||
|
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 shl 10;
|
||||||
|
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 shl 11;
|
||||||
|
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 shl 12;
|
||||||
|
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 shl 13;
|
||||||
|
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 shl 14;
|
||||||
|
CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 shl 15;
|
||||||
|
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 shl 16;
|
||||||
|
CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 shl 17;
|
||||||
|
CEF_PERMISSION_TYPE_VR_SESSION = 1 shl 18;
|
||||||
|
CEF_PERMISSION_TYPE_WINDOW_PLACEMENT = 1 shl 19;
|
||||||
|
|
||||||
// /include/cef_api_hash.h (used as "cef_api_hash" parameters)
|
// /include/cef_api_hash.h (used as "cef_api_hash" parameters)
|
||||||
CEF_API_HASH_PLATFORM = 0;
|
CEF_API_HASH_PLATFORM = 0;
|
||||||
CEF_API_HASH_UNIVERSAL = 1;
|
CEF_API_HASH_UNIVERSAL = 1;
|
||||||
|
@ -58,6 +58,9 @@ type
|
|||||||
function RunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean; virtual;
|
function RunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean; virtual;
|
||||||
function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; virtual;
|
function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; virtual;
|
||||||
procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual;
|
procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual;
|
||||||
|
function RunQuickMenu(const browser: ICefBrowser; const frame: ICefFrame; location: PCefPoint; size: PCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; const callback: ICefRunQuickMenuCallback): boolean; virtual;
|
||||||
|
function OnQuickMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; command_id: integer; event_flags: TCefEventFlags): boolean; virtual;
|
||||||
|
procedure OnQuickMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); virtual;
|
||||||
|
|
||||||
procedure RemoveReferences; virtual;
|
procedure RemoveReferences; virtual;
|
||||||
|
|
||||||
@ -73,6 +76,9 @@ type
|
|||||||
function RunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean; override;
|
function RunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean; override;
|
||||||
function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; override;
|
function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean; override;
|
||||||
procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); override;
|
procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); override;
|
||||||
|
function RunQuickMenu(const browser: ICefBrowser; const frame: ICefFrame; location: PCefPoint; size: PCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; const callback: ICefRunQuickMenuCallback): boolean; override;
|
||||||
|
function OnQuickMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; command_id: integer; event_flags: TCefEventFlags): boolean; override;
|
||||||
|
procedure OnQuickMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame); override;
|
||||||
|
|
||||||
procedure RemoveReferences; override;
|
procedure RemoveReferences; override;
|
||||||
|
|
||||||
@ -90,7 +96,7 @@ uses
|
|||||||
SysUtils,
|
SysUtils,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFrame, uCEFContextMenuParams,
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFrame, uCEFContextMenuParams,
|
||||||
uCEFMenuModel, uCEFRunContextMenuCallback;
|
uCEFMenuModel, uCEFRunContextMenuCallback, uCEFRunQuickMenuCallback;
|
||||||
|
|
||||||
procedure cef_context_menu_handler_on_before_context_menu(self : PCefContextMenuHandler;
|
procedure cef_context_menu_handler_on_before_context_menu(self : PCefContextMenuHandler;
|
||||||
browser : PCefBrowser;
|
browser : PCefBrowser;
|
||||||
@ -162,6 +168,59 @@ begin
|
|||||||
TCefFrameRef.UnWrap(frame));
|
TCefFrameRef.UnWrap(frame));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function cef_context_menu_handler_run_quick_menu(self : PCefContextMenuHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
location : PCefPoint;
|
||||||
|
size : PCefSize;
|
||||||
|
edit_state_flags : TCefQuickMenuEditStateFlags;
|
||||||
|
callback : PCefRunQuickMenuCallback): Integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
Result := Ord(False);
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefContextMenuHandlerOwn) then
|
||||||
|
Result := Ord(TCefContextMenuHandlerOwn(TempObject).RunQuickMenu(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
location,
|
||||||
|
size,
|
||||||
|
edit_state_flags,
|
||||||
|
TCefRunQuickMenuCallbackRef.UnWrap(callback)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function cef_context_menu_handler_on_quick_menu_command(self : PCefContextMenuHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
command_id : Integer;
|
||||||
|
event_flags : TCefEventFlags): Integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
Result := Ord(False);
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefContextMenuHandlerOwn) then
|
||||||
|
Result := Ord(TCefContextMenuHandlerOwn(TempObject).OnQuickMenuCommand(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
command_id,
|
||||||
|
event_flags));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure cef_context_menu_handler_on_quick_menu_dismissed(self : PCefContextMenuHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefContextMenuHandlerOwn) then
|
||||||
|
TCefContextMenuHandlerOwn(TempObject).OnQuickMenuDismissed(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame));
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TCefContextMenuHandlerOwn.Create;
|
constructor TCefContextMenuHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
inherited CreateData(SizeOf(TCefContextMenuHandler));
|
inherited CreateData(SizeOf(TCefContextMenuHandler));
|
||||||
@ -172,6 +231,9 @@ begin
|
|||||||
run_context_menu := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_run_context_menu;
|
run_context_menu := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_run_context_menu;
|
||||||
on_context_menu_command := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_on_context_menu_command;
|
on_context_menu_command := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_on_context_menu_command;
|
||||||
on_context_menu_dismissed := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_on_context_menu_dismissed;
|
on_context_menu_dismissed := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_on_context_menu_dismissed;
|
||||||
|
run_quick_menu := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_run_quick_menu;
|
||||||
|
on_quick_menu_command := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_on_quick_menu_command;
|
||||||
|
on_quick_menu_dismissed := {$IFDEF FPC}@{$ENDIF}cef_context_menu_handler_on_quick_menu_dismissed;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -198,6 +260,30 @@ begin
|
|||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCefContextMenuHandlerOwn.RunQuickMenu(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
location : PCefPoint;
|
||||||
|
size : PCefSize;
|
||||||
|
edit_state_flags : TCefQuickMenuEditStateFlags;
|
||||||
|
const callback : ICefRunQuickMenuCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefContextMenuHandlerOwn.OnQuickMenuCommand(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
command_id : integer;
|
||||||
|
event_flags : TCefEventFlags): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefContextMenuHandlerOwn.OnQuickMenuDismissed(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
function TCefContextMenuHandlerOwn.RunContextMenu(const browser : ICefBrowser;
|
function TCefContextMenuHandlerOwn.RunContextMenu(const browser : ICefBrowser;
|
||||||
const frame : ICefFrame;
|
const frame : ICefFrame;
|
||||||
const params : ICefContextMenuParams;
|
const params : ICefContextMenuParams;
|
||||||
@ -271,4 +357,34 @@ begin
|
|||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnContextMenuDismissed(browser, frame);
|
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnContextMenuDismissed(browser, frame);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomContextMenuHandler.RunQuickMenu(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
location : PCefPoint;
|
||||||
|
size : PCefSize;
|
||||||
|
edit_state_flags : TCefQuickMenuEditStateFlags;
|
||||||
|
const callback : ICefRunQuickMenuCallback): boolean;
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
Result := IChromiumEvents(FEvents).doRunQuickMenu(browser, frame, location, size, edit_state_flags, callback)
|
||||||
|
else
|
||||||
|
Result := inherited RunQuickMenu(browser, frame, location, size, edit_state_flags, callback);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomContextMenuHandler.OnQuickMenuCommand(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
command_id : integer;
|
||||||
|
event_flags : TCefEventFlags): boolean;
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
Result := IChromiumEvents(FEvents).doOnQuickMenuCommand(browser, frame, command_id, event_flags)
|
||||||
|
else
|
||||||
|
Result := inherited OnQuickMenuCommand(browser, frame, command_id, event_flags);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomContextMenuHandler.OnQuickMenuDismissed(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame);
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnQuickMenuDismissed(browser, frame);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -69,6 +69,7 @@ type
|
|||||||
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; virtual;
|
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; virtual;
|
||||||
procedure OnLoadingProgressChange(const browser: ICefBrowser; const progress: double); virtual;
|
procedure OnLoadingProgressChange(const browser: ICefBrowser; const progress: double); virtual;
|
||||||
procedure OnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; CursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean); virtual;
|
procedure OnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; CursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean); virtual;
|
||||||
|
procedure OnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean); virtual;
|
||||||
|
|
||||||
procedure RemoveReferences; virtual;
|
procedure RemoveReferences; virtual;
|
||||||
|
|
||||||
@ -90,6 +91,7 @@ type
|
|||||||
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; override;
|
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean; override;
|
||||||
procedure OnLoadingProgressChange(const browser: ICefBrowser; const progress: double); override;
|
procedure OnLoadingProgressChange(const browser: ICefBrowser; const progress: double); override;
|
||||||
procedure OnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; CursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean); override;
|
procedure OnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; CursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean); override;
|
||||||
|
procedure OnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean); override;
|
||||||
|
|
||||||
procedure RemoveReferences; override;
|
procedure RemoveReferences; override;
|
||||||
|
|
||||||
@ -284,6 +286,18 @@ begin
|
|||||||
Result := Ord(TempResult);
|
Result := Ord(TempResult);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure cef_display_handler_on_media_access_change(self: PCefDisplayHandler; browser: PCefBrowser; has_video_access, has_audio_access: integer); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefDisplayHandlerOwn) then
|
||||||
|
TCefDisplayHandlerOwn(TempObject).OnMediaAccessChange(TCefBrowserRef.UnWrap(browser),
|
||||||
|
has_video_access <> 0,
|
||||||
|
has_audio_access <> 0);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TCefDisplayHandlerOwn.Create;
|
constructor TCefDisplayHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
inherited CreateData(SizeOf(TCefDisplayHandler));
|
inherited CreateData(SizeOf(TCefDisplayHandler));
|
||||||
@ -300,6 +314,7 @@ begin
|
|||||||
on_auto_resize := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_auto_resize;
|
on_auto_resize := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_auto_resize;
|
||||||
on_loading_progress_change := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_loading_progress_change;
|
on_loading_progress_change := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_loading_progress_change;
|
||||||
on_cursor_change := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_cursor_change;
|
on_cursor_change := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_cursor_change;
|
||||||
|
on_media_access_change := {$IFDEF FPC}@{$ENDIF}cef_display_handler_on_media_access_change;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -328,6 +343,11 @@ begin
|
|||||||
aResult := False;
|
aResult := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefDisplayHandlerOwn.OnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCefDisplayHandlerOwn.OnFaviconUrlChange(const browser: ICefBrowser; const iconUrls: TStrings);
|
procedure TCefDisplayHandlerOwn.OnFaviconUrlChange(const browser: ICefBrowser; const iconUrls: TStrings);
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
@ -423,6 +443,12 @@ begin
|
|||||||
IChromiumEvents(FEvents).doOnCursorChange(browser, cursor_, cursorType, customCursorInfo, aResult);
|
IChromiumEvents(FEvents).doOnCursorChange(browser, cursor_, cursorType, customCursorInfo, aResult);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomDisplayHandler.OnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnMediaAccessChange(browser, has_video_access, has_audio_access);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomDisplayHandler.OnFaviconUrlChange(const browser: ICefBrowser; const iconUrls: TStrings);
|
procedure TCustomDisplayHandler.OnFaviconUrlChange(const browser: ICefBrowser; const iconUrls: TStrings);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then
|
if (FEvents <> nil) then
|
||||||
|
@ -113,6 +113,7 @@ type
|
|||||||
ICefContextMenuParams = interface;
|
ICefContextMenuParams = interface;
|
||||||
ICefMenuModel = interface;
|
ICefMenuModel = interface;
|
||||||
ICefRunContextMenuCallback = interface;
|
ICefRunContextMenuCallback = interface;
|
||||||
|
ICefRunQuickMenuCallback = interface;
|
||||||
ICefDownloadItem = interface;
|
ICefDownloadItem = interface;
|
||||||
ICefBeforeDownloadCallback = interface;
|
ICefBeforeDownloadCallback = interface;
|
||||||
ICefJsDialogCallback = interface;
|
ICefJsDialogCallback = interface;
|
||||||
@ -155,6 +156,12 @@ type
|
|||||||
ICefDevToolsMessageObserver = interface;
|
ICefDevToolsMessageObserver = interface;
|
||||||
ICefValue = interface;
|
ICefValue = interface;
|
||||||
ICefPrintSettings = interface;
|
ICefPrintSettings = interface;
|
||||||
|
ICefMediaAccessCallback = interface;
|
||||||
|
ICefMediaAccessHandler = interface;
|
||||||
|
ICefPermissionPromptCallback = interface;
|
||||||
|
ICefPermissionHandler = interface;
|
||||||
|
ICefSharedMemoryRegion = interface;
|
||||||
|
ICefSharedProcessMessageBuilder = interface;
|
||||||
|
|
||||||
TCefv8ValueArray = array of ICefv8Value;
|
TCefv8ValueArray = array of ICefv8Value;
|
||||||
TCefX509CertificateArray = array of ICefX509Certificate;
|
TCefX509CertificateArray = array of ICefX509Certificate;
|
||||||
@ -191,11 +198,12 @@ type
|
|||||||
end;
|
end;
|
||||||
TCefMediaSourceInfoArray = array of TCefMediaSourceInfo;
|
TCefMediaSourceInfoArray = array of TCefMediaSourceInfo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************
|
// *******************************************
|
||||||
// ***************** Events ******************
|
// ***************** Events ******************
|
||||||
// *******************************************
|
// *******************************************
|
||||||
|
|
||||||
|
|
||||||
TOnRegisterCustomSchemesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const registrar: TCefSchemeRegistrarRef) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
|
TOnRegisterCustomSchemesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const registrar: TCefSchemeRegistrarRef) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
|
||||||
TOnRenderThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
|
TOnRenderThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
|
||||||
TOnWebKitInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
|
TOnWebKitInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
|
||||||
@ -225,7 +233,6 @@ type
|
|||||||
// **** Callback procedures and functions ****
|
// **** Callback procedures and functions ****
|
||||||
// *******************************************
|
// *******************************************
|
||||||
|
|
||||||
|
|
||||||
TCefEndTracingCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const tracingFile: ustring);
|
TCefEndTracingCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const tracingFile: ustring);
|
||||||
TCefFastTaskProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure();
|
TCefFastTaskProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure();
|
||||||
TCefv8ArrayBufferReleaseCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(buffer : Pointer);
|
TCefv8ArrayBufferReleaseCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(buffer : Pointer);
|
||||||
@ -251,11 +258,12 @@ type
|
|||||||
TCefMediaRouteCreateCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
|
TCefMediaRouteCreateCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(result: TCefMediaRouterCreateResult; const error: ustring; const route: ICefMediaRoute);
|
||||||
TCefMediaSinkDeviceInfoCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const ip_address: ustring; port: integer; const model_name: ustring);
|
TCefMediaSinkDeviceInfoCallbackProc = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const ip_address: ustring; port: integer; const model_name: ustring);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************
|
// *******************************************
|
||||||
// ************ Custom interfaces ************
|
// ************ Custom interfaces ************
|
||||||
// *******************************************
|
// *******************************************
|
||||||
|
|
||||||
|
|
||||||
ICefStringList = interface
|
ICefStringList = interface
|
||||||
['{DB24F301-2F64-48D6-A72E-33697748147E}']
|
['{DB24F301-2F64-48D6-A72E-33697748147E}']
|
||||||
function GetHandle: TCefStringList;
|
function GetHandle: TCefStringList;
|
||||||
@ -329,6 +337,9 @@ type
|
|||||||
function doRunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean;
|
function doRunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean;
|
||||||
function doOnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean;
|
function doOnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean;
|
||||||
procedure doOnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame);
|
procedure doOnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame);
|
||||||
|
function doRunQuickMenu(const browser: ICefBrowser; const frame: ICefFrame; location: PCefPoint; size: PCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; const callback: ICefRunQuickMenuCallback): boolean;
|
||||||
|
function doOnQuickMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; command_id: integer; event_flags: TCefEventFlags): boolean;
|
||||||
|
procedure doOnQuickMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame);
|
||||||
|
|
||||||
// ICefKeyboardHandler
|
// ICefKeyboardHandler
|
||||||
function doOnPreKeyEvent(const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean;
|
function doOnPreKeyEvent(const browser: ICefBrowser; const event: PCefKeyEvent; osEvent: TCefEventHandle; out isKeyboardShortcut: Boolean): Boolean;
|
||||||
@ -345,6 +356,7 @@ type
|
|||||||
function doOnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
|
function doOnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
|
||||||
procedure doOnLoadingProgressChange(const browser: ICefBrowser; const progress: double);
|
procedure doOnLoadingProgressChange(const browser: ICefBrowser; const progress: double);
|
||||||
procedure doOnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
|
procedure doOnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; cursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
|
||||||
|
procedure doOnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
|
||||||
// ICefDownloadHandler
|
// ICefDownloadHandler
|
||||||
function doOnCanDownload(const browser: ICefBrowser; const url, request_method: ustring): boolean;
|
function doOnCanDownload(const browser: ICefBrowser; const url, request_method: ustring): boolean;
|
||||||
@ -401,6 +413,8 @@ type
|
|||||||
procedure doOnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
|
procedure doOnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
|
||||||
procedure doOnPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
procedure doOnPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
||||||
procedure doOnAcceleratedPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer);
|
procedure doOnAcceleratedPaint(const browser: ICefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer);
|
||||||
|
procedure doGetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize);
|
||||||
|
procedure doOnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState);
|
||||||
function doOnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean;
|
function doOnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean;
|
||||||
procedure doOnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation);
|
procedure doOnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation);
|
||||||
procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double);
|
procedure doOnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double);
|
||||||
@ -466,6 +480,11 @@ type
|
|||||||
// ICefCommandHandler
|
// ICefCommandHandler
|
||||||
function doOnChromeCommand(const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition): boolean;
|
function doOnChromeCommand(const browser: ICefBrowser; command_id: integer; disposition: TCefWindowOpenDisposition): boolean;
|
||||||
|
|
||||||
|
// ICefPermissionHandler
|
||||||
|
function doOnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefMediaAccessCallback): boolean;
|
||||||
|
function doOnShowPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefPermissionPromptCallback): boolean;
|
||||||
|
procedure doOnDismissPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult);
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
procedure doCookiesDeleted(numDeleted : integer);
|
procedure doCookiesDeleted(numDeleted : integer);
|
||||||
procedure doPdfPrintFinished(aResultOK : boolean);
|
procedure doPdfPrintFinished(aResultOK : boolean);
|
||||||
@ -513,6 +532,7 @@ type
|
|||||||
function MustCreateMediaObserver : boolean;
|
function MustCreateMediaObserver : boolean;
|
||||||
function MustCreatePrintHandler : boolean;
|
function MustCreatePrintHandler : boolean;
|
||||||
function MustCreateFrameHandler : boolean;
|
function MustCreateFrameHandler : boolean;
|
||||||
|
function MustCreatePermissionHandler : boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
IServerEvents = interface
|
IServerEvents = interface
|
||||||
@ -541,11 +561,11 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *******************************************
|
// *******************************************
|
||||||
// ************** CEF interfaces *************
|
// ************** CEF interfaces *************
|
||||||
// *******************************************
|
// *******************************************
|
||||||
|
|
||||||
|
|
||||||
// TCefBaseRefCounted
|
// TCefBaseRefCounted
|
||||||
// /include/capi/cef_base_capi.h (cef_base_ref_counted_t)
|
// /include/capi/cef_base_capi.h (cef_base_ref_counted_t)
|
||||||
ICefBaseRefCounted = interface
|
ICefBaseRefCounted = interface
|
||||||
@ -669,8 +689,11 @@ type
|
|||||||
function Copy: ICefProcessMessage;
|
function Copy: ICefProcessMessage;
|
||||||
function GetName: ustring;
|
function GetName: ustring;
|
||||||
function GetArgumentList: ICefListValue;
|
function GetArgumentList: ICefListValue;
|
||||||
property Name: ustring read GetName;
|
function GetSharedMemoryRegion: ICefSharedMemoryRegion;
|
||||||
property ArgumentList: ICefListValue read GetArgumentList;
|
|
||||||
|
property Name : ustring read GetName;
|
||||||
|
property ArgumentList : ICefListValue read GetArgumentList;
|
||||||
|
property SharedMemoryRegion : ICefSharedMemoryRegion read GetSharedMemoryRegion;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// TCefBrowser
|
// TCefBrowser
|
||||||
@ -1968,6 +1991,7 @@ type
|
|||||||
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
|
function OnAutoResize(const browser: ICefBrowser; const new_size: PCefSize): Boolean;
|
||||||
procedure OnLoadingProgressChange(const browser: ICefBrowser; const progress: double);
|
procedure OnLoadingProgressChange(const browser: ICefBrowser; const progress: double);
|
||||||
procedure OnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; CursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
|
procedure OnCursorChange(const browser: ICefBrowser; cursor_: TCefCursorHandle; CursorType: TCefCursorType; const customCursorInfo: PCefCursorInfo; var aResult : boolean);
|
||||||
|
procedure OnMediaAccessChange(const browser: ICefBrowser; has_video_access, has_audio_access: boolean);
|
||||||
|
|
||||||
procedure RemoveReferences; // custom procedure to clear all references
|
procedure RemoveReferences; // custom procedure to clear all references
|
||||||
end;
|
end;
|
||||||
@ -2026,6 +2050,14 @@ type
|
|||||||
procedure Cancel;
|
procedure Cancel;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// TCefRunContextMenuCallback
|
||||||
|
// /include/capi/cef_context_menu_handler_capi.h (cef_run_quick_menu_callback_t)
|
||||||
|
ICefRunQuickMenuCallback = interface(ICefBaseRefCounted)
|
||||||
|
['{11AD68BF-0055-4106-8F6B-B576F90D812F}']
|
||||||
|
procedure Cont(command_id: Integer; event_flags: TCefEventFlags);
|
||||||
|
procedure Cancel;
|
||||||
|
end;
|
||||||
|
|
||||||
// TCefContextMenuHandler
|
// TCefContextMenuHandler
|
||||||
// /include/capi/cef_context_menu_handler_capi.h (cef_context_menu_handler_t)
|
// /include/capi/cef_context_menu_handler_capi.h (cef_context_menu_handler_t)
|
||||||
ICefContextMenuHandler = interface(ICefBaseRefCounted)
|
ICefContextMenuHandler = interface(ICefBaseRefCounted)
|
||||||
@ -2034,6 +2066,9 @@ type
|
|||||||
function RunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean;
|
function RunContextMenu(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel; const callback: ICefRunContextMenuCallback): Boolean;
|
||||||
function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean;
|
function OnContextMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; commandId: Integer; eventFlags: TCefEventFlags): Boolean;
|
||||||
procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame);
|
procedure OnContextMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame);
|
||||||
|
function RunQuickMenu(const browser: ICefBrowser; const frame: ICefFrame; location: PCefPoint; size: PCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; const callback: ICefRunQuickMenuCallback): boolean;
|
||||||
|
function OnQuickMenuCommand(const browser: ICefBrowser; const frame: ICefFrame; command_id: integer; event_flags: TCefEventFlags): boolean;
|
||||||
|
procedure OnQuickMenuDismissed(const browser: ICefBrowser; const frame: ICefFrame);
|
||||||
|
|
||||||
procedure RemoveReferences; // custom procedure to clear all references
|
procedure RemoveReferences; // custom procedure to clear all references
|
||||||
end;
|
end;
|
||||||
@ -2068,6 +2103,8 @@ type
|
|||||||
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
|
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
|
||||||
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer);
|
||||||
procedure OnAcceleratedPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer);
|
procedure OnAcceleratedPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer);
|
||||||
|
procedure GetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize);
|
||||||
|
procedure OnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState);
|
||||||
function OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean;
|
function OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean;
|
||||||
procedure OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation);
|
procedure OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation);
|
||||||
procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double);
|
procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double);
|
||||||
@ -2092,6 +2129,7 @@ type
|
|||||||
procedure GetFindHandler(var aHandler : ICefFindHandler);
|
procedure GetFindHandler(var aHandler : ICefFindHandler);
|
||||||
procedure GetFocusHandler(var aHandler : ICefFocusHandler);
|
procedure GetFocusHandler(var aHandler : ICefFocusHandler);
|
||||||
procedure GetFrameHandler(var aHandler : ICefFrameHandler);
|
procedure GetFrameHandler(var aHandler : ICefFrameHandler);
|
||||||
|
procedure GetPermissionHandler(var aHandler: ICefPermissionHandler);
|
||||||
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler);
|
procedure GetJsdialogHandler(var aHandler : ICefJsdialogHandler);
|
||||||
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
|
||||||
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
|
||||||
@ -2476,6 +2514,61 @@ type
|
|||||||
procedure OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt);
|
procedure OnWebSocketMessage(const server: ICefServer; connection_id: Integer; const data: Pointer; data_size: NativeUInt);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// TCefMediaAccessCallback
|
||||||
|
// This interface is declared twice with almost identical parameters. "allowed_permissions" is defined as int and uint32.
|
||||||
|
// /include/capi/cef_media_access_handler_capi.h (cef_media_access_callback_t)
|
||||||
|
// /include/capi/cef_permission_handler_capi.h (cef_media_access_callback_t)
|
||||||
|
ICefMediaAccessCallback = interface(ICefBaseRefCounted)
|
||||||
|
['{66F6F5F4-8489-408B-B9ED-6B705C2E2010}']
|
||||||
|
procedure cont(allowed_permissions: TCefMediaAccessPermissionTypes);
|
||||||
|
procedure cancel;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// TCefMediaAccessHandler
|
||||||
|
// /include/capi/cef_media_access_handler_capi.h (cef_media_access_handler_t)
|
||||||
|
ICefMediaAccessHandler = interface(ICefBaseRefCounted)
|
||||||
|
['{8ED04C4A-05F2-46FD-89C4-E6114000D219}']
|
||||||
|
function OnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_url: ustring; requested_permissions: TCefMediaAccessPermissionTypes; const callback: ICefMediaAccessCallback): boolean;
|
||||||
|
|
||||||
|
procedure RemoveReferences;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// TCefPermissionPromptCallback
|
||||||
|
// /include/capi/cef_permission_handler_capi.h (cef_permission_prompt_callback_t)
|
||||||
|
ICefPermissionPromptCallback = interface(ICefBaseRefCounted)
|
||||||
|
['{F8827C7D-7B14-499E-B38A-5F9FEB1FD6A6}']
|
||||||
|
procedure cont(result: TCefPermissionRequestResult);
|
||||||
|
end;
|
||||||
|
|
||||||
|
// TCefPermissionHandler
|
||||||
|
// /include/capi/cef_permission_handler_capi.h (cef_permission_handler_t)
|
||||||
|
ICefPermissionHandler = interface(ICefBaseRefCounted)
|
||||||
|
['{DC079268-FB08-44DA-B216-35C5C339B341}']
|
||||||
|
function OnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefMediaAccessCallback): boolean;
|
||||||
|
function OnShowPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefPermissionPromptCallback): boolean;
|
||||||
|
procedure OnDismissPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult);
|
||||||
|
|
||||||
|
procedure RemoveReferences;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// TCefSharedMemoryRegion
|
||||||
|
// /include/capi/cef_shared_memory_region_capi.h (cef_shared_memory_region_t)
|
||||||
|
ICefSharedMemoryRegion = interface(ICefBaseRefCounted)
|
||||||
|
['{2828D0E1-44D0-4C6F-8C63-5CA6036DDA82}']
|
||||||
|
function IsValid: boolean;
|
||||||
|
function Size: NativeUInt;
|
||||||
|
function Memory: pointer;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// TCefSharedProcessMessageBuilder
|
||||||
|
// /include/capi/cef_shared_process_message_builder_capi.h (cef_shared_process_message_builder_t)
|
||||||
|
ICefSharedProcessMessageBuilder = interface(ICefBaseRefCounted)
|
||||||
|
['{B2AF627F-33FA-44F1-B943-FC4F120C84F8}']
|
||||||
|
function IsValid: boolean;
|
||||||
|
function Size: NativeUInt;
|
||||||
|
function Memory: pointer;
|
||||||
|
function Build: ICefProcessMessage;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2483,7 +2576,6 @@ type
|
|||||||
// ************* Views *************
|
// ************* Views *************
|
||||||
// *********************************
|
// *********************************
|
||||||
|
|
||||||
|
|
||||||
// TCefDisplay
|
// TCefDisplay
|
||||||
// /include/capi/views/cef_display_capi.h (cef_display_t)
|
// /include/capi/views/cef_display_capi.h (cef_display_t)
|
||||||
ICefDisplay = interface(ICefBaseRefCounted)
|
ICefDisplay = interface(ICefBaseRefCounted)
|
||||||
|
@ -178,6 +178,9 @@ var
|
|||||||
// /include/capi/cef_server_capi.h
|
// /include/capi/cef_server_capi.h
|
||||||
cef_server_create : procedure(const address: PCefString; port: uint16; backlog: Integer; handler: PCefServerHandler); cdecl;
|
cef_server_create : procedure(const address: PCefString; port: uint16; backlog: Integer; handler: PCefServerHandler); cdecl;
|
||||||
|
|
||||||
|
// /include/capi/cef_shared_process_message_builder_capi.h
|
||||||
|
cef_shared_process_message_builder_create : function(const name: PCefString; byte_size: NativeUInt) : PCefSharedProcessMessageBuilder; cdecl;
|
||||||
|
|
||||||
// /include/capi/cef_ssl_info_capi.h
|
// /include/capi/cef_ssl_info_capi.h
|
||||||
cef_is_cert_status_error : function(status : TCefCertStatus) : integer; cdecl;
|
cef_is_cert_status_error : function(status : TCefCertStatus) : integer; cdecl;
|
||||||
|
|
||||||
|
87
source/uCEFMediaAccessCallback.pas
Normal file
87
source/uCEFMediaAccessCallback.pas
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFMediaAccessCallback;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefMediaAccessCallbackRef = class(TCefBaseRefCountedRef, ICefMediaAccessCallback)
|
||||||
|
protected
|
||||||
|
procedure cont(allowed_permissions: TCefMediaAccessPermissionTypes);
|
||||||
|
procedure cancel;
|
||||||
|
|
||||||
|
public
|
||||||
|
class function UnWrap(data: Pointer): ICefMediaAccessCallback;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uCEFLibFunctions;
|
||||||
|
|
||||||
|
procedure TCefMediaAccessCallbackRef.cont(allowed_permissions: TCefMediaAccessPermissionTypes);
|
||||||
|
begin
|
||||||
|
PCefMediaAccessCallback(FData)^.cont(PCefMediaAccessCallback(FData), allowed_permissions);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefMediaAccessCallbackRef.cancel;
|
||||||
|
begin
|
||||||
|
PCefMediaAccessCallback(FData)^.cancel(PCefMediaAccessCallback(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TCefMediaAccessCallbackRef.UnWrap(data: Pointer): ICefMediaAccessCallback;
|
||||||
|
begin
|
||||||
|
if (data <> nil) then
|
||||||
|
Result := Create(data) as ICefMediaAccessCallback
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
117
source/uCEFMediaAccessHandler.pas
Normal file
117
source/uCEFMediaAccessHandler.pas
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFMediaAccessHandler;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefMediaAccessHandlerOwn = class(TCefBaseRefCountedOwn, ICefMediaAccessHandler)
|
||||||
|
protected
|
||||||
|
function OnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_url: ustring; requested_permissions: TCefMediaAccessPermissionTypes; const callback: ICefMediaAccessCallback): boolean;
|
||||||
|
|
||||||
|
procedure RemoveReferences; virtual;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
{$IFDEF DELPHI16_UP}
|
||||||
|
System.SysUtils,
|
||||||
|
{$ELSE}
|
||||||
|
SysUtils,
|
||||||
|
{$ENDIF}
|
||||||
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFBrowser, uCEFFrame, uCEFMediaAccessCallback;
|
||||||
|
|
||||||
|
function cef_media_access_handler_on_request_media_access_permission( self : PCefMediaAccessHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
const requesting_url : PCefString;
|
||||||
|
requested_permissions : integer;
|
||||||
|
callback : PCefMediaAccessCallback): integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
Result := Ord(False);
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefMediaAccessHandlerOwn) then
|
||||||
|
Result := Ord(TCefMediaAccessHandlerOwn(TempObject).OnRequestMediaAccessPermission(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
CefString(requesting_url),
|
||||||
|
requested_permissions,
|
||||||
|
TCefMediaAccessCallbackRef.UnWrap(callback)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
constructor TCefMediaAccessHandlerOwn.Create;
|
||||||
|
begin
|
||||||
|
inherited CreateData(SizeOf(TCefMediaAccessHandler));
|
||||||
|
|
||||||
|
with PCefMediaAccessHandler(FData)^ do
|
||||||
|
on_request_media_access_permission := {$IFDEF FPC}@{$ENDIF}cef_media_access_handler_on_request_media_access_permission;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefMediaAccessHandlerOwn.OnRequestMediaAccessPermission(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const requesting_url : ustring;
|
||||||
|
requested_permissions : TCefMediaAccessPermissionTypes;
|
||||||
|
const callback : ICefMediaAccessCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefMediaAccessHandlerOwn.RemoveReferences;
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
245
source/uCEFPermissionHandler.pas
Normal file
245
source/uCEFPermissionHandler.pas
Normal file
@ -0,0 +1,245 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFPermissionHandler;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefPermissionHandlerOwn = class(TCefBaseRefCountedOwn, ICefPermissionHandler)
|
||||||
|
protected
|
||||||
|
function OnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefMediaAccessCallback): boolean; virtual;
|
||||||
|
function OnShowPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefPermissionPromptCallback): boolean; virtual;
|
||||||
|
procedure OnDismissPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult); virtual;
|
||||||
|
|
||||||
|
procedure RemoveReferences; virtual;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create; virtual;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TCustomPermissionHandler = class(TCefPermissionHandlerOwn)
|
||||||
|
protected
|
||||||
|
FEvents : Pointer;
|
||||||
|
|
||||||
|
function OnRequestMediaAccessPermission(const browser: ICefBrowser; const frame: ICefFrame; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefMediaAccessCallback): boolean; override;
|
||||||
|
function OnShowPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; const requesting_origin: ustring; requested_permissions: cardinal; const callback: ICefPermissionPromptCallback): boolean; override;
|
||||||
|
procedure OnDismissPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult); 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, uCEFBrowser, uCEFFrame, uCEFPermissionPromptCallback, uCEFMediaAccessCallback;
|
||||||
|
|
||||||
|
function cef_permission_handler_on_request_media_access_permission( self : PCefPermissionHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
frame : PCefFrame;
|
||||||
|
const requesting_origin : PCefString;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
callback : PCefMediaAccessCallback): integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
Result := Ord(False);
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefPermissionHandlerOwn) then
|
||||||
|
Result := Ord(TCefPermissionHandlerOwn(TempObject).OnRequestMediaAccessPermission(TCefBrowserRef.UnWrap(browser),
|
||||||
|
TCefFrameRef.UnWrap(frame),
|
||||||
|
CefString(requesting_origin),
|
||||||
|
requested_permissions,
|
||||||
|
TCefMediaAccessCallbackRef.UnWrap(callback)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function cef_permission_handler_on_show_permission_prompt( self : PCefPermissionHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
const requesting_origin : PCefString;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
callback : PCefPermissionPromptCallback): integer; stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
Result := Ord(False);
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefPermissionHandlerOwn) then
|
||||||
|
Result := Ord(TCefPermissionHandlerOwn(TempObject).OnShowPermissionPrompt(TCefBrowserRef.UnWrap(browser),
|
||||||
|
prompt_id,
|
||||||
|
CefString(requesting_origin),
|
||||||
|
requested_permissions,
|
||||||
|
TCefPermissionPromptCallbackRef.UnWrap(callback)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure cef_permission_handler_on_dismiss_permission_prompt(self : PCefPermissionHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
result : TCefPermissionRequestResult); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefPermissionHandlerOwn) then
|
||||||
|
TCefPermissionHandlerOwn(TempObject).OnDismissPermissionPrompt(TCefBrowserRef.UnWrap(browser),
|
||||||
|
prompt_id,
|
||||||
|
result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// TCefPermissionHandlerOwn
|
||||||
|
|
||||||
|
constructor TCefPermissionHandlerOwn.Create;
|
||||||
|
begin
|
||||||
|
inherited CreateData(SizeOf(TCefPermissionHandler));
|
||||||
|
|
||||||
|
with PCefPermissionHandler(FData)^ do
|
||||||
|
begin
|
||||||
|
on_request_media_access_permission := {$IFDEF FPC}@{$ENDIF}cef_permission_handler_on_request_media_access_permission;
|
||||||
|
on_show_permission_prompt := {$IFDEF FPC}@{$ENDIF}cef_permission_handler_on_show_permission_prompt;
|
||||||
|
on_dismiss_permission_prompt := {$IFDEF FPC}@{$ENDIF}cef_permission_handler_on_dismiss_permission_prompt;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefPermissionHandlerOwn.OnRequestMediaAccessPermission(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const requesting_origin : ustring;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
const callback : ICefMediaAccessCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefPermissionHandlerOwn.OnShowPermissionPrompt(const browser : ICefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
const requesting_origin : ustring;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
const callback : ICefPermissionPromptCallback): boolean;
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefPermissionHandlerOwn.OnDismissPermissionPrompt(const browser: ICefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefPermissionHandlerOwn.RemoveReferences;
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
// TCustomPermissionHandler
|
||||||
|
|
||||||
|
constructor TCustomPermissionHandler.Create(const events : IChromiumEvents);
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
|
||||||
|
FEvents := Pointer(events);
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TCustomPermissionHandler.Destroy;
|
||||||
|
begin
|
||||||
|
RemoveReferences;
|
||||||
|
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomPermissionHandler.OnRequestMediaAccessPermission(const browser : ICefBrowser;
|
||||||
|
const frame : ICefFrame;
|
||||||
|
const requesting_origin : ustring;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
const callback : ICefMediaAccessCallback): boolean;
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
Result := IChromiumEvents(FEvents).doOnRequestMediaAccessPermission(browser, frame, requesting_origin, requested_permissions, callback)
|
||||||
|
else
|
||||||
|
Result := inherited OnRequestMediaAccessPermission(browser, frame, requesting_origin, requested_permissions, callback);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCustomPermissionHandler.OnShowPermissionPrompt(const browser : ICefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
const requesting_origin : ustring;
|
||||||
|
requested_permissions : cardinal;
|
||||||
|
const callback : ICefPermissionPromptCallback): boolean;
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
Result := IChromiumEvents(FEvents).doOnShowPermissionPrompt(browser, prompt_id, requesting_origin, requested_permissions, callback)
|
||||||
|
else
|
||||||
|
Result := inherited OnShowPermissionPrompt(browser, prompt_id, requesting_origin, requested_permissions, callback);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomPermissionHandler.OnDismissPermissionPrompt(const browser : ICefBrowser;
|
||||||
|
prompt_id : uint64;
|
||||||
|
result : TCefPermissionRequestResult);
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnDismissPermissionPrompt(browser, prompt_id, result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomPermissionHandler.RemoveReferences;
|
||||||
|
begin
|
||||||
|
FEvents := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
81
source/uCEFPermissionPromptCallback.pas
Normal file
81
source/uCEFPermissionPromptCallback.pas
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFPermissionPromptCallback;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefPermissionPromptCallbackRef = class(TCefBaseRefCountedRef, ICefPermissionPromptCallback)
|
||||||
|
protected
|
||||||
|
procedure cont(result: TCefPermissionRequestResult);
|
||||||
|
|
||||||
|
public
|
||||||
|
class function UnWrap(data: Pointer): ICefPermissionPromptCallback;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uCEFLibFunctions;
|
||||||
|
|
||||||
|
procedure TCefPermissionPromptCallbackRef.cont(result: TCefPermissionRequestResult);
|
||||||
|
begin
|
||||||
|
PCefPermissionPromptCallback(FData)^.cont(PCefPermissionPromptCallback(FData), result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TCefPermissionPromptCallbackRef.UnWrap(data: Pointer): ICefPermissionPromptCallback;
|
||||||
|
begin
|
||||||
|
if (data <> nil) then
|
||||||
|
Result := Create(data) as ICefPermissionPromptCallback
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -59,6 +59,7 @@ type
|
|||||||
function Copy: ICefProcessMessage;
|
function Copy: ICefProcessMessage;
|
||||||
function GetName: ustring;
|
function GetName: ustring;
|
||||||
function GetArgumentList: ICefListValue;
|
function GetArgumentList: ICefListValue;
|
||||||
|
function GetSharedMemoryRegion: ICefSharedMemoryRegion;
|
||||||
|
|
||||||
public
|
public
|
||||||
class function UnWrap(data: Pointer): ICefProcessMessage;
|
class function UnWrap(data: Pointer): ICefProcessMessage;
|
||||||
@ -68,7 +69,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
uCEFMiscFunctions, uCEFLibFunctions, uCEFListValue;
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFListValue, uCEFSharedMemoryRegion;
|
||||||
|
|
||||||
function TCefProcessMessageRef.Copy: ICefProcessMessage;
|
function TCefProcessMessageRef.Copy: ICefProcessMessage;
|
||||||
begin
|
begin
|
||||||
@ -80,6 +81,11 @@ begin
|
|||||||
Result := TCefListValueRef.UnWrap(PCefProcessMessage(FData)^.get_argument_list(PCefProcessMessage(FData)));
|
Result := TCefListValueRef.UnWrap(PCefProcessMessage(FData)^.get_argument_list(PCefProcessMessage(FData)));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCefProcessMessageRef.GetSharedMemoryRegion: ICefSharedMemoryRegion;
|
||||||
|
begin
|
||||||
|
Result := TCefSharedMemoryRegionRef.UnWrap(PCefProcessMessage(FData)^.get_shared_memory_region(PCefProcessMessage(FData)));
|
||||||
|
end;
|
||||||
|
|
||||||
function TCefProcessMessageRef.GetName: ustring;
|
function TCefProcessMessageRef.GetName: ustring;
|
||||||
begin
|
begin
|
||||||
Result := CefStringFreeAndGet(PCefProcessMessage(FData)^.get_name(PCefProcessMessage(FData)));
|
Result := CefStringFreeAndGet(PCefProcessMessage(FData)^.get_name(PCefProcessMessage(FData)));
|
||||||
|
@ -63,6 +63,8 @@ type
|
|||||||
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); virtual;
|
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); virtual;
|
||||||
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); virtual;
|
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); virtual;
|
||||||
procedure OnAcceleratedPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); virtual;
|
procedure OnAcceleratedPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); virtual;
|
||||||
|
procedure GetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize); virtual;
|
||||||
|
procedure OnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState); virtual;
|
||||||
function OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; virtual;
|
function OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; virtual;
|
||||||
procedure OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation); virtual;
|
procedure OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation); virtual;
|
||||||
procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual;
|
procedure OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double); virtual;
|
||||||
@ -88,6 +90,8 @@ type
|
|||||||
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); override;
|
procedure OnPopupSize(const browser: ICefBrowser; const rect: PCefRect); override;
|
||||||
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); override;
|
procedure OnPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); override;
|
||||||
procedure OnAcceleratedPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); override;
|
procedure OnAcceleratedPaint(const browser: ICefBrowser; kind: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); override;
|
||||||
|
procedure GetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize); override;
|
||||||
|
procedure OnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState); override;
|
||||||
function GetScreenInfo(const browser: ICefBrowser; var screenInfo: TCefScreenInfo): Boolean; override;
|
function GetScreenInfo(const browser: ICefBrowser; var screenInfo: TCefScreenInfo): Boolean; override;
|
||||||
function OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; override;
|
function OnStartDragging(const browser: ICefBrowser; const dragData: ICefDragData; allowedOps: TCefDragOperations; x, y: Integer): Boolean; override;
|
||||||
procedure OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation); override;
|
procedure OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation); override;
|
||||||
@ -354,6 +358,41 @@ begin
|
|||||||
input_mode);
|
input_mode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure cef_render_handler_get_touch_handle_size(self : PCefRenderHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
orientation : TCefHorizontalAlignment;
|
||||||
|
size : PCefSize); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
TempSize : TCefSize;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderHandlerOwn) and (size <> nil) then
|
||||||
|
begin
|
||||||
|
TempSize.width := size^.width;
|
||||||
|
TempSize.height := size^.height;
|
||||||
|
TCefRenderHandlerOwn(TempObject).GetTouchHandleSize(TCefBrowserRef.UnWrap(browser),
|
||||||
|
orientation,
|
||||||
|
TempSize);
|
||||||
|
size^.width := TempSize.width;
|
||||||
|
size^.height := TempSize.height;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure cef_render_handler_on_touch_handle_state_changed( self : PCefRenderHandler;
|
||||||
|
browser : PCefBrowser;
|
||||||
|
const state : PCefTouchHandleState); stdcall;
|
||||||
|
var
|
||||||
|
TempObject : TObject;
|
||||||
|
begin
|
||||||
|
TempObject := CefGetObject(self);
|
||||||
|
|
||||||
|
if (TempObject <> nil) and (TempObject is TCefRenderHandlerOwn) and (state <> nil) then
|
||||||
|
TCefRenderHandlerOwn(TempObject).OnTouchHandleStateChanged(TCefBrowserRef.UnWrap(browser),
|
||||||
|
state^);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TCefRenderHandlerOwn.Create;
|
constructor TCefRenderHandlerOwn.Create;
|
||||||
begin
|
begin
|
||||||
inherited CreateData(SizeOf(TCefRenderHandler));
|
inherited CreateData(SizeOf(TCefRenderHandler));
|
||||||
@ -369,6 +408,8 @@ begin
|
|||||||
on_popup_size := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_popup_size;
|
on_popup_size := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_popup_size;
|
||||||
on_paint := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_paint;
|
on_paint := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_paint;
|
||||||
on_accelerated_paint := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_accelerated_paint;
|
on_accelerated_paint := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_accelerated_paint;
|
||||||
|
get_touch_handle_size := {$IFDEF FPC}@{$ENDIF}cef_render_handler_get_touch_handle_size;
|
||||||
|
on_touch_handle_state_changed := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_touch_handle_state_changed;
|
||||||
start_dragging := {$IFDEF FPC}@{$ENDIF}cef_render_handler_start_dragging;
|
start_dragging := {$IFDEF FPC}@{$ENDIF}cef_render_handler_start_dragging;
|
||||||
update_drag_cursor := {$IFDEF FPC}@{$ENDIF}cef_render_handler_update_drag_cursor;
|
update_drag_cursor := {$IFDEF FPC}@{$ENDIF}cef_render_handler_update_drag_cursor;
|
||||||
on_scroll_offset_changed := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_scroll_offset_changed;
|
on_scroll_offset_changed := {$IFDEF FPC}@{$ENDIF}cef_render_handler_on_scroll_offset_changed;
|
||||||
@ -413,6 +454,16 @@ begin
|
|||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCefRenderHandlerOwn.GetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefRenderHandlerOwn.OnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState);
|
||||||
|
begin
|
||||||
|
//
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCefRenderHandlerOwn.OnPopupShow(const browser: ICefBrowser; show: Boolean);
|
procedure TCefRenderHandlerOwn.OnPopupShow(const browser: ICefBrowser; show: Boolean);
|
||||||
begin
|
begin
|
||||||
//
|
//
|
||||||
@ -487,7 +538,8 @@ end;
|
|||||||
|
|
||||||
procedure TCustomRenderHandler.GetAccessibilityHandler(var aAccessibilityHandler : ICefAccessibilityHandler);
|
procedure TCustomRenderHandler.GetAccessibilityHandler(var aAccessibilityHandler : ICefAccessibilityHandler);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnGetAccessibilityHandler(aAccessibilityHandler);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnGetAccessibilityHandler(aAccessibilityHandler);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRenderHandler.GetRootScreenRect(const browser: ICefBrowser; var rect: TCefRect): Boolean;
|
function TCustomRenderHandler.GetRootScreenRect(const browser: ICefBrowser; var rect: TCefRect): Boolean;
|
||||||
@ -530,7 +582,8 @@ procedure TCustomRenderHandler.OnPaint(const browser : ICefBrowser;
|
|||||||
width : Integer;
|
width : Integer;
|
||||||
height : Integer);
|
height : Integer);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnPaint(browser, kind, dirtyRectsCount, dirtyRects, buffer, width, height);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnPaint(browser, kind, dirtyRectsCount, dirtyRects, buffer, width, height);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnAcceleratedPaint(const browser : ICefBrowser;
|
procedure TCustomRenderHandler.OnAcceleratedPaint(const browser : ICefBrowser;
|
||||||
@ -539,22 +592,38 @@ procedure TCustomRenderHandler.OnAcceleratedPaint(const browser : ICefBr
|
|||||||
const dirtyRects : PCefRectArray;
|
const dirtyRects : PCefRectArray;
|
||||||
shared_handle : Pointer);
|
shared_handle : Pointer);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnAcceleratedPaint(browser, kind, dirtyRectsCount, dirtyRects, shared_handle);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnAcceleratedPaint(browser, kind, dirtyRectsCount, dirtyRects, shared_handle);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomRenderHandler.GetTouchHandleSize(const browser: ICefBrowser; orientation: TCefHorizontalAlignment; var size: TCefSize);
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doGetTouchHandleSize(browser, orientation, size);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCustomRenderHandler.OnTouchHandleStateChanged(const browser: ICefBrowser; const state: TCefTouchHandleState);
|
||||||
|
begin
|
||||||
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnTouchHandleStateChanged(browser, state);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnPopupShow(const browser: ICefBrowser; show: Boolean);
|
procedure TCustomRenderHandler.OnPopupShow(const browser: ICefBrowser; show: Boolean);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnPopupShow(browser, show);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnPopupShow(browser, show);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
|
procedure TCustomRenderHandler.OnPopupSize(const browser: ICefBrowser; const rect: PCefRect);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnPopupSize(browser, rect);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnPopupSize(browser, rect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double);
|
procedure TCustomRenderHandler.OnScrollOffsetChanged(const browser: ICefBrowser; x, y: Double);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnScrollOffsetChanged(browser, x, y);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnScrollOffsetChanged(browser, x, y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnIMECompositionRangeChanged(const browser : ICefBrowser;
|
procedure TCustomRenderHandler.OnIMECompositionRangeChanged(const browser : ICefBrowser;
|
||||||
@ -562,20 +631,23 @@ procedure TCustomRenderHandler.OnIMECompositionRangeChanged(const browser
|
|||||||
character_boundsCount : NativeUInt;
|
character_boundsCount : NativeUInt;
|
||||||
const character_bounds : PCefRect);
|
const character_bounds : PCefRect);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnIMECompositionRangeChanged(browser, selected_range, character_boundsCount, character_bounds);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnIMECompositionRangeChanged(browser, selected_range, character_boundsCount, character_bounds);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnTextSelectionChanged(const browser : ICefBrowser;
|
procedure TCustomRenderHandler.OnTextSelectionChanged(const browser : ICefBrowser;
|
||||||
const selected_text : ustring;
|
const selected_text : ustring;
|
||||||
const selected_range : PCefRange);
|
const selected_range : PCefRange);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnTextSelectionChanged(browser, selected_text, selected_range);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnTextSelectionChanged(browser, selected_text, selected_range);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomRenderHandler.OnVirtualKeyboardRequested(const browser : ICefBrowser;
|
procedure TCustomRenderHandler.OnVirtualKeyboardRequested(const browser : ICefBrowser;
|
||||||
input_mode : TCefTextInpuMode);
|
input_mode : TCefTextInpuMode);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnVirtualKeyboardRequested(browser, input_mode);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnVirtualKeyboardRequested(browser, input_mode);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomRenderHandler.OnStartDragging(const browser : ICefBrowser;
|
function TCustomRenderHandler.OnStartDragging(const browser : ICefBrowser;
|
||||||
@ -592,7 +664,8 @@ end;
|
|||||||
|
|
||||||
procedure TCustomRenderHandler.OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation);
|
procedure TCustomRenderHandler.OnUpdateDragCursor(const browser: ICefBrowser; operation: TCefDragOperation);
|
||||||
begin
|
begin
|
||||||
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnUpdateDragCursor(browser, operation);
|
if (FEvents <> nil) then
|
||||||
|
IChromiumEvents(FEvents).doOnUpdateDragCursor(browser, operation);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
86
source/uCEFRunQuickMenuCallback.pas
Normal file
86
source/uCEFRunQuickMenuCallback.pas
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFRunQuickMenuCallback;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefRunQuickMenuCallbackRef = class(TCefBaseRefCountedRef, ICefRunQuickMenuCallback)
|
||||||
|
protected
|
||||||
|
procedure Cont(command_id: Integer; event_flags: TCefEventFlags);
|
||||||
|
procedure Cancel;
|
||||||
|
public
|
||||||
|
class function UnWrap(data: Pointer): ICefRunQuickMenuCallback;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uCEFLibFunctions;
|
||||||
|
|
||||||
|
procedure TCefRunQuickMenuCallbackRef.Cont(command_id: Integer; event_flags: TCefEventFlags);
|
||||||
|
begin
|
||||||
|
PCefRunQuickMenuCallback(FData)^.cont(PCefRunQuickMenuCallback(FData), command_id, event_flags);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCefRunQuickMenuCallbackRef.Cancel;
|
||||||
|
begin
|
||||||
|
PCefRunQuickMenuCallback(FData)^.cancel(PCefRunQuickMenuCallback(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TCefRunQuickMenuCallbackRef.UnWrap(data: Pointer): ICefRunQuickMenuCallback;
|
||||||
|
begin
|
||||||
|
if (data <> nil) then
|
||||||
|
Result := Create(data) as ICefRunQuickMenuCallback
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
90
source/uCEFSharedMemoryRegion.pas
Normal file
90
source/uCEFSharedMemoryRegion.pas
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFSharedMemoryRegion;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefSharedMemoryRegionRef = class(TCefBaseRefCountedRef, ICefSharedMemoryRegion)
|
||||||
|
protected
|
||||||
|
function IsValid: boolean;
|
||||||
|
function Size: NativeUInt;
|
||||||
|
function Memory: pointer;
|
||||||
|
|
||||||
|
public
|
||||||
|
class function UnWrap(data: Pointer): ICefSharedMemoryRegion;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
function TCefSharedMemoryRegionRef.IsValid: Boolean;
|
||||||
|
begin
|
||||||
|
Result := PCefSharedMemoryRegion(FData)^.is_valid(PCefSharedMemoryRegion(FData)) <> 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefSharedMemoryRegionRef.Size: NativeUInt;
|
||||||
|
begin
|
||||||
|
Result := PCefSharedMemoryRegion(FData)^.Size(PCefSharedMemoryRegion(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefSharedMemoryRegionRef.Memory: pointer;
|
||||||
|
begin
|
||||||
|
Result := PCefSharedMemoryRegion(FData)^.Memory(PCefSharedMemoryRegion(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TCefSharedMemoryRegionRef.UnWrap(data: Pointer): ICefSharedMemoryRegion;
|
||||||
|
begin
|
||||||
|
if (data <> nil) then
|
||||||
|
Result := Create(data) as ICefSharedMemoryRegion
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
107
source/uCEFSharedProcessMessageBuilder.pas
Normal file
107
source/uCEFSharedProcessMessageBuilder.pas
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
// ************************************************************************
|
||||||
|
// ***************************** 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 � 2022 Salvador Diaz Fau. All rights reserved.
|
||||||
|
//
|
||||||
|
// ************************************************************************
|
||||||
|
// ************ vvvv Original license and comments below vvvv *************
|
||||||
|
// ************************************************************************
|
||||||
|
(*
|
||||||
|
* Delphi Chromium Embedded 3
|
||||||
|
*
|
||||||
|
* Usage allowed under the restrictions of the Lesser GNU General Public License
|
||||||
|
* or alternatively the restrictions of the Mozilla Public License 1.1
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
||||||
|
* the specific language governing rights and limitations under the License.
|
||||||
|
*
|
||||||
|
* Unit owner : Henri Gourvest <hgourvest@gmail.com>
|
||||||
|
* Web site : http://www.progdigy.com
|
||||||
|
* Repository : http://code.google.com/p/delphichromiumembedded/
|
||||||
|
* Group : http://groups.google.com/group/delphichromiumembedded
|
||||||
|
*
|
||||||
|
* Embarcadero Technologies, Inc is not permitted to use or redistribute
|
||||||
|
* this source code without explicit permission.
|
||||||
|
*
|
||||||
|
*)
|
||||||
|
|
||||||
|
unit uCEFSharedProcessMessageBuilder;
|
||||||
|
|
||||||
|
{$IFDEF FPC}
|
||||||
|
{$MODE OBJFPC}{$H+}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
{$I cef.inc}
|
||||||
|
|
||||||
|
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
|
||||||
|
{$MINENUMSIZE 4}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
|
||||||
|
|
||||||
|
type
|
||||||
|
TCefSharedProcessMessageBuilderRef = class(TCefBaseRefCountedRef, ICefSharedProcessMessageBuilder)
|
||||||
|
protected
|
||||||
|
function IsValid: boolean;
|
||||||
|
function Size: NativeUInt;
|
||||||
|
function Memory: pointer;
|
||||||
|
function Build: ICefProcessMessage;
|
||||||
|
public
|
||||||
|
class function UnWrap(data: Pointer): ICefSharedProcessMessageBuilder;
|
||||||
|
class function CreateBuilder(const name: ustring; byte_size: NativeUInt): ICefSharedProcessMessageBuilder;
|
||||||
|
end;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
uCEFMiscFunctions, uCEFLibFunctions, uCEFProcessMessage;
|
||||||
|
|
||||||
|
class function TCefSharedProcessMessageBuilderRef.CreateBuilder(const name: ustring; byte_size: NativeUInt): ICefSharedProcessMessageBuilder;
|
||||||
|
var
|
||||||
|
TempName : TCefString;
|
||||||
|
begin
|
||||||
|
TempName := CefString(name);
|
||||||
|
Result := UnWrap(cef_shared_process_message_builder_create(@TempName, byte_size));
|
||||||
|
end;
|
||||||
|
|
||||||
|
class function TCefSharedProcessMessageBuilderRef.UnWrap(data: Pointer): ICefSharedProcessMessageBuilder;
|
||||||
|
begin
|
||||||
|
if (data <> nil) then
|
||||||
|
Result := Create(data) as ICefSharedProcessMessageBuilder
|
||||||
|
else
|
||||||
|
Result := nil;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefSharedProcessMessageBuilderRef.IsValid: boolean;
|
||||||
|
begin
|
||||||
|
Result := PCefSharedProcessMessageBuilder(FData)^.is_valid(PCefSharedProcessMessageBuilder(FData)) <> 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefSharedProcessMessageBuilderRef.Size: NativeUInt;
|
||||||
|
begin
|
||||||
|
Result := PCefSharedProcessMessageBuilder(FData)^.size(PCefSharedProcessMessageBuilder(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefSharedProcessMessageBuilderRef.Memory: pointer;
|
||||||
|
begin
|
||||||
|
Result := PCefSharedProcessMessageBuilder(FData)^.memory(PCefSharedProcessMessageBuilder(FData));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCefSharedProcessMessageBuilderRef.Build: ICefProcessMessage;
|
||||||
|
begin
|
||||||
|
Result := TCefProcessMessageRef.UnWrap(PCefSharedProcessMessageBuilder(FData)^.build(PCefSharedProcessMessageBuilder(FData)));
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
@ -88,6 +88,7 @@ type
|
|||||||
PCefResourceBundleHandler = ^TCefResourceBundleHandler;
|
PCefResourceBundleHandler = ^TCefResourceBundleHandler;
|
||||||
PCefBrowserProcessHandler = ^TCefBrowserProcessHandler;
|
PCefBrowserProcessHandler = ^TCefBrowserProcessHandler;
|
||||||
PCefContextMenuHandler = ^TCefContextMenuHandler;
|
PCefContextMenuHandler = ^TCefContextMenuHandler;
|
||||||
|
PCefRunQuickMenuCallback = ^TCefRunQuickMenuCallback;
|
||||||
PCefAccessibilityHandler = ^TCefAccessibilityHandler;
|
PCefAccessibilityHandler = ^TCefAccessibilityHandler;
|
||||||
PCefFrame = ^TCefFrame;
|
PCefFrame = ^TCefFrame;
|
||||||
PCefFrameHandler = ^TCefFrameHandler;
|
PCefFrameHandler = ^TCefFrameHandler;
|
||||||
@ -156,6 +157,12 @@ type
|
|||||||
PCefV8StackFrame = ^TCefV8StackFrame;
|
PCefV8StackFrame = ^TCefV8StackFrame;
|
||||||
PCefProcessMessage = ^TCefProcessMessage;
|
PCefProcessMessage = ^TCefProcessMessage;
|
||||||
PCefRequestHandler = ^TCefRequestHandler;
|
PCefRequestHandler = ^TCefRequestHandler;
|
||||||
|
PCefMediaAccessCallback = ^TCefMediaAccessCallback;
|
||||||
|
PCefMediaAccessHandler = ^TCefMediaAccessHandler;
|
||||||
|
PCefPermissionHandler = ^TCefPermissionHandler;
|
||||||
|
PCefSharedMemoryRegion = ^TCefSharedMemoryRegion;
|
||||||
|
PCefSharedProcessMessageBuilder = ^TCefSharedProcessMessageBuilder;
|
||||||
|
PCefPermissionPromptCallback = ^TCefPermissionPromptCallback;
|
||||||
PCefResourceSkipCallback = ^TCefResourceSkipCallback;
|
PCefResourceSkipCallback = ^TCefResourceSkipCallback;
|
||||||
PCefResourceReadCallback = ^TCefResourceReadCallback;
|
PCefResourceReadCallback = ^TCefResourceReadCallback;
|
||||||
PCefResourceHandler = ^TCefResourceHandler;
|
PCefResourceHandler = ^TCefResourceHandler;
|
||||||
@ -187,6 +194,7 @@ type
|
|||||||
PCefNavigationEntry = ^TCefNavigationEntry;
|
PCefNavigationEntry = ^TCefNavigationEntry;
|
||||||
PCefMouseEvent = ^TCefMouseEvent;
|
PCefMouseEvent = ^TCefMouseEvent;
|
||||||
PCefTouchEvent = ^TCefTouchEvent;
|
PCefTouchEvent = ^TCefTouchEvent;
|
||||||
|
PCefTouchHandleState = ^TCefTouchHandleState;
|
||||||
PCefPrintSettings = ^TCefPrintSettings;
|
PCefPrintSettings = ^TCefPrintSettings;
|
||||||
PCefPrintDialogCallback = ^TCefPrintDialogCallback;
|
PCefPrintDialogCallback = ^TCefPrintDialogCallback;
|
||||||
PCefPrintJobCallback = ^TCefPrintJobCallback;
|
PCefPrintJobCallback = ^TCefPrintJobCallback;
|
||||||
@ -321,7 +329,11 @@ type
|
|||||||
TCefTextFieldCommands = Integer; // /include/internal/cef_types.h (cef_text_field_commands_t)
|
TCefTextFieldCommands = Integer; // /include/internal/cef_types.h (cef_text_field_commands_t)
|
||||||
TCefChromeToolbarType = Integer; // /include/internal/cef_types.h (cef_chrome_toolbar_type_t)
|
TCefChromeToolbarType = Integer; // /include/internal/cef_types.h (cef_chrome_toolbar_type_t)
|
||||||
TCefDockingMode = type Integer; // /include/internal/cef_types.h (cef_docking_mode_t)
|
TCefDockingMode = type Integer; // /include/internal/cef_types.h (cef_docking_mode_t)
|
||||||
TCefShowState = type Integer; // /include/internal/cef_types.h (cef_show_state_t)
|
TCefShowState = type Integer; // /include/internal/cef_types.h (cef_show_state_t)4
|
||||||
|
TCefQuickMenuEditStateFlags = type Integer; // /include/internal/cef_types.h (cef_quick_menu_edit_state_flags_t)
|
||||||
|
TCefTouchHandleStateFlags = type Integer; // /include/internal/cef_types.h (cef_touch_handle_state_flags_t)
|
||||||
|
TCefMediaAccessPermissionTypes = type Integer; // /include/internal/cef_types.h (cef_media_access_permission_types_t)
|
||||||
|
TCefPermissionRequestTypes = type Integer; // /include/internal/cef_types.h (cef_permission_request_types_t)
|
||||||
|
|
||||||
|
|
||||||
{$IFDEF FPC}
|
{$IFDEF FPC}
|
||||||
@ -1157,6 +1169,26 @@ type
|
|||||||
CEF_CUS_NONE
|
CEF_CUS_NONE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// /include/internal/cef_types.h (cef_permission_request_result_t)
|
||||||
|
TCefPermissionRequestResult = (
|
||||||
|
CEF_PERMISSION_RESULT_ACCEPT,
|
||||||
|
CEF_PERMISSION_RESULT_DENY,
|
||||||
|
CEF_PERMISSION_RESULT_DISMISS,
|
||||||
|
CEF_PERMISSION_RESULT_IGNORE
|
||||||
|
);
|
||||||
|
|
||||||
|
// /include/internal/cef_types.h (cef_touch_handle_state_t)
|
||||||
|
TCefTouchHandleState = record
|
||||||
|
touch_handle_id : integer;
|
||||||
|
flags : cardinal;
|
||||||
|
enabled : integer;
|
||||||
|
orientation : TCefHorizontalAlignment;
|
||||||
|
mirror_vertical : integer;
|
||||||
|
mirror_horizontal : integer;
|
||||||
|
origin : TCefPoint;
|
||||||
|
alpha : single;
|
||||||
|
end;
|
||||||
|
|
||||||
// /include/internal/cef_types.h (cef_composition_underline_t)
|
// /include/internal/cef_types.h (cef_composition_underline_t)
|
||||||
TCefCompositionUnderline = record
|
TCefCompositionUnderline = record
|
||||||
range : TCefRange;
|
range : TCefRange;
|
||||||
@ -1331,10 +1363,10 @@ type
|
|||||||
|
|
||||||
// /include/internal/cef_types.h (cef_screen_info_t)
|
// /include/internal/cef_types.h (cef_screen_info_t)
|
||||||
TCefScreenInfo = record
|
TCefScreenInfo = record
|
||||||
device_scale_factor : Single;
|
device_scale_factor : single;
|
||||||
depth : Integer;
|
depth : integer;
|
||||||
depth_per_component : Integer;
|
depth_per_component : integer;
|
||||||
is_monochrome : Integer;
|
is_monochrome : integer;
|
||||||
rect : TCefRect;
|
rect : TCefRect;
|
||||||
available_rect : TCefRect;
|
available_rect : TCefRect;
|
||||||
end;
|
end;
|
||||||
@ -1544,6 +1576,7 @@ type
|
|||||||
on_auto_resize : function(self: PCefDisplayHandler; browser: PCefBrowser; const new_size: PCefSize): Integer; stdcall;
|
on_auto_resize : function(self: PCefDisplayHandler; browser: PCefBrowser; const new_size: PCefSize): Integer; stdcall;
|
||||||
on_loading_progress_change : procedure(self: PCefDisplayHandler; browser: PCefBrowser; progress: double); stdcall;
|
on_loading_progress_change : procedure(self: PCefDisplayHandler; browser: PCefBrowser; progress: double); stdcall;
|
||||||
on_cursor_change : function(self: PCefDisplayHandler; browser: PCefBrowser; cursor: TCefCursorHandle; type_: TCefCursorType; const custom_cursor_info: PCefCursorInfo): Integer; stdcall;
|
on_cursor_change : function(self: PCefDisplayHandler; browser: PCefBrowser; cursor: TCefCursorHandle; type_: TCefCursorType; const custom_cursor_info: PCefCursorInfo): Integer; stdcall;
|
||||||
|
on_media_access_change : procedure(self: PCefDisplayHandler; browser: PCefBrowser; has_video_access, has_audio_access: integer); stdcall;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// /include/capi/cef_download_handler_capi.h (cef_download_handler_t)
|
// /include/capi/cef_download_handler_capi.h (cef_download_handler_t)
|
||||||
@ -1747,6 +1780,8 @@ type
|
|||||||
on_popup_size : procedure(self: PCefRenderHandler; browser: PCefBrowser; const rect: PCefRect); stdcall;
|
on_popup_size : procedure(self: PCefRenderHandler; browser: PCefBrowser; const rect: PCefRect); stdcall;
|
||||||
on_paint : procedure(self: PCefRenderHandler; browser: PCefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); stdcall;
|
on_paint : procedure(self: PCefRenderHandler; browser: PCefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; const buffer: Pointer; width, height: Integer); stdcall;
|
||||||
on_accelerated_paint : procedure(self: PCefRenderHandler; browser: PCefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); stdcall;
|
on_accelerated_paint : procedure(self: PCefRenderHandler; browser: PCefBrowser; type_: TCefPaintElementType; dirtyRectsCount: NativeUInt; const dirtyRects: PCefRectArray; shared_handle: Pointer); stdcall;
|
||||||
|
get_touch_handle_size : procedure(self: PCefRenderHandler; browser: PCefBrowser; orientation: TCefHorizontalAlignment; size: PCefSize); stdcall;
|
||||||
|
on_touch_handle_state_changed : procedure(self: PCefRenderHandler; browser: PCefBrowser; const state: PCefTouchHandleState); stdcall;
|
||||||
start_dragging : function(self: PCefRenderHandler; browser: PCefBrowser; drag_data: PCefDragData; allowed_ops: TCefDragOperations; x, y: Integer): Integer; stdcall;
|
start_dragging : function(self: PCefRenderHandler; browser: PCefBrowser; drag_data: PCefDragData; allowed_ops: TCefDragOperations; x, y: Integer): Integer; stdcall;
|
||||||
update_drag_cursor : procedure(self: PCefRenderHandler; browser: PCefBrowser; operation: TCefDragOperation); stdcall;
|
update_drag_cursor : procedure(self: PCefRenderHandler; browser: PCefBrowser; operation: TCefDragOperation); stdcall;
|
||||||
on_scroll_offset_changed : procedure(self: PCefRenderHandler; browser: PCefBrowser; x, y: Double); stdcall;
|
on_scroll_offset_changed : procedure(self: PCefRenderHandler; browser: PCefBrowser; x, y: Double); stdcall;
|
||||||
@ -1943,6 +1978,7 @@ type
|
|||||||
copy : function(self: PCefProcessMessage): PCefProcessMessage; stdcall;
|
copy : function(self: PCefProcessMessage): PCefProcessMessage; stdcall;
|
||||||
get_name : function(self: PCefProcessMessage): PCefStringUserFree; stdcall;
|
get_name : function(self: PCefProcessMessage): PCefStringUserFree; stdcall;
|
||||||
get_argument_list : function(self: PCefProcessMessage): PCefListValue; stdcall;
|
get_argument_list : function(self: PCefProcessMessage): PCefListValue; stdcall;
|
||||||
|
get_shared_memory_region : function(self: PCefProcessMessage): PCefSharedMemoryRegion; stdcall;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// /include/capi/cef_render_process_handler_capi.h (cef_render_process_handler_t)
|
// /include/capi/cef_render_process_handler_capi.h (cef_render_process_handler_t)
|
||||||
@ -1974,6 +2010,52 @@ type
|
|||||||
on_document_available_in_main_frame : procedure(self: PCefRequestHandler; browser: PCefBrowser); stdcall;
|
on_document_available_in_main_frame : procedure(self: PCefRequestHandler; browser: PCefBrowser); stdcall;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// This record is declared twice with almost identical parameters. "allowed_permissions" is defined as int and uint32.
|
||||||
|
// /include/capi/cef_media_access_handler_capi.h (cef_media_access_callback_t)
|
||||||
|
// /include/capi/cef_permission_handler_capi.h (cef_media_access_callback_t)
|
||||||
|
TCefMediaAccessCallback = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
cont : procedure(self: PCefMediaAccessCallback; allowed_permissions: integer); stdcall;
|
||||||
|
cancel : procedure(self: PCefMediaAccessCallback); stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// /include/capi/cef_media_access_handler_capi.h (cef_media_access_handler_t)
|
||||||
|
TCefMediaAccessHandler = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
on_request_media_access_permission : function(self: PCefMediaAccessHandler; browser: PCefBrowser; frame: PCefFrame; const requesting_url: PCefString; requested_permissions: integer; callback: PCefMediaAccessCallback): integer; stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// /include/capi/cef_permission_handler_capi.h (cef_permission_prompt_callback_t)
|
||||||
|
TCefPermissionPromptCallback = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
cont : procedure(self: PCefPermissionPromptCallback; result: TCefPermissionRequestResult); stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// /include/capi/cef_permission_handler_capi.h (cef_permission_handler_t)
|
||||||
|
TCefPermissionHandler = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
on_request_media_access_permission : function(self: PCefPermissionHandler; browser: PCefBrowser; frame: PCefFrame; const requesting_origin: PCefString; requested_permissions: cardinal; callback: PCefMediaAccessCallback): integer; stdcall;
|
||||||
|
on_show_permission_prompt : function(self: PCefPermissionHandler; browser: PCefBrowser; prompt_id: uint64; const requesting_origin: PCefString; requested_permissions: cardinal; callback: PCefPermissionPromptCallback): integer; stdcall;
|
||||||
|
on_dismiss_permission_prompt : procedure(self: PCefPermissionHandler; browser: PCefBrowser; prompt_id: uint64; result: TCefPermissionRequestResult); stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// /include/capi/cef_shared_memory_region_capi.h (cef_shared_memory_region_t)
|
||||||
|
TCefSharedMemoryRegion = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
is_valid : function(self: PCefSharedMemoryRegion): integer; stdcall;
|
||||||
|
size : function(self: PCefSharedMemoryRegion): NativeUInt; stdcall;
|
||||||
|
memory : function(self: PCefSharedMemoryRegion): pointer; stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// /include/capi/cef_shared_process_message_builder_capi.h (cef_shared_process_message_builder_t)
|
||||||
|
TCefSharedProcessMessageBuilder = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
is_valid : function(self: PCefSharedProcessMessageBuilder): integer; stdcall;
|
||||||
|
size : function(self: PCefSharedProcessMessageBuilder): NativeUInt; stdcall;
|
||||||
|
memory : function(self: PCefSharedProcessMessageBuilder): pointer; stdcall;
|
||||||
|
build : function(self: PCefSharedProcessMessageBuilder): PCefProcessMessage; stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
// /include/capi/cef_resource_handler_capi.h (cef_resource_skip_callback_t)
|
// /include/capi/cef_resource_handler_capi.h (cef_resource_skip_callback_t)
|
||||||
TCefResourceSkipCallback = record
|
TCefResourceSkipCallback = record
|
||||||
base : TCefBaseRefCounted;
|
base : TCefBaseRefCounted;
|
||||||
@ -2829,6 +2911,16 @@ type
|
|||||||
run_context_menu : function(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; model: PCefMenuModel; callback: PCefRunContextMenuCallback): Integer; stdcall;
|
run_context_menu : function(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; model: PCefMenuModel; callback: PCefRunContextMenuCallback): Integer; stdcall;
|
||||||
on_context_menu_command : function(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; command_id: Integer; event_flags: TCefEventFlags): Integer; stdcall;
|
on_context_menu_command : function(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame; params: PCefContextMenuParams; command_id: Integer; event_flags: TCefEventFlags): Integer; stdcall;
|
||||||
on_context_menu_dismissed : procedure(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame); stdcall;
|
on_context_menu_dismissed : procedure(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame); stdcall;
|
||||||
|
run_quick_menu : function(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame; location: PCefPoint; size: PCefSize; edit_state_flags: TCefQuickMenuEditStateFlags; callback: PCefRunQuickMenuCallback): integer; stdcall;
|
||||||
|
on_quick_menu_command : function(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame; command_id: integer; event_flags: TCefEventFlags): integer; stdcall;
|
||||||
|
on_quick_menu_dismissed : procedure(self: PCefContextMenuHandler; browser: PCefBrowser; frame: PCefFrame); stdcall;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// /include/capi/cef_context_menu_handler_capi.h (cef_run_quick_menu_callback_t)
|
||||||
|
TCefRunQuickMenuCallback = record
|
||||||
|
base : TCefBaseRefCounted;
|
||||||
|
cont : procedure(self: PCefRunQuickMenuCallback; command_id: integer; event_flags: TCefEventFlags); stdcall;
|
||||||
|
cancel : procedure(self: PCefRunQuickMenuCallback); stdcall;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// /include/capi/cef_client_capi.h (cef_client_t)
|
// /include/capi/cef_client_capi.h (cef_client_t)
|
||||||
@ -2844,6 +2936,7 @@ type
|
|||||||
get_find_handler : function(self: PCefClient): PCefFindHandler; stdcall;
|
get_find_handler : function(self: PCefClient): PCefFindHandler; stdcall;
|
||||||
get_focus_handler : function(self: PCefClient): PCefFocusHandler; stdcall;
|
get_focus_handler : function(self: PCefClient): PCefFocusHandler; stdcall;
|
||||||
get_frame_handler : function(self: PCefClient): PCefFrameHandler; stdcall;
|
get_frame_handler : function(self: PCefClient): PCefFrameHandler; stdcall;
|
||||||
|
get_permission_handler : function(self: PCefClient): PCefPermissionHandler; stdcall;
|
||||||
get_jsdialog_handler : function(self: PCefClient): PCefJsDialogHandler; stdcall;
|
get_jsdialog_handler : function(self: PCefClient): PCefJsDialogHandler; stdcall;
|
||||||
get_keyboard_handler : function(self: PCefClient): PCefKeyboardHandler; stdcall;
|
get_keyboard_handler : function(self: PCefClient): PCefKeyboardHandler; stdcall;
|
||||||
get_life_span_handler : function(self: PCefClient): PCefLifeSpanHandler; stdcall;
|
get_life_span_handler : function(self: PCefClient): PCefLifeSpanHandler; stdcall;
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
"UpdateLazPackages" : [
|
"UpdateLazPackages" : [
|
||||||
{
|
{
|
||||||
"ForceNotify" : true,
|
"ForceNotify" : true,
|
||||||
"InternalVersion" : 419,
|
"InternalVersion" : 420,
|
||||||
"Name" : "cef4delphi_lazarus.lpk",
|
"Name" : "cef4delphi_lazarus.lpk",
|
||||||
"Version" : "103.0.12.0"
|
"Version" : "104.4.18.0"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"UpdatePackageData" : {
|
"UpdatePackageData" : {
|
||||||
|
Reference in New Issue
Block a user