1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2024-11-24 08:02:15 +02:00

Update to CEF 90.5.4

This commit is contained in:
Salvador Díaz Fau 2021-04-18 19:36:20 +02:00
parent 8d8d498b0f
commit c5fae76a1f
40 changed files with 743 additions and 799 deletions

View File

@ -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 89.0.18 which includes Chromium 89.0.4389.114.
CEF4Delphi uses CEF 90.5.4 which includes Chromium 90.0.4430.72.
The CEF binaries used by CEF4Delphi are available for download at spotify :
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_89.0.18%2Bgb36241d%2Bchromium-89.0.4389.114_macosx64.tar.bz2)
* [Windows 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_windows32.tar.bz2)
* [Windows 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_windows64.tar.bz2)
* [Linux x86 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_linux32.tar.bz2)
* [Linux x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_linux64.tar.bz2)
* [Linux ARM 32 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_linuxarm.tar.bz2)
* [Linux ARM 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_linuxarm64.tar.bz2)
* [MacOS x86 64 bits](https://cef-builds.spotifycdn.com/cef_binary_90.5.4%2Bgc6a4331%2Bchromium-90.0.4430.72_macosx64.tar.bz2)
CEF4Delphi was developed and tested on Delphi 10.4.2 and it has been tested in Delphi 7, Delphi XE, Delphi 10, Delphi 10.2, Delphi 10.3 and Lazarus 2.0.12/FPC 3.2.0. CEF4Delphi includes VCL, FireMonkey (FMX) and Lazarus components.

View File

@ -222,8 +222,7 @@ begin
else
TempCache := GlobalCEFApp.RootCache + '\cache' + inttostr(MainForm.BrowserCount);
TempContext := TCefRequestContextRef.New(TempCache, '', False, False, False)
TempContext := TCefRequestContextRef.New(TempCache, '', '', True, False, False, False)
end
else
TempContext := nil;

View File

@ -211,11 +211,11 @@ begin
// If you use an empty cache path, CEF will use in-memory cache.
// The cache directories of all the browsers *MUST* be a subdirectory of
// GlobalCEFApp.RootCache unless you use a blank cache (in-memory).
// The cache directories of all the browsers *MUST* be a subdirectory of
// GlobalCEFApp.RootCache unless you use a blank cache (in-memory).
if MainForm.NewContextChk.Checked then
TempContext := TCefRequestContextRef.New('', '', False, False, False)
TempContext := TCefRequestContextRef.New('', '', '', True, False, False, False)
else
TempContext := nil;

View File

@ -445,7 +445,7 @@ begin
else
TempFullPath := TempName;
callback.cont(TempFullPath, False);
callback.cont(TempFullPath, True);
end;
procedure TMiniBrowserFrm.Chromium1BeforePluginLoad(Sender: TObject;

View File

@ -40,6 +40,7 @@ unit uTinyBrowser2;
interface
uses
Types,
uCEFInterfaces, uCEFTypes, uCEFChromiumCore;
type
@ -47,7 +48,6 @@ type
private
FChromium : TChromiumCore;
procedure Chromium_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
procedure Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure Chromium_OnBeforePopup(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl, targetFrameName: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; const popupFeatures: TCefPopupFeatures; var windowInfo: TCefWindowInfo; var client: ICefClient; var settings: TCefBrowserSettings; var extra_info: ICefDictionaryValue; var noJavascriptAccess: Boolean; var Result: Boolean);
procedure Chromium_OnOpenUrlFromTab(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const targetUrl: ustring; targetDisposition: TCefWindowOpenDisposition; userGesture: Boolean; out Result: Boolean);
@ -79,7 +79,7 @@ implementation
// and it's necessary to close the message loop.
uses
uCEFApplication;
uCEFApplication, uCEFConstants, uCEFMiscFunctions;
var
TinyBrowser : TTinyBrowser2 = nil;
@ -129,21 +129,20 @@ begin
end;
procedure TTinyBrowser2.AfterConstruction;
var
TempHandle : TCefWindowHandle;
TempRect : TRect;
begin
inherited AfterConstruction;
FChromium := TChromiumCore.Create(nil);
FChromium.DefaultURL := 'https://www.google.com';
FChromium.OnClose := Chromium_OnClose;
FChromium.OnBeforeClose := Chromium_OnBeforeClose;
FChromium.OnBeforePopup := Chromium_OnBeforePopup;
FChromium.OnOpenUrlFromTab := Chromium_OnOpenUrlFromTab;
FChromium.CreateBrowser('Tiny Browser 2');
end;
procedure TTinyBrowser2.Chromium_OnClose(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
begin
aAction := cbaClose;
InitializeWindowHandle(TempHandle);
FChromium.CreateBrowser(TempHandle, TempRect, 'Tiny Browser 2', nil, nil, True);
end;
procedure TTinyBrowser2.Chromium_OnBeforeClose(Sender: TObject; const browser: ICefBrowser);

View File

@ -241,6 +241,12 @@ object MiniBrowserFrm: TMiniBrowserFrm
OnBeforeClose = Chromium1BeforeClose
OnClose = Chromium1Close
OnBeforePluginLoad = Chromium1BeforePluginLoad
OnPrintStart = Chromium1PrintStart
OnPrintSettings = Chromium1PrintSettings
OnPrintDialog = Chromium1PrintDialog
OnPrintJob = Chromium1PrintJob
OnPrintReset = Chromium1PrintReset
OnGetPDFPaperSize = Chromium1GetPDFPaperSize
Left = 32
Top = 224
end

View File

@ -99,9 +99,15 @@ type
procedure Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
procedure Chromium1BeforeClose(Sender: TObject; const browser: ICefBrowser);
procedure Chromium1BeforePluginLoad(Sender: TObject; const mimeType, pluginUrl: ustring; isMainFrame: boolean; const topOriginUrl: ustring; const pluginInfo: ICefWebPluginInfo; var pluginPolicy: TCefPluginPolicy; var aResult: boolean);
procedure Chromium1GetPDFPaperSize(Sender: TObject; const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize);
procedure Chromium1GotFocus(Sender: TObject; const browser: ICefBrowser);
procedure Chromium1Jsdialog(Sender: TObject; const browser: ICefBrowser; const originUrl: ustring; dialogType: TCefJsDialogType; const messageText, defaultPromptText: ustring; const callback: ICefJsDialogCallback; out suppressMessage: Boolean; out Result: Boolean);
procedure Chromium1LoadingStateChange(Sender: TObject; const browser: ICefBrowser; isLoading, canGoBack, canGoForward: Boolean);
procedure Chromium1PrintDialog(Sender: TObject; const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult: boolean);
procedure Chromium1PrintJob(Sender: TObject; const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult: boolean);
procedure Chromium1PrintReset(Sender: TObject; const browser: ICefBrowser);
procedure Chromium1PrintSettings(Sender: TObject; const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
procedure Chromium1PrintStart(Sender: TObject; const browser: ICefBrowser);
procedure Chromium1TitleChange(Sender: TObject; const browser: ICefBrowser; const title: ustring);
procedure Chromium1AddressChange(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const url: ustring);
procedure Chromium1BeforeContextMenu(Sender: TObject; const browser: ICefBrowser; const frame: ICefFrame; const params: ICefContextMenuParams; const model: ICefMenuModel);
@ -210,12 +216,6 @@ type
property BrowserCanGoForward : boolean read GetBrowserCanGoForward write SetBrowserCanGoForward;
property BrowserStatusText : string read GetBrowserStatusText write SetBrowserStatusText;
property BrowserTitle : string read GetBrowserTitle write SetBrowserTitle;
public
procedure HandlePrintStart(const browser: ICefBrowser);
procedure HandlePrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
procedure HandlePrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
procedure HandlePrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
procedure HandlePrintReset(const browser: ICefBrowser);
end;
var
@ -260,37 +260,6 @@ const
// 2. TChromium.OnClose sends a CEFBROWSER_DESTROY message to destroy CEFWindowParent1 in the main thread, which triggers the TChromium.OnBeforeClose event.
// 3. TChromium.OnBeforeClose sets FCanClose := True and sends WM_CLOSE to the form.
procedure GlobalCEFApp_OnPrintStart(const browser: ICefBrowser);
begin
MiniBrowserFrm.HandlePrintStart(browser);
end;
procedure GlobalCEFApp_OnPrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
begin
MiniBrowserFrm.HandlePrintSettings(browser, settings, getDefaults);
end;
procedure GlobalCEFApp_OnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
begin
MiniBrowserFrm.HandlePrintDialog(browser, hasSelection, callback, aResult);
end;
procedure GlobalCEFApp_OnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
begin
MiniBrowserFrm.HandlePrintJob(browser, documentName, PDFFilePath, callback, aResult);
end;
procedure GlobalCEFApp_OnPrintReset(const browser: ICefBrowser);
begin
MiniBrowserFrm.HandlePrintReset(browser);
end;
procedure GlobalCEFApp_OnGetPDFPaperSize(deviceUnitsPerInch: Integer; var aResult : TCefSize);
begin
aResult.width := Printer.PaperSize.Width;
aResult.height := Printer.PaperSize.Height;
end;
procedure CreateGlobalCEFApp;
begin
GlobalCEFApp := TCefApplication.Create;
@ -298,12 +267,6 @@ begin
GlobalCEFApp.LogFile := 'debug.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
//GlobalCEFApp.EnablePrintPreview := True;
GlobalCEFApp.OnPrintStart := @GlobalCEFApp_OnPrintStart;
GlobalCEFApp.OnPrintSettings := @GlobalCEFApp_OnPrintSettings;
GlobalCEFApp.OnPrintDialog := @GlobalCEFApp_OnPrintDialog;
GlobalCEFApp.OnPrintJob := @GlobalCEFApp_OnPrintJob;
GlobalCEFApp.OnPrintReset := @GlobalCEFApp_OnPrintReset;
GlobalCEFApp.OnGetPDFPaperSize := @GlobalCEFApp_OnGetPDFPaperSize;
end;
{Property setters and getters}
@ -831,6 +794,88 @@ begin
SendCompMessage(CEF_UPDATELOADINGSTATE);
end;
procedure TMiniBrowserFrm.Chromium1PrintDialog(Sender: TObject;
const browser: ICefBrowser; hasSelection: boolean;
const callback: ICefPrintDialogCallback; var aResult: boolean);
begin
if (browser <> nil) and (callback <> nil) and Chromium1.IsSameBrowser(browser) then
begin
FBrowserCS.Acquire;
FPrintDialogCallback := callback;
FPrintDialogHasSelection := hasSelection;
aResult := True;
SendCompMessage(CEF_SHOWPRINTDIALOG);
FBrowserCS.Release;
end
else
aResult := False;
end;
procedure TMiniBrowserFrm.Chromium1PrintJob(Sender: TObject;
const browser: ICefBrowser; const documentName, PDFFilePath: ustring;
const callback: ICefPrintJobCallback; var aResult: boolean);
begin
if (browser <> nil) and (callback <> nil) and Chromium1.IsSameBrowser(browser) then
begin
FBrowserCS.Acquire;
FPrintJobCallback := callback;
FPrintJobDocumentName := documentName;
FPrintJobPDFFilePath := PDFFilePath;
aResult := True;
SendCompMessage(CEF_PRINTJOBSTARTED);
FBrowserCS.Release;
end
else
aResult := False;
end;
procedure TMiniBrowserFrm.Chromium1PrintReset(Sender: TObject;
const browser: ICefBrowser);
begin
if (browser <> nil) and Chromium1.IsSameBrowser(browser) then
SendCompMessage(CEF_PRINTRESET);
end;
procedure TMiniBrowserFrm.Chromium1PrintSettings(Sender: TObject;
const browser: ICefBrowser; const settings: ICefPrintSettings;
getDefaults: boolean);
var
TempSize : TCefSize;
TempArea : TCefRect;
begin
if (settings <> nil) and (browser <> nil) and settings.IsValid and not(settings.IsReadOnly) and Chromium1.IsSameBrowser(browser) then
begin
// if getDefaults then ...
TempSize.width := Printer.PaperSize.Width;
TempSize.height := Printer.PaperSize.Height;
TempArea.x := TPrinterCanvas(Printer.Canvas).LeftMargin;
TempArea.y := TPrinterCanvas(Printer.Canvas).TopMargin;
TempArea.width := TPrinterCanvas(Printer.Canvas).PageWidth;
TempArea.height := TPrinterCanvas(Printer.Canvas).PageHeight;
settings.DeviceName := Printer.PrinterName;
settings.Dpi := Printer.XDPI;
settings.SetOrientation(Printer.Orientation in [TPrinterOrientation.poLandscape, TPrinterOrientation.poReverseLandscape]);
settings.SetPrinterPrintableArea(@TempSize, @TempArea, Printer.Orientation = TPrinterOrientation.poReverseLandscape);
end;
end;
procedure TMiniBrowserFrm.Chromium1PrintStart(Sender: TObject;
const browser: ICefBrowser);
begin
if (browser <> nil) and Chromium1.IsSameBrowser(browser) then
SendCompMessage(CEF_PRINTSTART);
end;
procedure TMiniBrowserFrm.Chromium1PdfPrintFinished(Sender: TObject; aResultOK: Boolean);
begin
SendCompMessage(CEF_PDFPRINTEND, PtrInt(ord(aResultOK)));
@ -875,6 +920,14 @@ begin
aResult := False;
end;
procedure TMiniBrowserFrm.Chromium1GetPDFPaperSize(Sender: TObject;
const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize
);
begin
aResult.width := Printer.PaperSize.Width;
aResult.height := Printer.PaperSize.Height;
end;
procedure TMiniBrowserFrm.Chromium1GotFocus(Sender: TObject;
const browser: ICefBrowser);
begin
@ -1152,81 +1205,4 @@ begin
end;
{%Endregion}
{Printing procedures}
{%Region}
procedure TMiniBrowserFrm.HandlePrintStart(const browser: ICefBrowser);
begin
if (browser <> nil) and Chromium1.IsSameBrowser(browser) then
SendCompMessage(CEF_PRINTSTART);
end;
procedure TMiniBrowserFrm.HandlePrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
var
TempSize : TCefSize;
TempArea : TCefRect;
begin
if (settings <> nil) and (browser <> nil) and settings.IsValid and not(settings.IsReadOnly) and Chromium1.IsSameBrowser(browser) then
begin
// if getDefaults then ...
TempSize.width := Printer.PaperSize.Width;
TempSize.height := Printer.PaperSize.Height;
TempArea.x := TPrinterCanvas(Printer.Canvas).LeftMargin;
TempArea.y := TPrinterCanvas(Printer.Canvas).TopMargin;
TempArea.width := TPrinterCanvas(Printer.Canvas).PageWidth;
TempArea.height := TPrinterCanvas(Printer.Canvas).PageHeight;
settings.DeviceName := Printer.PrinterName;
settings.Dpi := Printer.XDPI;
settings.SetOrientation(Printer.Orientation in [TPrinterOrientation.poLandscape, TPrinterOrientation.poReverseLandscape]);
settings.SetPrinterPrintableArea(@TempSize, @TempArea, Printer.Orientation = TPrinterOrientation.poReverseLandscape);
end;
end;
procedure TMiniBrowserFrm.HandlePrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
begin
if (browser <> nil) and (callback <> nil) and Chromium1.IsSameBrowser(browser) then
begin
FBrowserCS.Acquire;
FPrintDialogCallback := callback;
FPrintDialogHasSelection := hasSelection;
aResult := True;
SendCompMessage(CEF_SHOWPRINTDIALOG);
FBrowserCS.Release;
end
else
aResult := False;
end;
procedure TMiniBrowserFrm.HandlePrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
begin
if (browser <> nil) and (callback <> nil) and Chromium1.IsSameBrowser(browser) then
begin
FBrowserCS.Acquire;
FPrintJobCallback := callback;
FPrintJobDocumentName := documentName;
FPrintJobPDFFilePath := PDFFilePath;
aResult := True;
SendCompMessage(CEF_PRINTJOBSTARTED);
FBrowserCS.Release;
end
else
aResult := False;
end;
procedure TMiniBrowserFrm.HandlePrintReset(const browser: ICefBrowser);
begin
if (browser <> nil) and Chromium1.IsSameBrowser(browser) then
SendCompMessage(CEF_PRINTRESET);
end;
{%Endregion}
end.

View File

@ -42,7 +42,7 @@ unit uTinyBrowser2;
interface
uses
SysUtils,
SysUtils, Classes,
uCEFInterfaces, uCEFTypes, uCEFChromiumCore;
type
@ -57,6 +57,7 @@ type
public
constructor Create;
destructor Destroy; override;
procedure AfterConstruction; override;
end;
procedure CreateGlobalCEFApp;
@ -77,12 +78,12 @@ implementation
// The destruction steps are much simpler for that reason.
// In this demo it's only necessary to implement the TChromium.OnBeforeClose
// events. The TChromium.OnBeforeClose event calls GlobalCEFApp.QuitMessageLoop
// event. The TChromium.OnBeforeClose event calls GlobalCEFApp.QuitMessageLoop
// because the browser has been destroyed and it's necessary to close the
// message loop.
uses
uCEFApplication, uCEFConstants;
uCEFApplication, uCEFConstants, uCEFMiscFunctions;
var
TinyBrowser : TTinyBrowser2 = nil;
@ -100,8 +101,8 @@ begin
GlobalCEFApp.OnContextInitialized := GlobalCEFApp_OnContextInitialized;
// Add a debug log in the BIN directory
//GlobalCEFApp.LogFile := 'cef.log';
//GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
GlobalCEFApp.LogFile := 'cef.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
end;
procedure DestroyTinyBrowser;
@ -117,12 +118,7 @@ constructor TTinyBrowser2.Create;
begin
inherited Create;
FChromium := TChromiumCore.Create(nil);
FChromium.DefaultURL := 'https://www.google.com';
FChromium.OnBeforeClose := Chromium_OnBeforeClose;
FChromium.OnBeforePopup := Chromium_OnBeforePopup;
FChromium.OnOpenUrlFromTab := Chromium_OnOpenUrlFromTab;
FChromium.CreateBrowser('Tiny Browser 2');
FChromium := nil;
end;
destructor TTinyBrowser2.Destroy;
@ -133,6 +129,23 @@ begin
inherited Destroy;
end;
procedure TTinyBrowser2.AfterConstruction;
var
TempHandle : TCefWindowHandle;
TempRect : TRect;
begin
inherited AfterConstruction;
FChromium := TChromiumCore.Create(nil);
FChromium.DefaultURL := 'https://www.google.com';
FChromium.OnBeforeClose := Chromium_OnBeforeClose;
FChromium.OnBeforePopup := Chromium_OnBeforePopup;
FChromium.OnOpenUrlFromTab := Chromium_OnOpenUrlFromTab;
InitializeWindowHandle(TempHandle);
FChromium.CreateBrowser(TempHandle, TempRect, 'Tiny Browser 2', nil, nil, True);
end;
procedure TTinyBrowser2.Chromium_OnBeforeClose(Sender: TObject;
const browser: ICefBrowser);
begin

View File

@ -21,7 +21,7 @@
</CompilerOptions>
<Description Value="CEF4Delphi is an open source project created by Salvador Díaz Fau to embed Chromium-based browsers in applications made with Delphi or Lazarus/FPC."/>
<License Value="MPL 1.1"/>
<Version Major="89" Release="18"/>
<Version Major="90" Minor="5" Release="4"/>
<Files Count="201">
<Item1>
<Filename Value="..\source\uCEFAccessibilityHandler.pas"/>

View File

@ -101,8 +101,8 @@ type
destructor Destroy; override;
procedure UpdateDeviceScaleFactor; override;
property DestroyApplicationObject: boolean read FDestroyApplicationObject write FDestroyApplicationObject;
property DestroyAppWindows : boolean read FDestroyAppWindows write FDestroyAppWindows;
property DestroyApplicationObject : boolean read FDestroyApplicationObject write FDestroyApplicationObject;
property DestroyAppWindows : boolean read FDestroyAppWindows write FDestroyAppWindows;
{$IFDEF FPC}
procedure Internal_OnContextInitialized; override; // In UI thread
@ -209,17 +209,19 @@ begin
{$ENDIF}
inherited Create;
if GlobalCEFApp = nil then
if (GlobalCEFApp = nil) then
GlobalCEFApp := Self;
FDestroyApplicationObject := False;
FDestroyAppWindows := True;
FDestroyApplicationObject := False;
FDestroyAppWindows := True;
end;
destructor TCefApplication.Destroy;
begin
if GlobalCEFApp = Self then
if (GlobalCEFApp = Self) then
GlobalCEFApp := nil;
inherited Destroy;
{$IFDEF FPC}
@ -301,7 +303,7 @@ var
begin
{$IFNDEF FPC}
{$IFNDEF FMX}
if Application <> nil then
if (Application <> nil) then
begin
if FDestroyApplicationObject then
begin
@ -335,7 +337,8 @@ begin
if (Application.PopupControlWnd <> 0) then DeallocateHWnd(Application.PopupControlWnd);
{$ENDIF}
end;
if not IsLibrary then
if not(IsLibrary) then
begin
// Undo the OleInitialize from TApplication.Create. The sub-processes want a different
// COM thread model and fail with an assertion if the Debug-DLLs are used.

View File

@ -64,15 +64,15 @@ uses
uCEFTypes, uCEFInterfaces, uCEFBaseRefCounted, uCEFSchemeRegistrar;
const
CEF_SUPPORTED_VERSION_MAJOR = 89;
CEF_SUPPORTED_VERSION_MINOR = 0;
CEF_SUPPORTED_VERSION_RELEASE = 18;
CEF_SUPPORTED_VERSION_MAJOR = 90;
CEF_SUPPORTED_VERSION_MINOR = 5;
CEF_SUPPORTED_VERSION_RELEASE = 4;
CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 89;
CEF_CHROMEELF_VERSION_MAJOR = 90;
CEF_CHROMEELF_VERSION_MINOR = 0;
CEF_CHROMEELF_VERSION_RELEASE = 4389;
CEF_CHROMEELF_VERSION_BUILD = 114;
CEF_CHROMEELF_VERSION_RELEASE = 4430;
CEF_CHROMEELF_VERSION_BUILD = 72;
{$IFDEF MSWINDOWS}
LIBCEF_DLL = 'libcef.dll';
@ -125,6 +125,8 @@ type
FIgnoreCertificateErrors : Boolean;
FBackgroundColor : TCefColor;
FAcceptLanguageList : ustring;
FCookieableSchemesList : ustring;
FCookieableSchemesExcludeDefaults : boolean;
FApplicationClientID : ustring;
FWindowsSandboxInfo : Pointer;
FWindowlessRenderingEnabled : Boolean;
@ -172,7 +174,6 @@ type
{$ENDIF}
FOnRegisterCustomSchemes : TOnRegisterCustomSchemesEvent;
FAppSettings : TCefSettings;
FCheckDevToolsResources : boolean;
FDisableExtensions : boolean;
FDisableGPUCache : boolean;
FStatus : TCefAplicationStatus;
@ -218,7 +219,6 @@ type
FMustCreateBrowserProcessHandler : boolean;
FMustCreateRenderProcessHandler : boolean;
FMustCreateLoadHandler : boolean;
FMustCreatePrintHandler : boolean;
// ICefBrowserProcessHandler
FOnGetCookieableSchemes : TOnGetCookieableSchemesEvent;
@ -251,14 +251,6 @@ type
FOnLoadEnd : TOnRenderLoadEnd;
FOnLoadError : TOnRenderLoadError;
// ICefPrintHandler
FOnPrintStart : TOnPrintStartEvent;
FOnPrintSettings : TOnPrintSettingsEvent;
FOnPrintDialog : TOnPrintDialogEvent;
FOnPrintJob : TOnPrintJobEvent;
FOnPrintReset : TOnPrintResetEvent;
FOnGetPDFPaperSize : TOnGetPDFPaperSizeEvent;
procedure SetCache(const aValue : ustring);
procedure SetRootCache(const aValue : ustring);
procedure SetUserDataPath(const aValue : ustring);
@ -278,7 +270,6 @@ type
function GetMustCreateBrowserProcessHandler : boolean; virtual;
function GetMustCreateRenderProcessHandler : boolean; virtual;
function GetMustCreateLoadHandler : boolean; virtual;
function GetMustCreatePrintHandler : boolean; virtual;
function GetGlobalContextInitialized : boolean;
function GetChildProcessesCount : integer;
function GetUsedMemory : uint64;
@ -364,7 +355,6 @@ type
function CheckCEFLibrary : boolean;
procedure RegisterWidevineCDM;
procedure ShowErrorMessageDlg(const aError : string); virtual;
procedure UpdateSupportedSchemes(aIncludeDefaults : boolean = True); virtual;
function ParseProcessType : TCefProcessType;
procedure AddCustomCommandLineSwitches(var aKeys, aValues : TStringList); virtual;
procedure AppendSwitch(var aKeys, aValues : TStringList; const aNewKey : ustring; const aNewValue : ustring = '');
@ -388,8 +378,8 @@ type
procedure UpdateDeviceScaleFactor; virtual;
// Internal procedures. Only ICefApp, ICefBrowserProcessHandler,
// ICefResourceBundleHandler, ICefRenderProcessHandler, ICefRegisterCDMCallback,
// ICefLoadHandler and ICefPrintHandler should use them.
// ICefResourceBundleHandler, ICefRenderProcessHandler, ICefRegisterCDMCallback and
// ICefLoadHandler should use them.
procedure Internal_OnBeforeCommandLineProcessing(const processType: ustring; const commandLine: ICefCommandLine);
procedure Internal_OnRegisterCustomSchemes(const registrar: TCefSchemeRegistrarRef);
procedure Internal_OnContextInitialized; virtual;
@ -413,12 +403,6 @@ type
procedure Internal_OnLoadError(const browser: ICefBrowser; const frame: ICefFrame; errorCode: Integer; const errorText, failedUrl: ustring);
procedure Internal_GetCookieableSchemes(var schemes: TStringList; var include_defaults : boolean);
procedure Internal_GetDefaultClient(var aClient : ICefClient);
procedure Internal_OnPrintStart(const browser: ICefBrowser);
procedure Internal_OnPrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
procedure Internal_OnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
procedure Internal_OnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
procedure Internal_OnPrintReset(const browser: ICefBrowser);
procedure Internal_OnGetPDFPaperSize(deviceUnitsPerInch: Integer; var aResult : TCefSize);
// Properties used to populate TCefSettings (cef_settings_t)
property NoSandbox : Boolean read FNoSandbox write FNoSandbox;
@ -441,14 +425,16 @@ type
property LogFile : ustring read FLogFile write FLogFile;
property LogSeverity : TCefLogSeverity read FLogSeverity write FLogSeverity;
property JavaScriptFlags : ustring read FJavaScriptFlags write FJavaScriptFlags;
property ResourcesDirPath : ustring read GetResourcesDirPath write SetResourcesDirPath;
property LocalesDirPath : ustring read GetLocalesDirPath write SetLocalesDirPath;
property ResourcesDirPath : ustring read GetResourcesDirPath write SetResourcesDirPath;
property LocalesDirPath : ustring read GetLocalesDirPath write SetLocalesDirPath;
property PackLoadingDisabled : Boolean read FPackLoadingDisabled write FPackLoadingDisabled;
property RemoteDebuggingPort : Integer read FRemoteDebuggingPort write FRemoteDebuggingPort;
property UncaughtExceptionStackSize : Integer read FUncaughtExceptionStackSize write FUncaughtExceptionStackSize;
property IgnoreCertificateErrors : Boolean read FIgnoreCertificateErrors write FIgnoreCertificateErrors;
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor;
property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList;
property CookieableSchemesList : ustring read FCookieableSchemesList write FCookieableSchemesList;
property CookieableSchemesExcludeDefaults : boolean read FCookieableSchemesExcludeDefaults write FCookieableSchemesExcludeDefaults;
property ApplicationClientID : ustring read FApplicationClientID write FApplicationClientID;
// Properties used to set command line switches
@ -529,14 +515,12 @@ type
property LogProcessInfo : boolean read FLogProcessInfo write FLogProcessInfo;
property ReRaiseExceptions : boolean read FReRaiseExceptions write FReRaiseExceptions;
property DeviceScaleFactor : single read FDeviceScaleFactor;
property CheckDevToolsResources : boolean read FCheckDevToolsResources write FCheckDevToolsResources;
property LocalesRequired : ustring read FLocalesRequired write FLocalesRequired;
property ProcessType : TCefProcessType read FProcessType;
property MustCreateResourceBundleHandler : boolean read GetMustCreateResourceBundleHandler write FMustCreateResourceBundleHandler;
property MustCreateBrowserProcessHandler : boolean read GetMustCreateBrowserProcessHandler write FMustCreateBrowserProcessHandler;
property MustCreateRenderProcessHandler : boolean read GetMustCreateRenderProcessHandler write FMustCreateRenderProcessHandler;
property MustCreateLoadHandler : boolean read GetMustCreateLoadHandler write FMustCreateLoadHandler;
property MustCreatePrintHandler : boolean read GetMustCreatePrintHandler write FMustCreatePrintHandler;
property OsmodalLoop : boolean write SetOsmodalLoop;
property Status : TCefAplicationStatus read FStatus;
property MissingLibFiles : string read FMissingLibFiles;
@ -589,16 +573,6 @@ type
property OnLoadStart : TOnRenderLoadStart read FOnLoadStart write FOnLoadStart;
property OnLoadEnd : TOnRenderLoadEnd read FOnLoadEnd write FOnLoadEnd;
property OnLoadError : TOnRenderLoadError read FOnLoadError write FOnLoadError;
// ICefPrintHandler
{$IFDEF LINUX}
property OnPrintStart : TOnPrintStartEvent read FOnPrintStart write FOnPrintStart;
property OnPrintSettings : TOnPrintSettingsEvent read FOnPrintSettings write FOnPrintSettings;
property OnPrintDialog : TOnPrintDialogEvent read FOnPrintDialog write FOnPrintDialog;
property OnPrintJob : TOnPrintJobEvent read FOnPrintJob write FOnPrintJob;
property OnPrintReset : TOnPrintResetEvent read FOnPrintReset write FOnPrintReset;
property OnGetPDFPaperSize : TOnGetPDFPaperSizeEvent read FOnGetPDFPaperSize write FOnGetPDFPaperSize;
{$ENDIF}
end;
TCEFDirectoryDeleterThread = class(TThread)
@ -672,7 +646,8 @@ end;
constructor TCefApplicationCore.Create;
begin
inherited Create;
if GlobalCEFApp = nil then
if (GlobalCEFApp = nil) then
GlobalCEFApp := Self;
FStatus := asLoading;
@ -708,6 +683,8 @@ begin
FIgnoreCertificateErrors := False;
FBackgroundColor := 0;
FAcceptLanguageList := '';
FCookieableSchemesList := '';
FCookieableSchemesExcludeDefaults := False;
FApplicationClientID := '';
FWindowsSandboxInfo := nil;
FWindowlessRenderingEnabled := False;
@ -745,7 +722,6 @@ begin
FMissingBinariesException := False;
FSetCurrentDir := False;
FGlobalContextInitialized := False;
FCheckDevToolsResources := True;
FDisableExtensions := False;
FDisableGPUCache := True;
FLocalesRequired := '';
@ -796,7 +772,6 @@ begin
FMustCreateBrowserProcessHandler := True;
FMustCreateRenderProcessHandler := False;
FMustCreateLoadHandler := False;
FMustCreatePrintHandler := False;
// ICefBrowserProcessHandler
FOnGetCookieableSchemes := nil;
@ -829,14 +804,6 @@ begin
FOnLoadEnd := nil;
FOnLoadError := nil;
// ICefPrintHandler
FOnPrintStart := nil;
FOnPrintSettings := nil;
FOnPrintDialog := nil;
FOnPrintJob := nil;
FOnPrintReset := nil;
FOnGetPDFPaperSize := nil;
UpdateDeviceScaleFactor;
FillChar(FAppSettings, SizeOf(TCefSettings), 0);
@ -1135,7 +1102,7 @@ begin
TempMissingSubProc := not(CheckSubprocessPath(FBrowserSubprocessPath, FMissingLibFiles));
TempMissingFrm := not(CheckDLLs(FFrameworkDirPath, FMissingLibFiles));
TempMissingRsc := not(CheckResources(ResourcesDirPath, FMissingLibFiles, FCheckDevToolsResources, not(FDisableExtensions)));
TempMissingRsc := not(CheckResources(ResourcesDirPath, FMissingLibFiles));
TempMissingLoc := not(CheckLocales(LocalesDirPath, FMissingLibFiles, FLocalesRequired));
if TempMissingFrm or TempMissingRsc or TempMissingLoc or TempMissingSubProc then
@ -1428,6 +1395,8 @@ begin
aSettings.ignore_certificate_errors := Ord(FIgnoreCertificateErrors);
aSettings.background_color := FBackgroundColor;
aSettings.accept_language_list := CefString(FAcceptLanguageList);
aSettings.cookieable_schemes_list := CefString(FCookieableSchemesList);
aSettings.cookieable_schemes_exclude_defaults := Ord(FCookieableSchemesExcludeDefaults);
aSettings.application_client_id_for_file_scanning := CefString(FApplicationClientID);
end;
@ -1632,24 +1601,6 @@ begin
raise Exception.Create(aError);
end;
procedure TCefApplicationCore.UpdateSupportedSchemes(aIncludeDefaults : boolean);
var
TempManager : ICefCookieManager;
begin
try
if (FSupportedSchemes <> nil) and
(FSupportedSchemes.Count > 0) then
begin
TempManager := TCefCookieManagerRef.Global(nil);
if (TempManager <> nil) then
TempManager.SetSupportedSchemes(FSupportedSchemes, aIncludeDefaults, nil);
end;
finally
TempManager := nil;
end;
end;
function TCefApplicationCore.ParseProcessType : TCefProcessType;
const
TYPE_PARAMETER_NAME = '--type=';
@ -1694,7 +1645,6 @@ end;
procedure TCefApplicationCore.Internal_OnContextInitialized;
begin
FGlobalContextInitialized := True;
UpdateSupportedSchemes;
if assigned(FOnContextInitialized) then
FOnContextInitialized();
@ -1837,42 +1787,6 @@ begin
FOnGetDefaultClient(aClient);
end;
procedure TCefApplicationCore.Internal_OnPrintStart(const browser: ICefBrowser);
begin
if assigned(FOnPrintStart) then
FOnPrintStart(browser);
end;
procedure TCefApplicationCore.Internal_OnPrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
begin
if assigned(FOnPrintSettings) then
FOnPrintSettings(browser, settings, getDefaults);
end;
procedure TCefApplicationCore.Internal_OnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
begin
if assigned(FOnPrintDialog) then
FOnPrintDialog(browser, hasSelection, callback, aResult);
end;
procedure TCefApplicationCore.Internal_OnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
begin
if assigned(FOnPrintJob) then
FOnPrintJob(browser, documentName, PDFFilePath, callback, aResult);
end;
procedure TCefApplicationCore.Internal_OnPrintReset(const browser: ICefBrowser);
begin
if assigned(FOnPrintReset) then
FOnPrintReset(browser);
end;
procedure TCefApplicationCore.Internal_OnGetPDFPaperSize(deviceUnitsPerInch: Integer; var aResult : TCefSize);
begin
if assigned(FOnGetPDFPaperSize) then
FOnGetPDFPaperSize(deviceUnitsPerInch, aResult);
end;
procedure TCefApplicationCore.AppendSwitch(var aKeys, aValues : TStringList; const aNewKey, aNewValue : ustring);
var
TempKey, TempHyphenatedKey : ustring;
@ -2305,7 +2219,6 @@ function TCefApplicationCore.GetMustCreateBrowserProcessHandler : boolean;
begin
Result := ((FSingleProcess or (FProcessType = ptBrowser)) and
(FMustCreateBrowserProcessHandler or
MustCreatePrintHandler or
assigned(FOnGetCookieableSchemes) or
assigned(FOnContextInitialized) or
assigned(FOnBeforeChildProcessLaunch) or
@ -2338,22 +2251,6 @@ begin
assigned(FOnLoadError)));
end;
function TCefApplicationCore.GetMustCreatePrintHandler : boolean;
begin
{$IFDEF LINUX}
Result := ((FSingleProcess or (FProcessType = ptBrowser)) and
(FMustCreatePrintHandler or
assigned(FOnPrintStart) or
assigned(FOnPrintSettings) or
assigned(FOnPrintDialog) or
assigned(FOnPrintJob) or
assigned(FOnPrintReset) or
assigned(FOnGetPDFPaperSize)));
{$ELSE}
Result := False;
{$ENDIF}
end;
function TCefApplicationCore.GetGlobalContextInitialized : boolean;
begin
Result := FGlobalContextInitialized or not(MustCreateBrowserProcessHandler);

View File

@ -36,8 +36,8 @@
*)
unit uCEFBrowserProcessHandler;
{$IFDEF FPC}
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
@ -59,10 +59,8 @@ uses
type
TCefBrowserProcessHandlerOwn = class(TCefBaseRefCountedOwn, ICefBrowserProcessHandler)
protected
procedure GetCookieableSchemes(var schemes: TStringList; var include_defaults : boolean); virtual; abstract;
procedure OnContextInitialized; virtual; abstract;
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); virtual; abstract;
procedure GetPrintHandler(var aHandler : ICefPrintHandler); virtual;
procedure OnScheduleMessagePumpWork(const delayMs: Int64); virtual; abstract;
procedure GetDefaultClient(var aClient : ICefClient); virtual;
@ -73,80 +71,37 @@ type
end;
TCefCustomBrowserProcessHandler = class(TCefBrowserProcessHandlerOwn)
protected
FCefApp : TCefApplicationCore;
FPrintHandler : ICefPrintHandler;
procedure GetCookieableSchemes(var schemes: TStringList; var include_defaults : boolean); override;
procedure OnContextInitialized; override;
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); override;
procedure GetPrintHandler(var aHandler : ICefPrintHandler); override;
procedure OnScheduleMessagePumpWork(const delayMs: Int64); override;
procedure GetDefaultClient(var aClient : ICefClient); override;
procedure RemoveReferences; override;
public
constructor Create(const aCefApp : TCefApplicationCore); reintroduce;
destructor Destroy; override;
end;
protected
FCefApp : TCefApplicationCore;
procedure OnContextInitialized; override;
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine); override;
procedure OnScheduleMessagePumpWork(const delayMs: Int64); override;
procedure GetDefaultClient(var aClient : ICefClient); override;
procedure RemoveReferences; override;
public
constructor Create(const aCefApp : TCefApplicationCore); reintroduce;
destructor Destroy; override;
end;
implementation
uses
{$IFDEF DELPHI16_UP}
System.SysUtils,
{$ELSE}
SysUtils,
{$IFDEF DELPHI16_UP}
System.SysUtils,
{$ELSE}
SysUtils,
{$ENDIF}
uCEFMiscFunctions, uCEFLibFunctions, uCEFCommandLine, uCEFListValue, uCEFConstants, uCEFStringList,
uCEFPrintHandler;
procedure cef_browser_process_handler_get_cookieable_schemes(self : PCefBrowserProcessHandler;
schemes : TCefStringList;
include_defaults : PInteger); stdcall;
var
TempSL : TStringList;
TempCefSL : ICefStringList;
TempObject : TObject;
TempIncDef : boolean;
begin
TempSL := nil;
try
try
TempObject := CefGetObject(self);
if (schemes <> nil) and (TempObject <> nil) and (TempObject is TCefBrowserProcessHandlerOwn) then
begin
TempIncDef := (include_defaults^ <> 0);
TempSL := TStringList.Create;
TempCefSL := TCefStringListRef.Create(schemes);
TempCefSL.CopyToStrings(TempSL);
TCefBrowserProcessHandlerOwn(TempObject).GetCookieableSchemes(TempSL, TempIncDef);
TempCefSL.Clear;
TempCefSL.AddStrings(TempSL);
include_defaults^ := ord(TempIncDef);
end;
except
on e : exception do
if CustomExceptionHandler('cef_browser_process_handler_get_cookieable_schemes', e) then raise;
end;
finally
if (TempSL <> nil) then FreeAndNil(TempSL);
TempCefSL := nil;
end;
end;
uCEFMiscFunctions, uCEFLibFunctions, uCEFCommandLine, uCEFListValue, uCEFConstants, uCEFStringList;
procedure cef_browser_process_handler_on_context_initialized(self: PCefBrowserProcessHandler); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
TempObject := CefGetObject(self);
if (TempObject <> nil) and
(TempObject is TCefBrowserProcessHandlerOwn) then
TCefBrowserProcessHandlerOwn(TempObject).OnContextInitialized;
@ -157,39 +112,20 @@ procedure cef_browser_process_handler_on_before_child_process_launch(self
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
TempObject := CefGetObject(self);
if (TempObject <> nil) and
(TempObject is TCefBrowserProcessHandlerOwn) then
TCefBrowserProcessHandlerOwn(TempObject).OnBeforeChildProcessLaunch(TCefCommandLineRef.UnWrap(command_line));
end;
function cef_browser_process_handler_get_print_handler(self: PCefBrowserProcessHandler): PCefPrintHandler; stdcall;
var
TempObject : TObject;
TempHandler : ICefPrintHandler;
begin
Result := nil;
TempObject := CefGetObject(self);
if (TempObject <> nil) and
(TempObject is TCefBrowserProcessHandlerOwn) then
try
TempHandler := nil;
TCefBrowserProcessHandlerOwn(TempObject).GetPrintHandler(TempHandler);
if (TempHandler <> nil) then Result := TempHandler.Wrap;
finally
TempHandler := nil;
end;
end;
procedure cef_browser_process_handler_on_schedule_message_pump_work(self : PCefBrowserProcessHandler;
delay_ms : Int64); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
TempObject := CefGetObject(self);
if (TempObject <> nil) and
(TempObject is TCefBrowserProcessHandlerOwn) then
TCefBrowserProcessHandlerOwn(TempObject).OnScheduleMessagePumpWork(delay_ms);
@ -201,16 +137,16 @@ var
TempClient : ICefClient;
begin
Result := nil;
TempObject := CefGetObject(self);
TempObject := CefGetObject(self);
if (TempObject <> nil) and
(TempObject is TCefBrowserProcessHandlerOwn) then
try
TempClient := nil;
TCefBrowserProcessHandlerOwn(TempObject).GetDefaultClient(TempClient);
if (TempClient <> nil) then Result := TempClient.Wrap;
finally
TempClient := nil;
if (TempClient <> nil) then Result := TempClient.Wrap;
finally
TempClient := nil;
end;
end;
@ -220,114 +156,78 @@ begin
with PCefBrowserProcessHandler(FData)^ do
begin
get_cookieable_schemes := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_get_cookieable_schemes;
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;
get_print_handler := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_get_print_handler;
on_schedule_message_pump_work := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_on_schedule_message_pump_work;
get_default_client := {$IFDEF FPC}@{$ENDIF}cef_browser_process_handler_get_default_client;
end;
end;
procedure TCefBrowserProcessHandlerOwn.GetPrintHandler(var aHandler : ICefPrintHandler);
begin
aHandler := nil;
end;
procedure TCefBrowserProcessHandlerOwn.GetDefaultClient(var aClient : ICefClient);
begin
aClient := nil;
aClient := nil;
end;
// TCefCustomBrowserProcessHandler
constructor TCefCustomBrowserProcessHandler.Create(const aCefApp : TCefApplicationCore);
begin
inherited Create;
FCefApp := aCefApp;
if (FCefApp <> nil) and FCefApp.MustCreatePrintHandler then
FPrintHandler := TCustomPrintHandler.Create(FCefApp)
else
FPrintHandler := nil;
end;
destructor TCefCustomBrowserProcessHandler.Destroy;
begin
RemoveReferences;
inherited Destroy;
end;
procedure TCefCustomBrowserProcessHandler.RemoveReferences;
begin
if (FPrintHandler <> nil) then
FPrintHandler.RemoveReferences;
FCefApp := nil;
FPrintHandler := nil;
end;
procedure TCefCustomBrowserProcessHandler.GetCookieableSchemes(var schemes : TStringList;
var include_defaults : boolean);
constructor TCefCustomBrowserProcessHandler.Create(const aCefApp : TCefApplicationCore);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_GetCookieableSchemes(schemes, include_defaults);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.GetCookieableSchemes', e) then raise;
end;
inherited Create;
FCefApp := aCefApp;
end;
destructor TCefCustomBrowserProcessHandler.Destroy;
begin
RemoveReferences;
inherited Destroy;
end;
procedure TCefCustomBrowserProcessHandler.RemoveReferences;
begin
FCefApp := nil;
end;
procedure TCefCustomBrowserProcessHandler.OnContextInitialized;
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnContextInitialized;
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnContextInitialized', e) then raise;
end;
end;
procedure TCefCustomBrowserProcessHandler.OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeChildProcessLaunch(commandLine);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnBeforeChildProcessLaunch', e) then raise;
end;
end;
procedure TCefCustomBrowserProcessHandler.GetPrintHandler(var aHandler : ICefPrintHandler);
begin
if (FPrintHandler <> nil) then
aHandler := FPrintHandler
else
inherited GetPrintHandler(aHandler);
end;
procedure TCefCustomBrowserProcessHandler.OnScheduleMessagePumpWork(const delayMs: Int64);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnScheduleMessagePumpWork(delayMs);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnScheduleMessagePumpWork', e) then raise;
end;
try
if (FCefApp <> nil) then FCefApp.Internal_OnContextInitialized;
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnContextInitialized', e) then raise;
end;
end;
procedure TCefCustomBrowserProcessHandler.OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnBeforeChildProcessLaunch(commandLine);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnBeforeChildProcessLaunch', e) then raise;
end;
end;
procedure TCefCustomBrowserProcessHandler.OnScheduleMessagePumpWork(const delayMs: Int64);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnScheduleMessagePumpWork(delayMs);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.OnScheduleMessagePumpWork', e) then raise;
end;
end;
procedure TCefCustomBrowserProcessHandler.GetDefaultClient(var aClient : ICefClient);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_GetDefaultClient(aClient);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.GetDefaultClient', e) then raise;
end;
try
if (FCefApp <> nil) then FCefApp.Internal_GetDefaultClient(aClient);
except
on e : exception do
if CustomExceptionHandler('TCefCustomBrowserProcessHandler.GetDefaultClient', e) then raise;
end;
end;
end.

View File

@ -60,6 +60,7 @@ type
TCefBrowserViewRef = class(TCefViewRef, ICefBrowserView)
protected
function GetBrowser : ICefBrowser;
function GetChromeToolbar : ICefView;
procedure SetPreferAccelerators(prefer_accelerators: boolean);
public
@ -78,6 +79,11 @@ begin
Result := TCefBrowserRef.UnWrap(PCefBrowserView(FData)^.get_browser(PCefBrowserView(FData)));
end;
function TCefBrowserViewRef.GetChromeToolbar : ICefView;
begin
Result := TCefViewRef.UnWrap(PCefBrowserView(FData)^.get_chrome_toolbar(PCefBrowserView(FData)));
end;
procedure TCefBrowserViewRef.SetPreferAccelerators(prefer_accelerators: boolean);
begin
PCefBrowserView(FData)^.set_prefer_accelerators(PCefBrowserView(FData),

View File

@ -71,6 +71,7 @@ type
FOnBrowserDestroyed : TOnBrowserDestroyedEvent;
FOnGetDelegateForPopupBrowserView : TOnGetDelegateForPopupBrowserViewEvent;
FOnPopupBrowserViewCreated : TOnPopupBrowserViewCreatedEvent;
FOnGetChromeToolbarType : TOnGetChromeToolbarTypeEvent;
procedure DestroyView; override;
procedure Initialize; override;
@ -85,6 +86,7 @@ type
procedure doOnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure doOnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
procedure doOnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
procedure doOnGetChromeToolbarType(var aChromeToolbarType: TCefChromeToolbarType);
public
function CreateBrowserView(const client: ICefClient; const url: ustring; const settings: TCefBrowserSettings; const extra_info: ICefDictionaryValue; const request_context: ICefRequestContext): boolean;
@ -99,6 +101,7 @@ type
property OnBrowserDestroyed : TOnBrowserDestroyedEvent read FOnBrowserDestroyed write FOnBrowserDestroyed;
property OnGetDelegateForPopupBrowserView : TOnGetDelegateForPopupBrowserViewEvent read FOnGetDelegateForPopupBrowserView write FOnGetDelegateForPopupBrowserView;
property OnPopupBrowserViewCreated : TOnPopupBrowserViewCreatedEvent read FOnPopupBrowserViewCreated write FOnPopupBrowserViewCreated;
property OnGetChromeToolbarType : TOnGetChromeToolbarTypeEvent read FOnGetChromeToolbarType write FOnGetChromeToolbarType;
end;
{$IFDEF FPC}
@ -147,6 +150,7 @@ begin
FOnBrowserDestroyed := nil;
FOnGetDelegateForPopupBrowserView := nil;
FOnPopupBrowserViewCreated := nil;
FOnGetChromeToolbarType := nil;
end;
procedure TCEFBrowserViewComponent.DestroyView;
@ -250,6 +254,12 @@ begin
FOnPopupBrowserViewCreated(self, browser_view, popup_browser_view, is_devtools, aResult);
end;
procedure TCEFBrowserViewComponent.doOnGetChromeToolbarType(var aChromeToolbarType: TCefChromeToolbarType);
begin
if assigned(FOnGetChromeToolbarType) then
FOnGetChromeToolbarType(self, aChromeToolbarType);
end;
{$IFDEF FPC}
procedure Register;
begin

View File

@ -63,6 +63,7 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
function GetChromeToolbarType: TCefChromeToolbarType;
public
class function UnWrap(data: Pointer): ICefBrowserViewDelegate;
@ -74,6 +75,7 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); virtual;
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); virtual;
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); virtual;
function GetChromeToolbarType: TCefChromeToolbarType; virtual;
procedure InitializeCEFMethods; override;
@ -92,6 +94,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -100,6 +103,7 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser); override;
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate); override;
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean); override;
function GetChromeToolbarType: TCefChromeToolbarType; override;
public
constructor Create(const events: ICefBrowserViewDelegateEvents); reintroduce;
@ -108,7 +112,7 @@ type
implementation
uses
uCEFLibFunctions, uCEFMiscFunctions, uCEFBrowserView, uCEFBrowser, uCEFClient;
uCEFLibFunctions, uCEFMiscFunctions, uCEFBrowserView, uCEFBrowser, uCEFClient, uCEFConstants;
// **************************************************************
@ -155,6 +159,11 @@ begin
ord(is_devtools)) <> 0);
end;
function TCefBrowserViewDelegateRef.GetChromeToolbarType: TCefChromeToolbarType;
begin
Result := PCefBrowserViewDelegate(FData)^.get_chrome_toolbar_type(PCefBrowserViewDelegate(FData));
end;
class function TCefBrowserViewDelegateRef.UnWrap(data: Pointer): ICefBrowserViewDelegate;
begin
if (data <> nil) then
@ -236,6 +245,17 @@ begin
Result := ord(TempResult);
end;
function cef_browserview_delegate_get_chrome_toolbar_type(self : PCefBrowserViewDelegate): TCefChromeToolbarType; stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
Result := CEF_CTT_NONE;
if (TempObject <> nil) and (TempObject is TCefBrowserViewDelegateOwn) then
Result := TCefBrowserViewDelegateOwn(TempObject).GetChromeToolbarType();
end;
constructor TCefBrowserViewDelegateOwn.Create;
begin
inherited CreateData(SizeOf(TCefBrowserViewDelegate));
@ -253,6 +273,7 @@ begin
on_browser_destroyed := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_browser_destroyed;
get_delegate_for_popup_browser_view := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_delegate_for_popup_browser_view;
on_popup_browser_view_created := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_on_popup_browser_view_created;
get_chrome_toolbar_type := {$IFDEF FPC}@{$ENDIF}cef_browserview_delegate_get_chrome_toolbar_type;
end;
end;
@ -276,6 +297,11 @@ begin
//
end;
function TCefBrowserViewDelegateOwn.GetChromeToolbarType: TCefChromeToolbarType;
begin
Result := CEF_CTT_NONE;
end;
// **************************************************************
// **************** TCustomBrowserViewDelegate ******************
@ -354,6 +380,17 @@ begin
end;
end;
procedure TCustomBrowserViewDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomBrowserViewDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomBrowserViewDelegate.OnFocus(const view: ICefView);
begin
try
@ -420,6 +457,18 @@ begin
end;
end;
function TCustomBrowserViewDelegate.GetChromeToolbarType: TCefChromeToolbarType;
begin
Result := inherited GetChromeToolbarType();
try
if (FEvents <> nil) then
ICefBrowserViewDelegateEvents(FEvents).doOnGetChromeToolbarType(Result);
except
on e : exception do
if CustomExceptionHandler('TCustomBrowserViewDelegate.GetChromeToolbarType', e) then raise;
end;
end;
end.

