1
0
mirror of https://github.com/salvadordf/CEF4Delphi.git synced 2025-06-12 22:07:39 +02:00

Update to CEF 3.3497.1840.gcd24143

- Added process information in the log file when you compile in DEBUG mode.
- Now TCefApplication checks if the subprocess executable is present.
This commit is contained in:
Salvador Díaz Fau
2018-10-12 12:21:43 +02:00
parent 2b37fa289f
commit a151f8d639
9 changed files with 98 additions and 43 deletions

View File

@ -50,7 +50,8 @@ uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
{$ENDIF} {$ENDIF}
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants; uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
uCEFWinControl;
const const
MINIBROWSER_VISITDOM_PARTIAL = WM_APP + $101; MINIBROWSER_VISITDOM_PARTIAL = WM_APP + $101;
@ -305,7 +306,7 @@ begin
// This adds lots of warnings to the console, specially if you run this inside VirtualBox. // This adds lots of warnings to the console, specially if you run this inside VirtualBox.
// Remove it if you don't want to use the DOM visitor // Remove it if you don't want to use the DOM visitor
GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogFile := 'debug.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_ERROR; GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
end; end;
procedure TDOMVisitorFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser); procedure TDOMVisitorFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);

View File

@ -50,7 +50,7 @@ uses
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
{$ENDIF} {$ENDIF}
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes,
uCEFConstants, uCEFv8Value; uCEFConstants, uCEFv8Value, uCEFWinControl;
type type
TJSSimpleWindowBindingFrm = class(TForm) TJSSimpleWindowBindingFrm = class(TForm)
@ -200,6 +200,8 @@ end;
procedure TJSSimpleWindowBindingFrm.FormCloseQuery( procedure TJSSimpleWindowBindingFrm.FormCloseQuery(
Sender: TObject; var CanClose: Boolean); Sender: TObject; var CanClose: Boolean);
begin
if GlobalCEFApp.LibLoaded then
begin begin
CanClose := FCanClose; CanClose := FCanClose;
@ -209,6 +211,9 @@ begin
Visible := False; Visible := False;
Chromium1.CloseBrowser(True); Chromium1.CloseBrowser(True);
end; end;
end
else
CanClose := True;
end; end;
procedure TJSSimpleWindowBindingFrm.FormCreate(Sender: TObject); procedure TJSSimpleWindowBindingFrm.FormCreate(Sender: TObject);

View File

@ -69,6 +69,7 @@
<DCC_S>false</DCC_S> <DCC_S>false</DCC_S>
<DCC_F>false</DCC_F> <DCC_F>false</DCC_F>
<DCC_K>false</DCC_K> <DCC_K>false</DCC_K>
<DCC_ExeOutput>..\..\bin</DCC_ExeOutput>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''"> <PropertyGroup Condition="'$(Base_Win32)'!=''">
<VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys> <VerInfo_Keys>CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)</VerInfo_Keys>
@ -114,6 +115,9 @@
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''"> <PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes> <AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppEnableHighDPI>true</AppEnableHighDPI> <AppEnableHighDPI>true</AppEnableHighDPI>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''"> <PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols> <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
@ -164,7 +168,7 @@
<Source Name="MainSource">MiniBrowser.dpr</Source> <Source Name="MainSource">MiniBrowser.dpr</Source>
</Source> </Source>
<Excluded_Packages> <Excluded_Packages>
<Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\DCLComponentes_UI.bpl">File C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\DCLComponentes_UI.bpl not found</Excluded_Packages> <Excluded_Packages Name="C:\Users\Public\Documents\Embarcadero\Studio\19.0\Bpl\DCLComponentes_UI.bpl">DCLComponentes_UI</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dclIPIndyImpl250.bpl">IP Abstraction Indy Implementation Design Time</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dcloffice2k250.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages> <Excluded_Packages Name="$(BDSBIN)\dclofficexp250.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>

View File

@ -220,6 +220,7 @@ object MiniBrowserFrm: TMiniBrowserFrm
Width = 1179 Width = 1179
Height = 652 Height = 652
Align = alClient Align = alClient
TabStop = True
TabOrder = 1 TabOrder = 1
end end
object DevTools: TCEFWindowParent object DevTools: TCEFWindowParent

View File

@ -50,7 +50,8 @@ uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus, Windows, Messages, SysUtils, Variants, Classes, Graphics, Menus,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, AppEvnts, ActiveX, ShlObj, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd, AppEvnts, ActiveX, ShlObj,
{$ENDIF} {$ENDIF}
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants; uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
uCEFWinControl;
const const
MINIBROWSER_SHOWDEVTOOLS = WM_APP + $101; MINIBROWSER_SHOWDEVTOOLS = WM_APP + $101;

View File

