diff --git a/README.md b/README.md index 6790037e..67e87bee 100644 --- a/README.md +++ b/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 uses CEF 107.1.12 which includes Chromium 107.0.5304.122. +CEF4Delphi uses CEF 108.4.13 which includes Chromium 108.0.5359.125. The CEF binaries used by CEF4Delphi are available for download at Spotify : -* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_107.1.12%2Bg65b79a6%2Bchromium-107.0.5304.122_windows32.tar.bz2) -* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_107.1.12%2Bg65b79a6%2Bchromium-107.0.5304.122_windows64.tar.bz2) -* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_107.1.12%2Bg65b79a6%2Bchromium-107.0.5304.122_linux64.tar.bz2) -* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_107.1.12%2Bg65b79a6%2Bchromium-107.0.5304.122_linuxarm.tar.bz2) -* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_107.1.12%2Bg65b79a6%2Bchromium-107.0.5304.122_linuxarm64.tar.bz2) -* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_107.1.12%2Bg65b79a6%2Bchromium-107.0.5304.122_macosx64.tar.bz2) +* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_108.4.13%2Bga98cd4c%2Bchromium-108.0.5359.125_windows32.tar.bz2) +* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_108.4.13%2Bga98cd4c%2Bchromium-108.0.5359.125_windows64.tar.bz2) +* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_108.4.13%2Bga98cd4c%2Bchromium-108.0.5359.125_linux64.tar.bz2) +* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_108.4.13%2Bga98cd4c%2Bchromium-108.0.5359.125_linuxarm.tar.bz2) +* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_108.4.13%2Bga98cd4c%2Bchromium-108.0.5359.125_linuxarm64.tar.bz2) +* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_108.4.13%2Bga98cd4c%2Bchromium-108.0.5359.125_macosx64.tar.bz2) CEF4Delphi was developed and tested on Delphi 11.2 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.4/FPC 3.2.2. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components. diff --git a/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj b/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj index 236d9336..87c955ee 100644 --- a/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj +++ b/demos/Delphi_VCL/MiniBrowser/MiniBrowser.dproj @@ -1,7 +1,7 @@  {4BC9C886-B196-4B7F-931A-6134EB9A8DA6} - 19.4 + 19.5 VCL MiniBrowser.dpr True @@ -180,13 +180,8 @@ Microsoft Office XP Sample Automation Server Wrapper Components - - - - MiniBrowser.exe - true - - + + @@ -210,16 +205,6 @@ 64 - - - classes - 1 - - - classes - 1 - - res\xml @@ -529,7 +514,7 @@ 1 .dylib - + 1 .dylib @@ -562,7 +547,7 @@ 1 .dylib - + 1 .dylib @@ -599,7 +584,7 @@ 0 - + 0 @@ -623,13 +608,17 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -639,181 +628,27 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -823,7 +658,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -833,7 +668,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -843,7 +678,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -853,7 +688,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -863,191 +698,37 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -1057,7 +738,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -1067,7 +748,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1077,7 +758,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1087,7 +768,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1097,7 +778,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1107,7 +788,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1117,7 +798,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1139,12 +820,8 @@ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - - 1 - - + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 @@ -1157,6 +834,10 @@ ..\ 1 + + ..\ + 1 + @@ -1165,7 +846,7 @@ 1 - + 1 @@ -1174,7 +855,7 @@ ..\$(PROJECTNAME).launchscreen 64 - + ..\$(PROJECTNAME).launchscreen 64 @@ -1186,7 +867,7 @@ 1 - + 1 @@ -1257,7 +938,7 @@ 1 - + 1 @@ -1317,6 +998,7 @@ + diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm index a41685f8..4568d2dd 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.dfm @@ -2,8 +2,8 @@ object MiniBrowserFrm: TMiniBrowserFrm Left = 0 Top = 0 Caption = 'MiniBrowser' - ClientHeight = 712 - ClientWidth = 1184 + ClientHeight = 711 + ClientWidth = 1180 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -17,10 +17,10 @@ object MiniBrowserFrm: TMiniBrowserFrm OnShow = FormShow TextHeight = 13 object Splitter1: TSplitter - Left = 1179 + Left = 1175 Top = 41 Width = 5 - Height = 652 + Height = 651 Align = alRight Visible = False ExplicitLeft = 0 @@ -30,12 +30,13 @@ object MiniBrowserFrm: TMiniBrowserFrm object NavControlPnl: TPanel Left = 0 Top = 0 - Width = 1184 + Width = 1180 Height = 41 Align = alTop BevelOuter = bvNone Enabled = False TabOrder = 1 + ExplicitWidth = 1188 object NavButtonPnl: TPanel Left = 0 Top = 0 @@ -108,7 +109,7 @@ object MiniBrowserFrm: TMiniBrowserFrm object URLEditPnl: TPanel Left = 133 Top = 0 - Width = 978 + Width = 982 Height = 41 Align = alClient BevelOuter = bvNone @@ -118,7 +119,7 @@ object MiniBrowserFrm: TMiniBrowserFrm object URLCbx: TComboBox Left = 0 Top = 9 - Width = 978 + Width = 982 Height = 21 Align = alClient ItemIndex = 0 @@ -167,6 +168,9 @@ object MiniBrowserFrm: TMiniBrowserFrm 'ar-estado' 'https://www.kirupa.com/html5/accessing_your_webcam_in_html5.htm' 'https://www.xdumaine.com/enumerateDevices/test/' + + 'https://dagrs.berkeley.edu/sites/default/files/2020-01/sample.pd' + + 'f' 'chrome://version/' 'chrome://net-internals/' 'chrome://tracing/' @@ -188,13 +192,14 @@ object MiniBrowserFrm: TMiniBrowserFrm end end object ConfigPnl: TPanel - Left = 1111 + Left = 1107 Top = 0 Width = 73 Height = 41 Align = alRight BevelOuter = bvNone TabOrder = 2 + ExplicitLeft = 1115 object ConfigBtn: TButton Left = 40 Top = 8 @@ -230,25 +235,29 @@ object MiniBrowserFrm: TMiniBrowserFrm object CEFWindowParent1: TCEFWindowParent Left = 0 Top = 41 - Width = 1179 - Height = 652 + Width = 1175 + Height = 651 Align = alClient TabStop = True TabOrder = 0 + ExplicitWidth = 1183 + ExplicitHeight = 653 end object DevTools: TCEFWindowParent - Left = 1184 + Left = 1180 Top = 41 Width = 0 - Height = 652 + Height = 651 Align = alRight TabOrder = 2 Visible = False + ExplicitLeft = 1188 + ExplicitHeight = 653 end object StatusBar1: TStatusBar Left = 0 - Top = 693 - Width = 1184 + Top = 692 + Width = 1180 Height = 19 Panels = < item @@ -263,6 +272,8 @@ object MiniBrowserFrm: TMiniBrowserFrm item Width = 100 end> + ExplicitTop = 694 + ExplicitWidth = 1188 end object Chromium1: TChromium OnTextResultAvailable = Chromium1TextResultAvailable diff --git a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas index ce48da90..1bac01b4 100644 --- a/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas +++ b/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas @@ -323,6 +323,7 @@ begin GlobalCEFApp.EnableGPU := True; GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO; + //GlobalCEFApp.ChromeRuntime := True; end; procedure TMiniBrowserFrm.BackBtnClick(Sender: TObject); @@ -1735,7 +1736,7 @@ begin SaveDialog1.Filter := 'PDF files (*.pdf)|*.PDF'; if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then - Chromium1.PrintToPDF(SaveDialog1.FileName, Chromium1.DocumentURL, Chromium1.DocumentURL); + Chromium1.PrintToPDF(SaveDialog1.FileName); end; procedure TMiniBrowserFrm.ConfigBtnClick(Sender: TObject); diff --git a/demos/Delphi_VCL/URLRequest/URLRequest.dproj b/demos/Delphi_VCL/URLRequest/URLRequest.dproj index a0ca1aae..2feb8788 100644 --- a/demos/Delphi_VCL/URLRequest/URLRequest.dproj +++ b/demos/Delphi_VCL/URLRequest/URLRequest.dproj @@ -1,7 +1,7 @@  {B474747B-C461-4724-A7DA-39C9B53BFEB0} - 19.3 + 19.5 VCL URLRequest.dpr True @@ -156,13 +156,8 @@ Microsoft Office XP Sample Automation Server Wrapper Components - - - - URLRequest.exe - true - - + + 1 @@ -185,16 +180,6 @@ 64 - - - classes - 1 - - - classes - 1 - - res\xml @@ -504,7 +489,7 @@ 1 .dylib - + 1 .dylib @@ -537,7 +522,7 @@ 1 .dylib - + 1 .dylib @@ -574,7 +559,7 @@ 0 - + 0 @@ -598,13 +583,17 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 + + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset + 1 + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -614,181 +603,27 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -798,7 +633,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -808,7 +643,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -818,7 +653,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -828,7 +663,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -838,191 +673,37 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -1032,7 +713,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset 1 @@ -1042,7 +723,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1052,7 +733,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1062,7 +743,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1072,7 +753,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1082,7 +763,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1092,7 +773,7 @@ ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 - + ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset 1 @@ -1114,12 +795,8 @@ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 - - - - 1 - - + + ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF 1 @@ -1132,6 +809,10 @@ ..\ 1 + + ..\ + 1 + @@ -1140,7 +821,7 @@ 1 - + 1 @@ -1149,7 +830,7 @@ ..\$(PROJECTNAME).launchscreen 64 - + ..\$(PROJECTNAME).launchscreen 64 @@ -1161,7 +842,7 @@ 1 - + 1 @@ -1232,7 +913,7 @@ 1 - + 1 @@ -1288,17 +969,18 @@ 1 - - - - - - + - + + + + + + + True diff --git a/demos/Delphi_VCL/URLRequest/uURLRequest.dfm b/demos/Delphi_VCL/URLRequest/uURLRequest.dfm index c28f9029..aa3fdd57 100644 --- a/demos/Delphi_VCL/URLRequest/uURLRequest.dfm +++ b/demos/Delphi_VCL/URLRequest/uURLRequest.dfm @@ -4,7 +4,7 @@ object URLRequestFrm: TURLRequestFrm BorderIcons = [biSystemMenu] BorderStyle = bsSingle Caption = 'URL request' - ClientHeight = 445 + ClientHeight = 529 ClientWidth = 518 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -13,22 +13,22 @@ object URLRequestFrm: TURLRequestFrm Font.Name = 'Tahoma' Font.Style = [] Padding.Top = 5 - OldCreateOrder = False Position = poScreenCenter OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy - PixelsPerInch = 96 TextHeight = 13 object StatusBar1: TStatusBar Left = 0 - Top = 426 + Top = 510 Width = 518 Height = 19 Panels = < item Width = 500 end> + ExplicitTop = 425 + ExplicitWidth = 514 end object GETGbx: TGroupBox Left = 10 @@ -68,7 +68,7 @@ object URLRequestFrm: TURLRequestFrm Left = 10 Top = 136 Width = 494 - Height = 274 + Height = 361 Caption = ' POST example ' TabOrder = 2 object Label2: TLabel @@ -84,7 +84,7 @@ object URLRequestFrm: TURLRequestFrm Width = 433 Height = 21 TabOrder = 0 - Text = 'https://ptsv2.com/t/cef4delphi/post' + Text = 'https://httpbin.org/post' end object SendPostReqBtn: TButton Left = 16 @@ -95,22 +95,13 @@ object URLRequestFrm: TURLRequestFrm TabOrder = 1 OnClick = SendPostReqBtnClick end - object Button1: TButton - Left = 16 - Top = 231 - Width = 462 - Height = 25 - Caption = 'Check results in PTSV2.com' - TabOrder = 2 - OnClick = Button1Click - end object GroupBox1: TGroupBox Left = 16 Top = 56 Width = 462 Height = 57 Caption = ' Parameter 1 ' - TabOrder = 3 + TabOrder = 2 object Label3: TLabel Left = 16 Top = 24 @@ -148,7 +139,7 @@ object URLRequestFrm: TURLRequestFrm Width = 462 Height = 57 Caption = ' Parameter 2 ' - TabOrder = 4 + TabOrder = 3 object Label5: TLabel Left = 16 Top = 24 @@ -180,6 +171,16 @@ object URLRequestFrm: TURLRequestFrm Text = 'value2' end end + object Memo1: TMemo + Left = 2 + Top = 232 + Width = 490 + Height = 127 + Align = alBottom + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 4 + end end object SaveDialog1: TSaveDialog Left = 448 diff --git a/demos/Delphi_VCL/URLRequest/uURLRequest.pas b/demos/Delphi_VCL/URLRequest/uURLRequest.pas index 35bcb45e..0f09bde4 100644 --- a/demos/Delphi_VCL/URLRequest/uURLRequest.pas +++ b/demos/Delphi_VCL/URLRequest/uURLRequest.pas @@ -66,7 +66,6 @@ type PostURLEdt: TEdit; Label2: TLabel; SendPostReqBtn: TButton; - Button1: TButton; GroupBox1: TGroupBox; Label3: TLabel; PostParam1NameEdt: TEdit; @@ -77,10 +76,10 @@ type Label6: TLabel; PostParam2NameEdt: TEdit; PostParam2ValueEdt: TEdit; + Memo1: TMemo; procedure DownloadBtnClick(Sender: TObject); procedure SendPostReqBtnClick(Sender: TObject); - procedure Button1Click(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -216,11 +215,6 @@ begin if (FMemStream <> nil) then FreeAndNil(FMemStream); end; -procedure TURLRequestFrm.Button1Click(Sender: TObject); -begin - ShellExecute(0, 'open', 'https://ptsv2.com/t/cef4delphi', nil, nil, SW_SHOWNORMAL); -end; - procedure TURLRequestFrm.CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); begin if FSendingGET then @@ -312,11 +306,8 @@ begin if FClosing then request.Cancel else - if FSendingGET then - begin - if (data <> nil) and (dataLength > 0) then - FMemStream.WriteBuffer(data^, dataLength); - end; + if (data <> nil) and (dataLength > 0) then + FMemStream.WriteBuffer(data^, dataLength); except on e : exception do if CustomExceptionHandler('TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData', e) then raise; @@ -366,7 +357,11 @@ begin end else if FSendingPOST then - TempMessage := 'Parameters sent!'; + begin + TempMessage := 'Parameters sent!'; + FMemStream.Position := 0; + Memo1.Lines.LoadFromStream(FMemStream); + end; StatusBar1.Panels[0].Text := TempMessage; showmessage(TempMessage); diff --git a/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas index ec6a8425..afd77b76 100644 --- a/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus_Linux_GTK2/MiniBrowser/uMiniBrowser.pas @@ -422,7 +422,7 @@ begin SaveDialog1.Filter := 'PDF files (*.pdf)|*.PDF'; if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then - Chromium1.PrintToPDF(SaveDialog1.FileName, Chromium1.DocumentURL, Chromium1.DocumentURL); + Chromium1.PrintToPDF(SaveDialog1.FileName); end; procedure TMiniBrowserFrm.ShowDevTools1Click(Sender: TObject); diff --git a/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/OSRExternalPumpBrowser_sp.lpr b/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/OSRExternalPumpBrowser_sp.lpr index 99c903cd..8b9ad6bd 100644 --- a/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/OSRExternalPumpBrowser_sp.lpr +++ b/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/OSRExternalPumpBrowser_sp.lpr @@ -48,7 +48,6 @@ uses begin GlobalCEFApp := TCefApplicationCore.Create; GlobalCEFApp.WindowlessRenderingEnabled := True; - GlobalCEFApp.EnableHighDPISupport := True; GlobalCEFApp.ExternalMessagePump := True; GlobalCEFApp.MultiThreadedMessageLoop := False; diff --git a/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.lfm b/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.lfm index 15405152..59a52e2b 100644 --- a/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.lfm +++ b/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.lfm @@ -12,7 +12,7 @@ object Form1: TForm1 OnDestroy = FormDestroy OnHide = FormHide OnShow = FormShow - LCLVersion = '2.2.2.0' + LCLVersion = '2.2.4.0' object AddressPnl: TPanel Left = 0 Height = 30 @@ -66,7 +66,7 @@ object Form1: TForm1 OnMouseLeave = Panel1MouseLeave object FocusWorkaroundEdt: TEdit Left = -9000 - Height = 19 + Height = 20 Top = -9000 Width = 80 BorderStyle = bsNone diff --git a/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas b/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas index 50f71c64..d863aea0 100644 --- a/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas +++ b/demos/Lazarus_Linux_GTK3/OSRExternalPumpBrowser/uosrexternalpumpbrowser.pas @@ -206,7 +206,6 @@ procedure CreateGlobalCEFApp; begin GlobalCEFApp := TCefApplication.Create; GlobalCEFApp.WindowlessRenderingEnabled := True; - GlobalCEFApp.EnableHighDPISupport := True; GlobalCEFApp.BrowserSubprocessPath := 'OSRExternalPumpBrowser_sp'; GlobalCEFApp.BackgroundColor := CefColorSetARGB($FF, $FF, $FF, $FF); GlobalCEFApp.ExternalMessagePump := True; diff --git a/demos/Lazarus_Windows/CookieVisitor/CookieVisitor.lpi b/demos/Lazarus_Windows/CookieVisitor/CookieVisitor.lpi index daf173a8..3f2340ef 100644 --- a/demos/Lazarus_Windows/CookieVisitor/CookieVisitor.lpi +++ b/demos/Lazarus_Windows/CookieVisitor/CookieVisitor.lpi @@ -1,7 +1,7 @@ - + @@ -9,9 +9,9 @@ + - <UseAppBundle Value="False"/> <ResourceType Value="res"/> @@ -25,7 +25,6 @@ </PublishOptions> <RunParams> <FormatVersion Value="2"/> - <Modes Count="0"/> </RunParams> <RequiredPackages Count="2"> <Item1> @@ -72,6 +71,9 @@ </SyntaxOptions> </Parsing> <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + </Debugging> <Options> <Win32> <GraphicApplication Value="True"/> diff --git a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm index 240ecc25..d6ca476b 100644 --- a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm +++ b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.lfm @@ -15,7 +15,7 @@ object MiniBrowserFrm: TMiniBrowserFrm OnDestroy = FormDestroy OnShow = FormShow Position = poScreenCenter - LCLVersion = '2.2.2.0' + LCLVersion = '2.2.4.0' object Splitter1: TSplitter Left = 1179 Height = 663 diff --git a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas index 13871e52..7d681a9e 100644 --- a/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas +++ b/demos/Lazarus_Windows/MiniBrowser/uMiniBrowser.pas @@ -1567,7 +1567,7 @@ begin SaveDialog1.Filter := 'PDF files (*.pdf)|*.PDF'; if SaveDialog1.Execute and (length(SaveDialog1.FileName) > 0) then - Chromium1.PrintToPDF(SaveDialog1.FileName, Chromium1.DocumentURL, Chromium1.DocumentURL); + Chromium1.PrintToPDF(SaveDialog1.FileName); end; procedure TMiniBrowserFrm.ConfigBtnClick(Sender: TObject); diff --git a/demos/Lazarus_Windows/TabbedBrowser2/uMainForm.lfm b/demos/Lazarus_Windows/TabbedBrowser2/uMainForm.lfm index 33bc8894..96af608c 100644 --- a/demos/Lazarus_Windows/TabbedBrowser2/uMainForm.lfm +++ b/demos/Lazarus_Windows/TabbedBrowser2/uMainForm.lfm @@ -1,66 +1,64 @@ object MainForm: TMainForm Left = 0 + Height = 703 Top = 0 + Width = 991 Caption = 'Initializing. Please, wait...' ClientHeight = 703 ClientWidth = 991 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 - PixelsPerInch = 96 + Position = poScreenCenter + LCLVersion = '2.2.4.0' object BrowserPageCtrl: TPageControl Left = 32 + Height = 703 Top = 0 Width = 959 - Height = 703 Align = alClient TabOrder = 0 TabWidth = 150 end object ButtonPnl: TPanel Left = 0 + Height = 703 Top = 0 Width = 32 - Height = 703 Align = alLeft BevelOuter = bvNone + ClientHeight = 703 + ClientWidth = 32 Enabled = False TabOrder = 1 object AddTabBtn: TSpeedButton Left = 1 + Height = 26 Top = 1 Width = 26 - Height = 26 Caption = '+' - Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -24 Font.Name = 'Arial Black' - Font.Style = [] - ParentFont = False OnClick = AddTabBtnClick + ParentFont = False end object RemoveTabBtn: TSpeedButton Left = 1 + Height = 26 Top = 30 Width = 26 - Height = 26 Caption = '−' - Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -24 Font.Name = 'Arial Black' - Font.Style = [] - ParentFont = False OnClick = RemoveTabBtnClick + ParentFont = False end end end diff --git a/demos/Lazarus_Windows/URLRequest/URLRequest.lpi b/demos/Lazarus_Windows/URLRequest/URLRequest.lpi index dc8603f5..210c5dd4 100644 --- a/demos/Lazarus_Windows/URLRequest/URLRequest.lpi +++ b/demos/Lazarus_Windows/URLRequest/URLRequest.lpi @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectOptions> - <Version Value="11"/> + <Version Value="12"/> <PathDelim Value="\"/> <General> <Flags> @@ -9,9 +9,9 @@ <MainUnitHasCreateFormStatements Value="False"/> <MainUnitHasTitleStatement Value="False"/> <MainUnitHasScaledStatement Value="False"/> + <CompatibilityMode Value="True"/> </Flags> <SessionStorage Value="InProjectDir"/> - <MainUnit Value="0"/> <Title Value="URLRequest"/> <UseAppBundle Value="False"/> <ResourceType Value="res"/> @@ -25,7 +25,6 @@ </PublishOptions> <RunParams> <FormatVersion Value="2"/> - <Modes Count="0"/> </RunParams> <RequiredPackages Count="2"> <Item1> @@ -62,6 +61,9 @@ </SyntaxOptions> </Parsing> <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2Set"/> + </Debugging> <Options> <Win32> <GraphicApplication Value="True"/> diff --git a/demos/Lazarus_Windows/URLRequest/uURLRequest.lfm b/demos/Lazarus_Windows/URLRequest/uURLRequest.lfm index 2dce810a..73b21c4e 100644 --- a/demos/Lazarus_Windows/URLRequest/uURLRequest.lfm +++ b/demos/Lazarus_Windows/URLRequest/uURLRequest.lfm @@ -1,12 +1,12 @@ object URLRequestFrm: TURLRequestFrm Left = 613 - Height = 445 - Top = 279 + Height = 623 + Top = 125 Width = 518 BorderIcons = [biSystemMenu] BorderStyle = bsSingle Caption = 'URL request' - ClientHeight = 445 + ClientHeight = 623 ClientWidth = 518 Color = clBtnFace Font.Color = clWindowText @@ -16,11 +16,11 @@ object URLRequestFrm: TURLRequestFrm OnCreate = FormCreate OnDestroy = FormDestroy Position = poScreenCenter - LCLVersion = '2.0.12.0' + LCLVersion = '2.2.4.0' object StatusBar1: TStatusBar Left = 0 Height = 23 - Top = 422 + Top = 600 Width = 518 Panels = < item @@ -65,11 +65,11 @@ object URLRequestFrm: TURLRequestFrm end object POSTGbx: TGroupBox Left = 10 - Height = 274 + Height = 446 Top = 136 Width = 494 Caption = ' POST example ' - ClientHeight = 256 + ClientHeight = 428 ClientWidth = 490 TabOrder = 2 object Label2: TLabel @@ -86,7 +86,7 @@ object URLRequestFrm: TURLRequestFrm Top = 12 Width = 433 TabOrder = 0 - Text = 'https://ptsv2.com/t/cef4delphi/post' + Text = 'https://httpbin.org/post' end object SendPostReqBtn: TButton Left = 14 @@ -97,15 +97,6 @@ object URLRequestFrm: TURLRequestFrm OnClick = SendPostReqBtnClick TabOrder = 1 end - object Button1: TButton - Left = 14 - Height = 25 - Top = 217 - Width = 462 - Caption = 'Check results in PTSV2.com' - OnClick = Button1Click - TabOrder = 2 - end object GroupBox1: TGroupBox Left = 14 Height = 57 @@ -114,7 +105,7 @@ object URLRequestFrm: TURLRequestFrm Caption = ' Parameter 1 ' ClientHeight = 39 ClientWidth = 458 - TabOrder = 3 + TabOrder = 2 object Label3: TLabel Left = 14 Height = 13 @@ -156,7 +147,7 @@ object URLRequestFrm: TURLRequestFrm Caption = ' Parameter 2 ' ClientHeight = 39 ClientWidth = 458 - TabOrder = 4 + TabOrder = 3 object Label5: TLabel Left = 14 Height = 13 @@ -190,6 +181,15 @@ object URLRequestFrm: TURLRequestFrm Text = 'value2' end end + object Memo1: TMemo + Left = 16 + Height = 194 + Top = 216 + Width = 462 + ReadOnly = True + ScrollBars = ssBoth + TabOrder = 4 + end end object SaveDialog1: TSaveDialog Left = 448 diff --git a/demos/Lazarus_Windows/URLRequest/uURLRequest.pas b/demos/Lazarus_Windows/URLRequest/uURLRequest.pas index dc2afa0f..1de7ee1b 100644 --- a/demos/Lazarus_Windows/URLRequest/uURLRequest.pas +++ b/demos/Lazarus_Windows/URLRequest/uURLRequest.pas @@ -61,6 +61,7 @@ type { TURLRequestFrm } TURLRequestFrm = class(TForm) + Memo1: TMemo; StatusBar1: TStatusBar; SaveDialog1: TSaveDialog; CEFUrlRequestClientComponent1: TCEFUrlRequestClientComponent; @@ -72,7 +73,6 @@ type PostURLEdt: TEdit; Label2: TLabel; SendPostReqBtn: TButton; - Button1: TButton; GroupBox1: TGroupBox; Label3: TLabel; PostParam1NameEdt: TEdit; @@ -96,8 +96,6 @@ type procedure CEFUrlRequestClientComponent1RequestComplete(Sender: TObject; const request: ICefUrlRequest); procedure CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); - procedure Button1Click(Sender: TObject); - private FMemStream : TMemoryStream; FCanClose : boolean; @@ -209,11 +207,8 @@ begin if FClosing then request.Cancel else - if FSendingGET then - begin - if (data <> nil) and (dataLength > 0) then - FMemStream.WriteBuffer(data^, dataLength); - end; + if (data <> nil) and (dataLength > 0) then + FMemStream.WriteBuffer(data^, dataLength); except on e : exception do if CustomExceptionHandler('TURLRequestFrm.CEFUrlRequestClientComponent1DownloadData', e) then raise; @@ -241,11 +236,6 @@ begin if (FMemStream <> nil) then FreeAndNil(FMemStream); end; -procedure TURLRequestFrm.Button1Click(Sender: TObject); -begin - OpenURL('https://ptsv2.com/t/cef4delphi'); { *Converted from ShellExecute* } -end; - procedure TURLRequestFrm.CEFUrlRequestClientComponent1CreateURLRequest(Sender: TObject); begin if FSendingGET then @@ -374,7 +364,11 @@ begin end else if FSendingPOST then - TempMessage := 'Parameters sent!'; + begin + TempMessage := 'Parameters sent!'; + FMemStream.Position := 0; + Memo1.Lines.LoadFromStream(FMemStream); + end; StatusBar1.Panels[0].Text := TempMessage; showmessage(TempMessage); diff --git a/packages/CEF4Delphi.dpk b/packages/CEF4Delphi.dpk index 39ada99b..a550d62f 100644 --- a/packages/CEF4Delphi.dpk +++ b/packages/CEF4Delphi.dpk @@ -230,7 +230,10 @@ contains uCEFPermissionHandler in '..\source\uCEFPermissionHandler.pas', uCEFSharedMemoryRegion in '..\source\uCEFSharedMemoryRegion.pas', uCEFSharedProcessMessageBuilder in '..\source\uCEFSharedProcessMessageBuilder.pas', - uCEFRunQuickMenuCallback in '..\source\uCEFRunQuickMenuCallback.pas'; + uCEFRunQuickMenuCallback in '..\source\uCEFRunQuickMenuCallback.pas', + uCEFPreferenceRegistrar in '..\source\uCEFPreferenceRegistrar.pas', + uCEFPreferenceManager in '..\source\uCEFPreferenceManager.pas', + uCEFApplicationEvents in '..\source\uCEFApplicationEvents.pas'; end. diff --git a/packages/CEF4DelphiFMXRTL.dproj b/packages/CEF4DelphiFMXRTL.dproj index 3b5ed760..d753ac3c 100644 --- a/packages/CEF4DelphiFMXRTL.dproj +++ b/packages/CEF4DelphiFMXRTL.dproj @@ -108,26 +108,6 @@ <VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri;ITSAppUsesNonExemptEncryption=false;NSBluetoothAlwaysUsageDescription=The reason for accessing bluetooth;NSBluetoothPeripheralUsageDescription=The reason for accessing bluetooth peripherals;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSMotionUsageDescription=The reason for accessing the accelerometer;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers</VerInfo_Keys> <VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> - <iOS_AppStore1024>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_1024x1024.png</iOS_AppStore1024> - <iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120> - <iPhone_AppIcon180>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png</iPhone_AppIcon180> - <iPhone_Launch2x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2x.png</iPhone_Launch2x> - <iPhone_LaunchDark2x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImageDark_2x.png</iPhone_LaunchDark2x> - <iPhone_Launch3x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_3x.png</iPhone_Launch3x> - <iPhone_LaunchDark3x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImageDark_3x.png</iPhone_LaunchDark3x> - <iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80> - <iPhone_Spotlight120>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_120x120.png</iPhone_Spotlight120> - <iPhone_Setting58>$(BDS)\bin\Artwork\iOS\iPhone\FM_SettingIcon_58x58.png</iPhone_Setting58> - <iPhone_Setting87>$(BDS)\bin\Artwork\iOS\iPhone\FM_SettingIcon_87x87.png</iPhone_Setting87> - <iPhone_Notification40>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_40x40.png</iPhone_Notification40> - <iPhone_Notification60>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_60x60.png</iPhone_Notification60> - <iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152> - <iPad_AppIcon167>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_167x167.png</iPad_AppIcon167> - <iPad_Launch2x>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImage_2x.png</iPad_Launch2x> - <iPad_LaunchDark2x>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageDark_2x.png</iPad_LaunchDark2x> - <iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80> - <iPad_Setting58>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png</iPad_Setting58> - <iPad_Notification40>$(BDS)\bin\Artwork\iOS\iPad\FM_NotificationIcon_40x40.png</iPad_Notification40> </PropertyGroup> <PropertyGroup Condition="'$(Base_OSX64)'!=''"> <VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);NSHighResolutionCapable=true;LSApplicationCategoryType=public.app-category.utilities;NSLocationUsageDescription=The reason for accessing the location information of the user;NSContactsUsageDescription=The reason for accessing the contacts;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSCameraUsageDescription=The reason for accessing the camera;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSMotionUsageDescription=The reason for accessing the accelerometer;NSDesktopFolderUsageDescription=The reason for accessing the Desktop folder;NSDocumentsFolderUsageDescription=The reason for accessing the Documents folder;NSDownloadsFolderUsageDescription=The reason for accessing the Downloads folder;NSNetworkVolumesUsageDescription=The reason for accessing files on a network volume;NSRemovableVolumesUsageDescription=The reason for accessing files on a removable volume;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers</VerInfo_Keys> diff --git a/packages/CEF4DelphiVCLRTL.dpk b/packages/CEF4DelphiVCLRTL.dpk index fb06bddd..940bd303 100644 --- a/packages/CEF4DelphiVCLRTL.dpk +++ b/packages/CEF4DelphiVCLRTL.dpk @@ -230,7 +230,10 @@ contains uCEFPermissionHandler in '..\source\uCEFPermissionHandler.pas', uCEFSharedMemoryRegion in '..\source\uCEFSharedMemoryRegion.pas', uCEFSharedProcessMessageBuilder in '..\source\uCEFSharedProcessMessageBuilder.pas', - uCEFRunQuickMenuCallback in '..\source\uCEFRunQuickMenuCallback.pas'; + uCEFRunQuickMenuCallback in '..\source\uCEFRunQuickMenuCallback.pas', + uCEFPreferenceRegistrar in '..\source\uCEFPreferenceRegistrar.pas', + uCEFPreferenceManager in '..\source\uCEFPreferenceManager.pas', + uCEFApplicationEvents in '..\source\uCEFApplicationEvents.pas'; end. diff --git a/packages/CEF4DelphiVCLRTL.dproj b/packages/CEF4DelphiVCLRTL.dproj index 30c34919..87fdd840 100644 --- a/packages/CEF4DelphiVCLRTL.dproj +++ b/packages/CEF4DelphiVCLRTL.dproj @@ -312,6 +312,9 @@ <DCCReference Include="..\source\uCEFSharedMemoryRegion.pas"/> <DCCReference Include="..\source\uCEFSharedProcessMessageBuilder.pas"/> <DCCReference Include="..\source\uCEFRunQuickMenuCallback.pas"/> + <DCCReference Include="..\source\uCEFPreferenceRegistrar.pas"/> + <DCCReference Include="..\source\uCEFPreferenceManager.pas"/> + <DCCReference Include="..\source\uCEFApplicationEvents.pas"/> <BuildConfiguration Include="Base"> <Key>Base</Key> </BuildConfiguration> @@ -329,7 +332,11 @@ <Borland.ProjectType>Package</Borland.ProjectType> <BorlandProject> <Delphi.Personality> - <Excluded_Packages/> + <Excluded_Packages> + <Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl280.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages> + <Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> + <Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> + </Excluded_Packages> <Source> <Source Name="MainSource">CEF4DelphiVCLRTL.dpk</Source> </Source> @@ -339,6 +346,12 @@ <DeployFile LocalName="$(BDS)\Redist\iossimulator\libpcre.dylib" Class="DependencyModule"/> <DeployFile LocalName="$(BDS)\Redist\osx32\libcgunwind.1.0.dylib" Class="DependencyModule"/> <DeployFile LocalName="..\..\..\..\..\..\..\Public\Documents\Embarcadero\Studio\22.0\Bpl\CEF4DelphiVCLRTL.bpl" Configuration="Debug" Class="ProjectOutput"/> + <DeployFile LocalName="..\..\..\..\..\..\..\Public\Documents\Embarcadero\Studio\22.0\Bpl\CEF4DelphiVCLRTL.bpl" Configuration="Debug" Class="ProjectOutput"> + <Platform Name="Win32"> + <RemoteName>CEF4DelphiVCLRTL.bpl</RemoteName> + <Overwrite>true</Overwrite> + </Platform> + </DeployFile> <DeployFile LocalName="..\..\..\..\..\..\..\Public\Documents\Embarcadero\Studio\22.0\Bpl\CEF4DelphiVCLRTL.bpl" Configuration="Release" Class="ProjectOutput"/> <DeployFile LocalName="..\..\..\..\..\..\..\Public\Documents\Embarcadero\Studio\22.0\Bpl\Win64\CEF4DelphiVCLRTL.bpl" Configuration="Release" Class="ProjectOutput"/> <DeployClass Name="AdditionalDebugSymbols"> diff --git a/packages/CEF4Delphi_designtime.dproj b/packages/CEF4Delphi_designtime.dproj index 2d94d453..b8a41a98 100644 --- a/packages/CEF4Delphi_designtime.dproj +++ b/packages/CEF4Delphi_designtime.dproj @@ -98,26 +98,6 @@ <VerInfo_Keys>CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0;CFBundleShortVersionString=1.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;NSLocationAlwaysAndWhenInUseUsageDescription=The reason for accessing the location information of the user;UIBackgroundModes=;NSContactsUsageDescription=The reason for accessing the contacts;NSPhotoLibraryUsageDescription=The reason for accessing the photo library;NSPhotoLibraryAddUsageDescription=The reason for adding to the photo library;NSCameraUsageDescription=The reason for accessing the camera;NSFaceIDUsageDescription=The reason for accessing the face id;NSMicrophoneUsageDescription=The reason for accessing the microphone;NSSiriUsageDescription=The reason for accessing Siri;ITSAppUsesNonExemptEncryption=false;NSBluetoothAlwaysUsageDescription=The reason for accessing bluetooth;NSBluetoothPeripheralUsageDescription=The reason for accessing bluetooth peripherals;NSCalendarsUsageDescription=The reason for accessing the calendar data;NSRemindersUsageDescription=The reason for accessing the reminders;NSMotionUsageDescription=The reason for accessing the accelerometer;NSSpeechRecognitionUsageDescription=The reason for requesting to send user data to Apple's speech recognition servers</VerInfo_Keys> <VerInfo_UIDeviceFamily>iPhoneAndiPad</VerInfo_UIDeviceFamily> <VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo> - <iOS_AppStore1024>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_1024x1024.png</iOS_AppStore1024> - <iPhone_AppIcon120>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png</iPhone_AppIcon120> - <iPhone_AppIcon180>$(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_180x180.png</iPhone_AppIcon180> - <iPhone_Launch2x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_2x.png</iPhone_Launch2x> - <iPhone_LaunchDark2x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImageDark_2x.png</iPhone_LaunchDark2x> - <iPhone_Launch3x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImage_3x.png</iPhone_Launch3x> - <iPhone_LaunchDark3x>$(BDS)\bin\Artwork\iOS\iPhone\FM_LaunchImageDark_3x.png</iPhone_LaunchDark3x> - <iPhone_Spotlight80>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png</iPhone_Spotlight80> - <iPhone_Spotlight120>$(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_120x120.png</iPhone_Spotlight120> - <iPhone_Setting58>$(BDS)\bin\Artwork\iOS\iPhone\FM_SettingIcon_58x58.png</iPhone_Setting58> - <iPhone_Setting87>$(BDS)\bin\Artwork\iOS\iPhone\FM_SettingIcon_87x87.png</iPhone_Setting87> - <iPhone_Notification40>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_40x40.png</iPhone_Notification40> - <iPhone_Notification60>$(BDS)\bin\Artwork\iOS\iPhone\FM_NotificationIcon_60x60.png</iPhone_Notification60> - <iPad_AppIcon152>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png</iPad_AppIcon152> - <iPad_AppIcon167>$(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_167x167.png</iPad_AppIcon167> - <iPad_Launch2x>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImage_2x.png</iPad_Launch2x> - <iPad_LaunchDark2x>$(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageDark_2x.png</iPad_LaunchDark2x> - <iPad_SpotLight80>$(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png</iPad_SpotLight80> - <iPad_Setting58>$(BDS)\bin\Artwork\iOS\iPad\FM_SettingIcon_58x58.png</iPad_Setting58> - <iPad_Notification40>$(BDS)\bin\Artwork\iOS\iPad\FM_NotificationIcon_40x40.png</iPad_Notification40> </PropertyGroup> <PropertyGroup Condition="'$(Base_Win32)'!=''"> <DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace> diff --git a/packages/cef4delphi_lazarus.lpk b/packages/cef4delphi_lazarus.lpk index 9ea19ded..72de8fff 100644 --- a/packages/cef4delphi_lazarus.lpk +++ b/packages/cef4delphi_lazarus.lpk @@ -21,8 +21,8 @@ </CompilerOptions> <Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/> <License Value="MPL 1.1"/> - <Version Major="107" Minor="1" Release="12"/> - <Files Count="210"> + <Version Major="108" Minor="4" Release="13"/> + <Files Count="213"> <Item1> <Filename Value="..\source\uCEFAccessibilityHandler.pas"/> <UnitName Value="uCEFAccessibilityHandler"/> @@ -881,6 +881,18 @@ <Filename Value="..\source\uCEFSharedMemoryRegion.pas"/> <UnitName Value="uCEFSharedMemoryRegion"/> </Item210> + <Item211> + <Filename Value="..\source\uCEFPreferenceManager.pas"/> + <UnitName Value="uCEFPreferenceManager"/> + </Item211> + <Item212> + <Filename Value="..\source\uCEFPreferenceRegistrar.pas"/> + <UnitName Value="uCEFPreferenceRegistrar"/> + </Item212> + <Item213> + <Filename Value="..\source\uCEFApplicationEvents.pas"/> + <UnitName Value="uCEFApplicationEvents"/> + </Item213> </Files> <CompatibilityMode Value="True"/> <RequiredPkgs Count="5"> diff --git a/packages/cef4delphi_lazarus.pas b/packages/cef4delphi_lazarus.pas index e7e24c4a..1665d835 100644 --- a/packages/cef4delphi_lazarus.pas +++ b/packages/cef4delphi_lazarus.pas @@ -66,7 +66,11 @@ uses uCEFWorkSchedulerQueueThread, uCEFLinkedWinControlBase, uCEFLazarusCocoa, uCEFBrowserWindow, uCEFOsrBrowserWindow, uCEFTimerWorkScheduler, uCEFFrameHandler, uCEFOverlayController, uCEFFileDialogInfo, uCEFArgCopy, - uCEFCommandHandler, uCEFLinuxEventPipe, LazarusPackageIntf; + uCEFCommandHandler, uCEFLinuxEventPipe, uCEFPermissionHandler, + uCEFRunQuickMenuCallback, uCEFMediaAccessHandler, uCEFMediaAccessCallback, + uCEFPermissionPromptCallback, uCEFSharedProcessMessageBuilder, + uCEFSharedMemoryRegion, uCEFPreferenceManager, uCEFPreferenceRegistrar, + uCEFApplicationEvents, LazarusPackageIntf; implementation diff --git a/source/uCEFApplicationCore.pas b/source/uCEFApplicationCore.pas index cad9eca6..0916dde2 100644 --- a/source/uCEFApplicationCore.pas +++ b/source/uCEFApplicationCore.pas @@ -63,18 +63,19 @@ uses {$IFDEF LINUX} {$IFDEF FPC}xlib,{$ENDIF} uCEFArgCopy, {$ENDIF} - uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar; + uCEFTypes, uCEFInterfaces, uCEFApplicationEvents, uCEFBaseRefCounted, + uCEFSchemeRegistrar, uCEFPreferenceRegistrar; const - CEF_SUPPORTED_VERSION_MAJOR = 107; - CEF_SUPPORTED_VERSION_MINOR = 1; - CEF_SUPPORTED_VERSION_RELEASE = 12; + CEF_SUPPORTED_VERSION_MAJOR = 108; + CEF_SUPPORTED_VERSION_MINOR = 4; + CEF_SUPPORTED_VERSION_RELEASE = 13; CEF_SUPPORTED_VERSION_BUILD = 0; CEF_CHROMEELF_VERSION_MAJOR = CEF_SUPPORTED_VERSION_MAJOR; CEF_CHROMEELF_VERSION_MINOR = 0; - CEF_CHROMEELF_VERSION_RELEASE = 5304; - CEF_CHROMEELF_VERSION_BUILD = 122; + CEF_CHROMEELF_VERSION_RELEASE = 5359; + CEF_CHROMEELF_VERSION_BUILD = 125; {$IFDEF MSWINDOWS} LIBCEF_DLL = 'libcef.dll'; @@ -193,7 +194,9 @@ type // Fields used during the CEF initialization FWindowsSandboxInfo : pointer; + {$IFDEF MSWINDOWS} FEnableHighDPISupport : boolean; + {$ENDIF} {$IFDEF LINUX} FArgCopy : TCEFArgCopy; {$ENDIF} @@ -233,6 +236,7 @@ type FOnRegisterCustomSchemes : TOnRegisterCustomSchemesEvent; // ICefBrowserProcessHandler + FOnRegisterCustomPreferences : TOnRegisterCustomPreferencesEvent; FOnContextInitialized : TOnContextInitializedEvent; FOnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent; FOnScheduleMessagePumpWork : TOnScheduleMessagePumpWorkEvent; @@ -266,7 +270,9 @@ type procedure SetFrameworkDirPath(const aValue : ustring); procedure SetResourcesDirPath(const aValue : ustring); procedure SetLocalesDirPath(const aValue : ustring); + {$IFDEF MSWINDOWS} procedure SetOsmodalLoop(aValue : boolean); + {$ENDIF} procedure SetKioskPrinting(aValue : boolean); function GetChromeVersion : ustring; @@ -297,6 +303,7 @@ type function LoadCEFlibrary : boolean; virtual; function Load_cef_api_hash_h : boolean; function Load_cef_app_capi_h : boolean; + function Load_cef_app_win_h : boolean; function Load_cef_browser_capi_h : boolean; function Load_cef_command_line_capi_h : boolean; function Load_cef_cookie_capi_h : boolean; @@ -310,6 +317,7 @@ type function Load_cef_origin_whitelist_capi_h : boolean; function Load_cef_parser_capi_h : boolean; function Load_cef_path_util_capi_h : boolean; + function Load_cef_preference_capi_h : boolean; function Load_cef_print_settings_capi_h : boolean; function Load_cef_process_message_capi_h : boolean; function Load_cef_process_util_capi_h : boolean; @@ -397,6 +405,7 @@ type // ICefLoadHandler should use them. procedure Internal_OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine); procedure Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef); + procedure Internal_OnRegisterCustomPreferences(type_: TCefPreferencesType; const registrar: TCefPreferenceRegistrarRef); procedure Internal_OnContextInitialized; virtual; procedure Internal_OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); procedure Internal_OnScheduleMessagePumpWork(const delayMs: Int64); @@ -510,7 +519,9 @@ type // Properties used during the CEF initialization property WindowsSandboxInfo : Pointer read FWindowsSandboxInfo write FWindowsSandboxInfo; + {$IFDEF MSWINDOWS} property EnableHighDPISupport : boolean read FEnableHighDPISupport write FEnableHighDPISupport; + {$ENDIF} {$IFDEF LINUX} property argcCopy : longint read GetArgc; property argvCopy : PPAnsiChar read GetArgv; @@ -542,7 +553,9 @@ type property MustCreateBrowserProcessHandler : boolean read GetMustCreateBrowserProcessHandler write FMustCreateBrowserProcessHandler; property MustCreateRenderProcessHandler : boolean read GetMustCreateRenderProcessHandler write FMustCreateRenderProcessHandler; property MustCreateLoadHandler : boolean read GetMustCreateLoadHandler write FMustCreateLoadHandler; + {$IFDEF MSWINDOWS} property OsmodalLoop : boolean write SetOsmodalLoop; + {$ENDIF} property Status : TCefAplicationStatus read FStatus; property MissingLibFiles : string read FMissingLibFiles; property MustFreeLibrary : boolean read FMustFreeLibrary write FMustFreeLibrary; @@ -563,6 +576,7 @@ type property OnRegCustomSchemes : TOnRegisterCustomSchemesEvent read FOnRegisterCustomSchemes write FOnRegisterCustomSchemes; // ICefBrowserProcessHandler + property OnRegisterCustomPreferences : TOnRegisterCustomPreferencesEvent read FOnRegisterCustomPreferences write FOnRegisterCustomPreferences; property OnContextInitialized : TOnContextInitializedEvent read FOnContextInitialized write FOnContextInitialized; property OnBeforeChildProcessLaunch : TOnBeforeChildProcessLaunchEvent read FOnBeforeChildProcessLaunch write FOnBeforeChildProcessLaunch; property OnScheduleMessagePumpWork : TOnScheduleMessagePumpWorkEvent read FOnScheduleMessagePumpWork write FOnScheduleMessagePumpWork; @@ -758,7 +772,9 @@ begin // Fields used during the CEF initialization FWindowsSandboxInfo := nil; + {$IFDEF MSWINDOWS} FEnableHighDPISupport := False; + {$ENDIF} {$IFDEF LINUX} FArgCopy := TCEFArgCopy.Create; {$ENDIF} @@ -816,6 +832,7 @@ begin FOnRegisterCustomSchemes := nil; // ICefBrowserProcessHandler + FOnRegisterCustomPreferences := nil; FOnContextInitialized := nil; FOnBeforeChildProcessLaunch := nil; FOnScheduleMessagePumpWork := nil; @@ -1287,10 +1304,12 @@ begin cef_quit_message_loop(); end; +{$IFDEF MSWINDOWS} procedure TCefApplicationCore.SetOsmodalLoop(aValue : boolean); begin if (FStatus = asInitialized) then cef_set_osmodal_loop(Ord(aValue)); end; +{$ENDIF} procedure TCefApplicationCore.SetKioskPrinting(aValue : boolean); begin @@ -2210,6 +2229,13 @@ begin FOnRegisterCustomSchemes(registrar); end; +procedure TCefApplicationCore.Internal_OnRegisterCustomPreferences( type_ : TCefPreferencesType; + const registrar : TCefPreferenceRegistrarRef); +begin + if assigned(FOnRegisterCustomPreferences) then + FOnRegisterCustomPreferences(type_, registrar); +end; + function TCefApplicationCore.GetMustCreateResourceBundleHandler : boolean; begin Result := ((FSingleProcess or (FProcessType in [ptBrowser, ptRenderer, ptZygote])) and @@ -2519,6 +2545,7 @@ begin if Load_cef_api_hash_h and Load_cef_app_capi_h and + Load_cef_app_win_h and Load_cef_browser_capi_h and Load_cef_command_line_capi_h and Load_cef_cookie_capi_h and @@ -2532,6 +2559,7 @@ begin Load_cef_origin_whitelist_capi_h and Load_cef_parser_capi_h and Load_cef_path_util_capi_h and + Load_cef_preference_capi_h and Load_cef_print_settings_capi_h and Load_cef_process_message_capi_h and Load_cef_process_util_capi_h and @@ -2575,8 +2603,11 @@ begin FLibLoaded := True; Result := True; - if FLogProcessInfo then CefDebugLog('Process started', CEF_LOG_SEVERITY_INFO); + if FLogProcessInfo then CefDebugLog('Process started', CEF_LOG_SEVERITY_INFO); + + {$IFDEF MSWINDOWS} if FEnableHighDPISupport then cef_enable_highdpi_support(); + {$ENDIF} end else begin @@ -2607,17 +2638,26 @@ begin {$IFDEF FPC}Pointer({$ENDIF}cef_do_message_loop_work{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_do_message_loop_work'); {$IFDEF FPC}Pointer({$ENDIF}cef_run_message_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_run_message_loop'); {$IFDEF FPC}Pointer({$ENDIF}cef_quit_message_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_quit_message_loop'); - {$IFDEF FPC}Pointer({$ENDIF}cef_set_osmodal_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_set_osmodal_loop'); - {$IFDEF FPC}Pointer({$ENDIF}cef_enable_highdpi_support{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_enable_highdpi_support'); Result := assigned(cef_initialize) and assigned(cef_shutdown) and assigned(cef_execute_process) and assigned(cef_do_message_loop_work) and assigned(cef_run_message_loop) and - assigned(cef_quit_message_loop) and - assigned(cef_set_osmodal_loop) and - assigned(cef_enable_highdpi_support); + assigned(cef_quit_message_loop); +end; + +function TCefApplicationCore.Load_cef_app_win_h : boolean; +begin + {$IFDEF MSWINDOWS} + {$IFDEF FPC}Pointer({$ENDIF}cef_set_osmodal_loop{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_set_osmodal_loop'); + {$IFDEF FPC}Pointer({$ENDIF}cef_enable_highdpi_support{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_enable_highdpi_support'); + + Result := assigned(cef_set_osmodal_loop) and + assigned(cef_enable_highdpi_support); + {$ELSE} + Result := True; + {$ENDIF} end; function TCefApplicationCore.Load_cef_browser_capi_h : boolean; @@ -2723,6 +2763,7 @@ end; function TCefApplicationCore.Load_cef_parser_capi_h : boolean; begin + {$IFDEF FPC}Pointer({$ENDIF}cef_resolve_url{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_resolve_url'); {$IFDEF FPC}Pointer({$ENDIF}cef_parse_url{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_parse_url'); {$IFDEF FPC}Pointer({$ENDIF}cef_create_url{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_create_url'); {$IFDEF FPC}Pointer({$ENDIF}cef_format_url_for_security_display{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_format_url_for_security_display'); @@ -2737,7 +2778,8 @@ begin {$IFDEF FPC}Pointer({$ENDIF}cef_parse_jsonand_return_error{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_parse_jsonand_return_error'); {$IFDEF FPC}Pointer({$ENDIF}cef_write_json{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_write_json'); - Result := assigned(cef_parse_url) and + Result := assigned(cef_resolve_url) and + assigned(cef_parse_url) and assigned(cef_create_url) and assigned(cef_format_url_for_security_display) and assigned(cef_get_mime_type) and @@ -2759,6 +2801,13 @@ begin Result := assigned(cef_get_path); end; +function TCefApplicationCore.Load_cef_preference_capi_h : boolean; +begin + {$IFDEF FPC}Pointer({$ENDIF}cef_preference_manager_get_global{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_preference_manager_get_global'); + + Result := assigned(cef_preference_manager_get_global); +end; + function TCefApplicationCore.Load_cef_print_settings_capi_h : boolean; begin {$IFDEF FPC}Pointer({$ENDIF}cef_print_settings_create{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_print_settings_create'); @@ -2918,6 +2967,7 @@ begin {$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_array{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_array'); {$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_array_buffer{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_array_buffer'); {$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_function{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_function'); + {$IFDEF FPC}Pointer({$ENDIF}cef_v8value_create_promise{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8value_create_promise'); {$IFDEF FPC}Pointer({$ENDIF}cef_v8stack_trace_get_current{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_v8stack_trace_get_current'); {$IFDEF FPC}Pointer({$ENDIF}cef_register_extension{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_register_extension'); @@ -2936,6 +2986,7 @@ begin assigned(cef_v8value_create_array) and assigned(cef_v8value_create_array_buffer) and assigned(cef_v8value_create_function) and + assigned(cef_v8value_create_promise) and assigned(cef_v8stack_trace_get_current) and assigned(cef_register_extension); end; @@ -3153,6 +3204,8 @@ begin {$IFDEF FPC}Pointer({$ENDIF}cef_display_get_alls{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_get_alls'); {$IFDEF FPC}Pointer({$ENDIF}cef_display_convert_screen_point_to_pixels{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_convert_screen_point_to_pixels'); {$IFDEF FPC}Pointer({$ENDIF}cef_display_convert_screen_point_from_pixels{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_convert_screen_point_from_pixels'); + {$IFDEF FPC}Pointer({$ENDIF}cef_display_convert_screen_rect_to_pixels{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_convert_screen_rect_to_pixels'); + {$IFDEF FPC}Pointer({$ENDIF}cef_display_convert_screen_rect_from_pixels{$IFDEF FPC}){$ENDIF} := GetProcAddress(FLibHandle, 'cef_display_convert_screen_rect_from_pixels'); Result := assigned(cef_display_get_primary) and assigned(cef_display_get_nearest_point) and @@ -3160,7 +3213,9 @@ begin assigned(cef_display_get_count) and assigned(cef_display_get_alls) and assigned(cef_display_convert_screen_point_to_pixels) and - assigned(cef_display_convert_screen_point_from_pixels); + assigned(cef_display_convert_screen_point_from_pixels) and + assigned(cef_display_convert_screen_rect_to_pixels) and + assigned(cef_display_convert_screen_rect_from_pixels); end; function TCefApplicationCore.Load_cef_label_button_capi_h : boolean; diff --git a/source/uCEFApplicationEvents.pas b/source/uCEFApplicationEvents.pas new file mode 100644 index 00000000..6184f6e5 --- /dev/null +++ b/source/uCEFApplicationEvents.pas @@ -0,0 +1,88 @@ +// ************************************************************************ +// ***************************** 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 uCEFApplicationEvents; + +{$IFDEF FPC} + {$MODE OBJFPC}{$H+} +{$ENDIF} + +{$I cef.inc} + +{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF} +{$MINENUMSIZE 4} + +interface + +uses + uCEFTypes, uCEFInterfaces, uCEFSchemeRegistrar, uCEFPreferenceRegistrar; + +type + // ICefApp + TOnRegisterCustomSchemesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const registrar: TCefSchemeRegistrarRef) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + + // ICefBrowserProcessHandler + TOnRegisterCustomPreferencesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(type_: TCefPreferencesType; const registrar: TCefPreferenceRegistrarRef) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnContextInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; + TOnBeforeChildProcessLaunchEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const commandLine: ICefCommandLine) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnScheduleMessagePumpWorkEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const delayMs: Int64) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; + TOnGetDefaultClientEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(var aClient : ICefClient) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; + + // ICefResourceBundleHandler + TOnGetLocalizedStringEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(stringId: Integer; out stringVal: ustring; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnGetDataResourceEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnGetDataResourceForScaleEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; scaleFactor: TCefScaleFactor; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + + // ICefRenderProcessHandler + TOnWebKitInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnBrowserCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const extra_info: ICefDictionaryValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnBrowserDestroyedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnContextCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnContextReleasedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnUncaughtExceptionEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnFocusedNodeChangedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnProcessMessageReceivedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; var aHandled : boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF LCL} of object {$ENDIF} {$ENDIF}; + + // ICefLoadHandler + TOnRenderLoadingStateChange = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadStart = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadEnd = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + TOnRenderLoadError = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; + +implementation + +end. diff --git a/source/uCEFBrowserProcessHandler.pas b/source/uCEFBrowserProcessHandler.pas index 7d3e2388..1fe9ae06 100644 --- a/source/uCEFBrowserProcessHandler.pas +++ b/source/uCEFBrowserProcessHandler.pas @@ -54,11 +54,12 @@ uses {$ELSE} Classes, {$ENDIF} - uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFApplicationCore; + uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFApplicationCore, uCEFPreferenceRegistrar; type TCefBrowserProcessHandlerOwn = class(TCefBaseRefCountedOwn, ICefBrowserProcessHandler) protected + procedure OnRegisterCustomPreferences(type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); virtual; abstract; procedure OnContextInitialized; virtual; abstract; procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual; abstract; procedure OnScheduleMessagePumpWork(const delayMs: Int64); virtual; abstract; @@ -74,6 +75,7 @@ type protected FCefApp : TCefApplicationCore; + procedure OnRegisterCustomPreferences(type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); override; procedure OnContextInitialized; override; procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); override; procedure OnScheduleMessagePumpWork(const delayMs: Int64); override; @@ -96,6 +98,18 @@ uses {$ENDIF} uCEFMiscFunctions, uCEFLibFunctions, uCEFCommandLine, uCEFListValue, uCEFConstants, uCEFStringList; +procedure cef_browser_process_handler_on_register_custom_preferences(self: PCefBrowserProcessHandler; type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); stdcall; +var + TempObject : TObject; +begin + TempObject := CefGetObject(self); + + // We have to wrap registrar inside TCefBrowserProcessHandlerOwn.OnRegisterCustomPreferences to avoid a circular reference + if (TempObject <> nil) and + (TempObject is TCefBrowserProcessHandlerOwn) then + TCefBrowserProcessHandlerOwn(TempObject).OnRegisterCustomPreferences(type_, registrar); +end; + procedure cef_browser_process_handler_on_context_initialized(self: PCefBrowserProcessHandler); stdcall; var TempObject : TObject; @@ -156,6 +170,7 @@ begin with PCefBrowserProcessHandler(FData)^ do begin + on_register_custom_preferences := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_on_register_custom_preferences; on_context_initialized := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_on_context_initialized; on_before_child_process_launch := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_on_before_child_process_launch; on_schedule_message_pump_work := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_on_schedule_message_pump_work; @@ -190,6 +205,29 @@ begin FCefApp := nil; end; +procedure TCefCustomBrowserProcessHandler.OnRegisterCustomPreferences(type_ : TCefPreferencesType; + registrar : PCefPreferenceRegistrar); +var + TempRegistrar : TCefPreferenceRegistrarRef; +begin + TempRegistrar := nil; + + try + try + if (FCefApp <> nil) then + begin + TempRegistrar := TCefPreferenceRegistrarRef.Create(registrar); + FCefApp.Internal_OnRegisterCustomPreferences(type_, TempRegistrar); + end; + except + on e : exception do + if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnRegisterCustomPreferences', e) then raise; + end; + finally + if (TempRegistrar <> nil) then FreeAndNil(TempRegistrar); + end; +end; + procedure TCefCustomBrowserProcessHandler.OnContextInitialized; begin try diff --git a/source/uCEFChromiumCore.pas b/source/uCEFChromiumCore.pas index 53db6f09..aeb3d6c3 100644 --- a/source/uCEFChromiumCore.pas +++ b/source/uCEFChromiumCore.pas @@ -460,8 +460,6 @@ type procedure InitializeEvents; procedure InitializeSettings(var aSettings : TCefBrowserSettings); - procedure GetPrintPDFSettings(var aSettings : TCefPdfPrintSettings; const aTitle, aURL : ustring); - function UpdateProxyPrefs(const aBrowser: ICefBrowser) : boolean; function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; aValue : boolean) : boolean; overload; function UpdatePreference(const aBrowser: ICefBrowser; const aName : ustring; aValue : integer) : boolean; overload; @@ -817,7 +815,7 @@ type procedure StopFinding(aClearSelection : Boolean); procedure Print; - procedure PrintToPDF(const aFilePath, aTitle, aURL : ustring); + procedure PrintToPDF(const aFilePath : ustring); procedure ClipboardCopy; procedure ClipboardPaste; @@ -2301,14 +2299,14 @@ begin end; // The TChromiumCore.OnPdfPrintFinished event will be triggered when the PDF file is created. -procedure TChromiumCore.PrintToPDF(const aFilePath, aTitle, aURL : ustring); +procedure TChromiumCore.PrintToPDF(const aFilePath : ustring); var TempSettings : TCefPdfPrintSettings; TempCallback : ICefPdfPrintCallback; begin - if Initialized then + if Initialized and (FPDFPrintOptions <> nil) then begin - GetPrintPDFSettings(TempSettings, aTitle, aURL); + FPDFPrintOptions.CopyToSettings(TempSettings); TempCallback := TCefCustomPDFPrintCallBack.Create(self); Browser.Host.PrintToPdf(aFilePath, @TempSettings, TempCallback); end; @@ -2405,27 +2403,6 @@ begin end; end; -procedure TChromiumCore.GetPrintPDFSettings(var aSettings : TCefPdfPrintSettings; const aTitle, aURL : ustring); -begin - if (FPDFPrintOptions <> nil) then - begin - aSettings.header_footer_title := CefString(aTitle); - aSettings.header_footer_url := CefString(aURL); - aSettings.page_width := FPDFPrintOptions.page_width; - aSettings.page_height := FPDFPrintOptions.page_height; - aSettings.scale_factor := FPDFPrintOptions.scale_factor; - aSettings.margin_top := FPDFPrintOptions.margin_top; - aSettings.margin_right := FPDFPrintOptions.margin_right; - aSettings.margin_bottom := FPDFPrintOptions.margin_bottom; - aSettings.margin_left := FPDFPrintOptions.margin_left; - aSettings.margin_type := FPDFPrintOptions.margin_type; - aSettings.header_footer_enabled := Ord(FPDFPrintOptions.header_footer_enabled); - aSettings.selection_only := Ord(FPDFPrintOptions.selection_only); - aSettings.landscape := Ord(FPDFPrintOptions.landscape); - aSettings.backgrounds_enabled := Ord(FPDFPrintOptions.backgrounds_enabled); - end; -end; - procedure TChromiumCore.GetSettings(var aSettings : TCefBrowserSettings); begin if (FFontOptions <> nil) and (FOptions <> nil) then diff --git a/source/uCEFConstants.pas b/source/uCEFConstants.pas index 7e514a6e..ae442424 100644 --- a/source/uCEFConstants.pas +++ b/source/uCEFConstants.pas @@ -672,7 +672,7 @@ const 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; + CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 shl 19; // /include/cef_api_hash.h (used as "cef_api_hash" parameters) CEF_API_HASH_PLATFORM = 0; diff --git a/source/uCEFDisplay.pas b/source/uCEFDisplay.pas index 0b3fecad..37d9c231 100644 --- a/source/uCEFDisplay.pas +++ b/source/uCEFDisplay.pas @@ -76,6 +76,8 @@ type class function GetAlls(var aDisplayArray : TCefDisplayArray) : boolean; class function ScreenPointToPixels(const aScreenPoint : TPoint) : TPoint; class function ScreenPointFromPixels(const aPixelsPoint : TPoint) : TPoint; + class function ScreenRectToPixels(const aScreenRect : TRect) : TRect; + class function ScreenRectFromPixels(const aPixelsRect : TRect) : TRect; end; implementation @@ -208,10 +210,7 @@ begin Result.Y := TempPixelsPt.y; end else - begin - Result.X := aScreenPoint.X; - Result.X := aScreenPoint.Y; - end; + Result := aScreenPoint; end; class function TCefDisplayRef.ScreenPointFromPixels(const aPixelsPoint : TPoint) : TPoint; @@ -227,10 +226,43 @@ begin Result.Y := TempScreenPt.y; end else + Result := aPixelsPoint; +end; + +class function TCefDisplayRef.ScreenRectToPixels(const aScreenRect : TRect) : TRect; +var + TempScreenRc, TempPixelsRc : TCefRect; +begin + if assigned(GlobalCEFApp) and GlobalCEFApp.LibLoaded then begin - Result.X := aPixelsPoint.X; - Result.X := aPixelsPoint.Y; - end; + TempScreenRc.x := aScreenRect.Left; + TempScreenRc.y := aScreenRect.Top; + TempPixelsRc := cef_display_convert_screen_rect_to_pixels(@TempScreenRc); + Result.Left := TempPixelsRc.x; + Result.Top := TempPixelsRc.y; + Result.Right := TempPixelsRc.Width - 1; + Result.Bottom := TempPixelsRc.Height - 1; + end + else + Result := aScreenRect; +end; + +class function TCefDisplayRef.ScreenRectFromPixels(const aPixelsRect : TRect) : TRect; +var + TempScreenRc, TempPixelsRc : TCefRect; +begin + if assigned(GlobalCEFApp) and GlobalCEFApp.LibLoaded then + begin + TempPixelsRc.x := aPixelsRect.Left; + TempPixelsRc.y := aPixelsRect.Top; + TempScreenRc := cef_display_convert_screen_rect_from_pixels(@TempPixelsRc); + Result.Left := TempScreenRc.x; + Result.Top := TempScreenRc.y; + Result.Right := TempScreenRc.Width - 1; + Result.Bottom := TempScreenRc.Height - 1; + end + else + Result := aPixelsRect; end; end. diff --git a/source/uCEFInterfaces.pas b/source/uCEFInterfaces.pas index d8207f8d..4a5ba3b5 100644 --- a/source/uCEFInterfaces.pas +++ b/source/uCEFInterfaces.pas @@ -199,36 +199,6 @@ type TCefMediaSourceInfoArray = array of TCefMediaSourceInfo; - - // ******************************************* - // ***************** Events ****************** - // ******************************************* - - TOnRegisterCustomSchemesEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const registrar: TCefSchemeRegistrarRef) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnRenderThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnWebKitInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnBrowserCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const extra_info: ICefDictionaryValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnBrowserDestroyedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnContextCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnContextReleasedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnUncaughtExceptionEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const context: ICefv8Context; const exception: ICefV8Exception; const stackTrace: ICefV8StackTrace) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnFocusedNodeChangedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; const node: ICefDomNode) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnProcessMessageReceivedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message: ICefProcessMessage; var aHandled : boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF LCL} of object {$ENDIF} {$ENDIF}; - TOnContextInitializedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure() {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; - TOnBeforeChildProcessLaunchEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const commandLine: ICefCommandLine) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnRenderProcessThreadCreatedEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const extraInfo: ICefListValue) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnScheduleMessagePumpWorkEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const delayMs: Int64) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; - TOnGetDefaultClientEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(var aClient : ICefClient) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC} of object{$ENDIF}{$ENDIF}; - TOnGetDataResourceEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnGetLocalizedStringEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(stringId: Integer; out stringVal: ustring; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnGetDataResourceForScaleEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(resourceId: Integer; scaleFactor: TCefScaleFactor; out data: Pointer; out dataSize: NativeUInt; var aResult : Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnRenderLoadStart = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; transitionType: TCefTransitionType) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnRenderLoadEnd = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; httpStatusCode: Integer) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnRenderLoadError = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const frame: ICefFrame; errorCode: TCefErrorCode; const errorText, failedUrl: ustring) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - TOnRenderLoadingStateChange = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF}; - - - // ******************************************* // **** Callback procedures and functions **** // ******************************************* @@ -1124,6 +1094,7 @@ type function IsArray: Boolean; function IsArrayBuffer: Boolean; function IsFunction: Boolean; + function IsPromise: Boolean; function IsSame(const that: ICefv8Value): Boolean; function GetBoolValue: Boolean; function GetIntValue: Integer; @@ -1158,6 +1129,8 @@ type function GetFunctionHandler: ICefv8Handler; function ExecuteFunction(const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; function ExecuteFunctionWithContext(const context: ICefv8Context; const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; + function ResolvePromise(const arg: ICefv8Value): boolean; + function RejectPromise(const errorMsg: ustring): boolean; end; // TCefV8StackFrame @@ -1486,6 +1459,7 @@ type // /include/capi/cef_browser_process_handler_capi.h (cef_browser_process_handler_t) ICefBrowserProcessHandler = interface(ICefBaseRefCounted) ['{27291B7A-C0AE-4EE0-9115-15C810E22F6C}'] + procedure OnRegisterCustomPreferences(type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); procedure OnContextInitialized; procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); procedure OnScheduleMessagePumpWork(const delayMs: Int64); @@ -2258,9 +2232,21 @@ type procedure OnResolveCompleted(result: TCefErrorCode; const resolvedIps: TStrings); end; + // TCefPreferenceManager + // /include/capi/cef_preference_capi.h (cef_preference_manager_t) + // /include/capi/cef_preference_manager_capi.h (cef_preference_manager_t) + ICefPreferenceManager = interface(ICefBaseRefCounted) + ['{E8231D35-D028-4E64-BFDB-7E4596027DEC}'] + function HasPreference(const name: ustring): Boolean; + function GetPreference(const name: ustring): ICefValue; + function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; + function CanSetPreference(const name: ustring): Boolean; + function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; + end; + // TCefRequestContext // /include/capi/cef_request_context_capi.h (cef_request_context_t) - ICefRequestContext = interface(ICefBaseRefCounted) + ICefRequestContext = interface(ICefPreferenceManager) ['{5830847A-2971-4BD5-ABE6-21451F8923F7}'] function IsSame(const other: ICefRequestContext): Boolean; function IsSharingWith(const other: ICefRequestContext): Boolean; @@ -2271,11 +2257,6 @@ type function GetCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; function ClearSchemeHandlerFactories: Boolean; - function HasPreference(const name: ustring): Boolean; - function GetPreference(const name: ustring): ICefValue; - function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; - function CanSetPreference(const name: ustring): Boolean; - function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; procedure ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure ClearHttpAuthCredentials(const callback: ICefCompletionCallback); procedure CloseAllConnections(const callback: ICefCompletionCallback); @@ -3038,36 +3019,40 @@ type // /include/capi/views/cef_window_delegate_capi.h (cef_window_delegate_t) ICefWindowDelegate = interface(ICefPanelDelegate) ['{52D4EE2C-303B-42B6-A35F-30D03834A23F}'] - procedure OnWindowCreated(const window: ICefWindow); - procedure OnWindowDestroyed(const window: ICefWindow); - procedure OnWindowActivationChanged(const window: ICefWindow; active: boolean); - procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); - procedure OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); - procedure OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); - procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean); - procedure OnCanResize(const window: ICefWindow; var aResult : boolean); - procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean); - procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean); - procedure OnCanClose(const window: ICefWindow; var aResult : boolean); - procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); - procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); + procedure OnWindowCreated(const window_: ICefWindow); + procedure OnWindowClosing(const window_: ICefWindow); + procedure OnWindowDestroyed(const window_: ICefWindow); + procedure OnWindowActivationChanged(const window_: ICefWindow; active: boolean); + procedure OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); + procedure OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); + procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); + procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); + procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); + procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); + procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); + procedure OnCanClose(const window_: ICefWindow; var aResult : boolean); + procedure OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); + procedure OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); end; ICefWindowDelegateEvents = interface(ICefPanelDelegateEvents) ['{05C19A41-E75D-459E-AD4D-C8A0CA4A49D3}'] - procedure doOnWindowCreated(const window: ICefWindow); - procedure doOnWindowDestroyed(const window: ICefWindow); - procedure doOnWindowActivationChanged(const window: ICefWindow; active: boolean); - procedure doOnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); - procedure doOnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); - procedure doOnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); - procedure doOnIsFrameless(const window: ICefWindow; var aResult : boolean); - procedure doOnCanResize(const window: ICefWindow; var aResult : boolean); - procedure doOnCanMaximize(const window: ICefWindow; var aResult : boolean); - procedure doOnCanMinimize(const window: ICefWindow; var aResult : boolean); - procedure doOnCanClose(const window: ICefWindow; var aResult : boolean); - procedure doOnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); - procedure doOnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); + procedure doOnWindowCreated(const window_: ICefWindow); + procedure doOnWindowClosing(const window_: ICefWindow); + procedure doOnWindowDestroyed(const window_: ICefWindow); + procedure doOnWindowActivationChanged(const window_: ICefWindow; active: boolean); + procedure doOnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); + procedure doOnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); + procedure doOnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); + procedure doOnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); + procedure doOnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure doOnCanResize(const window_: ICefWindow; var aResult : boolean); + procedure doOnCanMaximize(const window_: ICefWindow; var aResult : boolean); + procedure doOnCanMinimize(const window_: ICefWindow; var aResult : boolean); + procedure doOnCanClose(const window_: ICefWindow; var aResult : boolean); + procedure doOnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); + procedure doOnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); end; implementation diff --git a/source/uCEFLibFunctions.pas b/source/uCEFLibFunctions.pas index 8f9c4755..ef2a9432 100644 --- a/source/uCEFLibFunctions.pas +++ b/source/uCEFLibFunctions.pas @@ -80,8 +80,6 @@ var cef_do_message_loop_work : procedure; cdecl; cef_run_message_loop : procedure; cdecl; cef_quit_message_loop : procedure; cdecl; - cef_set_osmodal_loop : procedure(osModalLoop: Integer); cdecl; - cef_enable_highdpi_support : procedure; cdecl; // /include/capi/cef_browser_capi.h cef_browser_host_create_browser : function(const windowInfo: PCefWindowInfo; client: PCefClient; const url: PCefString; const settings: PCefBrowserSettings; extra_info: PCefDictionaryValue; request_context: PCefRequestContext): Integer; cdecl; @@ -129,6 +127,7 @@ var cef_clear_cross_origin_whitelist : function : Integer; cdecl; // /include/capi/cef_parser_capi.h + cef_resolve_url : function(const base_url, relative_url: PCefString; resolved_url: PCefString): Integer; cdecl; cef_parse_url : function(const url: PCefString; var parts: TCefUrlParts): Integer; cdecl; cef_create_url : function(const parts: PCefUrlParts; url: PCefString): Integer; cdecl; cef_format_url_for_security_display : function(const origin_url: PCefString): PCefStringUserFree; cdecl; @@ -146,6 +145,9 @@ var // /include/capi/cef_path_util_capi.h cef_get_path : function(key: TCefPathKey; path: PCefString): Integer; cdecl; + // /include/capi/cef_preference_capi.h + cef_preference_manager_get_global : function : PCefPreferenceManager; cdecl; + // /include/capi/cef_print_settings_capi.h cef_print_settings_create : function : PCefPrintSettings; cdecl; @@ -225,6 +227,7 @@ var cef_v8value_create_array : function(length: Integer): PCefv8Value; cdecl; cef_v8value_create_array_buffer : function(buffer : Pointer; length: NativeUInt; release_callback : PCefv8ArrayBufferReleaseCallback): PCefv8Value; cdecl; cef_v8value_create_function : function(const name: PCefString; handler: PCefv8Handler): PCefv8Value; cdecl; + cef_v8value_create_promise : function : PCefv8Value; cdecl; cef_v8stack_trace_get_current : function(frame_limit: Integer): PCefV8StackTrace; cdecl; cef_register_extension : function(const extension_name, javascript_code: PCefString; handler: PCefv8Handler): Integer; cdecl; @@ -261,6 +264,8 @@ var cef_display_get_alls : procedure(displaysCount: PNativeUInt; displays: PPCefDisplay); cdecl; cef_display_convert_screen_point_to_pixels : function(const point: PCefPoint): TCefPoint; cdecl; cef_display_convert_screen_point_from_pixels : function(const point: PCefPoint): TCefPoint; cdecl; + cef_display_convert_screen_rect_to_pixels : function(const rect: PCefRect): TCefRect; cdecl; + cef_display_convert_screen_rect_from_pixels : function(const rect: PCefRect): TCefRect; cdecl; // /include/capi/views/cef_label_button_capi.h cef_label_button_create : function(delegate: PCefButtonDelegate; const text: PCefString): PCefLabelButton; cdecl; @@ -286,6 +291,10 @@ var // *********** INTERNAL ************ // ********************************* + // /include/internal/cef_app_win.h + cef_set_osmodal_loop : procedure(osModalLoop: Integer); cdecl; + cef_enable_highdpi_support : procedure; cdecl; + // /include/internal/cef_logging_internal.h cef_get_min_log_level : function : Integer; cdecl; cef_get_vlog_level : function(const file_start: PAnsiChar; N: NativeInt): Integer; cdecl; diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas index 5b30e662..c67de98d 100644 --- a/source/uCEFMiscFunctions.pas +++ b/source/uCEFMiscFunctions.pas @@ -244,6 +244,7 @@ function FileVersionInfoToString(const aVersionInfo : TFileVersionInfo) : string function CheckFilesExist(var aList : TStringList; var aMissingFiles : string) : boolean; function Is32BitProcess : boolean; +function CefResolveUrl(const base_url, relative_url: ustring): ustring; function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; function CefCreateUrl(var parts: TUrlParts): ustring; function CefFormatUrlForSecurityDisplay(const originUrl: string): string; @@ -1778,6 +1779,24 @@ begin {$ENDIF} end; +function CefResolveUrl(const base_url, relative_url: ustring): ustring; +var + TempBaseURL, TempRelativeURL, TempResolvedURL : TCefString; +begin + Result := ''; + + if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then + begin + TempBaseURL := CefString(base_url); + TempRelativeURL := CefString(relative_url); + + CefStringInitialize(@TempResolvedURL); + + if (cef_resolve_url(@TempBaseURL, @TempRelativeURL, @TempResolvedURL) <> 0) then + Result := CefStringClearAndGet(@TempResolvedURL); + end; +end; + function CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; var TempURL : TCefString; diff --git a/source/uCEFPDFPrintOptions.pas b/source/uCEFPDFPrintOptions.pas index 5333b67f..bcdc8c64 100644 --- a/source/uCEFPDFPrintOptions.pas +++ b/source/uCEFPDFPrintOptions.pas @@ -57,55 +57,222 @@ uses uCEFTypes; type - TPDFPrintOptions = class(TPersistent) + TPDFPrintOptions = class protected - Fpage_width : integer; - Fpage_height : Integer; - Fscale_factor : integer; - Fmargin_top : integer; - Fmargin_right : integer; - Fmargin_bottom : integer; - Fmargin_left : integer; - Fmargin_type : TCefPdfPrintMarginType; - Fheader_footer_enabled : boolean; - Fselection_only : boolean; - Flandscape : boolean; - Fbackgrounds_enabled : boolean; + FLandscape : boolean; + FPrintBackground : boolean; + FScale : double; + FPaperWidth : double; + FPaperHeight : double; + FPreferCSSPageSize : boolean; + FMarginType : TCefPdfPrintMarginType; + FMarginTop : double; + FMarginRight : double; + FMarginBottom : double; + FMarginLeft : double; + FPageRanges : ustring; + FDisplayHeaderFooter : boolean; + FHeaderTemplate : ustring; + FFooterTemplate : ustring; + + function GetScalePct: double; + function GetPaperWidthMM: double; + function GetPaperHeightMM: double; + function GetMarginTopMM: double; + function GetMarginRightMM: double; + function GetMarginBottomMM: double; + function GetMarginLeftMM: double; + + procedure SetScalePct(const aValue: double); + procedure SetPaperWidthMM(const aValue: double); + procedure SetPaperHeightMM(const aValue: double); + procedure SetMarginTopMM(const aValue: double); + procedure SetMarginRightMM(const aValue: double); + procedure SetMarginBottomMM(const aValue: double); + procedure SetMarginLeftMM(const aValue: double); + + function InchesToMM(const aInches: double): double; + function MMToInches(const aMM: double): double; public constructor Create; virtual; + procedure CopyToSettings(var aSettings : TCefPdfPrintSettings); - published - property page_width : integer read Fpage_width write Fpage_width default 0; - property page_height : integer read Fpage_height write Fpage_height default 0; - property scale_factor : integer read Fscale_factor write Fscale_factor default 0; - property margin_top : integer read Fmargin_top write Fmargin_top; - property margin_right : integer read Fmargin_right write Fmargin_right; - property margin_bottom : integer read Fmargin_bottom write Fmargin_bottom; - property margin_left : integer read Fmargin_left write Fmargin_left; - property margin_type : TCefPdfPrintMarginType read Fmargin_type write Fmargin_type default PDF_PRINT_MARGIN_DEFAULT; - property header_footer_enabled : boolean read Fheader_footer_enabled write Fheader_footer_enabled default False; - property selection_only : boolean read Fselection_only write Fselection_only default False; - property landscape : boolean read Flandscape write Flandscape default False; - property backgrounds_enabled : boolean read Fbackgrounds_enabled write Fbackgrounds_enabled default False; + property Landscape : boolean read FLandscape write FLandscape; + property PrintBackground : boolean read FPrintBackground write FPrintBackground; + property PreferCSSPageSize : boolean read FPreferCSSPageSize write FPreferCSSPageSize; + property PageRanges : ustring read FPageRanges write FPageRanges; + property DisplayHeaderFooter : boolean read FDisplayHeaderFooter write FDisplayHeaderFooter; + property HeaderTemplate : ustring read FHeaderTemplate write FHeaderTemplate; + property FooterTemplate : ustring read FFooterTemplate write FFooterTemplate; + + property Scale : double read FScale write FScale; + property ScalePct : double read GetScalePct write SetScalePct; + + property PaperWidthInch : double read FPaperWidth write FPaperWidth; + property PaperHeightInch : double read FPaperHeight write FPaperHeight; + property PaperWidthMM : double read GetPaperWidthMM write SetPaperWidthMM; + property PaperHeightMM : double read GetPaperHeightMM write SetPaperHeightMM; + + property MarginType : TCefPdfPrintMarginType read FMarginType write FMarginType; + property MarginTopInch : double read FMarginTop write FMarginTop; + property MarginRightInch : double read FMarginRight write FMarginRight; + property MarginBottomInch : double read FMarginBottom write FMarginBottom; + property MarginLeftInch : double read FMarginLeft write FMarginLeft; + property MarginTopMM : double read GetMarginTopMM write SetMarginTopMM; + property MarginRightMM : double read GetMarginRightMM write SetMarginRightMM; + property MarginBottomMM : double read GetMarginBottomMM write SetMarginBottomMM; + property MarginLeftMM : double read GetMarginLeftMM write SetMarginLeftMM; end; implementation +uses + uCEFMiscFunctions; + +const + MM_IN_ONE_INCH = 25.4; + constructor TPDFPrintOptions.Create; begin - Fpage_width := 0; - Fpage_height := 0; - Fscale_factor := 100; - Fmargin_top := 0; - Fmargin_right := 0; - Fmargin_bottom := 0; - Fmargin_left := 0; - Fmargin_type := PDF_PRINT_MARGIN_DEFAULT; - Fheader_footer_enabled := False; - Fselection_only := False; - Flandscape := False; - Fbackgrounds_enabled := False; + FLandscape := False; + FPrintBackground := False; + FScale := 0; + FPaperWidth := 0; + FPaperHeight := 0; + FPreferCSSPageSize := False; + FMarginType := PDF_PRINT_MARGIN_DEFAULT; + FMarginTop := 0; + FMarginRight := 0; + FMarginBottom := 0; + FMarginLeft := 0; + FPageRanges := ''; + FDisplayHeaderFooter := False; + FHeaderTemplate := ''; + FFooterTemplate := ''; +end; + +function TPDFPrintOptions.InchesToMM(const aInches: double): double; +begin + Result := aInches * MM_IN_ONE_INCH; +end; + +function TPDFPrintOptions.MMToInches(const aMM: double): double; +begin + Result := aMM / MM_IN_ONE_INCH; +end; + +function TPDFPrintOptions.GetScalePct: double; +begin + if (FScale <= 0) then + Result := 100 + else + Result := FScale * 100; +end; + +function TPDFPrintOptions.GetPaperWidthMM: double; +begin + Result := InchesToMM(FPaperWidth); +end; + +function TPDFPrintOptions.GetPaperHeightMM: double; +begin + Result := InchesToMM(FPaperHeight); +end; + +function TPDFPrintOptions.GetMarginTopMM: double; +begin + Result := InchesToMM(FMarginTop); +end; + +function TPDFPrintOptions.GetMarginRightMM: double; +begin + Result := InchesToMM(FMarginRight); +end; + +function TPDFPrintOptions.GetMarginBottomMM: double; +begin + Result := InchesToMM(FMarginBottom); +end; + +function TPDFPrintOptions.GetMarginLeftMM: double; +begin + Result := InchesToMM(FMarginLeft); +end; + +procedure TPDFPrintOptions.SetScalePct(const aValue: double); +begin + if (aValue <= 0) then + FScale := 0 + else + FScale := aValue / 100; +end; + +procedure TPDFPrintOptions.SetPaperWidthMM(const aValue: double); +begin + if (aValue <= 0) then + FPaperWidth := 0 + else + FPaperWidth := MMToInches(aValue); +end; + +procedure TPDFPrintOptions.SetPaperHeightMM(const aValue: double); +begin + if (aValue <= 0) then + FPaperHeight := 0 + else + FPaperHeight := MMToInches(aValue); +end; + +procedure TPDFPrintOptions.SetMarginTopMM(const aValue: double); +begin + if (aValue <= 0) then + FMarginTop := 0 + else + FMarginTop := MMToInches(aValue); +end; + +procedure TPDFPrintOptions.SetMarginRightMM(const aValue: double); +begin + if (aValue <= 0) then + FMarginRight := 0 + else + FMarginRight := MMToInches(aValue); +end; + +procedure TPDFPrintOptions.SetMarginBottomMM(const aValue: double); +begin + if (aValue <= 0) then + FMarginBottom := 0 + else + FMarginBottom := MMToInches(aValue); +end; + +procedure TPDFPrintOptions.SetMarginLeftMM(const aValue: double); +begin + if (aValue <= 0) then + FMarginLeft := 0 + else + FMarginLeft := MMToInches(aValue); +end; + +procedure TPDFPrintOptions.CopyToSettings(var aSettings : TCefPdfPrintSettings); +begin + aSettings.landscape := Ord(FLandscape); + aSettings.print_background := Ord(FPrintBackground); + aSettings.scale := FScale; + aSettings.paper_width := FPaperWidth; + aSettings.paper_height := FPaperHeight; + aSettings.prefer_css_page_size := Ord(FPreferCSSPageSize); + aSettings.margin_type := FMarginType; + aSettings.margin_top := FMarginTop; + aSettings.margin_right := FMarginRight; + aSettings.margin_bottom := FMarginBottom; + aSettings.margin_left := FMarginLeft; + aSettings.page_ranges := CefString(FPageRanges); + aSettings.display_header_footer := Ord(FDisplayHeaderFooter); + aSettings.header_template := CefString(FHeaderTemplate); + aSettings.footer_template := CefString(FFooterTemplate); end; end. diff --git a/source/uCEFPreferenceManager.pas b/source/uCEFPreferenceManager.pas new file mode 100644 index 00000000..4a9ec571 --- /dev/null +++ b/source/uCEFPreferenceManager.pas @@ -0,0 +1,132 @@ +// ************************************************************************ +// ***************************** 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 uCEFPreferenceManager; + +{$IFDEF FPC} + {$MODE OBJFPC}{$H+} +{$ENDIF} + +{$I cef.inc} + +{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF} +{$MINENUMSIZE 4} + +interface + +uses + {$IFDEF DELPHI16_UP} + System.Classes, System.SysUtils, + {$ELSE} + Classes, SysUtils, + {$ENDIF} + uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes; + +type + TCefPreferenceManagerRef = class(TCefBaseRefCountedRef, ICefPreferenceManager) + protected + function HasPreference(const name: ustring): Boolean; + function GetPreference(const name: ustring): ICefValue; + function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; + function CanSetPreference(const name: ustring): Boolean; + function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; + public + class function UnWrap(data: Pointer): ICefPreferenceManager; + class function Global: ICefPreferenceManager; + end; + +implementation + +uses + uCEFLibFunctions, uCEFMiscFunctions, uCEFValue, uCEFDictionaryValue; + +class function TCefPreferenceManagerRef.UnWrap(data: Pointer): ICefPreferenceManager; +begin + if (data <> nil) then + Result := Create(data) as ICefPreferenceManager + else + Result := nil; +end; + +class function TCefPreferenceManagerRef.Global: ICefPreferenceManager; +begin + Result := UnWrap(cef_preference_manager_get_global()); +end; + +function TCefPreferenceManagerRef.HasPreference(const name: ustring): Boolean; +var + TempName : TCefString; +begin + TempName := CefString(name); + Result := PCefPreferenceManager(FData)^.has_preference(PCefPreferenceManager(FData), @TempName) <> 0; +end; + +function TCefPreferenceManagerRef.GetPreference(const name: ustring): ICefValue; +var + TempName : TCefString; +begin + TempName := CefString(name); + Result := TCefValueRef.UnWrap(PCefPreferenceManager(FData)^.get_preference(PCefPreferenceManager(FData), @TempName)); +end; + +function TCefPreferenceManagerRef.GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; +begin + Result := TCefDictionaryValueRef.UnWrap(PCefPreferenceManager(FData)^.get_all_preferences(PCefPreferenceManager(FData), Ord(includeDefaults))); +end; + +function TCefPreferenceManagerRef.CanSetPreference(const name: ustring): Boolean; +var + TempName : TCefString; +begin + TempName := CefString(name); + Result := PCefPreferenceManager(FData)^.can_set_preference(PCefPreferenceManager(FData), @TempName) <> 0; +end; + +function TCefPreferenceManagerRef.SetPreference(const name : ustring; + const value : ICefValue; + out error : ustring): Boolean; +var + TempName, TempError : TCefString; +begin + CefStringInitialize(@TempError); + + TempName := CefString(name); + Result := PCefPreferenceManager(FData)^.set_preference(PCefPreferenceManager(FData), @TempName, CefGetData(value), @TempError) <> 0; + error := CefStringClearAndGet(@TempError); +end; + +end. diff --git a/source/uCEFPreferenceRegistrar.pas b/source/uCEFPreferenceRegistrar.pas new file mode 100644 index 00000000..2d9fae10 --- /dev/null +++ b/source/uCEFPreferenceRegistrar.pas @@ -0,0 +1,76 @@ +// ************************************************************************ +// ***************************** 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 uCEFPreferenceRegistrar; + +{$IFDEF FPC} + {$MODE OBJFPC}{$H+} +{$ENDIF} + +{$I cef.inc} + +{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF} +{$MINENUMSIZE 4} + +interface + +uses + uCEFBaseScopedWrapper, uCEFTypes, uCEFInterfaces; + +type + TCefPreferenceRegistrarRef = class(TCEFBaseScopedWrapperRef) + public + function AddPreference(const name: ustring; const default_value: ICefValue): Boolean; + end; + +implementation + +uses + uCEFMiscFunctions; + +function TCefPreferenceRegistrarRef.AddPreference(const name : ustring; + const default_value : ICefValue): Boolean; +var + TempName : TCefString; +begin + TempName := CefString(name); + Result := PCefPreferenceRegistrar(FData)^.add_preference(PCefPreferenceRegistrar(FData), + @TempName, + CefGetData(default_value)) <> 0; +end; + +end. diff --git a/source/uCEFRequestContext.pas b/source/uCEFRequestContext.pas index 74acf5e6..ee95d93d 100644 --- a/source/uCEFRequestContext.pas +++ b/source/uCEFRequestContext.pas @@ -54,10 +54,10 @@ uses {$ELSE} Classes, SysUtils, {$ENDIF} - uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFCompletionCallback; + uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes, uCEFCompletionCallback, uCEFPreferenceManager; type - TCefRequestContextRef = class(TCefBaseRefCountedRef, ICefRequestContext) + TCefRequestContextRef = class(TCefPreferenceManagerRef, ICefRequestContext) protected function IsSame(const other: ICefRequestContext): Boolean; function IsSharingWith(const other: ICefRequestContext): Boolean; @@ -68,11 +68,6 @@ type function GetCookieManagerProc(const callback: TCefCompletionCallbackProc): ICefCookieManager; function RegisterSchemeHandlerFactory(const schemeName, domainName: ustring; const factory: ICefSchemeHandlerFactory): Boolean; function ClearSchemeHandlerFactories: Boolean; - function HasPreference(const name: ustring): Boolean; - function GetPreference(const name: ustring): ICefValue; - function GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; - function CanSetPreference(const name: ustring): Boolean; - function SetPreference(const name: ustring; const value: ICefValue; out error: ustring): Boolean; procedure ClearCertificateExceptions(const callback: ICefCompletionCallback); procedure ClearHttpAuthCredentials(const callback: ICefCompletionCallback); procedure CloseAllConnections(const callback: ICefCompletionCallback); @@ -85,8 +80,8 @@ type function GetMediaRouter(const callback: ICefCompletionCallback): ICefMediaRouter; public - class function UnWrap(data: Pointer): ICefRequestContext; - class function Global: ICefRequestContext; + class function UnWrap(data: Pointer): ICefRequestContext; reintroduce; + class function Global: ICefRequestContext; reintroduce; class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload; class function New(const aCache, aAcceptLanguageList, aCookieableSchemesList : ustring; aCookieableSchemesExcludeDefaults, aPersistSessionCookies, aPersistUserPreferences : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload; class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext; @@ -110,9 +105,8 @@ type implementation uses - uCEFMiscFunctions, uCEFLibFunctions, uCEFValue, uCEFDictionaryValue, - uCEFCookieManager, uCEFRequestContextHandler, uCEFExtension, uCEFStringList, - uCEFMediaRouter; + uCEFMiscFunctions, uCEFLibFunctions, uCEFCookieManager, uCEFRequestContextHandler, + uCEFExtension, uCEFStringList, uCEFMediaRouter; function TCefRequestContextRef.ClearSchemeHandlerFactories: Boolean; begin @@ -193,48 +187,6 @@ begin Result := UnWrap(cef_request_context_create_context(@TempSettings, CefGetData(handler))); end; -function TCefRequestContextRef.HasPreference(const name: ustring): Boolean; -var - TempName : TCefString; -begin - TempName := CefString(name); - Result := PCefRequestContext(FData)^.has_preference(PCefRequestContext(FData), @TempName) <> 0; -end; - -function TCefRequestContextRef.GetPreference(const name: ustring): ICefValue; -var - TempName : TCefString; -begin - TempName := CefString(name); - Result := TCefValueRef.UnWrap(PCefRequestContext(FData)^.get_preference(PCefRequestContext(FData), @TempName)); -end; - -function TCefRequestContextRef.GetAllPreferences(includeDefaults: Boolean): ICefDictionaryValue; -begin - Result := TCefDictionaryValueRef.UnWrap(PCefRequestContext(FData)^.get_all_preferences(PCefRequestContext(FData), Ord(includeDefaults))); -end; - -function TCefRequestContextRef.CanSetPreference(const name: ustring): Boolean; -var - TempName : TCefString; -begin - TempName := CefString(name); - Result := PCefRequestContext(FData)^.can_set_preference(PCefRequestContext(FData), @TempName) <> 0; -end; - -function TCefRequestContextRef.SetPreference(const name : ustring; - const value : ICefValue; - out error : ustring): Boolean; -var - TempName, TempError : TCefString; -begin - CefStringInitialize(@TempError); - - TempName := CefString(name); - Result := PCefRequestContext(FData)^.set_preference(PCefRequestContext(FData), @TempName, CefGetData(value), @TempError) <> 0; - error := CefStringClearAndGet(@TempError); -end; - procedure TCefRequestContextRef.ClearCertificateExceptions(const callback: ICefCompletionCallback); begin PCefRequestContext(FData)^.clear_certificate_exceptions(PCefRequestContext(FData), CefGetData(callback)); diff --git a/source/uCEFTypes.pas b/source/uCEFTypes.pas index 7f59a80d..be5361a4 100644 --- a/source/uCEFTypes.pas +++ b/source/uCEFTypes.pas @@ -69,6 +69,8 @@ type PCefValue = ^TCefValue; PCefBinaryValue = ^TCefBinaryValue; PCefSchemeRegistrar = ^TCefSchemeRegistrar; + PCefPreferenceRegistrar = ^TCefPreferenceRegistrar; + PCefPreferenceManager = ^TCefPreferenceManager; PCefCommandLine = ^TCefCommandLine; PCefCommandHandler = ^TCefCommandHandler; PCefBaseRefCounted = ^TCefBaseRefCounted; @@ -1053,7 +1055,6 @@ type TCefPdfPrintMarginType = ( PDF_PRINT_MARGIN_DEFAULT, PDF_PRINT_MARGIN_NONE, - PDF_PRINT_MARGIN_MINIMUM, PDF_PRINT_MARGIN_CUSTOM ); @@ -1169,6 +1170,12 @@ type CEF_PERMISSION_RESULT_IGNORE ); + // /include/internal/cef_types.h (cef_preferences_type_t) + TCefPreferencesType = ( + CEF_PREFERENCES_TYPE_GLOBAL, + CEF_PREFERENCES_TYPE_REQUEST_CONTEXT + ); + // /include/internal/cef_types.h (cef_test_cert_type_t) TCefTestCertType = ( CEF_TEST_CERT_OK_IP, @@ -1417,20 +1424,21 @@ type // /include/internal/cef_types.h (cef_pdf_print_settings_t) TCefPdfPrintSettings = record - header_footer_title : TCefString; - header_footer_url : TCefString; - page_width : Integer; - page_height : Integer; - scale_factor : Integer; - margin_top : Integer; - margin_right : Integer; - margin_bottom : Integer; - margin_left : Integer; - margin_type : TCefPdfPrintMarginType; - header_footer_enabled : Integer; - selection_only : Integer; landscape : Integer; - backgrounds_enabled : Integer; + print_background : Integer; + scale : double; + paper_width : double; + paper_height : double; + prefer_css_page_size : Integer; + margin_type : TCefPdfPrintMarginType; + margin_top : double; + margin_right : double; + margin_bottom : double; + margin_left : double; + page_ranges : TCefString; + display_header_footer : Integer; + header_template : TCefString; + footer_template : TCefString; end; // /include/internal/cef_types.h (cef_mouse_event_t) @@ -1792,6 +1800,23 @@ type on_virtual_keyboard_requested : procedure(self: PCefRenderHandler; browser: PCefBrowser; input_mode: TCefTextInpuMode); stdcall; end; + // /include/capi/cef_preference_capi.h (cef_preference_registrar_t) + TCefPreferenceRegistrar = record + base : TCefBaseScoped; + add_preference : function(self: PCefPreferenceRegistrar; const name: PCefString; default_value: PCefValue): Integer; stdcall; + end; + + // /include/capi/cef_preference_capi.h (cef_preference_manager_t) + // /include/capi/cef_preference_manager_capi.h (cef_preference_manager_t) + TCefPreferenceManager = record + base : TCefBaseRefCounted; + has_preference : function(self: PCefPreferenceManager; const name: PCefString): Integer; stdcall; + get_preference : function(self: PCefPreferenceManager; const name: PCefString): PCefValue; stdcall; + get_all_preferences : function(self: PCefPreferenceManager; include_defaults: Integer): PCefDictionaryValue; stdcall; + can_set_preference : function(self: PCefPreferenceManager; const name: PCefString): Integer; stdcall; + set_preference : function(self: PCefPreferenceManager; const name: PCefString; value: PCefValue; error: PCefString): Integer; stdcall; + end; + // /include/capi/cef_v8_capi.h (cef_v8stack_trace_t) TCefV8StackTrace = record base : TCefBaseRefCounted; @@ -2147,7 +2172,7 @@ type // /include/capi/cef_request_context_capi.h (cef_request_context_t) TCefRequestContext = record - base : TCefBaseRefCounted; + base : TCefPreferenceManager; is_same : function(self, other: PCefRequestContext): Integer; stdcall; is_sharing_with : function(self, other: PCefRequestContext): Integer; stdcall; is_global : function(self: PCefRequestContext): Integer; stdcall; @@ -2156,11 +2181,6 @@ type get_cookie_manager : function(self: PCefRequestContext; callback: PCefCompletionCallback): PCefCookieManager; stdcall; register_scheme_handler_factory : function(self: PCefRequestContext; const scheme_name, domain_name: PCefString; factory: PCefSchemeHandlerFactory): Integer; stdcall; clear_scheme_handler_factories : function(self: PCefRequestContext): Integer; stdcall; - has_preference : function(self: PCefRequestContext; const name: PCefString): Integer; stdcall; - get_preference : function(self: PCefRequestContext; const name: PCefString): PCefValue; stdcall; - get_all_preferences : function(self: PCefRequestContext; include_defaults: Integer): PCefDictionaryValue; stdcall; - can_set_preference : function(self: PCefRequestContext; const name: PCefString): Integer; stdcall; - set_preference : function(self: PCefRequestContext; const name: PCefString; value: PCefValue; error: PCefString): Integer; stdcall; clear_certificate_exceptions : procedure(self: PCefRequestContext; callback: PCefCompletionCallback); stdcall; clear_http_auth_credentials : procedure(self: PCefRequestContext; callback: PCefCompletionCallback); stdcall; close_all_connections : procedure(self: PCefRequestContext; callback: PCefCompletionCallback); stdcall; @@ -2793,6 +2813,7 @@ type is_array : function(self: PCefv8Value): Integer; stdcall; is_array_buffer : function(self: PCefv8Value): Integer; stdcall; is_function : function(self: PCefv8Value): Integer; stdcall; + is_promise : function(self: PCefv8Value): Integer; stdcall; is_same : function(self, that: PCefv8Value): Integer; stdcall; get_bool_value : function(self: PCefv8Value): Integer; stdcall; get_int_value : function(self: PCefv8Value): Integer; stdcall; @@ -2827,6 +2848,8 @@ type get_function_handler : function(self: PCefv8Value): PCefv8Handler; stdcall; execute_function : function(self: PCefv8Value; obj: PCefv8Value; argumentsCount: NativeUInt; const arguments: PPCefV8Value): PCefv8Value; stdcall; execute_function_with_context : function(self: PCefv8Value; context: PCefv8Context; obj: PCefv8Value; argumentsCount: NativeUInt; const arguments: PPCefV8Value): PCefv8Value; stdcall; + resolve_promise : function(self, arg: PCefv8Value): Integer; stdcall; + reject_promise : function(self: PCefv8Value; const errorMsg: PCefString): Integer; stdcall; end; // /include/capi/cef_v8_capi.h (cef_v8context_t) @@ -3050,6 +3073,7 @@ type // /include/capi/cef_browser_process_handler_capi.h (cef_browser_process_handler_t) TCefBrowserProcessHandler = record base : TCefBaseRefCounted; + on_register_custom_preferences : procedure(self: PCefBrowserProcessHandler; type_: TCefPreferencesType; registrar: PCefPreferenceRegistrar); stdcall; on_context_initialized : procedure(self: PCefBrowserProcessHandler); stdcall; on_before_child_process_launch : procedure(self: PCefBrowserProcessHandler; command_line: PCefCommandLine); stdcall; on_schedule_message_pump_work : procedure(self: PCefBrowserProcessHandler; delay_ms: Int64); stdcall; @@ -3455,8 +3479,10 @@ type TCefWindowDelegate = record base : TCefPanelDelegate; on_window_created : procedure(self: PCefWindowDelegate; window: PCefWindow); stdcall; + on_window_closing : procedure(self: PCefWindowDelegate; window: PCefWindow); stdcall; on_window_destroyed : procedure(self: PCefWindowDelegate; window: PCefWindow); stdcall; on_window_activation_changed : procedure(self: PCefWindowDelegate; window: PCefWindow; active: integer); stdcall; + on_window_bounds_changed : procedure(self: PCefWindowDelegate; window: PCefWindow; const new_bounds: PCefRect); stdcall; get_parent_window : function(self: PCefWindowDelegate; window: PCefWindow; is_menu, can_activate_menu: PInteger): PCefWindow; stdcall; get_initial_bounds : function(self: PCefWindowDelegate; window: PCefWindow): TCefRect; stdcall; get_initial_show_state : function(self: PCefWindowDelegate; window: PCefWindow): TCefShowState; stdcall; diff --git a/source/uCEFViewsFrameworkEvents.pas b/source/uCEFViewsFrameworkEvents.pas index dffc6ebf..29c48c9d 100644 --- a/source/uCEFViewsFrameworkEvents.pas +++ b/source/uCEFViewsFrameworkEvents.pas @@ -90,19 +90,21 @@ type TOnMenuButtonPressedEvent = procedure(const Sender: TObject; const menu_button: ICefMenuButton; const screen_point: TCefPoint; const button_pressed_lock: ICefMenuButtonPressedLock) of object; // ICefWindowDelegate - TOnWindowCreatedEvent = procedure(const Sender: TObject; const window: ICefWindow) of object; - TOnWindowDestroyedEvent = procedure(const Sender: TObject; const window: ICefWindow) of object; - TOnWindowActivationChangedEvent = procedure(const Sender: TObject; const window: ICefWindow; active: boolean) of object; - TOnGetParentWindowEvent = procedure(const Sender: TObject; const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow) of object; - TOnGetInitialBoundsEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : TCefRect) of object; - TOnGetInitialShowStateEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : TCefShowState) of object; - TOnIsFramelessEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : boolean) of object; - TOnCanResizeEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : boolean) of object; - TOnCanMaximizeEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : boolean) of object; - TOnCanMinimizeEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : boolean) of object; - TOnCanCloseEvent = procedure(const Sender: TObject; const window: ICefWindow; var aResult : boolean) of object; - TOnAcceleratorEvent = procedure(const Sender: TObject; const window: ICefWindow; command_id: Integer; var aResult : boolean) of object; - TOnWindowKeyEventEvent = procedure(const Sender: TObject; const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean) of object; + TOnWindowCreatedEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; + TOnWindowClosingEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; + TOnWindowDestroyedEvent = procedure(const Sender: TObject; const window_: ICefWindow) of object; + TOnWindowActivationChangedEvent = procedure(const Sender: TObject; const window_: ICefWindow; active: boolean) of object; + TOnWindowBoundsChangedEvent = procedure(const Sender: TObject; const window_: ICefWindow; const new_bounds: TCefRect) of object; + TOnGetParentWindowEvent = procedure(const Sender: TObject; const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow) of object; + TOnGetInitialBoundsEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : TCefRect) of object; + TOnGetInitialShowStateEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : TCefShowState) of object; + TOnIsFramelessEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanResizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanMaximizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanMinimizeEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnCanCloseEvent = procedure(const Sender: TObject; const window_: ICefWindow; var aResult : boolean) of object; + TOnAcceleratorEvent = procedure(const Sender: TObject; const window_: ICefWindow; command_id: Integer; var aResult : boolean) of object; + TOnWindowKeyEventEvent = procedure(const Sender: TObject; const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean) of object; implementation diff --git a/source/uCEFWindowComponent.pas b/source/uCEFWindowComponent.pas index 915d7992..39a3c2d7 100644 --- a/source/uCEFWindowComponent.pas +++ b/source/uCEFWindowComponent.pas @@ -68,8 +68,10 @@ type // ICefWindowDelegateEvents FOnWindowCreated : TOnWindowCreatedEvent; + FOnWindowClosing : TOnWindowClosingEvent; FOnWindowDestroyed : TOnWindowDestroyedEvent; FOnWindowActivationChanged : TOnWindowActivationChangedEvent; + FOnWindowBoundsChanged : TOnWindowBoundsChangedEvent; FOnGetParentWindow : TOnGetParentWindowEvent; FOnGetInitialBounds : TOnGetInitialBoundsEvent; FOnGetInitialShowState : TOnGetInitialShowStateEvent; @@ -109,8 +111,10 @@ type // ICefWindowDelegateEvents procedure doOnWindowCreated(const window_: ICefWindow); + procedure doOnWindowClosing(const window_: ICefWindow); procedure doOnWindowDestroyed(const window_: ICefWindow); procedure doOnWindowActivationChanged(const window_: ICefWindow; active: boolean); + procedure doOnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); procedure doOnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); procedure doOnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); procedure doOnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); @@ -163,8 +167,10 @@ type published property OnWindowCreated : TOnWindowCreatedEvent read FOnWindowCreated write FOnWindowCreated; + property OnWindowClosing : TOnWindowClosingEvent read FOnWindowClosing write FOnWindowClosing; property OnWindowDestroyed : TOnWindowDestroyedEvent read FOnWindowDestroyed write FOnWindowDestroyed; property OnWindowActivationChanged : TOnWindowActivationChangedEvent read FOnWindowActivationChanged write FOnWindowActivationChanged; + property OnWindowBoundsChanged : TOnWindowBoundsChangedEvent read FOnWindowBoundsChanged write FOnWindowBoundsChanged; property OnGetParentWindow : TOnGetParentWindowEvent read FOnGetParentWindow write FOnGetParentWindow; property OnGetInitialBounds : TOnGetInitialBoundsEvent read FOnGetInitialBounds write FOnGetInitialBounds; property OnGetInitialShowState : TOnGetInitialShowStateEvent read FOnGetInitialShowState write FOnGetInitialShowState; @@ -220,8 +226,10 @@ begin FWindow := nil; FWindowDlg := nil; FOnWindowCreated := nil; + FOnWindowClosing := nil; FOnWindowDestroyed := nil; FOnWindowActivationChanged := nil; + FOnWindowBoundsChanged := nil; FOnGetParentWindow := nil; FOnGetInitialBounds := nil; FOnGetInitialShowState := nil; @@ -296,6 +304,12 @@ begin FOnWindowCreated(self, window_); end; +procedure TCEFWindowComponent.doOnWindowClosing(const window_: ICefWindow); +begin + if assigned(FOnWindowClosing) then + FOnWindowClosing(self, window_); +end; + procedure TCEFWindowComponent.doOnWindowDestroyed(const window_: ICefWindow); begin if assigned(FOnWindowDestroyed) then @@ -310,6 +324,12 @@ begin FOnWindowActivationChanged(self, window_, active); end; +procedure TCEFWindowComponent.doOnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); +begin + if assigned(FOnWindowBoundsChanged) then + FOnWindowBoundsChanged(self, window_, new_bounds); +end; + procedure TCEFWindowComponent.doOnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); begin if assigned(FOnGetParentWindow) then diff --git a/source/uCEFWindowDelegate.pas b/source/uCEFWindowDelegate.pas index f9e98c66..5f442e18 100644 --- a/source/uCEFWindowDelegate.pas +++ b/source/uCEFWindowDelegate.pas @@ -59,19 +59,21 @@ uses type TCefWindowDelegateRef = class(TCefPanelDelegateRef, ICefWindowDelegate) protected - procedure OnWindowCreated(const window: ICefWindow); - procedure OnWindowDestroyed(const window: ICefWindow); - procedure OnWindowActivationChanged(const window: ICefWindow; active: boolean); - procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); - procedure OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); - procedure OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); - procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean); - procedure OnCanResize(const window: ICefWindow; var aResult : boolean); - procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean); - procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean); - procedure OnCanClose(const window: ICefWindow; var aResult : boolean); - procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); - procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); + procedure OnWindowCreated(const window_: ICefWindow); + procedure OnWindowClosing(const window_: ICefWindow); + procedure OnWindowDestroyed(const window_: ICefWindow); + procedure OnWindowActivationChanged(const window_: ICefWindow; active: boolean); + procedure OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); + procedure OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); + procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); + procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); + procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); + procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); + procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); + procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); + procedure OnCanClose(const window_: ICefWindow; var aResult : boolean); + procedure OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); + procedure OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); public class function UnWrap(data: Pointer): ICefWindowDelegate; @@ -79,19 +81,21 @@ type TCefWindowDelegateOwn = class(TCefPanelDelegateOwn, ICefWindowDelegate) protected - procedure OnWindowCreated(const window: ICefWindow); virtual; - procedure OnWindowDestroyed(const window: ICefWindow); virtual; - procedure OnWindowActivationChanged(const window: ICefWindow; active: boolean); virtual; - procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); virtual; - procedure OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); virtual; - procedure OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); virtual; - procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean); virtual; - procedure OnCanResize(const window: ICefWindow; var aResult : boolean); virtual; - procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean); virtual; - procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean); virtual; - procedure OnCanClose(const window: ICefWindow; var aResult : boolean); virtual; - procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); virtual; - procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); virtual; + procedure OnWindowCreated(const window_: ICefWindow); virtual; + procedure OnWindowClosing(const window_: ICefWindow); virtual; + procedure OnWindowDestroyed(const window_: ICefWindow); virtual; + procedure OnWindowActivationChanged(const window_: ICefWindow; active: boolean); virtual; + procedure OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); virtual; + procedure OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); virtual; + procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); virtual; + procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); virtual; + procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnCanClose(const window_: ICefWindow; var aResult : boolean); virtual; + procedure OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); virtual; + procedure OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); virtual; procedure InitializeCEFMethods; override; @@ -116,19 +120,21 @@ type procedure OnBlur(const view: ICefView); override; // ICefWindowDelegate - procedure OnWindowCreated(const window: ICefWindow); override; - procedure OnWindowDestroyed(const window: ICefWindow); override; - procedure OnWindowActivationChanged(const window: ICefWindow; active: boolean); override; - procedure OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); override; - procedure OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); override; - procedure OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); override; - procedure OnIsFrameless(const window: ICefWindow; var aResult : boolean); override; - procedure OnCanResize(const window: ICefWindow; var aResult : boolean); override; - procedure OnCanMaximize(const window: ICefWindow; var aResult : boolean); override; - procedure OnCanMinimize(const window: ICefWindow; var aResult : boolean); override; - procedure OnCanClose(const window: ICefWindow; var aResult : boolean); override; - procedure OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); override; - procedure OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); override; + procedure OnWindowCreated(const window_: ICefWindow); override; + procedure OnWindowClosing(const window_: ICefWindow); override; + procedure OnWindowDestroyed(const window_: ICefWindow); override; + procedure OnWindowActivationChanged(const window_: ICefWindow; active: boolean); override; + procedure OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); override; + procedure OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); override; + procedure OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); override; + procedure OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); override; + procedure OnIsFrameless(const window_: ICefWindow; var aResult : boolean); override; + procedure OnCanResize(const window_: ICefWindow; var aResult : boolean); override; + procedure OnCanMaximize(const window_: ICefWindow; var aResult : boolean); override; + procedure OnCanMinimize(const window_: ICefWindow; var aResult : boolean); override; + procedure OnCanClose(const window_: ICefWindow; var aResult : boolean); override; + procedure OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); override; + procedure OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); override; public constructor Create(const events: ICefWindowDelegateEvents); reintroduce; @@ -144,22 +150,32 @@ uses // ******************* TCefWindowDelegateRef ******************** // ************************************************************** -procedure TCefWindowDelegateRef.OnWindowCreated(const window: ICefWindow); +procedure TCefWindowDelegateRef.OnWindowCreated(const window_: ICefWindow); begin - PCefWindowDelegate(FData)^.on_window_created(PCefWindowDelegate(FData), CefGetData(window)); + PCefWindowDelegate(FData)^.on_window_created(PCefWindowDelegate(FData), CefGetData(window_)); end; -procedure TCefWindowDelegateRef.OnWindowDestroyed(const window: ICefWindow); +procedure TCefWindowDelegateRef.OnWindowClosing(const window_: ICefWindow); begin - PCefWindowDelegate(FData)^.on_window_destroyed(PCefWindowDelegate(FData), CefGetData(window)); + PCefWindowDelegate(FData)^.on_window_closing(PCefWindowDelegate(FData), CefGetData(window_)); end; -procedure TCefWindowDelegateRef.OnWindowActivationChanged(const window: ICefWindow; active: boolean); +procedure TCefWindowDelegateRef.OnWindowDestroyed(const window_: ICefWindow); begin - PCefWindowDelegate(FData)^.on_window_activation_changed(PCefWindowDelegate(FData), CefGetData(window), ord(active)); + PCefWindowDelegate(FData)^.on_window_destroyed(PCefWindowDelegate(FData), CefGetData(window_)); end; -procedure TCefWindowDelegateRef.OnGetParentWindow(const window : ICefWindow; +procedure TCefWindowDelegateRef.OnWindowActivationChanged(const window_: ICefWindow; active: boolean); +begin + PCefWindowDelegate(FData)^.on_window_activation_changed(PCefWindowDelegate(FData), CefGetData(window_), ord(active)); +end; + +procedure TCefWindowDelegateRef.OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); +begin + PCefWindowDelegate(FData)^.on_window_bounds_changed(PCefWindowDelegate(FData), CefGetData(window_), @new_bounds); +end; + +procedure TCefWindowDelegateRef.OnGetParentWindow(const window_ : ICefWindow; var is_menu : boolean; var can_activate_menu : boolean; var aResult : ICefWindow); @@ -169,56 +185,56 @@ begin TempIsMenu := ord(is_menu); TempCanActivateMenu := ord(can_activate_menu); aResult := TCefWindowRef.UnWrap(PCefWindowDelegate(FData)^.get_parent_window(PCefWindowDelegate(FData), - CefGetData(window), + CefGetData(window_), @TempIsMenu, @TempCanActivateMenu)); is_menu := TempIsMenu <> 0; can_activate_menu := TempCanActivateMenu <> 0; end; -procedure TCefWindowDelegateRef.OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); +procedure TCefWindowDelegateRef.OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); begin - aResult := PCefWindowDelegate(FData)^.get_initial_bounds(PCefWindowDelegate(FData), CefGetData(window)); + aResult := PCefWindowDelegate(FData)^.get_initial_bounds(PCefWindowDelegate(FData), CefGetData(window_)); end; -procedure TCefWindowDelegateRef.OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); +procedure TCefWindowDelegateRef.OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); begin - aResult := PCefWindowDelegate(FData)^.get_initial_show_state(PCefWindowDelegate(FData), CefGetData(window)); + aResult := PCefWindowDelegate(FData)^.get_initial_show_state(PCefWindowDelegate(FData), CefGetData(window_)); end; -procedure TCefWindowDelegateRef.OnIsFrameless(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateRef.OnIsFrameless(const window_: ICefWindow; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.is_frameless(PCefWindowDelegate(FData), CefGetData(window)) <> 0); + aResult := (PCefWindowDelegate(FData)^.is_frameless(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); end; -procedure TCefWindowDelegateRef.OnCanResize(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateRef.OnCanResize(const window_: ICefWindow; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.can_resize(PCefWindowDelegate(FData), CefGetData(window)) <> 0); + aResult := (PCefWindowDelegate(FData)^.can_resize(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); end; -procedure TCefWindowDelegateRef.OnCanMaximize(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateRef.OnCanMaximize(const window_: ICefWindow; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.can_maximize(PCefWindowDelegate(FData), CefGetData(window)) <> 0); + aResult := (PCefWindowDelegate(FData)^.can_maximize(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); end; -procedure TCefWindowDelegateRef.OnCanMinimize(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateRef.OnCanMinimize(const window_: ICefWindow; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.can_minimize(PCefWindowDelegate(FData), CefGetData(window)) <> 0); + aResult := (PCefWindowDelegate(FData)^.can_minimize(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); end; -procedure TCefWindowDelegateRef.OnCanClose(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateRef.OnCanClose(const window_: ICefWindow; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.can_close(PCefWindowDelegate(FData), CefGetData(window)) <> 0); + aResult := (PCefWindowDelegate(FData)^.can_close(PCefWindowDelegate(FData), CefGetData(window_)) <> 0); end; -procedure TCefWindowDelegateRef.OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); +procedure TCefWindowDelegateRef.OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.on_accelerator(PCefWindowDelegate(FData), CefGetData(window), command_id) <> 0); + aResult := (PCefWindowDelegate(FData)^.on_accelerator(PCefWindowDelegate(FData), CefGetData(window_), command_id) <> 0); end; -procedure TCefWindowDelegateRef.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); +procedure TCefWindowDelegateRef.OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); begin - aResult := (PCefWindowDelegate(FData)^.on_key_event(PCefWindowDelegate(FData), CefGetData(window), @event) <> 0); + aResult := (PCefWindowDelegate(FData)^.on_key_event(PCefWindowDelegate(FData), CefGetData(window_), @event) <> 0); end; class function TCefWindowDelegateRef.UnWrap(data: Pointer): ICefWindowDelegate; @@ -234,39 +250,39 @@ end; // ******************* TCefWindowDelegateOwn ******************** // ************************************************************** -procedure cef_window_delegate_on_window_created(self: PCefWindowDelegate; window: PCefWindow); stdcall; +procedure cef_window_delegate_on_window_created(self: PCefWindowDelegate; window_: PCefWindow); stdcall; var TempObject : TObject; begin TempObject := CefGetObject(self); if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnWindowCreated(TCefWindowRef.UnWrap(window)); + TCefWindowDelegateOwn(TempObject).OnWindowCreated(TCefWindowRef.UnWrap(window_)); end; -procedure cef_window_delegate_on_window_destroyed(self: PCefWindowDelegate; window: PCefWindow); stdcall; +procedure cef_window_delegate_on_window_destroyed(self: PCefWindowDelegate; window_: PCefWindow); stdcall; var TempObject : TObject; begin TempObject := CefGetObject(self); if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnWindowDestroyed(TCefWindowRef.UnWrap(window)); + TCefWindowDelegateOwn(TempObject).OnWindowDestroyed(TCefWindowRef.UnWrap(window_)); end; -procedure cef_window_delegate_on_window_activation_changed(self: PCefWindowDelegate; window: PCefWindow; active: integer); stdcall; +procedure cef_window_delegate_on_window_activation_changed(self: PCefWindowDelegate; window_: PCefWindow; active: integer); stdcall; var TempObject : TObject; begin TempObject := CefGetObject(self); if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnWindowActivationChanged(TCefWindowRef.UnWrap(window), + TCefWindowDelegateOwn(TempObject).OnWindowActivationChanged(TCefWindowRef.UnWrap(window_), active <> 0); end; function cef_window_delegate_get_parent_window(self : PCefWindowDelegate; - window : PCefWindow; + window_ : PCefWindow; is_menu : PInteger; can_activate_menu : PInteger): PCefWindow; stdcall; var @@ -282,7 +298,7 @@ begin TempIsMenu := (is_menu^ <> 0); TempCanActivateMenu := (can_activate_menu^ <> 0); - TCefWindowDelegateOwn(TempObject).OnGetParentWindow(TCefWindowRef.UnWrap(window), + TCefWindowDelegateOwn(TempObject).OnGetParentWindow(TCefWindowRef.UnWrap(window_), TempIsMenu, TempCanActivateMenu, TempWindow); @@ -293,7 +309,7 @@ begin Result := CefGetData(TempWindow); end; -function cef_window_delegate_get_initial_bounds(self: PCefWindowDelegate; window: PCefWindow): TCefRect; stdcall; +function cef_window_delegate_get_initial_bounds(self: PCefWindowDelegate; window_: PCefWindow): TCefRect; stdcall; var TempObject : TObject; TempRect : TCefRect; @@ -305,7 +321,7 @@ begin TempRect.height := 0; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnGetInitialBounds(TCefWindowRef.UnWrap(window), + TCefWindowDelegateOwn(TempObject).OnGetInitialBounds(TCefWindowRef.UnWrap(window_), TempRect); Result.x := TempRect.x; @@ -314,7 +330,7 @@ begin Result.height := TempRect.height; end; -function cef_window_delegate_get_initial_show_state(self: PCefWindowDelegate; window: PCefWindow): TCefShowState; stdcall; +function cef_window_delegate_get_initial_show_state(self: PCefWindowDelegate; window_: PCefWindow): TCefShowState; stdcall; var TempObject : TObject; begin @@ -322,11 +338,11 @@ begin Result := CEF_SHOW_STATE_NORMAL; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnGetInitialShowState(TCefWindowRef.UnWrap(window), + TCefWindowDelegateOwn(TempObject).OnGetInitialShowState(TCefWindowRef.UnWrap(window_), Result); end; -function cef_window_delegate_is_frameless(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; +function cef_window_delegate_is_frameless(self: PCefWindowDelegate; window_: PCefWindow): Integer; stdcall; var TempObject : TObject; TempIsFrameless : boolean; @@ -335,12 +351,12 @@ begin TempIsFrameless := False; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnIsFrameless(TCefWindowRef.UnWrap(window), TempIsFrameless); + TCefWindowDelegateOwn(TempObject).OnIsFrameless(TCefWindowRef.UnWrap(window_), TempIsFrameless); Result := ord(TempIsFrameless); end; -function cef_window_delegate_can_resize(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; +function cef_window_delegate_can_resize(self: PCefWindowDelegate; window_: PCefWindow): Integer; stdcall; var TempObject : TObject; TempCanResize : boolean; @@ -349,12 +365,12 @@ begin TempCanResize := True; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnCanResize(TCefWindowRef.UnWrap(window), TempCanResize); + TCefWindowDelegateOwn(TempObject).OnCanResize(TCefWindowRef.UnWrap(window_), TempCanResize); Result := ord(TempCanResize); end; -function cef_window_delegate_can_maximize(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; +function cef_window_delegate_can_maximize(self: PCefWindowDelegate; window_: PCefWindow): Integer; stdcall; var TempObject : TObject; TempCanMaximize : boolean; @@ -363,12 +379,12 @@ begin TempCanMaximize := True; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnCanMaximize(TCefWindowRef.UnWrap(window), TempCanMaximize); + TCefWindowDelegateOwn(TempObject).OnCanMaximize(TCefWindowRef.UnWrap(window_), TempCanMaximize); Result := ord(TempCanMaximize); end; -function cef_window_delegate_can_minimize(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; +function cef_window_delegate_can_minimize(self: PCefWindowDelegate; window_: PCefWindow): Integer; stdcall; var TempObject : TObject; TempCanMinimize : boolean; @@ -377,12 +393,12 @@ begin TempCanMinimize := True; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnCanMinimize(TCefWindowRef.UnWrap(window), TempCanMinimize); + TCefWindowDelegateOwn(TempObject).OnCanMinimize(TCefWindowRef.UnWrap(window_), TempCanMinimize); Result := ord(TempCanMinimize); end; -function cef_window_delegate_can_close(self: PCefWindowDelegate; window: PCefWindow): Integer; stdcall; +function cef_window_delegate_can_close(self: PCefWindowDelegate; window_: PCefWindow): Integer; stdcall; var TempObject : TObject; TempCanClose : boolean; @@ -391,13 +407,13 @@ begin TempCanClose := True; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnCanClose(TCefWindowRef.UnWrap(window), TempCanClose); + TCefWindowDelegateOwn(TempObject).OnCanClose(TCefWindowRef.UnWrap(window_), TempCanClose); Result := ord(TempCanClose); end; function cef_window_delegate_on_accelerator(self : PCefWindowDelegate; - window : PCefWindow; + window_ : PCefWindow; command_id : Integer): Integer; stdcall; var TempObject : TObject; @@ -407,13 +423,13 @@ begin TempResult := False; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnAccelerator(TCefWindowRef.UnWrap(window), command_id, TempResult); + TCefWindowDelegateOwn(TempObject).OnAccelerator(TCefWindowRef.UnWrap(window_), command_id, TempResult); Result := ord(TempResult); end; function cef_window_delegate_on_key_event( self : PCefWindowDelegate; - window : PCefWindow; + window_ : PCefWindow; const event : PCefKeyEvent): Integer; stdcall; var TempObject : TObject; @@ -423,7 +439,7 @@ begin TempResult := False; if (TempObject <> nil) and (TempObject is TCefWindowDelegateOwn) then - TCefWindowDelegateOwn(TempObject).OnKeyEvent(TCefWindowRef.UnWrap(window), event^, TempResult); + TCefWindowDelegateOwn(TempObject).OnKeyEvent(TCefWindowRef.UnWrap(window_), event^, TempResult); Result := ord(TempResult); end; @@ -457,67 +473,77 @@ begin end; end; -procedure TCefWindowDelegateOwn.OnWindowCreated(const window: ICefWindow); +procedure TCefWindowDelegateOwn.OnWindowCreated(const window_: ICefWindow); begin // end; -procedure TCefWindowDelegateOwn.OnWindowDestroyed(const window: ICefWindow); +procedure TCefWindowDelegateOwn.OnWindowClosing(const window_: ICefWindow); begin // end; -procedure TCefWindowDelegateOwn.OnWindowActivationChanged(const window: ICefWindow; active: boolean); +procedure TCefWindowDelegateOwn.OnWindowDestroyed(const window_: ICefWindow); begin // end; -procedure TCefWindowDelegateOwn.OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); +procedure TCefWindowDelegateOwn.OnWindowActivationChanged(const window_: ICefWindow; active: boolean); begin // end; -procedure TCefWindowDelegateOwn.OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); +procedure TCefWindowDelegateOwn.OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); begin // end; -procedure TCefWindowDelegateOwn.OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); +procedure TCefWindowDelegateOwn.OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); begin // end; -procedure TCefWindowDelegateOwn.OnIsFrameless(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); begin // end; -procedure TCefWindowDelegateOwn.OnCanResize(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); begin // end; -procedure TCefWindowDelegateOwn.OnCanMaximize(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnIsFrameless(const window_: ICefWindow; var aResult : boolean); begin // end; -procedure TCefWindowDelegateOwn.OnCanMinimize(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnCanResize(const window_: ICefWindow; var aResult : boolean); begin // end; -procedure TCefWindowDelegateOwn.OnCanClose(const window: ICefWindow; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnCanMaximize(const window_: ICefWindow; var aResult : boolean); begin // end; -procedure TCefWindowDelegateOwn.OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnCanMinimize(const window_: ICefWindow; var aResult : boolean); begin // end; -procedure TCefWindowDelegateOwn.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); +procedure TCefWindowDelegateOwn.OnCanClose(const window_: ICefWindow; var aResult : boolean); +begin + // +end; + +procedure TCefWindowDelegateOwn.OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); +begin + // +end; + +procedure TCefWindowDelegateOwn.OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); begin // end; @@ -644,143 +670,165 @@ begin end; end; -procedure TCustomWindowDelegate.OnWindowCreated(const window: ICefWindow); +procedure TCustomWindowDelegate.OnWindowCreated(const window_: ICefWindow); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnWindowCreated(window); + ICefWindowDelegateEvents(FEvents).doOnWindowCreated(window_); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnWindowCreated', e) then raise; end; end; -procedure TCustomWindowDelegate.OnWindowDestroyed(const window: ICefWindow); +procedure TCustomWindowDelegate.OnWindowClosing(const window_: ICefWindow); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnWindowDestroyed(window); + ICefWindowDelegateEvents(FEvents).doOnWindowClosing(window_); + except + on e : exception do + if CustomExceptionHandler('TCustomWindowDelegate.OnWindowClosing', e) then raise; + end; +end; + +procedure TCustomWindowDelegate.OnWindowDestroyed(const window_: ICefWindow); +begin + try + if (FEvents <> nil) then + ICefWindowDelegateEvents(FEvents).doOnWindowDestroyed(window_); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnWindowDestroyed', e) then raise; end; end; -procedure TCustomWindowDelegate.OnWindowActivationChanged(const window: ICefWindow; active: boolean); +procedure TCustomWindowDelegate.OnWindowActivationChanged(const window_: ICefWindow; active: boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnWindowActivationChanged(window, active); + ICefWindowDelegateEvents(FEvents).doOnWindowActivationChanged(window_, active); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnWindowActivationChanged', e) then raise; end; end; -procedure TCustomWindowDelegate.OnGetParentWindow(const window: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); +procedure TCustomWindowDelegate.OnWindowBoundsChanged(const window_: ICefWindow; const new_bounds: TCefRect); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnGetParentWindow(window, is_menu, can_activate_menu, aResult); + ICefWindowDelegateEvents(FEvents).doOnWindowBoundsChanged(window_, new_bounds); + except + on e : exception do + if CustomExceptionHandler('TCustomWindowDelegate.OnWindowBoundsChanged', e) then raise; + end; +end; + +procedure TCustomWindowDelegate.OnGetParentWindow(const window_: ICefWindow; var is_menu, can_activate_menu: boolean; var aResult : ICefWindow); +begin + try + if (FEvents <> nil) then + ICefWindowDelegateEvents(FEvents).doOnGetParentWindow(window_, is_menu, can_activate_menu, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnGetParentWindow', e) then raise; end; end; -procedure TCustomWindowDelegate.OnGetInitialBounds(const window: ICefWindow; var aResult : TCefRect); +procedure TCustomWindowDelegate.OnGetInitialBounds(const window_: ICefWindow; var aResult : TCefRect); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnGetInitialBounds(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnGetInitialBounds(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnGetInitialBounds', e) then raise; end; end; -procedure TCustomWindowDelegate.OnGetInitialShowState(const window: ICefWindow; var aResult : TCefShowState); +procedure TCustomWindowDelegate.OnGetInitialShowState(const window_: ICefWindow; var aResult : TCefShowState); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnGetInitialShowState(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnGetInitialShowState(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnGetInitialShowState', e) then raise; end; end; -procedure TCustomWindowDelegate.OnIsFrameless(const window: ICefWindow; var aResult : boolean); +procedure TCustomWindowDelegate.OnIsFrameless(const window_: ICefWindow; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnIsFrameless(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnIsFrameless(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnIsFrameless', e) then raise; end; end; -procedure TCustomWindowDelegate.OnCanResize(const window: ICefWindow; var aResult : boolean); +procedure TCustomWindowDelegate.OnCanResize(const window_: ICefWindow; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnCanResize(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnCanResize(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnCanResize', e) then raise; end; end; -procedure TCustomWindowDelegate.OnCanMaximize(const window: ICefWindow; var aResult : boolean); +procedure TCustomWindowDelegate.OnCanMaximize(const window_: ICefWindow; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnCanMaximize(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnCanMaximize(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnCanMaximize', e) then raise; end; end; -procedure TCustomWindowDelegate.OnCanMinimize(const window: ICefWindow; var aResult : boolean); +procedure TCustomWindowDelegate.OnCanMinimize(const window_: ICefWindow; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnCanMinimize(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnCanMinimize(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnCanMinimize', e) then raise; end; end; -procedure TCustomWindowDelegate.OnCanClose(const window: ICefWindow; var aResult : boolean); +procedure TCustomWindowDelegate.OnCanClose(const window_: ICefWindow; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnCanClose(window, aResult); + ICefWindowDelegateEvents(FEvents).doOnCanClose(window_, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnCanClose', e) then raise; end; end; -procedure TCustomWindowDelegate.OnAccelerator(const window: ICefWindow; command_id: Integer; var aResult : boolean); +procedure TCustomWindowDelegate.OnAccelerator(const window_: ICefWindow; command_id: Integer; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnAccelerator(window, command_id, aResult); + ICefWindowDelegateEvents(FEvents).doOnAccelerator(window_, command_id, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnAccelerator', e) then raise; end; end; -procedure TCustomWindowDelegate.OnKeyEvent(const window: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); +procedure TCustomWindowDelegate.OnKeyEvent(const window_: ICefWindow; const event: TCefKeyEvent; var aResult : boolean); begin try if (FEvents <> nil) then - ICefWindowDelegateEvents(FEvents).doOnKeyEvent(window, event, aResult); + ICefWindowDelegateEvents(FEvents).doOnKeyEvent(window_, event, aResult); except on e : exception do if CustomExceptionHandler('TCustomWindowDelegate.OnKeyEvent', e) then raise; diff --git a/source/uCEFv8Value.pas b/source/uCEFv8Value.pas index b4543062..0729ac8d 100644 --- a/source/uCEFv8Value.pas +++ b/source/uCEFv8Value.pas @@ -72,6 +72,7 @@ type function IsArray: Boolean; function IsArrayBuffer: Boolean; function IsFunction: Boolean; + function IsPromise: Boolean; function IsSame(const that: ICefv8Value): Boolean; function GetBoolValue: Boolean; function GetIntValue: Integer; @@ -106,6 +107,8 @@ type function GetFunctionHandler: ICefv8Handler; function ExecuteFunction(const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; function ExecuteFunctionWithContext(const context: ICefv8Context; const obj: ICefv8Value; const arguments: TCefv8ValueArray): ICefv8Value; + function ResolvePromise(const arg: ICefv8Value): boolean; + function RejectPromise(const errorMsg: ustring): boolean; public class function UnWrap(data: Pointer): ICefv8Value; @@ -127,6 +130,7 @@ type class function NewArray(len: Integer): ICefv8Value; class function NewArrayBuffer(buffer: Pointer; length: NativeUInt; const callback : ICefv8ArrayBufferReleaseCallback): ICefv8Value; class function NewFunction(const name: ustring; const handler: ICefv8Handler): ICefv8Value; + class function NewPromise: ICefv8Value; end; implementation @@ -178,6 +182,11 @@ begin Result := UnWrap(cef_v8value_create_function(@TempName, CefGetData(handler))); end; +class function TCefv8ValueRef.NewPromise: ICefv8Value; +begin + Result := UnWrap(cef_v8value_create_promise()); +end; + class function TCefv8ValueRef.NewInt(value: Integer): ICefv8Value; begin Result := UnWrap(cef_v8value_create_int(value)); @@ -316,6 +325,19 @@ begin end; end; +function TCefv8ValueRef.ResolvePromise(const arg: ICefv8Value): boolean; +begin + Result := PCefV8Value(FData)^.resolve_promise(PCefV8Value(FData), CefGetData(arg)) <> 0; +end; + +function TCefv8ValueRef.RejectPromise(const errorMsg: ustring): boolean; +var + TempErrorMsg : TCefString; +begin + TempErrorMsg := CefString(errorMsg); + Result := PCefV8Value(FData)^.reject_promise(PCefV8Value(FData), @TempErrorMsg) <> 0; +end; + function TCefv8ValueRef.GetArrayLength: Integer; begin Result := PCefV8Value(FData)^.get_array_length(PCefV8Value(FData)); @@ -491,6 +513,11 @@ begin Result := PCefV8Value(FData)^.is_function(PCefV8Value(FData)) <> 0; end; +function TCefv8ValueRef.IsPromise: Boolean; +begin + Result := PCefV8Value(FData)^.is_promise(PCefV8Value(FData)) <> 0; +end; + function TCefv8ValueRef.IsInt: Boolean; begin Result := PCefV8Value(FData)^.is_int(PCefV8Value(FData)) <> 0; diff --git a/update_CEF4Delphi.json b/update_CEF4Delphi.json index d47d1cd4..44cc309a 100644 --- a/update_CEF4Delphi.json +++ b/update_CEF4Delphi.json @@ -2,9 +2,9 @@ "UpdateLazPackages" : [ { "ForceNotify" : true, - "InternalVersion" : 449, + "InternalVersion" : 450, "Name" : "cef4delphi_lazarus.lpk", - "Version" : "107.1.12" + "Version" : "108.4.13" } ], "UpdatePackageData" : {