View File

@ -104,8 +104,8 @@ type
function CreateBrowser(aParentHandle: TCefWindowHandle;
aParentRect: TRect; const aWindowName: ustring = '';
const aContext: ICefRequestContext = nil;
const aExtraInfo: ICefDictionaryValue = nil): boolean; overload; override;
procedure CreateBrowser(const aWindowName: ustring); overload; override;
const aExtraInfo: ICefDictionaryValue = nil;
aForceAsPopup : boolean = False): boolean; overload; override;
function CreateBrowser(const aURL: ustring;
const aBrowserViewComp: TCEFBrowserViewComponent;
const aContext: ICefRequestContext = nil;
@ -369,19 +369,12 @@ end;
function TEmbeddedChromium.CreateBrowser(aParentHandle: TCefWindowHandle;
aParentRect: TRect; const aWindowName: ustring;
const aContext: ICefRequestContext; const aExtraInfo: ICefDictionaryValue): boolean;
const aContext: ICefRequestContext; const aExtraInfo: ICefDictionaryValue;
aForceAsPopup : boolean): boolean;
begin
FState := csCreatingBrowser;
Result := inherited CreateBrowser(aParentHandle, aParentRect, aWindowName,
aContext, aExtraInfo);
if Initialized then
DoCreated(0);
end;
procedure TEmbeddedChromium.CreateBrowser(const aWindowName: ustring);
begin
FState := csCreatingBrowser;
inherited CreateBrowser(aWindowName);
aContext, aExtraInfo, aForceAsPopup);
if Initialized then
DoCreated(0);
end;

