From 74b1d6c52a76693c1bca7c2e1477f582d3872952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Salvador=20D=C3=ADaz=20Fau?= Date: Sat, 28 Oct 2017 18:48:53 +0200 Subject: [PATCH] Added v8_context_snapshot.bin to the cef binaries checking functions - Added v8_context_snapshot.bin to the cef binaries checking functions. - Added a the Initialized property to TChromiumWindow and nowCreateBrowser is a function, not procedure. --- source/uCEFChromiumWindow.pas | 16 ++++++++++++---- source/uCEFMiscFunctions.pas | 15 ++++++++------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/source/uCEFChromiumWindow.pas b/source/uCEFChromiumWindow.pas index 169d8449..f0f18e80 100644 --- a/source/uCEFChromiumWindow.pas +++ b/source/uCEFChromiumWindow.pas @@ -62,6 +62,7 @@ type FOnAfterCreated : TNotifyEvent; function GetChildWindowHandle : THandle; override; + function GetBrowserInitialized : boolean; procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE; procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; @@ -72,11 +73,12 @@ type public constructor Create(AOwner: TComponent); override; procedure AfterConstruction; override; - procedure CreateBrowser; + function CreateBrowser : boolean; procedure CloseBrowser(aForceClose : boolean); procedure LoadURL(const aURL : string); property ChromiumBrowser : TChromium read FChromium; + property Initialized : boolean read GetBrowserInitialized; published property OnClose : TNotifyEvent read FOnClose write FOnClose; @@ -121,6 +123,11 @@ begin Result := 0; end; +function TChromiumWindow.GetBrowserInitialized : boolean; +begin + Result := (FChromium <> nil) and FChromium.Initialized; +end; + procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean); begin if assigned(FOnClose) then @@ -148,10 +155,11 @@ begin if assigned(FOnAfterCreated) then FOnAfterCreated(self); end; -procedure TChromiumWindow.CreateBrowser; +function TChromiumWindow.CreateBrowser : boolean; begin - if not(csDesigning in ComponentState) and (FChromium <> nil) then - FChromium.CreateBrowser(self, ''); + Result := not(csDesigning in ComponentState) and + (FChromium <> nil) and + FChromium.CreateBrowser(self, ''); end; procedure TChromiumWindow.CloseBrowser(aForceClose : boolean); diff --git a/source/uCEFMiscFunctions.pas b/source/uCEFMiscFunctions.pas index 48003fff..e5fb0735 100644 --- a/source/uCEFMiscFunctions.pas +++ b/source/uCEFMiscFunctions.pas @@ -741,13 +741,14 @@ begin Result := False; try - Result := GetAbsoluteDirPath(aResourcesDirPath, TempDir) and - FileExists(TempDir + 'natives_blob.bin') and - FileExists(TempDir + 'snapshot_blob.bin') and - FileExists(TempDir + 'cef.pak') and - FileExists(TempDir + 'cef_100_percent.pak') and - FileExists(TempDir + 'cef_200_percent.pak') and - FileExists(TempDir + 'cef_extensions.pak') and + Result := GetAbsoluteDirPath(aResourcesDirPath, TempDir) and + FileExists(TempDir + 'natives_blob.bin') and + FileExists(TempDir + 'snapshot_blob.bin') and + FileExists(TempDir + 'v8_context_snapshot.bin') and + FileExists(TempDir + 'cef.pak') and + FileExists(TempDir + 'cef_100_percent.pak') and + FileExists(TempDir + 'cef_200_percent.pak') and + FileExists(TempDir + 'cef_extensions.pak') and (not aCheckDevResources or FileExists(TempDir + 'devtools_resources.pak')); except on e : exception do