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,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls, Types, ComCtrls, ClipBrd,
{$ENDIF}
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants;
uCEFChromium, uCEFWindowParent, uCEFInterfaces, uCEFApplication, uCEFTypes, uCEFConstants,
uCEFWinControl;
const
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.
// Remove it if you don't want to use the DOM visitor
GlobalCEFApp.LogFile := 'debug.log';
GlobalCEFApp.LogSeverity := LOGSEVERITY_ERROR;
GlobalCEFApp.LogSeverity := LOGSEVERITY_INFO;
end;
procedure TDOMVisitorFrm.Chromium1AfterCreated(Sender: TObject; const browser: ICefBrowser);

View File

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

View File

@ -69,6 +69,7 @@
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_ExeOutput>..\..\bin</DCC_ExeOutput>
</PropertyGroup>
<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>
@ -114,6 +115,9 @@
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<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 Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
@ -164,7 +168,7 @@
<Source Name="MainSource">MiniBrowser.dpr</Source>
</Source>
<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)\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>

View File

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

View File

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

View File

@ -4,7 +4,7 @@
<PathDelim Value="\"/>
<Version Value="10"/>
<BuildModes Active="Default"/>
<Units Count="36">
<Units Count="38">
<Unit0>
<Filename Value="SimpleLazarusBrowser.lpr"/>
<IsPartOfProject Value="True"/>
@ -274,13 +274,38 @@
</Unit34>
<Unit35>
<Filename Value="..\..\source\uCEFLinkedWindowParent.pas"/>
<IsVisibleTab Value="True"/>
<TopLine Value="31"/>
<CursorPos X="28" Y="38"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</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>
<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>
</CONFIG>

View File

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

View File

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

View File

@ -57,7 +57,7 @@ uses
{$IFDEF MSWINDOWS}Windows, ActiveX,{$ENDIF} {$IFDEF DELPHI14_UP}IOUtils,{$ENDIF} Classes, SysUtils, Controls, Graphics, Math,
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFLibFunctions, uCEFResourceHandler,
uCEFRegisterCDMCallback;
uCEFRegisterCDMCallback, uCEFConstants;
const
Kernel32DLL = 'kernel32.dll';
@ -148,7 +148,7 @@ function CefCrashReportingEnabled : boolean;
procedure CefSetCrashKeyValue(const aKey, aValue : ustring);
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);
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 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 CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean;
@ -226,7 +227,7 @@ function DeleteDirContents(const aDirectory : string) : boolean;
implementation
uses
uCEFConstants, uCEFApplication, uCEFSchemeHandlerFactory, uCEFValue,
uCEFApplication, uCEFSchemeHandlerFactory, uCEFValue,
uCEFBinaryValue, uCEFStringList;
function CefColorGetA(color: TCefColor): Byte;
@ -650,7 +651,7 @@ begin
end;
end;
procedure CefDebugLog(const aMessage : string);
procedure CefDebugLog(const aMessage : string; aSeverity : integer);
const
DEFAULT_LINE = 1;
var
@ -668,7 +669,7 @@ begin
else TempString := TempString + ', PT: Other';
end;
CefLog('CEF4Delphi', DEFAULT_LINE, CEF_LOG_SEVERITY_ERROR, TempString + ' - ' + aMessage);
CefLog('CEF4Delphi', DEFAULT_LINE, aSeverity, TempString + ' - ' + aMessage);
end;
end;
@ -945,6 +946,21 @@ begin
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;
var
TempDir : string;