View File

@ -87,6 +87,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -258,6 +259,17 @@ begin
end;
end;
procedure TCustomButtonDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefButtonDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomButtonDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomButtonDelegate.OnFocus(const view: ICefView);
begin
try

View File

@ -304,6 +304,14 @@ type
FOnExtensionCanAccessBrowser : TOnCanAccessBrowserEvent;
FOnExtensionGetExtensionResource : TOnGetExtensionResourceEvent;
// ICefPrintHandler
FOnPrintStart : TOnPrintStartEvent;
FOnPrintSettings : TOnPrintSettingsEvent;
FOnPrintDialog : TOnPrintDialogEvent;
FOnPrintJob : TOnPrintJobEvent;
FOnPrintReset : TOnPrintResetEvent;
FOnGetPDFPaperSize : TOnGetPDFPaperSizeEvent;
// Custom
FOnTextResultAvailable : TOnTextResultAvailableEvent;
FOnPdfPrintFinished : TOnPdfPrintFinishedEvent;
@ -399,8 +407,6 @@ type
procedure SetAcceptLanguageList(const aValue : ustring);
procedure SetAcceptCookies(const aValue : TCefCookiePref);
procedure SetBlock3rdPartyCookies(const aValue : boolean);
procedure SetOnRequestContextInitialized(const aValue : TOnRequestContextInitialized);
procedure SetOnBeforePluginLoad(const aValue : TOnBeforePluginLoad);
procedure SetMultiBrowserMode(aValue : boolean);
procedure SetNetworkPredictions(aValue : TCefNetworkPredictionOptions);
procedure SetQuicAllowed(aValue : boolean);
@ -419,7 +425,6 @@ type
procedure DestroyExtensionHandler;
procedure DestroyAllHandlersAndObservers;
procedure CreateReqContextHandler;
procedure CreateResourceRequestHandler;
procedure CreateMediaObserver;
procedure CreateDevToolsMsgObserver;
@ -622,6 +627,14 @@ type
function doOnExtensionCanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean;
function doOnExtensionGetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean;
// ICefPrintHandler
procedure doOnPrintStart(const browser: ICefBrowser);
procedure doOnPrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
procedure doOnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
procedure doOnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
procedure doOnPrintReset(const browser: ICefBrowser);
procedure doOnGetPDFPaperSize(const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult : TCefSize);
// Custom
procedure doCookiesDeleted(numDeleted : integer); virtual;
procedure doPdfPrintFinished(aResultOK : boolean); virtual;
@ -666,9 +679,9 @@ type
function MustCreateFindHandler : boolean; virtual;
function MustCreateResourceRequestHandler : boolean; virtual;
function MustCreateCookieAccessFilter : boolean; virtual;
function MustCreateRequestContextHandler : boolean; virtual;
function MustCreateMediaObserver : boolean; virtual;
function MustCreateExtensionHandler : boolean; virtual;
function MustCreatePrintHandler : boolean; virtual;
property ParentFormHandle : TCefWindowHandle read GetParentFormHandle;
@ -690,9 +703,8 @@ type
function SetNewBrowserParent(aNewParentHwnd : HWND) : boolean;
{$ENDIF MSWINDOWS}
function CreateBrowser(aParentHandle : TCefWindowHandle; aParentRect : TRect; const aWindowName : ustring = ''; const aContext : ICefRequestContext = nil; const aExtraInfo : ICefDictionaryValue = nil) : boolean; overload; virtual;
function CreateBrowser(aParentHandle : TCefWindowHandle; aParentRect : TRect; const aWindowName : ustring = ''; const aContext : ICefRequestContext = nil; const aExtraInfo : ICefDictionaryValue = nil; aForceAsPopup : boolean = False) : boolean; overload; virtual;
function CreateBrowser(const aURL : ustring; const aBrowserViewComp : TCEFBrowserViewComponent; const aContext : ICefRequestContext = nil; const aExtraInfo : ICefDictionaryValue = nil) : boolean; overload; virtual;
procedure CreateBrowser(const aWindowName : ustring); overload; virtual;
procedure LoadURL(const aURL : ustring; const aFrameName : ustring = ''); overload;
procedure LoadURL(const aURL : ustring; const aFrame : ICefFrame); overload;
@ -743,7 +755,6 @@ type
function VisitURLCookies(const url : ustring; includeHttpOnly : boolean = False; aID : integer = 0) : boolean;
function SetCookie(const url, name_, value, domain, path: ustring; secure, httponly, hasExpires: Boolean; const creation, lastAccess, expires: TDateTime; same_site : TCefCookieSameSite; priority : TCefCookiePriority; aSetImmediately : boolean = True; aID : integer = 0): Boolean;
function FlushCookieStore(aFlushImmediately : boolean = True) : boolean;
procedure UpdateSupportedSchemes(const aSchemes : TStrings; aIncludeDefaults : boolean = True);
procedure ShowDevTools(const inspectElementAt: TPoint; aWindowInfo: PCefWindowInfo);
procedure CloseDevTools; overload;
@ -1058,8 +1069,8 @@ type
property OnFindResult : TOnFindResult read FOnFindResult write FOnFindResult;
// ICefRequestContextHandler
property OnRequestContextInitialized : TOnRequestContextInitialized read FOnRequestContextInitialized write SetOnRequestContextInitialized;
property OnBeforePluginLoad : TOnBeforePluginLoad read FOnBeforePluginLoad write SetOnBeforePluginLoad;
property OnRequestContextInitialized : TOnRequestContextInitialized read FOnRequestContextInitialized write FOnRequestContextInitialized;
property OnBeforePluginLoad : TOnBeforePluginLoad read FOnBeforePluginLoad write FOnBeforePluginLoad;
property OnGetResourceRequestHandler_ReqCtxHdlr : TOnGetResourceRequestHandler read FOnGetResourceRequestHandler_ReqCtxHdlr write FOnGetResourceRequestHandler_ReqCtxHdlr;
// ICefMediaObserver
@ -1094,6 +1105,16 @@ type
property OnExtensionGetActiveBrowser : TOnGetActiveBrowserEvent read FOnExtensionGetActiveBrowser write FOnExtensionGetActiveBrowser;
property OnExtensionCanAccessBrowser : TOnCanAccessBrowserEvent read FOnExtensionCanAccessBrowser write FOnExtensionCanAccessBrowser;
property OnExtensionGetExtensionResource : TOnGetExtensionResourceEvent read FOnExtensionGetExtensionResource write FOnExtensionGetExtensionResource;
// ICefPrintHandler
{$IFDEF LINUX}
property OnPrintStart : TOnPrintStartEvent read FOnPrintStart write FOnPrintStart;
property OnPrintSettings : TOnPrintSettingsEvent read FOnPrintSettings write FOnPrintSettings;
property OnPrintDialog : TOnPrintDialogEvent read FOnPrintDialog write FOnPrintDialog;
property OnPrintJob : TOnPrintJobEvent read FOnPrintJob write FOnPrintJob;
property OnPrintReset : TOnPrintResetEvent read FOnPrintReset write FOnPrintReset;
property OnGetPDFPaperSize : TOnGetPDFPaperSizeEvent read FOnGetPDFPaperSize write FOnGetPDFPaperSize;
{$ENDIF}
end;
TBrowserInfo = class
@ -1535,13 +1556,6 @@ begin
DestroyClientHandler;
end;
procedure TChromiumCore.CreateReqContextHandler;
begin
if MustCreateRequestContextHandler and
(FReqContextHandler = nil) then
FReqContextHandler := TCustomRequestContextHandler.Create(self);
end;
procedure TChromiumCore.CreateMediaObserver;
begin
if MustCreateMediaObserver and
@ -1578,14 +1592,15 @@ begin
if not(csDesigning in ComponentState) then
begin
{$IFDEF MSWINDOWS}
FCompHandle := AllocateHWnd({$IFDEF FPC}@{$ENDIF}WndProc);
FCompHandle := AllocateHWnd({$IFDEF FPC}@{$ENDIF}WndProc);
{$ENDIF}
FBrowsers := TBrowserInfoList.Create;
FOptions := TChromiumOptions.Create;
FFontOptions := TChromiumFontOptions.Create;
FPDFPrintOptions := TPDFPrintOptions.Create;
FZoomStepCS := TCriticalSection.Create;
FBrowsersCS := TCriticalSection.Create;
FBrowsers := TBrowserInfoList.Create;
FOptions := TChromiumOptions.Create;
FFontOptions := TChromiumFontOptions.Create;
FPDFPrintOptions := TPDFPrintOptions.Create;
FZoomStepCS := TCriticalSection.Create;
FBrowsersCS := TCriticalSection.Create;
FReqContextHandler := TCustomRequestContextHandler.Create(self);
end;
except
on e : exception do
@ -1771,6 +1786,14 @@ begin
FOnExtensionCanAccessBrowser := nil;
FOnExtensionGetExtensionResource := nil;
// ICefPrintHandler
FOnPrintStart := nil;
FOnPrintSettings := nil;
FOnPrintDialog := nil;
FOnPrintJob := nil;
FOnPrintReset := nil;
FOnGetPDFPaperSize := nil;
// Custom
FOnTextResultAvailable := nil;
FOnPdfPrintFinished := nil;
@ -1802,9 +1825,10 @@ function TChromiumCore.CreateBrowser( aParentHandle : TCefWindowHandle;
aParentRect : TRect;
const aWindowName : ustring;
const aContext : ICefRequestContext;
const aExtraInfo : ICefDictionaryValue) : boolean;
const aExtraInfo : ICefDictionaryValue;
aForceAsPopup : boolean) : boolean;
var
TempNewContext, TempGlobalContext : ICefRequestContext;
TempNewContext, TempOldContext : ICefRequestContext;
begin
Result := False;
TempNewContext := nil;
@ -1825,24 +1849,23 @@ begin
CreateClientHandler(not(ValidCefWindowHandle(aParentHandle))) then
begin
GetSettings(FBrowserSettings);
InitializeWindowInfo(aParentHandle, aParentRect, aWindowName);
if aForceAsPopup then
WindowInfoAsPopUp(FWindowInfo, aParentHandle, aWindowName)
else
InitializeWindowInfo(aParentHandle, aParentRect, aWindowName);
CreateResourceRequestHandler;
CreateMediaObserver;
CreateDevToolsMsgObserver;
CreateExtensionHandler;
if (aContext = nil) then
begin
CreateReqContextHandler;
if (FReqContextHandler <> nil) then
begin
TempGlobalContext := TCefRequestContextRef.Global();
TempNewContext := TCefRequestContextRef.Shared(TempGlobalContext, FReqContextHandler);
end;
end
TempOldContext := TCefRequestContextRef.Global()
else
TempNewContext := aContext;
TempOldContext := aContext;
TempNewContext := TCefRequestContextRef.Shared(TempOldContext, FReqContextHandler);
if GlobalCEFApp.MultiThreadedMessageLoop then
Result := CreateBrowserHost(@FWindowInfo, FDefaultUrl, @FBrowserSettings, aExtraInfo, TempNewContext)
@ -1854,8 +1877,8 @@ begin
if CustomExceptionHandler('TChromiumCore.CreateBrowser', e) then raise;
end;
finally
TempGlobalContext := nil;
TempNewContext := nil;
TempOldContext := nil;
TempNewContext := nil;
end;
end;
@ -1864,9 +1887,10 @@ function TChromiumCore.CreateBrowser(const aURL : ustring;
const aContext : ICefRequestContext;
const aExtraInfo : ICefDictionaryValue) : boolean;
var
TempNewContext, TempGlobalContext : ICefRequestContext;
TempNewContext, TempOldContext : ICefRequestContext;
begin
Result := False;
Result := False;
TempNewContext := nil;
try
try
@ -1891,17 +1915,11 @@ begin
CreateExtensionHandler;
if (aContext = nil) then
begin
CreateReqContextHandler;
if (FReqContextHandler <> nil) then
begin
TempGlobalContext := TCefRequestContextRef.Global();
TempNewContext := TCefRequestContextRef.Shared(TempGlobalContext, FReqContextHandler);
end;
end
TempOldContext := TCefRequestContextRef.Global()
else
TempNewContext := aContext;
TempOldContext := aContext;
TempNewContext := TCefRequestContextRef.Shared(TempOldContext, FReqContextHandler);
Result := aBrowserViewComp.CreateBrowserView(FHandler, aURL, FBrowserSettings, aExtraInfo, TempNewContext);
end;
@ -1910,39 +1928,8 @@ begin
if CustomExceptionHandler('TChromiumCore.CreateBrowser', e) then raise;
end;
finally
TempGlobalContext := nil;
TempNewContext := nil;
end;
end;
procedure TChromiumCore.CreateBrowser(const aWindowName : ustring);
var
TempHandle : TCefWindowHandle;
begin
try
// GlobalCEFApp.GlobalContextInitialized has to be TRUE before creating any browser
// even if you use a custom request context.
// If you create a browser in the initialization of your app, make sure you call this
// function when GlobalCEFApp.GlobalContextInitialized is TRUE.
// Use the GlobalCEFApp.OnContextInitialized event to know when
// GlobalCEFApp.GlobalContextInitialized is set to TRUE.
if (BrowserId = 0) and
(GlobalCEFApp <> nil) and
GlobalCEFApp.GlobalContextInitialized and
CreateClientHandler(False) then
begin
GetSettings(FBrowserSettings);
InitializeWindowHandle(TempHandle);
WindowInfoAsPopUp(FWindowInfo, TempHandle, aWindowName);
CreateResourceRequestHandler;
CreateMediaObserver;
CreateDevToolsMsgObserver;
CreateExtensionHandler;
CreateBrowserHostSync(@FWindowInfo, FDefaultUrl, @FBrowserSettings, nil, nil);
end;
except
on e : exception do
if CustomExceptionHandler('TChromiumCore.CreateBrowser', e) then raise;
TempOldContext := nil;
TempNewContext := nil;
end;
end;
@ -2330,7 +2317,6 @@ begin
aSettings.plugins := FOptions.Plugins;
aSettings.universal_access_from_file_urls := FOptions.UniversalAccessFromFileUrls;
aSettings.file_access_from_file_urls := FOptions.FileAccessFromFileUrls;
aSettings.web_security := FOptions.WebSecurity;
aSettings.image_loading := FOptions.ImageLoading;
aSettings.image_shrink_standalone_to_fit := FOptions.ImageShrinkStandaloneToFit;
aSettings.text_area_resize := FOptions.TextAreaResize;
@ -2346,38 +2332,9 @@ end;
procedure TChromiumCore.InitializeSettings(var aSettings : TCefBrowserSettings);
begin
aSettings.size := SizeOf(TCefBrowserSettings);
aSettings.windowless_frame_rate := 30;
aSettings.standard_font_family := CefString('');
aSettings.fixed_font_family := CefString('');
aSettings.serif_font_family := CefString('');
aSettings.sans_serif_font_family := CefString('');
aSettings.cursive_font_family := CefString('');
aSettings.fantasy_font_family := CefString('');
aSettings.default_font_size := 0;
aSettings.default_fixed_font_size := 0;
aSettings.minimum_font_size := 0;
aSettings.minimum_logical_font_size := 0;
aSettings.remote_fonts := STATE_DEFAULT;
aSettings.default_encoding := CefString('');
aSettings.javascript := STATE_DEFAULT;
aSettings.javascript_close_windows := STATE_DEFAULT;
aSettings.javascript_access_clipboard := STATE_DEFAULT;
aSettings.javascript_dom_paste := STATE_DEFAULT;
aSettings.plugins := STATE_DEFAULT;
aSettings.universal_access_from_file_urls := STATE_DEFAULT;
aSettings.file_access_from_file_urls := STATE_DEFAULT;
aSettings.web_security := STATE_DEFAULT;
aSettings.image_loading := STATE_DEFAULT;
aSettings.image_shrink_standalone_to_fit := STATE_DEFAULT;
aSettings.text_area_resize := STATE_DEFAULT;
aSettings.tab_to_links := STATE_DEFAULT;
aSettings.local_storage := STATE_DEFAULT;
aSettings.databases := STATE_DEFAULT;
aSettings.application_cache := STATE_DEFAULT;
aSettings.webgl := STATE_DEFAULT;
aSettings.background_color := 0;
aSettings.accept_language_list := CefString('');
FillChar(aSettings, SizeOf(TCefBrowserSettings), 0);
aSettings.size := SizeOf(TCefBrowserSettings);
aSettings.windowless_frame_rate := CEF_OSR_FRAMERATE_DEFAULT; // Use CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT if the shared textures are enabled.
end;
// Leave aFrameName empty to load the URL in the main frame
@ -3281,20 +3238,6 @@ begin
end;
end;
procedure TChromiumCore.SetOnRequestContextInitialized(const aValue : TOnRequestContextInitialized);
begin
FOnRequestContextInitialized := aValue;
CreateReqContextHandler;
end;
procedure TChromiumCore.SetOnBeforePluginLoad(const aValue : TOnBeforePluginLoad);
begin
FOnBeforePluginLoad := aValue;
CreateReqContextHandler;
end;
procedure TChromiumCore.UpdateHostZoomLevel(const aValue : double);
begin
if Initialized then
@ -3611,29 +3554,6 @@ begin
end;
end;
procedure TChromiumCore.UpdateSupportedSchemes(const aSchemes : TStrings; aIncludeDefaults : boolean);
var
TempManager : ICefCookieManager;
TempContext : ICefRequestContext;
begin
if Initialized then
begin
TempContext := Browser.Host.RequestContext;
if (TempContext <> nil) then
begin
TempManager := TempContext.GetCookieManager(nil);
if (TempManager <> nil) then
try
TempManager.SetSupportedSchemes(aSchemes, aIncludeDefaults, nil);
finally
TempManager := nil;
end;
end;
end;
end;
// If aClearImmediately is false then OnCertificateExceptionsCleared is triggered when the exceptions are cleared
function TChromiumCore.ClearCertificateExceptions(aClearImmediately : boolean) : boolean;
var
@ -3960,7 +3880,7 @@ begin
TempRequestContext := RequestContext;
if (TempRequestContext <> nil) then
Result := TempRequestContext.MediaRouter
Result := TempRequestContext.GetMediaRouter(nil)
else
Result := nil;
end;
@ -4784,14 +4704,6 @@ begin
assigned(FOnCanSaveCookie);
end;
function TChromiumCore.MustCreateRequestContextHandler : boolean;
begin
Result := assigned(FOnRequestContextInitialized) or
assigned(FOnBeforePluginLoad) or
assigned(FOnGetResourceRequestHandler_ReqCtxHdlr) or
MustCreateResourceRequestHandler;
end;
function TChromiumCore.MustCreateMediaObserver : boolean;
begin
Result := assigned(FOnSinks) or
@ -4833,6 +4745,16 @@ begin
assigned(FOnExtensionGetExtensionResource);
end;
function TChromiumCore.MustCreatePrintHandler : boolean;
begin
Result := assigned(FOnPrintStart) or
assigned(FOnPrintSettings) or
assigned(FOnPrintDialog) or
assigned(FOnPrintJob) or
assigned(FOnPrintReset) or
assigned(FOnGetPDFPaperSize);
end;
{$IFDEF MSWINDOWS}
procedure TChromiumCore.PrefsAvailableMsg(aResultOK : boolean);
begin
@ -4929,14 +4851,15 @@ begin
if Initialized then
begin
InitializeSettings(FDevBrowserSettings);
if aWindowInfo = nil then
if (aWindowInfo = nil) then
begin
InitializeWindowHandle(TempHandle);
DefaultInitializeDevToolsWindowInfo(TempHandle, Rect(0, 0, 0, 0), '');
end
else
if aWindowInfo <> @FDevWindowInfo then
FDevWindowInfo := aWindowInfo^;
if (aWindowInfo <> @FDevWindowInfo) then
FDevWindowInfo := aWindowInfo^;
TempClient := TCustomClientHandler.Create(Self, True);
@ -5734,6 +5657,53 @@ begin
FOnExtensionGetExtensionResource(self, extension, browser, file_, callback, Result);
end;
procedure TChromiumCore.doOnPrintStart(const browser: ICefBrowser);
begin
if assigned(FOnPrintStart) then
FOnPrintStart(self, browser);
end;
procedure TChromiumCore.doOnPrintSettings(const browser : ICefBrowser;
const settings : ICefPrintSettings;
getDefaults : boolean);
begin
if assigned(FOnPrintSettings) then
FOnPrintSettings(self, browser, settings, getDefaults);
end;
procedure TChromiumCore.doOnPrintDialog(const browser : ICefBrowser;
hasSelection : boolean;
const callback : ICefPrintDialogCallback;
var aResult : boolean);
begin
if assigned(FOnPrintDialog) then
FOnPrintDialog(self, browser, hasSelection, callback, aResult);
end;
procedure TChromiumCore.doOnPrintJob(const browser : ICefBrowser;
const documentName : ustring;
const PDFFilePath : ustring;
const callback : ICefPrintJobCallback;
var aResult : boolean);
begin
if assigned(FOnPrintJob) then
FOnPrintJob(self, browser, documentName, PDFFilePath, callback, aResult);
end;
procedure TChromiumCore.doOnPrintReset(const browser: ICefBrowser);
begin
if assigned(FOnPrintReset) then
FOnPrintReset(self, browser);
end;
procedure TChromiumCore.doOnGetPDFPaperSize(const browser : ICefBrowser;
deviceUnitsPerInch : Integer;
var aResult : TCefSize);
begin
if assigned(FOnGetPDFPaperSize) then
FOnGetPDFPaperSize(self, browser, deviceUnitsPerInch, aResult);
end;
procedure TChromiumCore.doOnFullScreenModeChange(const browser : ICefBrowser;
fullscreen : Boolean);
begin