@ -4,7 +4,7 @@
<PathDelim Value="\"/> <PathDelim Value="\"/>
<Version Value="10"/> <Version Value="10"/>
<BuildModes Active="Default"/> <BuildModes Active="Default"/>
<Units Count="36"> <Units Count="38">
<Unit0> <Unit0>
<Filename Value="SimpleLazarusBrowser.lpr"/> <Filename Value="SimpleLazarusBrowser.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@ -274,13 +274,38 @@
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="..\..\source\uCEFLinkedWindowParent.pas"/> <Filename Value="..\..\source\uCEFLinkedWindowParent.pas"/>
<IsVisibleTab Value="True"/>
<TopLine Value="31"/> <TopLine Value="31"/>
<CursorPos X="28" Y="38"/> <CursorPos X="28" Y="38"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit35> </Unit35>
<Unit36>
<Filename Value="..\..\source\uCEFWriteHandler.pas"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="336"/>
<CursorPos Y="358"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit36>
<Unit37>
<Filename Value="C:\lazarus\fpc\3.0.4\source\rtl\objpas\math.pp"/>
<EditorIndex Value="2"/>
<TopLine Value="158"/>
<CursorPos X="10" Y="180"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit37>
</Units> </Units>
<JumpHistory HistoryIndex="-1"/> <JumpHistory Count="2" HistoryIndex="1">
<Position1>
<Filename Value="..\..\source\uCEFLinkedWindowParent.pas"/>
<Caret Line="38" Column="28" TopLine="31"/>
</Position1>
<Position2>
<Filename Value="..\..\source\uCEFWriteHandler.pas"/>
<Caret Line="353" Column="19" TopLine="321"/>
</Position2>
</JumpHistory>
</ProjectSession> </ProjectSession>
</CONFIG> </CONFIG>

View File

@ -49,7 +49,8 @@ uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
{$ENDIF} {$ENDIF}
uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces; uCEFChromium, uCEFWindowParent, uCEFChromiumWindow, uCEFTypes, uCEFInterfaces,
uCEFWinControl;
type type
TForm1 = class(TForm) TForm1 = class(TForm)
@ -112,6 +113,8 @@ uses
// 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form. // 3. TChromiumWindow.OnBeforeClose sets FCanClose to True and closes the form.
procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if GlobalCEFApp.LibLoaded then
begin begin
CanClose := FCanClose; CanClose := FCanClose;
@ -121,6 +124,9 @@ begin
Visible := False; Visible := False;
ChromiumWindow1.CloseBrowser(True); ChromiumWindow1.CloseBrowser(True);
end; end;
end
else
CanClose := True;
end; end;
procedure TForm1.FormShow(Sender: TObject); procedure TForm1.FormShow(Sender: TObject);

View File

@ -61,7 +61,7 @@ uses
const const
CEF_SUPPORTED_VERSION_MAJOR = 3; CEF_SUPPORTED_VERSION_MAJOR = 3;
CEF_SUPPORTED_VERSION_MINOR = 3497; CEF_SUPPORTED_VERSION_MINOR = 3497;
CEF_SUPPORTED_VERSION_RELEASE = 1836; CEF_SUPPORTED_VERSION_RELEASE = 1840;
CEF_SUPPORTED_VERSION_BUILD = 0; CEF_SUPPORTED_VERSION_BUILD = 0;
CEF_CHROMEELF_VERSION_MAJOR = 69; CEF_CHROMEELF_VERSION_MAJOR = 69;
@ -716,20 +716,13 @@ begin
end; end;
procedure TCefApplication.SetBrowserSubprocessPath(const aValue : ustring); procedure TCefApplication.SetBrowserSubprocessPath(const aValue : ustring);
var
TempPath : string;
begin begin
if (length(aValue) > 0) then if (length(aValue) > 0) then
begin begin
if CustomPathIsRelative(aValue) then if CustomPathIsRelative(aValue) then
TempPath := GetModulePath + aValue FBrowserSubprocessPath := GetModulePath + aValue
else else
TempPath := aValue; FBrowserSubprocessPath := aValue;
if FileExists(TempPath) then
FBrowserSubprocessPath := TempPath
else
FBrowserSubprocessPath := '';
end end
else else
FBrowserSubprocessPath := ''; FBrowserSubprocessPath := '';
@ -800,7 +793,7 @@ end;
function TCefApplication.CheckCEFLibrary : boolean; function TCefApplication.CheckCEFLibrary : boolean;
var var
TempString, TempOldDir : string; TempString, TempOldDir : string;
TempMissingFrm, TempMissingRsc, TempMissingLoc : boolean; TempMissingFrm, TempMissingRsc, TempMissingLoc, TempMissingSubProc : boolean;
TempMachine : integer; TempMachine : integer;
TempVersionInfo : TFileVersionInfo; TempVersionInfo : TFileVersionInfo;
begin begin
@ -816,11 +809,12 @@ begin
chdir(GetModulePath); chdir(GetModulePath);
end; end;
TempMissingSubProc := not(CheckSubprocessPath(FBrowserSubprocessPath, FMissingLibFiles));
TempMissingFrm := not(CheckDLLs(FFrameworkDirPath, FMissingLibFiles)); TempMissingFrm := not(CheckDLLs(FFrameworkDirPath, FMissingLibFiles));
TempMissingRsc := not(CheckResources(FResourcesDirPath, FMissingLibFiles, FCheckDevToolsResources, not(FDisableExtensions))); TempMissingRsc := not(CheckResources(FResourcesDirPath, FMissingLibFiles, FCheckDevToolsResources, not(FDisableExtensions)));
TempMissingLoc := not(CheckLocales(FLocalesDirPath, FMissingLibFiles, FLocalesRequired)); TempMissingLoc := not(CheckLocales(FLocalesDirPath, FMissingLibFiles, FLocalesRequired));
if TempMissingFrm or TempMissingRsc or TempMissingLoc then if TempMissingFrm or TempMissingRsc or TempMissingLoc or TempMissingSubProc then
begin begin
FStatus := asErrorMissingFiles; FStatus := asErrorMissingFiles;
TempString := 'CEF3 binaries missing !'; TempString := 'CEF3 binaries missing !';
@ -1639,6 +1633,8 @@ begin
FLibLoaded := True; FLibLoaded := True;
Result := True; Result := True;
{$IFDEF DEBUG}CefDebugLog('Process started', CEF_LOG_SEVERITY_INFO);{$ENDIF}
if FEnableHighDPISupport then cef_enable_highdpi_support(); if FEnableHighDPISupport then cef_enable_highdpi_support();
end end
else else

