1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-01-13 10:22:04 +02:00

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.
This commit is contained in:
Salvador Díaz Fau 2017-10-28 18:48:53 +02:00
parent bb83979092
commit 74b1d6c52a
2 changed files with 20 additions and 11 deletions

View File

@ -62,6 +62,7 @@ type
FOnAfterCreated : TNotifyEvent; FOnAfterCreated : TNotifyEvent;
function GetChildWindowHandle : THandle; override; function GetChildWindowHandle : THandle; override;
function GetBrowserInitialized : boolean;
procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE; procedure OnCloseMsg(var aMessage : TMessage); message CEF_DOONCLOSE;
procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED; procedure OnAfterCreatedMsg(var aMessage : TMessage); message CEF_AFTERCREATED;
@ -72,11 +73,12 @@ type
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure AfterConstruction; override; procedure AfterConstruction; override;
procedure CreateBrowser; function CreateBrowser : boolean;
procedure CloseBrowser(aForceClose : boolean); procedure CloseBrowser(aForceClose : boolean);
procedure LoadURL(const aURL : string); procedure LoadURL(const aURL : string);
property ChromiumBrowser : TChromium read FChromium; property ChromiumBrowser : TChromium read FChromium;
property Initialized : boolean read GetBrowserInitialized;
published published
property OnClose : TNotifyEvent read FOnClose write FOnClose; property OnClose : TNotifyEvent read FOnClose write FOnClose;
@ -121,6 +123,11 @@ begin
Result := 0; Result := 0;
end; 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); procedure TChromiumWindow.WebBrowser_OnClose(Sender: TObject; const browser: ICefBrowser; out Result: Boolean);
begin begin
if assigned(FOnClose) then if assigned(FOnClose) then
@ -148,10 +155,11 @@ begin
if assigned(FOnAfterCreated) then FOnAfterCreated(self); if assigned(FOnAfterCreated) then FOnAfterCreated(self);
end; end;
procedure TChromiumWindow.CreateBrowser; function TChromiumWindow.CreateBrowser : boolean;
begin begin
if not(csDesigning in ComponentState) and (FChromium <> nil) then Result := not(csDesigning in ComponentState) and
FChromium.CreateBrowser(self, ''); (FChromium <> nil) and
FChromium.CreateBrowser(self, '');
end; end;
procedure TChromiumWindow.CloseBrowser(aForceClose : boolean); procedure TChromiumWindow.CloseBrowser(aForceClose : boolean);

View File

@ -741,13 +741,14 @@ begin
Result := False; Result := False;
try try
Result := GetAbsoluteDirPath(aResourcesDirPath, TempDir) and Result := GetAbsoluteDirPath(aResourcesDirPath, TempDir) and
FileExists(TempDir + 'natives_blob.bin') and FileExists(TempDir + 'natives_blob.bin') and
FileExists(TempDir + 'snapshot_blob.bin') and FileExists(TempDir + 'snapshot_blob.bin') and
FileExists(TempDir + 'cef.pak') and FileExists(TempDir + 'v8_context_snapshot.bin') and
FileExists(TempDir + 'cef_100_percent.pak') and FileExists(TempDir + 'cef.pak') and
FileExists(TempDir + 'cef_200_percent.pak') and FileExists(TempDir + 'cef_100_percent.pak') and
FileExists(TempDir + 'cef_extensions.pak') and FileExists(TempDir + 'cef_200_percent.pak') and
FileExists(TempDir + 'cef_extensions.pak') and
(not aCheckDevResources or FileExists(TempDir + 'devtools_resources.pak')); (not aCheckDevResources or FileExists(TempDir + 'devtools_resources.pak'));
except except
on e : exception do on e : exception do