View File

@ -200,6 +200,14 @@ type
TOnCanAccessBrowserEvent = procedure(Sender: TObject; const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser; var aResult : boolean) of object;
TOnGetExtensionResourceEvent = procedure(Sender: TObject; const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback; var aResult : boolean) of object;
// ICefPrintHandler
TOnPrintStartEvent = procedure(Sender: TObject; const browser: ICefBrowser) of object;
TOnPrintSettingsEvent = procedure(Sender: TObject; const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean) of object;
TOnPrintDialogEvent = procedure(Sender: TObject; const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean) of object;
TOnPrintJobEvent = procedure(Sender: TObject; const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean) of object;
TOnPrintResetEvent = procedure(Sender: TObject; const browser: ICefBrowser) of object;
TOnGetPDFPaperSizeEvent = procedure(Sender: TObject; const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult : TCefSize) of object;
// Custom
TOnTextResultAvailableEvent = procedure(Sender: TObject; const aText : ustring) of object;
TOnPdfPrintFinishedEvent = procedure(Sender: TObject; aResultOK : boolean) of object;

View File

@ -54,7 +54,7 @@ uses
{$ELSE}
Classes,
{$ENDIF}
uCEFTypes;
uCEFTypes, uCEFConstants;
type
TChromiumOptions = class(TPersistent)
@ -67,7 +67,6 @@ type
FPlugins : TCefState;
FUniversalAccessFromFileUrls : TCefState;
FFileAccessFromFileUrls : TCefState;
FWebSecurity : TCefState;
FImageLoading : TCefState;
FImageShrinkStandaloneToFit : TCefState;
FTextAreaResize : TCefState;
@ -90,7 +89,6 @@ type
property Plugins : TCefState read FPlugins write FPlugins default STATE_DEFAULT;
property UniversalAccessFromFileUrls : TCefState read FUniversalAccessFromFileUrls write FUniversalAccessFromFileUrls default STATE_DEFAULT;
property FileAccessFromFileUrls : TCefState read FFileAccessFromFileUrls write FFileAccessFromFileUrls default STATE_DEFAULT;
property WebSecurity : TCefState read FWebSecurity write FWebSecurity default STATE_DEFAULT;
property ImageLoading : TCefState read FImageLoading write FImageLoading default STATE_DEFAULT;
property ImageShrinkStandaloneToFit : TCefState read FImageShrinkStandaloneToFit write FImageShrinkStandaloneToFit default STATE_DEFAULT;
property TextAreaResize : TCefState read FTextAreaResize write FTextAreaResize default STATE_DEFAULT;
@ -101,14 +99,15 @@ type
property Webgl : TCefState read FWebgl write FWebgl default STATE_DEFAULT;
property BackgroundColor : TCefColor read FBackgroundColor write FBackgroundColor default 0;
property AcceptLanguageList : ustring read FAcceptLanguageList write FAcceptLanguageList;
property WindowlessFrameRate : Integer read FWindowlessFrameRate write FWindowlessFrameRate default 30;
property WindowlessFrameRate : Integer read FWindowlessFrameRate write FWindowlessFrameRate default CEF_OSR_FRAMERATE_DEFAULT;
end;
implementation
constructor TChromiumOptions.Create;
begin
FWindowlessFrameRate := 30;
FWindowlessFrameRate := CEF_OSR_FRAMERATE_DEFAULT; // Use CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT if the shared textures are enabled.
FJavascript := STATE_DEFAULT;
FJavascriptCloseWindows := STATE_DEFAULT;
FJavascriptAccessClipboard := STATE_DEFAULT;
@ -116,7 +115,6 @@ begin
FPlugins := STATE_DEFAULT;
FUniversalAccessFromFileUrls := STATE_DEFAULT;
FFileAccessFromFileUrls := STATE_DEFAULT;
FWebSecurity := STATE_DEFAULT;
FImageLoading := STATE_DEFAULT;
FImageShrinkStandaloneToFit := STATE_DEFAULT;
FTextAreaResize := STATE_DEFAULT;