View File

@ -57,7 +57,7 @@ uses
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} Classes, SysUtils, Controls, Graphics, Math, {$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} Classes, SysUtils, Controls, Graphics, Math,
{$ENDIF} {$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler, uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
uCEFRegisterCDMCallback; uCEFRegisterCDMCallback, uCEFConstants;
const const
Kernel32DLL = 'kernel32.dll'; Kernel32DLL = 'kernel32.dll';
@ -148,7 +148,7 @@ function CefCrashReportingEnabled : boolean;
procedure CefSetCrashKeyValue(const aKey, aValue : ustring); procedure CefSetCrashKeyValue(const aKey, aValue : ustring);
procedure CefLog(const aFile : string; aLine, aSeverity : integer; const aMessage : string); procedure CefLog(const aFile : string; aLine, aSeverity : integer; const aMessage : string);
procedure CefDebugLog(const aMessage : string); procedure CefDebugLog(const aMessage : string; aSeverity : integer = CEF_LOG_SEVERITY_ERROR);
procedure OutputDebugMessage(const aMessage : string); procedure OutputDebugMessage(const aMessage : string);
function CustomExceptionHandler(const aFunctionName : string; const aException : exception) : boolean; function CustomExceptionHandler(const aFunctionName : string; const aException : exception) : boolean;
@ -166,6 +166,7 @@ function GetDLLVersion(const aDLLFile : string; var aVersionInfo : TFileVersion
function SplitLongString(aSrcString : string) : string; function SplitLongString(aSrcString : string) : string;
function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean; 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 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; aCheckDevResources: boolean = True; aCheckExtensions: boolean = True) : boolean;
function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean; function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean;
@ -226,7 +227,7 @@ function DeleteDirContents(const aDirectory : string) : boolean;
implementation implementation
uses uses
uCEFConstants, uCEFApplication, uCEFSchemeHandlerFactory, uCEFValue, uCEFApplication, uCEFSchemeHandlerFactory, uCEFValue,
uCEFBinaryValue, uCEFStringList; uCEFBinaryValue, uCEFStringList;
function CefColorGetA(color: TCefColor): Byte; function CefColorGetA(color: TCefColor): Byte;
@ -650,7 +651,7 @@ begin
end; end;
end; end;
procedure CefDebugLog(const aMessage : string); procedure CefDebugLog(const aMessage : string; aSeverity : integer);
const const
DEFAULT_LINE = 1; DEFAULT_LINE = 1;
var var
@ -668,7 +669,7 @@ begin
else TempString := TempString + ', PT: Other'; else TempString := TempString + ', PT: Other';
end; end;
CefLog('CEF4Delphi', DEFAULT_LINE, CEF_LOG_SEVERITY_ERROR, TempString + ' - ' + aMessage); CefLog('CEF4Delphi', DEFAULT_LINE, aSeverity, TempString + ' - ' + aMessage);
end; end;
end; end;
@ -945,6 +946,21 @@ begin
end; end;
end; end;
function CheckSubprocessPath(const aSubprocessPath : string; var aMissingFiles : string) : boolean;
begin
Result := False;
try
if (length(aSubprocessPath) = 0) or FileExists(aSubprocessPath) then
Result := True
else
aMissingFiles := trim(aMissingFiles) + CRLF + ExtractFileName(aSubprocessPath);
except
on e : exception do
if CustomExceptionHandler('CheckSubprocessPath', e) then raise;
end;
end;
function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean; function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean;
var var
TempDir : string; TempDir : string;