View File

@ -66,6 +66,7 @@ type
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
procedure GetLoadHandler(var aHandler : ICefLoadHandler); virtual;
procedure GetPrintHandler(var aHandler : ICefPrintHandler); virtual;
procedure GetRenderHandler(var aHandler : ICefRenderHandler); virtual;
procedure GetRequestHandler(var aHandler : ICefRequestHandler); virtual;
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean; virtual;
@ -90,6 +91,7 @@ type
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); virtual;
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); virtual;
procedure GetLoadHandler(var aHandler : ICefLoadHandler); virtual;
procedure GetPrintHandler(var aHandler : ICefPrintHandler); virtual;
procedure GetRenderHandler(var aHandler : ICefRenderHandler); virtual;
procedure GetRequestHandler(var aHandler : ICefRequestHandler); virtual;
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean; virtual;
@ -117,6 +119,7 @@ type
FRequestHandler : ICefRequestHandler;
FDragHandler : ICefDragHandler;
FFindHandler : ICefFindHandler;
FPrintHandler : ICefPrintHandler;
procedure GetAudioHandler(var aHandler : ICefAudioHandler); override;
procedure GetContextMenuHandler(var aHandler : ICefContextMenuHandler); override;
@ -130,6 +133,7 @@ type
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler); override;
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler); override;
procedure GetLoadHandler(var aHandler : ICefLoadHandler); override;
procedure GetPrintHandler(var aHandler : ICefPrintHandler); override;
procedure GetRenderHandler(var aHandler : ICefRenderHandler); override;
procedure GetRequestHandler(var aHandler : ICefRequestHandler); override;
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean; override;
@ -154,7 +158,8 @@ uses
uCEFFocusHandler, uCEFContextMenuHandler, uCEFDialogHandler, uCEFKeyboardHandler,
uCEFDisplayHandler, uCEFDownloadHandler, uCEFJsDialogHandler,
uCEFLifeSpanHandler, uCEFRequestHandler, uCEFRenderHandler, uCEFDragHandler,
uCEFFindHandler, uCEFConstants, uCEFApplicationCore, uCEFFrame, uCEFAudioHandler;
uCEFFindHandler, uCEFConstants, uCEFApplicationCore, uCEFFrame, uCEFAudioHandler,
uCEFPrintHandler;
// ******************************************************
@ -229,6 +234,11 @@ begin
aHandler := nil;
end;
procedure TCefClientRef.GetPrintHandler(var aHandler : ICefPrintHandler);
begin
aHandler := nil;
end;
procedure TCefClientRef.GetRenderHandler(var aHandler : ICefRenderHandler);
begin
aHandler := nil;
@ -459,7 +469,7 @@ begin
end;
end;
function cef_client_own_get_get_render_handler(self: PCefClient): PCefRenderHandler; stdcall;
function cef_client_own_get_render_handler(self: PCefClient): PCefRenderHandler; stdcall;
var
TempObject : TObject;
TempHandler : ICefRenderHandler;
@ -493,6 +503,24 @@ begin
end;
end;
function cef_client_own_get_print_handler(self: PCefClient): PCefPrintHandler; stdcall;
var
TempObject : TObject;
TempHandler : ICefPrintHandler;
begin
Result := nil;
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefClientOwn) then
try
TempHandler := nil;
TCefClientOwn(TempObject).GetPrintHandler(TempHandler);
if (TempHandler <> nil) then Result := TempHandler.Wrap;
finally
TempHandler := nil;
end;
end;
function cef_client_own_on_process_message_received(self : PCefClient;
browser : PCefBrowser;
frame : PCefFrame;
@ -529,7 +557,8 @@ begin
get_keyboard_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_keyboard_handler;
get_life_span_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_life_span_handler;
get_load_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_load_handler;
get_render_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_get_render_handler;
get_print_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_print_handler;
get_render_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_render_handler;
get_request_handler := {$IFDEF FPC}@{$ENDIF}cef_client_own_get_request_handler;
on_process_message_received := {$IFDEF FPC}@{$ENDIF}cef_client_own_on_process_message_received;
end;
@ -595,6 +624,11 @@ begin
aHandler := nil;
end;
procedure TCefClientOwn.GetPrintHandler(var aHandler : ICefPrintHandler);
begin
aHandler := nil;
end;
procedure TCefClientOwn.GetRenderHandler(var aHandler : ICefRenderHandler);
begin
aHandler := nil;
@ -654,6 +688,7 @@ begin
if events.MustCreateRequestHandler then FRequestHandler := TCustomRequestHandler.Create(events);
if events.MustCreateDragHandler then FDragHandler := TCustomDragHandler.Create(events);
if events.MustCreateFindHandler then FFindHandler := TCustomFindHandler.Create(events);
if events.MustCreatePrintHandler then FPrintHandler := TCustomPrintHandler.Create(events);
end;
end;
end;
@ -683,6 +718,7 @@ begin
if (FRenderHandler <> nil) then FRenderHandler.RemoveReferences;
if (FDragHandler <> nil) then FDragHandler.RemoveReferences;
if (FFindHandler <> nil) then FFindHandler.RemoveReferences;
if (FPrintHandler <> nil) then FPrintHandler.RemoveReferences;
end;
procedure TCustomClientHandler.InitializeVars;
@ -701,6 +737,7 @@ begin
FRenderHandler := nil;
FDragHandler := nil;
FFindHandler := nil;
FPrintHandler := nil;
FEvents := nil;
end;
@ -800,6 +837,14 @@ begin
aHandler := nil;
end;
procedure TCustomClientHandler.GetPrintHandler(var aHandler : ICefPrintHandler);
begin
if (FPrintHandler <> nil) then
aHandler := FPrintHandler
else
aHandler := nil;
end;
procedure TCustomClientHandler.GetRenderHandler(var aHandler : ICefRenderHandler);
begin
if (FRenderHandler <> nil) then

View File

@ -552,6 +552,11 @@ const
CEF_TFC_DELETE = 5;
CEF_TFC_SELECT_ALL = 6;
// /include/internal/cef_types.h (cef_chrome_toolbar_type_t)
CEF_CTT_NONE = 1;
CEF_CTT_NORMAL = 2;
CEF_CTT_LOCATION = 3;
// /include/cef_api_hash.h (used as "cef_api_hash" parameters)
CEF_API_HASH_PLATFORM = 0;
CEF_API_HASH_UNIVERSAL = 1;
@ -638,9 +643,14 @@ const
WM_POINTERUP = $0247;
{$IFEND}
// Default values for the Windowsless framerate setting in TChromiumOptions
// The values are frames per second.
CEF_OSR_FRAMERATE_DEFAULT = 30; // Used when the shared textures are disabled.
CEF_OSR_SHARED_TEXTURES_FRAMERATE_DEFAULT = 60; // Used when the shared textures are enabled.
CEF_TIMER_MINIMUM = $0000000A;
CEF_TIMER_MAXIMUM = $7FFFFFFF;
CEF_TIMER_MAXDELAY = 1000 div 30; // 30fps
CEF_TIMER_MAXDELAY = 1000 div CEF_OSR_FRAMERATE_DEFAULT;
CEF_TIMER_DEPLETEWORK_CYCLES = 10;
CEF_TIMER_DEPLETEWORK_DELAY = 50;

View File

@ -79,7 +79,6 @@ type
function IsSpellCheckEnabled: Boolean;
function GetEditStateFlags: TCefContextMenuEditStateFlags;
function IsCustomMenu: Boolean;
function IsPepperMenu: Boolean;
public
class function UnWrap(data: Pointer): ICefContextMenuParams;
end;
@ -193,11 +192,6 @@ begin
Result := PCefContextMenuParams(FData)^.is_editable(PCefContextMenuParams(FData)) <> 0;
end;
function TCefContextMenuParamsRef.IsPepperMenu: Boolean;
begin
Result := PCefContextMenuParams(FData)^.is_pepper_menu(PCefContextMenuParams(FData)) <> 0;
end;
function TCefContextMenuParamsRef.IsSpellCheckEnabled: Boolean;
begin
Result := PCefContextMenuParams(FData)^.is_spell_check_enabled(PCefContextMenuParams(FData)) <> 0;

View File

@ -59,8 +59,6 @@ uses
type
TCefCookieManagerRef = class(TCefBaseRefCountedRef, ICefCookieManager)
protected
procedure SetSupportedSchemes(const schemes: TStrings; include_defaults: boolean; const callback: ICefCompletionCallback);
procedure SetSupportedSchemesProc(const schemes: TStrings; include_defaults: boolean; const callback: TCefCompletionCallbackProc);
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
function VisitUrlCookies(const url: ustring; includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
@ -173,39 +171,6 @@ begin
TCefFastSetCookieCallback.Create(callback));
end;
procedure TCefCookieManagerRef.SetSupportedSchemes(const schemes : TStrings;
include_defaults : boolean;
const callback : ICefCompletionCallback);
var
TempSL : ICefStringList;
TempHandle : TCefStringList;
begin
try
if (schemes <> nil) and (schemes.count > 0) then
begin
TempSL := TCefStringListOwn.Create;
TempSL.AddStrings(schemes);
TempHandle := TempSL.Handle;
end
else
TempHandle := nil;
PCefCookieManager(FData)^.set_supported_schemes(PCefCookieManager(FData),
TempHandle,
ord(include_defaults),
CefGetData(callback));
finally
TempSL := nil;
end;
end;
procedure TCefCookieManagerRef.SetSupportedSchemesProc(const schemes : TStrings;
include_defaults : boolean;
const callback : TCefCompletionCallbackProc);
begin
SetSupportedSchemes(schemes, include_defaults, TCefFastCompletionCallback.Create(callback));
end;
class function TCefCookieManagerRef.UnWrap(data: Pointer): ICefCookieManager;
begin
if (data <> nil) then

View File

@ -146,7 +146,8 @@ procedure TCustomFindHandler.OnFindResult(const browser : ICefBrowser
activeMatchOrdinal : Integer;
finalUpdate : Boolean);
begin
if (FEvents <> nil) then IChromiumEvents(FEvents).doOnFindResult(browser, identifier, count, selectionRect, activeMatchOrdinal, finalUpdate);
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnFindResult(browser, identifier, count, selectionRect, activeMatchOrdinal, finalUpdate);
end;
end.

View File

@ -220,12 +220,8 @@ type
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};
TOnPrintStartEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnPrintSettingsEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnPrintDialogEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnPrintJobEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnPrintResetEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(const browser: ICefBrowser) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
TOnGetPDFPaperSizeEvent = {$IFDEF DELPHI12_UP}reference to{$ENDIF} procedure(deviceUnitsPerInch: Integer; var aResult : TCefSize) {$IFNDEF DELPHI12_UP}{$IFNDEF FPC}of object{$ENDIF}{$ENDIF};
// *******************************************
// **** Callback procedures and functions ****
@ -458,6 +454,14 @@ type
function doOnExtensionCanAccessBrowser(const extension: ICefExtension; const browser: ICefBrowser; include_incognito: boolean; const target_browser: ICefBrowser): boolean;
function doOnExtensionGetExtensionResource(const extension: ICefExtension; const browser: ICefBrowser; const file_: ustring; const callback: ICefGetExtensionResourceCallback): boolean;
// ICefPrintHandler
procedure doOnPrintStart(const browser: ICefBrowser);
procedure doOnPrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean);
procedure doOnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult : boolean);
procedure doOnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult : boolean);
procedure doOnPrintReset(const browser: ICefBrowser);
procedure doOnGetPDFPaperSize(const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult : TCefSize);
// Custom
procedure doCookiesDeleted(numDeleted : integer);
procedure doPdfPrintFinished(aResultOK : boolean);
@ -501,8 +505,8 @@ type
function MustCreateFindHandler : boolean;
function MustCreateResourceRequestHandler : boolean;
function MustCreateCookieAccessFilter : boolean;
function MustCreateRequestContextHandler : boolean;
function MustCreateMediaObserver : boolean;
function MustCreatePrintHandler : boolean;
end;
IServerEvents = interface
@ -1438,10 +1442,8 @@ type
// /include/capi/cef_browser_process_handler_capi.h (cef_browser_process_handler_t)
ICefBrowserProcessHandler = interface(ICefBaseRefCounted)
['{27291B7A-C0AE-4EE0-9115-15C810E22F6C}']
procedure GetCookieableSchemes(var schemes: TStringList; var include_defaults : boolean);
procedure OnContextInitialized;
procedure OnBeforeChildProcessLaunch(const commandLine: ICefCommandLine);
procedure GetPrintHandler(var aHandler : ICefPrintHandler);
procedure OnScheduleMessagePumpWork(const delayMs: Int64);
procedure GetDefaultClient(var aClient : ICefClient);
@ -1503,8 +1505,6 @@ type
// /include/capi/cef_cookie_capi.h (cef_cookie_manager_t)
ICefCookieManager = Interface(ICefBaseRefCounted)
['{CC1749E6-9AD3-4283-8430-AF6CBF3E8785}']
procedure SetSupportedSchemes(const schemes: TStrings; include_defaults: boolean; const callback: ICefCompletionCallback);
procedure SetSupportedSchemesProc(const schemes: TStrings; include_defaults: boolean; const callback: TCefCompletionCallbackProc);
function VisitAllCookies(const visitor: ICefCookieVisitor): Boolean;
function VisitAllCookiesProc(const visitor: TCefCookieVisitorProc): Boolean;
function VisitUrlCookies(const url: ustring; includeHttpOnly: Boolean; const visitor: ICefCookieVisitor): Boolean;
@ -1613,7 +1613,6 @@ type
function IsSpellCheckEnabled: Boolean;
function GetEditStateFlags: TCefContextMenuEditStateFlags;
function IsCustomMenu: Boolean;
function IsPepperMenu: Boolean;
property XCoord : Integer read GetXCoord;
property YCoord : Integer read GetYCoord;
@ -2091,6 +2090,7 @@ type
procedure GetKeyboardHandler(var aHandler : ICefKeyboardHandler);
procedure GetLifeSpanHandler(var aHandler : ICefLifeSpanHandler);
procedure GetLoadHandler(var aHandler : ICefLoadHandler);
procedure GetPrintHandler(var aHandler : ICefPrintHandler);
procedure GetRenderHandler(var aHandler : ICefRenderHandler);
procedure GetRequestHandler(var aHandler : ICefRequestHandler);
function OnProcessMessageReceived(const browser: ICefBrowser; const frame: ICefFrame; sourceProcess: TCefProcessId; const message_ : ICefProcessMessage): Boolean;
@ -2261,11 +2261,10 @@ type
function HasExtension(const extension_id: ustring): boolean;
function GetExtensions(const extension_ids: TStringList): boolean;
function GetExtension(const extension_id: ustring): ICefExtension;
function GetMediaRouter: ICefMediaRouter;
function GetMediaRouter(const callback: ICefCompletionCallback): ICefMediaRouter;
property CachePath : ustring read GetCachePath;
property IsGlobalContext : boolean read IsGlobal;
property MediaRouter : ICefMediaRouter read GetMediaRouter;
end;
// TCefPrintSettings
@ -2329,7 +2328,7 @@ type
procedure OnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult: boolean);
procedure OnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult: boolean);
procedure OnPrintReset(const browser: ICefBrowser);
procedure GetPDFPaperSize(deviceUnitsPerInch: integer; var aResult: TCefSize);
procedure GetPDFPaperSize(const browser: ICefBrowser; deviceUnitsPerInch: integer; var aResult: TCefSize);
procedure RemoveReferences; // custom procedure to clear all references
end;
@ -2631,6 +2630,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
procedure OnWindowChanged(const view: ICefView; added: boolean);
procedure OnFocus(const view: ICefView);
procedure OnBlur(const view: ICefView);
end;
@ -2644,6 +2644,7 @@ type
procedure doOnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
procedure doOnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
procedure doOnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
procedure doOnWindowChanged(const view: ICefView; added: boolean);
procedure doOnFocus(const view: ICefView);
procedure doOnBlur(const view: ICefView);
@ -2764,6 +2765,7 @@ type
ICefBrowserView = interface(ICefView)
['{A617EE5D-B933-4E14-9FC0-7E88E9B6C051}']
function GetBrowser : ICefBrowser;
function GetChromeToolbar : ICefView;
procedure SetPreferAccelerators(prefer_accelerators: boolean);
end;
@ -2775,6 +2777,9 @@ type
procedure OnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure OnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
procedure OnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
function GetChromeToolbarType: TCefChromeToolbarType;
property ChromeToolbarType: TCefChromeToolbarType read GetChromeToolbarType;
end;
ICefBrowserViewDelegateEvents = interface(ICefViewDelegateEvents)
@ -2783,6 +2788,7 @@ type
procedure doOnBrowserDestroyed(const browser_view: ICefBrowserView; const browser: ICefBrowser);
procedure doOnGetDelegateForPopupBrowserView(const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate);
procedure doOnPopupBrowserViewCreated(const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean);
procedure doOnGetChromeToolbarType(var aChromeToolbarType: TCefChromeToolbarType);
end;
// TCefButton

View File

@ -115,7 +115,7 @@ var
cef_image_create : function : PCefImage; cdecl;
// /include/capi/cef_media_router_capi.h
cef_media_router_get_global : function : PCefMediaRouter; cdecl;
cef_media_router_get_global : function(callback: PCefCompletionCallback) : PCefMediaRouter; cdecl;
// /include/capi/cef_menu_model_capi.h
cef_menu_model_create : function(delegate: PCefMenuModelDelegate): PCefMenuModel; cdecl;

View File

@ -115,7 +115,7 @@ end;
class function TCefMediaRouterRef.Global: ICefMediaRouter;
begin
Result := UnWrap(cef_media_router_get_global());
Result := UnWrap(cef_media_router_get_global(nil));
end;
end.

View File

@ -85,6 +85,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -247,6 +248,17 @@ begin
end;
end;
procedure TCustomMenuButtonDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefMenuButtonDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomMenuButtonDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomMenuButtonDelegate.OnFocus(const view: ICefView);
begin
try

View File

@ -212,7 +212,7 @@ function SplitLongString(aSrcString : string) : string;
function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean;
function CheckSubprocessPath(const aSubprocessPath : string; var aMissingFiles : string) : boolean;
function CheckLocales(const aLocalesDirPath : string; var aMissingFiles : string; const aLocalesRequired : string = '') : boolean;
function CheckResources(const aResourcesDirPath : string; var aMissingFiles : string; aCheckDevResources: boolean = True; aCheckExtensions: boolean = True) : boolean;
function CheckResources(const aResourcesDirPath : string; var aMissingFiles : string) : boolean;
function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean;
{$IFDEF MSWINDOWS}
function CheckDLLVersion(const aDLLFile : ustring; aMajor, aMinor, aRelease, aBuild : uint16) : boolean;
@ -1141,7 +1141,7 @@ begin
end;
end;
function CheckResources(const aResourcesDirPath : string; var aMissingFiles : string; aCheckDevResources, aCheckExtensions: boolean) : boolean;
function CheckResources(const aResourcesDirPath : string; var aMissingFiles : string) : boolean;
var
TempDir : string;
TempList : TStringList;
@ -1156,12 +1156,9 @@ begin
TempList := TStringList.Create;
TempList.Add(TempDir + 'snapshot_blob.bin');
TempList.Add(TempDir + 'v8_context_snapshot.bin');
TempList.Add(TempDir + 'cef.pak');
TempList.Add(TempDir + 'cef_100_percent.pak');
TempList.Add(TempDir + 'cef_200_percent.pak');
if aCheckExtensions then TempList.Add(TempDir + 'cef_extensions.pak');
if aCheckDevResources then TempList.Add(TempDir + 'devtools_resources.pak');
TempList.Add(TempDir + 'resources.pak');
TempList.Add(TempDir + 'chrome_100_percent.pak');
TempList.Add(TempDir + 'chrome_200_percent.pak');
if TempExists then
Result := CheckFilesExist(TempList, aMissingFiles)

View File

@ -78,6 +78,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -190,6 +191,17 @@ begin
end;
end;
procedure TCustomPanelDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefPanelDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomPanelDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomPanelDelegate.OnFocus(const view: ICefView);
begin
try

View File

@ -59,7 +59,7 @@ type
procedure OnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult: boolean); virtual;
procedure OnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult: boolean); virtual;
procedure OnPrintReset(const browser: ICefBrowser); virtual; abstract;
procedure GetPDFPaperSize(deviceUnitsPerInch: Integer; var aResult: TCefSize); virtual;
procedure GetPDFPaperSize(const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize); virtual;
procedure RemoveReferences; virtual; abstract;
@ -69,19 +69,19 @@ type
TCustomPrintHandler = class(TCefPrintHandlerOwn)
protected
FCefApp : TCefApplicationCore;
FEvents : Pointer;
procedure OnPrintStart(const browser: ICefBrowser); override;
procedure OnPrintSettings(const browser: ICefBrowser; const settings: ICefPrintSettings; getDefaults: boolean); override;
procedure OnPrintDialog(const browser: ICefBrowser; hasSelection: boolean; const callback: ICefPrintDialogCallback; var aResult: boolean); override;
procedure OnPrintJob(const browser: ICefBrowser; const documentName, PDFFilePath: ustring; const callback: ICefPrintJobCallback; var aResult: boolean); override;
procedure OnPrintReset(const browser: ICefBrowser); override;
procedure GetPDFPaperSize(deviceUnitsPerInch: Integer; var aResult: TCefSize); override;
procedure GetPDFPaperSize(const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize); override;
procedure RemoveReferences; override;
public
constructor Create(const aCefApp : TCefApplicationCore); reintroduce; virtual;
constructor Create(const events : IChromiumEvents); reintroduce; virtual;
destructor Destroy; override;
end;
@ -178,6 +178,7 @@ begin
end;
function cef_print_handler_get_pdf_paper_size(self : PCefPrintHandler;
browser : PCefBrowser;
device_units_per_inch : Integer): TCefSize; stdcall;
var
TempObject : TObject;
@ -188,7 +189,9 @@ begin
TempSize.Height := 0;
if (TempObject <> nil) and (TempObject is TCefPrintHandlerOwn) then
TCefPrintHandlerOwn(TempObject).GetPDFPaperSize(device_units_per_inch, TempSize);
TCefPrintHandlerOwn(TempObject).GetPDFPaperSize(TCefBrowserRef.UnWrap(browser),
device_units_per_inch,
TempSize);
Result := TempSize;
end;
@ -218,7 +221,7 @@ begin
aResult := False;
end;
procedure TCefPrintHandlerOwn.GetPDFPaperSize(deviceUnitsPerInch: Integer; var aResult: TCefSize);
procedure TCefPrintHandlerOwn.GetPDFPaperSize(const browser: ICefBrowser; deviceUnitsPerInch: Integer; var aResult: TCefSize);
begin
aResult.Width := 0;
aResult.Height := 0;
@ -227,11 +230,11 @@ end;
// TCustomPrintHandler
constructor TCustomPrintHandler.Create(const aCefApp : TCefApplicationCore);
constructor TCustomPrintHandler.Create(const events : IChromiumEvents);
begin
inherited Create;
FCefApp := aCefApp;
FEvents := Pointer(events);
end;
destructor TCustomPrintHandler.Destroy;
@ -243,29 +246,21 @@ end;
procedure TCustomPrintHandler.RemoveReferences;
begin
FCefApp := nil;
FEvents := nil;
end;
procedure TCustomPrintHandler.OnPrintStart(const browser : ICefBrowser);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnPrintStart(browser);
except
on e : exception do
if CustomExceptionHandler('TCustomPrintHandler.OnPrintStart', e) then raise;
end;
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnPrintStart(browser);
end;
procedure TCustomPrintHandler.OnPrintSettings(const browser : ICefBrowser;
const settings : ICefPrintSettings;
getDefaults : boolean);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnPrintSettings(browser, settings, getDefaults);
except
on e : exception do
if CustomExceptionHandler('TCustomPrintHandler.OnPrintSettings', e) then raise;
end;
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnPrintSettings(browser, settings, getDefaults);
end;
procedure TCustomPrintHandler.OnPrintDialog(const browser : ICefBrowser;
@ -273,12 +268,8 @@ procedure TCustomPrintHandler.OnPrintDialog(const browser : ICefBrowser;
const callback : ICefPrintDialogCallback;
var aResult : boolean);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnPrintDialog(browser, hasSelection, callback, aResult);
except
on e : exception do
if CustomExceptionHandler('TCustomPrintHandler.OnPrintDialog', e) then raise;
end;
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnPrintDialog(browser, hasSelection, callback, aResult);
end;
procedure TCustomPrintHandler.OnPrintJob(const browser : ICefBrowser;
@ -287,33 +278,22 @@ procedure TCustomPrintHandler.OnPrintJob(const browser : ICefBrowser;
const callback : ICefPrintJobCallback;
var aResult : boolean);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnPrintJob(browser, documentName, PDFFilePath, callback, aResult);
except
on e : exception do
if CustomExceptionHandler('TCustomPrintHandler.OnPrintJob', e) then raise;
end;
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnPrintJob(browser, documentName, PDFFilePath, callback, aResult);
end;
procedure TCustomPrintHandler.OnPrintReset(const browser : ICefBrowser);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnPrintReset(browser);
except
on e : exception do
if CustomExceptionHandler('TCustomPrintHandler.OnPrintReset', e) then raise;
end;
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnPrintReset(browser);
end;
procedure TCustomPrintHandler.GetPDFPaperSize( deviceUnitsPerInch : Integer;
var aResult : TCefSize);
procedure TCustomPrintHandler.GetPDFPaperSize(const browser : ICefBrowser;
deviceUnitsPerInch : Integer;
var aResult : TCefSize);
begin
try
if (FCefApp <> nil) then FCefApp.Internal_OnGetPDFPaperSize(deviceUnitsPerInch, aResult);
except
on e : exception do
if CustomExceptionHandler('TCustomPrintHandler.GetPDFPaperSize', e) then raise;
end;
if (FEvents <> nil) then
IChromiumEvents(FEvents).doOnGetPDFPaperSize(browser, deviceUnitsPerInch, aResult);
end;
end.

View File

@ -83,13 +83,13 @@ type
function HasExtension(const extension_id: ustring): boolean;
function GetExtensions(const extension_ids: TStringList): boolean;
function GetExtension(const extension_id: ustring): ICefExtension;
function GetMediaRouter: ICefMediaRouter;
function GetMediaRouter(const callback: ICefCompletionCallback): ICefMediaRouter;
public
class function UnWrap(data: Pointer): ICefRequestContext;
class function Global: ICefRequestContext;
class function New(const settings: PCefRequestContextSettings; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;
class function New(const aCache, aAcceptLanguageList : ustring; aPersistSessionCookies, aPersistUserPreferences, aIgnoreCertificateErrors : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;
class function New(const aCache, aAcceptLanguageList, aCookieableSchemesList : ustring; aCookieableSchemesExcludeDefaults, aPersistSessionCookies, aPersistUserPreferences, aIgnoreCertificateErrors : boolean; const handler: ICefRequestContextHandler = nil): ICefRequestContext; overload;
class function Shared(const other: ICefRequestContext; const handler: ICefRequestContextHandler): ICefRequestContext;
end;
@ -173,21 +173,25 @@ begin
Result := UnWrap(cef_request_context_create_context(settings, CefGetData(handler)));
end;
class function TCefRequestContextRef.New(const aCache : ustring;
const aAcceptLanguageList : ustring;
aPersistSessionCookies : boolean;
aPersistUserPreferences : boolean;
aIgnoreCertificateErrors : boolean;
const handler : ICefRequestContextHandler): ICefRequestContext;
class function TCefRequestContextRef.New(const aCache : ustring;
const aAcceptLanguageList : ustring;
const aCookieableSchemesList : ustring;
aCookieableSchemesExcludeDefaults : boolean;
aPersistSessionCookies : boolean;
aPersistUserPreferences : boolean;
aIgnoreCertificateErrors : boolean;
const handler : ICefRequestContextHandler): ICefRequestContext;
var
TempSettings : TCefRequestContextSettings;
begin
TempSettings.size := SizeOf(TCefRequestContextSettings);
TempSettings.cache_path := CefString(aCache);
TempSettings.persist_session_cookies := Ord(aPersistSessionCookies);
TempSettings.persist_user_preferences := Ord(aPersistUserPreferences);
TempSettings.ignore_certificate_errors := Ord(aIgnoreCertificateErrors);
TempSettings.accept_language_list := CefString(aAcceptLanguageList);
TempSettings.size := SizeOf(TCefRequestContextSettings);
TempSettings.cache_path := CefString(aCache);
TempSettings.persist_session_cookies := Ord(aPersistSessionCookies);
TempSettings.persist_user_preferences := Ord(aPersistUserPreferences);
TempSettings.ignore_certificate_errors := Ord(aIgnoreCertificateErrors);
TempSettings.accept_language_list := CefString(aAcceptLanguageList);
TempSettings.cookieable_schemes_list := CefString(aCookieableSchemesList);
TempSettings.cookieable_schemes_exclude_defaults := Ord(aCookieableSchemesExcludeDefaults);
Result := UnWrap(cef_request_context_create_context(@TempSettings, CefGetData(handler)));
end;
@ -309,9 +313,9 @@ begin
Result := TCefExtensionRef.UnWrap(PCefRequestContext(FData)^.get_extension(PCefRequestContext(FData), @TempID));
end;
function TCefRequestContextRef.GetMediaRouter: ICefMediaRouter;
function TCefRequestContextRef.GetMediaRouter(const callback: ICefCompletionCallback): ICefMediaRouter;
begin
Result := TCefMediaRouterRef.UnWrap(PCefRequestContext(FData)^.get_media_router(PCefRequestContext(FData)));
Result := TCefMediaRouterRef.UnWrap(PCefRequestContext(FData)^.get_media_router(PCefRequestContext(FData), CefGetData(callback)));
end;
function TCefRequestContextRef.RegisterSchemeHandlerFactory(const schemeName : ustring;

View File

@ -88,6 +88,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -267,6 +268,17 @@ begin
end;
end;
procedure TCustomTextfieldDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefTextfieldDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomTextfieldDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomTextfieldDelegate.OnFocus(const view: ICefView);
begin
try

View File

@ -322,6 +322,7 @@ type
TCefMediaRouterCreateResult = Integer; // /include/internal/cef_types.h (cef_media_route_create_result_t)
TCefCookiePriority = Integer; // /include/internal/cef_types.h (cef_cookie_priority_t)
TCefTextFieldCommands = Integer; // /include/internal/cef_types.h (cef_text_field_commands_t)
TCefChromeToolbarType = Integer; // /include/internal/cef_types.h (cef_chrome_toolbar_type_t)
{$IFDEF FPC}
@ -1235,6 +1236,8 @@ type
ignore_certificate_errors : Integer;
background_color : TCefColor;
accept_language_list : TCefString;
cookieable_schemes_list : TCefString;
cookieable_schemes_exclude_defaults : integer;
application_client_id_for_file_scanning : TCefString;
end;
@ -1341,7 +1344,6 @@ type
plugins : TCefState;
universal_access_from_file_urls : TCefState;
file_access_from_file_urls : TCefState;
web_security : TCefState;
image_loading : TCefState;
image_shrink_standalone_to_fit : TCefState;
text_area_resize : TCefState;
@ -1366,12 +1368,14 @@ type
// /include/internal/cef_types.h (cef_request_context_settings_t)
TCefRequestContextSettings = record
size : NativeUInt;
cache_path : TCefString;
persist_session_cookies : Integer;
persist_user_preferences : Integer;
ignore_certificate_errors : Integer;
accept_language_list : TCefString;
size : NativeUInt;
cache_path : TCefString;
persist_session_cookies : Integer;
persist_user_preferences : Integer;
ignore_certificate_errors : Integer;
accept_language_list : TCefString;
cookieable_schemes_list : TCefString;
cookieable_schemes_exclude_defaults : integer;
end;
// /include/internal/cef_types.h (cef_cookie_t)
@ -2136,7 +2140,7 @@ type
has_extension : function(self: PCefRequestContext; const extension_id: PCefString): Integer; stdcall;
get_extensions : function(self: PCefRequestContext; extension_ids: TCefStringList): Integer; stdcall;
get_extension : function(self: PCefRequestContext; const extension_id: PCefString): PCefExtension; stdcall;
get_media_router : function(self: PCefRequestContext): PCefMediaRouter; stdcall;
get_media_router : function(self: PCefRequestContext; callback: PCefCompletionCallback): PCefMediaRouter; stdcall;
end;
// /include/capi/cef_request_context_handler_capi.h (cef_request_context_handler_t)
@ -2156,7 +2160,6 @@ type
// /include/capi/cef_cookie_capi.h (cef_cookie_manager_t)
TCefCookieManager = record
base : TCefBaseRefCounted;
set_supported_schemes : procedure(self: PCefCookieManager; schemes: TCefStringList; include_defaults: Integer; callback: PCefCompletionCallback); stdcall;
visit_all_cookies : function(self: PCefCookieManager; visitor: PCefCookieVisitor): Integer; stdcall;
visit_url_cookies : function(self: PCefCookieManager; const url: PCefString; includeHttpOnly: Integer; visitor: PCefCookieVisitor): Integer; stdcall;
set_cookie : function(self: PCefCookieManager; const url: PCefString; const cookie: PCefCookie; callback: PCefSetCookieCallback): Integer; stdcall;
@ -2308,7 +2311,7 @@ type
on_print_dialog : function(self: PCefPrintHandler; browser: PCefBrowser; has_selection: Integer; callback: PCefPrintDialogCallback): Integer; stdcall;
on_print_job : function(self: PCefPrintHandler; browser: PCefBrowser; const document_name, pdf_file_path: PCefString; callback: PCefPrintJobCallback): Integer; stdcall;
on_print_reset : procedure(self: PCefPrintHandler; browser: PCefBrowser); stdcall;
get_pdf_paper_size : function(self: PCefPrintHandler; device_units_per_inch: Integer): TCefSize; stdcall;
get_pdf_paper_size : function(self: PCefPrintHandler; browser: PCefBrowser; device_units_per_inch: Integer): TCefSize; stdcall;
end;
// /include/capi/cef_drag_data_capi.h (cef_drag_data_t)
@ -2632,7 +2635,6 @@ type
is_spell_check_enabled : function(self: PCefContextMenuParams): Integer; stdcall;
get_edit_state_flags : function(self: PCefContextMenuParams): TCefContextMenuEditStateFlags; stdcall;
is_custom_menu : function(self: PCefContextMenuParams): Integer; stdcall;
is_pepper_menu : function(self: PCefContextMenuParams): Integer; stdcall;
end;
// /include/capi/cef_download_item_capi.h (cef_download_item_t)
@ -2891,6 +2893,7 @@ type
get_keyboard_handler : function(self: PCefClient): PCefKeyboardHandler; stdcall;
get_life_span_handler : function(self: PCefClient): PCefLifeSpanHandler; stdcall;
get_load_handler : function(self: PCefClient): PCefLoadHandler; stdcall;
get_print_handler : function(self: PCefClient): PCefPrintHandler; stdcall;
get_render_handler : function(self: PCefClient): PCefRenderHandler; stdcall;
get_request_handler : function(self: PCefClient): PCefRequestHandler; stdcall;
on_process_message_received : function(self: PCefClient; browser: PCefBrowser; frame: PCefFrame; source_process: TCefProcessId; message_: PCefProcessMessage): Integer; stdcall;
@ -2997,10 +3000,8 @@ type
// /include/capi/cef_browser_process_handler_capi.h (cef_browser_process_handler_t)
TCefBrowserProcessHandler = record
base : TCefBaseRefCounted;
get_cookieable_schemes : procedure(self: PCefBrowserProcessHandler; schemes: TCefStringList; include_defaults: PInteger); stdcall;
on_context_initialized : procedure(self: PCefBrowserProcessHandler); stdcall;
on_before_child_process_launch : procedure(self: PCefBrowserProcessHandler; command_line: PCefCommandLine); stdcall;
get_print_handler : function(self: PCefBrowserProcessHandler): PCefPrintHandler; stdcall;
on_schedule_message_pump_work : procedure(self: PCefBrowserProcessHandler; delay_ms: Int64); stdcall;
get_default_client : function(self: PCefBrowserProcessHandler): PCefClient; stdcall;
end;
@ -3179,6 +3180,7 @@ type
get_height_for_width : function(self: PCefViewDelegate; view: PCefView; width: Integer): Integer; stdcall;
on_parent_view_changed : procedure(self: PCefViewDelegate; view: PCefView; added: Integer; parent: PCefView); stdcall;
on_child_view_changed : procedure(self: PCefViewDelegate; view: PCefView; added: Integer; child: PCefView); stdcall;
on_window_changed : procedure(self: PCefViewDelegate; view: PCefView; added: Integer); stdcall;
on_focus : procedure(self: PCefViewDelegate; view: PCefView); stdcall;
on_blur : procedure(self: PCefViewDelegate; view: PCefView); stdcall;
end;
@ -3264,6 +3266,7 @@ type
TCefBrowserView = record
base : TCefView;
get_browser : function(self: PCefBrowserView): PCefBrowser; stdcall;
get_chrome_toolbar : function(self: PCefBrowserView): PCefView; stdcall;
set_prefer_accelerators : procedure(self: PCefBrowserView; prefer_accelerators: Integer); stdcall;
end;
@ -3274,6 +3277,7 @@ type
on_browser_destroyed : procedure(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; browser: PCefBrowser); stdcall;
get_delegate_for_popup_browser_view : function(self: PCefBrowserViewDelegate; browser_view: PCefBrowserView; const settings: PCefBrowserSettings; client: PCefClient; is_devtools: Integer): PCefBrowserViewDelegate; stdcall;
on_popup_browser_view_created : function(self: PCefBrowserViewDelegate; browser_view, popup_browser_view: PCefBrowserView; is_devtools: Integer): Integer; stdcall;
get_chrome_toolbar_type : function(self: PCefBrowserViewDelegate): TCefChromeToolbarType; stdcall;
end;
// /include/capi/views/cef_button_capi.h (cef_button_t)

View File

@ -69,6 +69,7 @@ type
FOnGetHeightForWidth : TOnGetHeightForWidthEvent;
FOnParentViewChanged : TOnParentViewChangedEvent;
FOnChildViewChanged : TOnChildViewChangedEvent;
FOnWindowChanged : TOnWindowChangedEvent;
FOnFocus : TOnFocusEvent;
FOnBlur : TOnBlurEvent;
@ -124,6 +125,7 @@ type
procedure doOnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); virtual;
procedure doOnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); virtual;
procedure doOnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); virtual;
procedure doOnWindowChanged(const view: ICefView; added: boolean); virtual;
procedure doOnFocus(const view: ICefView); virtual;
procedure doOnBlur(const view: ICefView); virtual;
procedure doCreateCustomView; virtual;
@ -183,6 +185,7 @@ type
property OnGetHeightForWidth : TOnGetHeightForWidthEvent read FOnGetHeightForWidth write FOnGetHeightForWidth;
property OnParentViewChanged : TOnParentViewChangedEvent read FOnParentViewChanged write FOnParentViewChanged;
property OnChildViewChanged : TOnChildViewChangedEvent read FOnChildViewChanged write FOnChildViewChanged;
property OnWindowChanged : TOnWindowChangedEvent read FOnWindowChanged write FOnWindowChanged;
property OnFocus : TOnFocusEvent read FOnFocus write FOnFocus;
property OnBlur : TOnBlurEvent read FOnBlur write FOnBlur;
end;
@ -241,6 +244,7 @@ begin
FOnGetHeightForWidth := nil;
FOnParentViewChanged := nil;
FOnChildViewChanged := nil;
FOnWindowChanged := nil;
FOnFocus := nil;
FOnBlur := nil;
end;
@ -694,6 +698,13 @@ begin
FOnChildViewChanged(self, view, added, child);
end;
procedure TCEFViewComponent.doOnWindowChanged(const view : ICefView;
added : boolean);
begin
if assigned(FOnWindowChanged) then
FOnWindowChanged(self, view, added);
end;
procedure TCEFViewComponent.doOnFocus(const view: ICefView);
begin
if assigned(FOnFocus) then

View File

@ -65,6 +65,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer);
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView);
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView);
procedure OnWindowChanged(const view: ICefView; added: boolean);
procedure OnFocus(const view: ICefView);
procedure OnBlur(const view: ICefView);
@ -80,6 +81,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); virtual;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); virtual;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); virtual;
procedure OnWindowChanged(const view: ICefView; added: boolean); virtual;
procedure OnFocus(const view: ICefView); virtual;
procedure OnBlur(const view: ICefView); virtual;
@ -98,6 +100,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -157,6 +160,13 @@ begin
CefGetData(child));
end;
procedure TCefViewDelegateRef.OnWindowChanged(const view: ICefView; added: boolean);
begin
PCefViewDelegate(FData)^.on_window_changed(PCefViewDelegate(FData),
CefGetData(view),
ord(added));
end;
procedure TCefViewDelegateRef.OnFocus(const view: ICefView);
begin
PCefViewDelegate(FData)^.on_focus(PCefViewDelegate(FData),
@ -271,6 +281,17 @@ begin
TCefViewRef.UnWrap(child));
end;
procedure cef_view_delegate_on_window_changed(self: PCefViewDelegate; view: PCefView; added: Integer); stdcall;
var
TempObject : TObject;
begin
TempObject := CefGetObject(self);
if (TempObject <> nil) and (TempObject is TCefViewDelegateOwn) then
TCefViewDelegateOwn(TempObject).OnWindowChanged(TCefViewRef.UnWrap(view),
added <> 0);
end;
procedure cef_view_delegate_on_focus(self: PCefViewDelegate; view: PCefView); stdcall;
var
TempObject : TObject;
@ -308,6 +329,7 @@ begin
get_height_for_width := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_get_height_for_width;
on_parent_view_changed := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_parent_view_changed;
on_child_view_changed := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_child_view_changed;
on_window_changed := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_window_changed;
on_focus := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_focus;
on_blur := {$IFDEF FPC}@{$ENDIF}cef_view_delegate_on_blur;
end;
@ -343,6 +365,11 @@ begin
//
end;
procedure TCefViewDelegateOwn.OnWindowChanged(const view: ICefView; added: boolean);
begin
//
end;
procedure TCefViewDelegateOwn.OnFocus(const view: ICefView);
begin
//
@ -438,6 +465,17 @@ begin
end;
end;
procedure TCustomViewDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefViewDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomViewDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomViewDelegate.OnFocus(const view: ICefView);
begin
try

View File

@ -64,6 +64,7 @@ type
TOnGetHeightForWidthEvent = procedure(const Sender: TObject; const view: ICefView; width: Integer; var aResult: Integer) of object;
TOnParentViewChangedEvent = procedure(const Sender: TObject; const view: ICefView; added: boolean; const parent: ICefView) of object;
TOnChildViewChangedEvent = procedure(const Sender: TObject; const view: ICefView; added: boolean; const child: ICefView) of object;
TOnWindowChangedEvent = procedure(const Sender: TObject; const view: ICefView; added: boolean) of object;
TOnFocusEvent = procedure(const Sender: TObject; const view: ICefView) of object;
TOnBlurEvent = procedure(const Sender: TObject; const view: ICefView) of object;
@ -78,6 +79,7 @@ type
TOnBrowserDestroyedEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const browser: ICefBrowser) of object;
TOnGetDelegateForPopupBrowserViewEvent = procedure(const Sender: TObject; const browser_view: ICefBrowserView; const settings: TCefBrowserSettings; const client: ICefClient; is_devtools: boolean; var aResult : ICefBrowserViewDelegate) of object;
TOnPopupBrowserViewCreatedEvent = procedure(const Sender: TObject; const browser_view, popup_browser_view: ICefBrowserView; is_devtools: boolean; var aResult : boolean) of object;
TOnGetChromeToolbarTypeEvent = procedure(const Sender: TObject; var aChromeToolbarType: TCefChromeToolbarType) of object;
// ICefButtonDelegate
TOnButtonPressedEvent = procedure(const Sender: TObject; const button: ICefButton) of object;

View File

@ -106,6 +106,7 @@ type
procedure OnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); override;
procedure OnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); override;
procedure OnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); override;
procedure OnWindowChanged(const view: ICefView; added: boolean); override;
procedure OnFocus(const view: ICefView); override;
procedure OnBlur(const view: ICefView); override;
@ -544,6 +545,17 @@ begin
end;
end;
procedure TCustomWindowDelegate.OnWindowChanged(const view: ICefView; added: boolean);
begin
try
if (FEvents <> nil) then
ICefWindowDelegateEvents(FEvents).doOnWindowChanged(view, added);
except
on e : exception do
if CustomExceptionHandler('TCustomWindowDelegate.OnWindowChanged', e) then raise;
end;
end;
procedure TCustomWindowDelegate.OnFocus(const view: ICefView);
begin
try

View File

@ -2,9 +2,9 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 274,
"InternalVersion" : 275,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "89.0.18.0"
"Version" : "90.5.4.0"
}
],
"UpdatePackageData" : {