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

OutputDebugMessage moved to uCEFMiscFunctions, New TCEFApplication.AddCommandLine procedure and TCEFApplication.CheckCEFLibrary enhancements

This commit is contained in:
Salvador Diaz Fau 2017-02-13 10:24:44 +01:00
parent 8aafbee064
commit 9b4bb2a27c
10 changed files with 336 additions and 253 deletions

View File

@ -255,16 +255,7 @@
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
@ -578,7 +569,16 @@
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceResourceRules"/>
<DeployClass Name="DependencyModule">
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
<Platform Name="OSX32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
</DeployClass>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>

View File

@ -1,45 +1,27 @@
[Closed Files]
File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,1722,34,1739,0,0,,
File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFClient.pas',0,1,521,9,547,0,0,,
File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFRequestHandler.pas',0,1,285,24,301,0,0,,
File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFX509CertPrincipal.pas',0,1,178,11,198,0,0,,
File_4=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFLibFunctions.pas',0,1,196,10,229,0,0,,
File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFInterfaces.pas',0,1,69,3,103,0,0,,
File_6=TSourceModule,'V:\dcef3-2883\src\ceflib.pas',0,1,10411,3,10440,0,0,,
File_0=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas',0,1,741,71,779,0,0,,{1,727,73}
File_1=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas',0,1,957,68,985,0,0,,
File_2=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFChromium.pas',0,1,1998,7,2013,0,0,,
File_3=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFClient.pas',0,1,490,71,507,0,0,,
File_4=TSourceModule,'c:\program files\embarcadero\studio\17.0\SOURCE\RTL\SYS\System.SysUtils.pas',0,1,25193,1,25222,0,0,,
File_5=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas',0,1,421,23,440,0,0,,
File_6=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFX509CertPrincipal.pas',0,1,179,21,194,0,0,,
File_7=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFRequestHandler.pas',0,1,284,48,300,0,0,,
File_8=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFLibFunctions.pas',0,1,196,10,229,0,0,,
File_9=TSourceModule,'C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFInterfaces.pas',0,1,69,3,103,0,0,,
[Modules]
Module0=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas
Module1=default.htm
Module2=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas
Module3=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas
Count=4
Module0=default.htm
Count=1
EditWindowCount=1
[C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas]
ModuleType=TSourceModule
FormState=0
FormOnTop=0
[default.htm]
ModuleType=TURLModule
[C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas]
ModuleType=TSourceModule
FormState=0
FormOnTop=0
[C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas]
ModuleType=TSourceModule
FormState=0
FormOnTop=0
[EditWindow0]
ViewCount=4
CurrentEditView=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas
ViewCount=1
CurrentView=0
View0=0
View1=1
View2=2
View3=3
PercentageSizes=1
Create=1
Visible=1
@ -56,56 +38,23 @@ ClientHeight=9428
DockedToMainForm=1
BorlandEditorCodeExplorer=BorlandEditorCodeExplorer@EditWindow0
TopPanelSize=0
LeftPanelSize=0
LeftPanelSize=1898
LeftPanelClients=PropertyInspector,DockSite3
LeftPanelData=00000800010100000000AA19000000000000016A0700000000000001000000005D0E000009000000446F636B53697465330100000000A12300001100000050726F7065727479496E73706563746F72FFFFFFFF
RightPanelSize=2000
RightPanelClients=DockSite2
RightPanelData=00000800010100000000AA1900000000000001D0070000000000000100000000A123000009000000446F636B5369746532FFFFFFFF
RightPanelClients=DockSite2,DockSite4
RightPanelData=00000800010100000000AA1900000000000001D00700000000000001000000004312000009000000446F636B53697465320100000000A123000009000000446F636B5369746534FFFFFFFF
BottomPanelSize=0
BottomPanelClients=DockSite1,MessageView
BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D3B3600000000000002110E000000000000FFFFFFFF
BottomPanelData=0000080001020200000009000000446F636B53697465310F0000004D65737361676556696577466F726D1234000000000000022506000000000000FFFFFFFF
BottomMiddlePanelSize=0
BottomMiddlePanelClients=DockSite0,GraphDrawingModel
BottomMiddelPanelData=0000080001020200000009000000446F636B536974653010000000477261706844726177696E67566965779D1D00000000000002F306000000000000FFFFFFFF
TabDockLeftClients=PropertyInspector=0,DockSite3=1
TabDockRightClients=DockSite4=0
[View0]
CustomEditViewType=TWelcomePageView
WelcomePageURL=bds:/default.htm
[View1]
CustomEditViewType=TEditView
Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas
CursorX=45
CursorY=355
TopLine=350
LeftCol=1
Elisions=
Bookmarks=
EditViewName=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFApplication.pas
[View2]
CustomEditViewType=TEditView
Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas
CursorX=22
CursorY=350
TopLine=316
LeftCol=1
Elisions=
Bookmarks=
EditViewName=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFTypes.pas
[View3]
CustomEditViewType=TEditView
Module=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas
CursorX=17
CursorY=422
TopLine=383
LeftCol=1
Elisions=
Bookmarks=
EditViewName=C:\Users\usuario\Documents\Embarcadero\Studio\Projects\CEF4Delphi\source\uCEFMiscFunctions.pas
[Watches]
Count=0
@ -168,11 +117,11 @@ State=0
Left=0
Top=0
Width=2000
Height=8868
Height=4226
MaxLeft=-1
MaxTop=-1
ClientWidth=2000
ClientHeight=8868
ClientHeight=4226
TBDockHeight=5897
LRDockWidth=2352
Dockable=1
@ -185,14 +134,14 @@ Visible=0
Docked=1
State=0
Left=0
Top=23
Top=0
Width=2773
Height=3464
Height=1424
MaxLeft=-1
MaxTop=-1
ClientWidth=2773
ClientHeight=3464
TBDockHeight=3464
ClientHeight=1424
TBDockHeight=1424
LRDockWidth=2773
Dockable=1
StayOnTop=0
@ -205,12 +154,12 @@ Docked=1
State=0
Left=0
Top=0
Width=1875
Height=6693
Width=2000
Height=4339
MaxLeft=-1
MaxTop=-1
ClientWidth=1875
ClientHeight=6693
ClientWidth=2000
ClientHeight=4339
TBDockHeight=7152
LRDockWidth=2000
Dockable=1
@ -260,8 +209,8 @@ Create=1
Visible=0
Docked=1
State=0
Left=-8
Top=-30
Left=-148
Top=-137
Width=1844
Height=3139
MaxLeft=-1
@ -314,17 +263,17 @@ StayOnTop=0
[PropertyInspector]
PercentageSizes=1
Create=1
Visible=0
Visible=1
Docked=1
State=0
Left=78
Top=386
Left=0
Top=362
Width=1898
Height=7164
Height=5370
MaxLeft=-1
MaxTop=-1
ClientWidth=1773
ClientHeight=6738
ClientWidth=1898
ClientHeight=5370
TBDockHeight=7164
LRDockWidth=1898
Dockable=1
@ -340,11 +289,11 @@ State=0
Left=0
Top=0
Width=2000
Height=6816
Height=6861
MaxLeft=-1
MaxTop=-1
ClientWidth=2000
ClientHeight=6816
ClientHeight=6861
TBDockHeight=5964
LRDockWidth=2508
Dockable=1
@ -356,8 +305,8 @@ Create=1
Visible=0
Docked=1
State=0
Left=-946
Top=1
Left=-898
Top=-137
Width=2844
Height=6200
MaxLeft=-1
@ -375,8 +324,8 @@ Create=1
Visible=0
Docked=1
State=0
Left=-8
Top=287
Left=-1026
Top=-137
Width=273
Height=359
MaxLeft=-1
@ -480,11 +429,11 @@ State=0
Left=0
Top=0
Width=2336
Height=942
Height=1177
MaxLeft=-1
MaxTop=-1
ClientWidth=2336
ClientHeight=942
ClientHeight=1177
TBDockHeight=2321
LRDockWidth=2820
Dockable=1
@ -545,11 +494,11 @@ State=0
Left=0
Top=0
Width=2000
Height=6816
Height=6861
MaxLeft=-1
MaxTop=-1
ClientWidth=2000
ClientHeight=6816
ClientHeight=6861
TBDockHeight=4888
LRDockWidth=7148
Dockable=1
@ -561,8 +510,8 @@ Create=1
Visible=0
Docked=1
State=0
Left=249
Top=709
Left=0
Top=0
Width=2859
Height=3206
MaxLeft=-1
@ -608,12 +557,12 @@ Docked=1
State=0
Left=0
Top=0
Width=1773
Height=6738
Width=1898
Height=3498
MaxLeft=-1
MaxTop=-1
ClientWidth=1773
ClientHeight=6738
ClientWidth=1898
ClientHeight=3498
TBDockHeight=3677
LRDockWidth=1898
Dockable=1
@ -628,11 +577,11 @@ State=0
Left=0
Top=0
Width=2000
Height=6816
Height=6861
MaxLeft=-1
MaxTop=-1
ClientWidth=2000
ClientHeight=6816
ClientHeight=6861
TBDockHeight=4888
LRDockWidth=5305
Dockable=1
@ -693,7 +642,7 @@ Visible=0
Docked=1
State=0
Left=0
Top=23
Top=0
Width=3820
Height=1424
MaxLeft=-1
@ -719,12 +668,12 @@ State=0
Left=0
Top=23
Width=2000
Height=9170
Height=4529
MaxLeft=-1
MaxTop=-1
ClientWidth=2000
ClientHeight=9170
TBDockHeight=7119
ClientHeight=4529
TBDockHeight=7164
LRDockWidth=2000
Dockable=1
StayOnTop=0
@ -733,21 +682,21 @@ ActiveTabID=ProjectManager
TabDockClients=ProjectManager,ModelViewTool,DataExplorerContainer,frmDesignPreview,TFileExplorerForm
[DockSite3]
HostDockSite=LeftDockTabSet
HostDockSite=DockLeftPanel
DockSiteType=1
PercentageSizes=1
Create=1
Visible=0
Visible=1
Docked=1
State=0
Left=0
Top=0
Top=23
Width=1898
Height=7164
Height=3498
MaxLeft=-1
MaxTop=-1
ClientWidth=1773
ClientHeight=6738
ClientWidth=1898
ClientHeight=3498
TBDockHeight=7164
LRDockWidth=1898
Dockable=1
@ -757,22 +706,22 @@ ActiveTabID=StructureView
TabDockClients=StructureView,ClassBrowserTool
[DockSite4]
HostDockSite=RightTabDock
HostDockSite=DockRightPanel
DockSiteType=1
PercentageSizes=1
Create=1
Visible=0
Visible=1
Docked=1
State=0
Left=0
Top=0
Top=454
Width=2000
Height=7119
Height=4339
MaxLeft=-1
MaxTop=-1
ClientWidth=1875
ClientHeight=6693
TBDockHeight=7119
ClientWidth=2000
ClientHeight=4339
TBDockHeight=7164
LRDockWidth=2000
Dockable=1
StayOnTop=0

Binary file not shown.

View File

@ -1,9 +1,9 @@
[Stats]
EditorSecs=29305
EditorSecs=32530
DesignerSecs=14
InspectorSecs=9
CompileSecs=513522
OtherSecs=2686
CompileSecs=559079
OtherSecs=2807
StartTime=22/01/2017 10:49:52
RealKeys=0
EffectiveKeys=0

View File

@ -48,9 +48,9 @@ interface
uses
{$IFDEF DELPHI16_UP}
WinApi.Windows,
WinApi.Windows, System.Classes,
{$ELSE}
Windows,
Windows, Classes,
{$ENDIF}
uCEFTypes, uCEFInterfaces, uCEFBase;
@ -101,7 +101,7 @@ type
FDeleteCookies : boolean;
FApp : TInternalApp;
FAppIntf : ICefApp;
FCustomCommandLine : ustring;
FCustomCommandLines : TStringList;
FFlashEnabled : boolean;
FCheckCEFFiles : boolean;
FLibLoaded : boolean;
@ -163,6 +163,9 @@ type
function SingleExeProcessing : boolean;
function GetFileVersion(const aFileName : string) : uint64;
function CheckCEFLibrary : boolean;
function CheckLocales : boolean;
function CheckResources : boolean;
function CheckDLLs : boolean;
procedure UInt64ToFileVersionInfo(const aVersion : uint64; var aVersionInfo : TFileVersionInfo);
procedure UpdateChromeVersionInfo;
@ -177,7 +180,8 @@ type
public
constructor Create;
destructor Destroy; override;
procedure OutputDebugMessage(const aMessage : string);
procedure AfterConstruction; override;
procedure AddCustomCommandLine(const aCommandLine : string);
function StartMainProcess : boolean;
function StartSubProcess : boolean;
@ -213,7 +217,6 @@ type
property ExternalMessagePump : boolean read FExternalMessagePump write FExternalMessagePump;
property DeleteCache : boolean read FDeleteCache write FDeleteCache;
property DeleteCookies : boolean read FDeleteCookies write FDeleteCookies;
property CustomCommandLine : ustring read FCustomCommandLine write FCustomCommandLine;
property FlashEnabled : boolean read FFlashEnabled write FFlashEnabled;
property CheckCEFFiles : boolean read FCheckCEFFiles write FCheckCEFFiles;
property ChromeMajorVer : uint16 read FChromeVersionInfo.MajorVer;
@ -275,7 +278,8 @@ uses
{$ELSE}
Math, IOUtils, SysUtils,
{$ENDIF}
uCEFLibFunctions, uCEFMiscFunctions, uCEFSchemeRegistrar, uCEFCommandLine, uCEFConstants;
uCEFLibFunctions, uCEFMiscFunctions, uCEFSchemeRegistrar, uCEFCommandLine,
uCEFConstants;
const
CEF_SUPPORTED_VERSION_MAJOR = 3;
@ -325,7 +329,7 @@ begin
FApp := nil;
FAppIntf := nil;
FFlashEnabled := True;
FCustomCommandLine := '';
FCustomCommandLines := nil;
FCheckCEFFiles := True;
FOnRegisterCustomSchemes := nil;
FResourceBundleHandler := nil;
@ -347,18 +351,21 @@ begin
FAppIntf := nil;
FApp := nil;
if (FCustomCommandLines <> nil) then FreeAndNil(FCustomCommandLines);
inherited Destroy;
end;
procedure TCefApplication.OutputDebugMessage(const aMessage : string);
const
DEFAULT_LINE = 1;
procedure TCefApplication.AfterConstruction;
begin
{$IFDEF DEBUG}
OutputDebugString(PWideChar(aMessage + chr(0)));
inherited AfterConstruction;
if FLibLoaded then CefLog('CEF4Delphi', DEFAULT_LINE, CEF_LOG_SEVERITY_ERROR, aMessage);
{$ENDIF}
FCustomCommandLines := TStringList.Create;
end;
procedure TCefApplication.AddCustomCommandLine(const aCommandLine : string);
begin
if (FCustomCommandLines <> nil) then FCustomCommandLines.Add(aCommandLine);
end;
function TCefApplication.CreateInternalApp : boolean;
@ -473,6 +480,136 @@ begin
aVersionInfo.Build := uint16(aVersion and $FFFF);
end;
function TCefApplication.CheckLocales : boolean;
var
TempDir : string;
begin
Result := False;
try
if (length(FLocalesDirPath) > 0) then
TempDir := FLocalesDirPath
else
TempDir := 'locales';
Result := DirectoryExists(TempDir) and
FileExists(TempDir + '\am.pak') and
FileExists(TempDir + '\ar.pak') and
FileExists(TempDir + '\bg.pak') and
FileExists(TempDir + '\bn.pak') and
FileExists(TempDir + '\ca.pak') and
FileExists(TempDir + '\cs.pak') and
FileExists(TempDir + '\da.pak') and
FileExists(TempDir + '\de.pak') and
FileExists(TempDir + '\el.pak') and
FileExists(TempDir + '\en-GB.pak') and
FileExists(TempDir + '\en-US.pak') and
FileExists(TempDir + '\es.pak') and
FileExists(TempDir + '\es-419.pak') and
FileExists(TempDir + '\et.pak') and
FileExists(TempDir + '\fa.pak') and
FileExists(TempDir + '\fi.pak') and
FileExists(TempDir + '\fil.pak') and
FileExists(TempDir + '\fr.pak') and
FileExists(TempDir + '\gu.pak') and
FileExists(TempDir + '\he.pak') and
FileExists(TempDir + '\hi.pak') and
FileExists(TempDir + '\hr.pak') and
FileExists(TempDir + '\hu.pak') and
FileExists(TempDir + '\id.pak') and
FileExists(TempDir + '\it.pak') and
FileExists(TempDir + '\ja.pak') and
FileExists(TempDir + '\kn.pak') and
FileExists(TempDir + '\ko.pak') and
FileExists(TempDir + '\lt.pak') and
FileExists(TempDir + '\lv.pak') and
FileExists(TempDir + '\ml.pak') and
FileExists(TempDir + '\mr.pak') and
FileExists(TempDir + '\ms.pak') and
FileExists(TempDir + '\nb.pak') and
FileExists(TempDir + '\nl.pak') and
FileExists(TempDir + '\pl.pak') and
FileExists(TempDir + '\pt-BR.pak') and
FileExists(TempDir + '\pt-PT.pak') and
FileExists(TempDir + '\ro.pak') and
FileExists(TempDir + '\ru.pak') and
FileExists(TempDir + '\sk.pak') and
FileExists(TempDir + '\sl.pak') and
FileExists(TempDir + '\sr.pak') and
FileExists(TempDir + '\sv.pak') and
FileExists(TempDir + '\sw.pak') and
FileExists(TempDir + '\ta.pak') and
FileExists(TempDir + '\te.pak') and
FileExists(TempDir + '\th.pak') and
FileExists(TempDir + '\tr.pak') and
FileExists(TempDir + '\uk.pak') and
FileExists(TempDir + '\vi.pak') and
FileExists(TempDir + '\zh-CN.pak') and
FileExists(TempDir + '\zh-TW.pak');
except
on e : exception do
OutputDebugMessage('TCefApplication.CheckLocales error: ' + e.Message);
end;
end;
function TCefApplication.CheckResources : boolean;
var
TempDir : string;
begin
Result := False;
try
// path is hard-coded in Chromium for natives_blob.bin, snapshot_blob.bin and icudtl.dat
if FileExists('natives_blob.bin') and
FileExists('snapshot_blob.bin') and
FileExists('icudtl.dat') then
begin
if (length(FResourcesDirPath) > 0) then
begin
if DirectoryExists(FResourcesDirPath) then
begin
TempDir := FResourcesDirPath;
if (TempDir[length(TempDir)] <> '\') then TempDir := TempDir + '\';
Result := 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
FileExists(TempDir + 'devtools_resources.pak');
end;
end
else
Result := FileExists('cef.pak') and
FileExists('cef_100_percent.pak') and
FileExists('cef_200_percent.pak') and
FileExists('cef_extensions.pak') and
FileExists('devtools_resources.pak');
end;
except
on e : exception do
OutputDebugMessage('TCefApplication.CheckResources error: ' + e.Message);
end;
end;
function TCefApplication.CheckDLLs : boolean;
begin
Result := False;
try
Result := FileExists('chrome_elf.dll') and
FileExists('d3dcompiler_43.dll') and
FileExists('d3dcompiler_47.dll') and
FileExists('libcef.dll') and
FileExists('libEGL.dll') and
FileExists('libGLESv2.dll') and
FileExists('widevinecdmadapter.dll');
except
on e : exception do
OutputDebugMessage('TCefApplication.CheckDLLs error: ' + e.Message);
end;
end;
function TCefApplication.CheckCEFLibrary : boolean;
var
TempVersion : uint64;
@ -480,45 +617,26 @@ var
begin
Result := False;
try
if not(FCheckCEFFiles) then
Result := True
else
if FileExists('chrome_elf.dll') and
FileExists('d3dcompiler_43.dll') and
FileExists('d3dcompiler_47.dll') and
FileExists('libcef.dll') and
FileExists('libEGL.dll') and
FileExists('libGLESv2.dll') and
FileExists('natives_blob.bin') and
FileExists('snapshot_blob.bin') and
FileExists('widevinecdmadapter.dll') and
FileExists('cef.pak') and
FileExists('cef_100_percent.pak') and
FileExists('cef_200_percent.pak') and
FileExists('cef_extensions.pak') and
FileExists('devtools_resources.pak') and
FileExists('icudtl.dat') and
DirectoryExists('locales') and
FileExists('locales\en-US.pak') then
begin
TempVersion := GetFileVersion('libcef.dll');
UInt64ToFileVersionInfo(TempVersion, TempVersionInfo);
if not(FCheckCEFFiles) then
Result := True
else
if CheckDLLs and
CheckResources and
CheckLocales then
begin
TempVersion := GetFileVersion('libcef.dll');
UInt64ToFileVersionInfo(TempVersion, TempVersionInfo);
if (TempVersionInfo.MajorVer = CEF_SUPPORTED_VERSION_MAJOR) and
(TempVersionInfo.MinorVer = CEF_SUPPORTED_VERSION_MINOR) and
(TempVersionInfo.Release = CEF_SUPPORTED_VERSION_RELEASE) and
(TempVersionInfo.Build = CEF_SUPPORTED_VERSION_BUILD) then
Result := True
else
OutputDebugMessage('TCefApplication.CheckCEFLibrary error: Unsupported CEF version !');
end
else
OutputDebugMessage('TCefApplication.CheckCEFLibrary error: CEF binaries missing !');
except
on e : exception do
OutputDebugMessage('TCefApplication.CheckCEFLibrary error: ' + e.Message);
end;
if (TempVersionInfo.MajorVer = CEF_SUPPORTED_VERSION_MAJOR) and
(TempVersionInfo.MinorVer = CEF_SUPPORTED_VERSION_MINOR) and
(TempVersionInfo.Release = CEF_SUPPORTED_VERSION_RELEASE) and
(TempVersionInfo.Build = CEF_SUPPORTED_VERSION_BUILD) then
Result := True
else
OutputDebugMessage('TCefApplication.CheckCEFLibrary error: Unsupported CEF version !');
end
else
OutputDebugMessage('TCefApplication.CheckCEFLibrary error: CEF binaries missing !');
end;
procedure TCefApplication.UpdateChromeVersionInfo;
@ -637,6 +755,8 @@ end;
procedure TCefApplication.App_OnBeforeCommandLineProc(const processType : ustring;
const commandLine : ICefCommandLine);
var
i : integer;
begin
if (commandLine <> nil) then
begin
@ -647,7 +767,18 @@ begin
commandLine.AppendSwitch('--enable-system-flash');
end;
if (length(FCustomCommandLine) > 0) then commandLine.AppendSwitch(FCustomCommandLine);
if (FCustomCommandLines <> nil) then
begin
i := 0;
while (i < FCustomCommandLines.Count) do
begin
if (length(FCustomCommandLines[i]) > 0) then
commandLine.AppendSwitch(FCustomCommandLines[i]);
inc(i);
end;
end;
end;
end;

View File

@ -680,8 +680,7 @@ begin
if (FPrefs <> nil) then FreeAndNil(FPrefs);
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.Destroy error: ' + e.Message);
OutputDebugMessage('TChromium.Destroy error: ' + e.Message);
end;
finally
inherited Destroy;
@ -703,8 +702,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.AfterConstruction error: ' + e.Message);
OutputDebugMessage('TChromium.AfterConstruction error: ' + e.Message);
end;
end;
@ -722,8 +720,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.CreateClientHandler error: ' + e.Message);
OutputDebugMessage('TChromium.CreateClientHandler error: ' + e.Message);
end;
end;
@ -868,8 +865,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.CreateBrowser error: ' + e.Message);
OutputDebugMessage('TChromium.CreateBrowser error: ' + e.Message);
end;
end;
@ -946,8 +942,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.VisitDOM error: ' + e.Message);
OutputDebugMessage('TChromium.VisitDOM error: ' + e.Message);
end;
end;
@ -1204,8 +1199,7 @@ begin
if (GlobalCEFApp <> nil) then Result := GlobalCEFApp.MultiThreadedMessageLoop;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.GetMultithreadApp error: ' + e.Message);
OutputDebugMessage('TChromium.GetMultithreadApp error: ' + e.Message);
end;
end;
@ -1634,13 +1628,12 @@ begin
Result := TempProxy.SetDictionary(TempDict) and
FBrowser.Host.RequestContext.SetPreference('proxy', TempProxy, TempError);
if not(Result) and (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('UpdateProxyPrefs error : ' + quotedstr(TempError));
if not(Result) then
OutputDebugMessage('TChromium.UpdateProxyPrefs error : ' + quotedstr(TempError));
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.UpdateProxyPrefs error: ' + e.Message);
OutputDebugMessage('TChromium.UpdateProxyPrefs error: ' + e.Message);
end;
end;
@ -1663,13 +1656,12 @@ begin
Result := FBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
if not(Result) and (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('UpdatePreference error : ' + quotedstr(TempError));
if not(Result) then
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
end;
end;
@ -1687,13 +1679,12 @@ begin
TempValue.SetInt(aValue);
Result := FBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
if not(Result) and (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('UpdatePreference error : ' + quotedstr(TempError));
if not(Result) then
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
end;
end;
@ -1711,13 +1702,12 @@ begin
TempValue.SetDouble(aValue);
Result := FBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
if not(Result) and (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('UpdatePreference error : ' + quotedstr(TempError));
if not(Result) then
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
end;
end;
@ -1735,13 +1725,12 @@ begin
TempValue.SetString(aValue);
Result := FBrowser.Host.RequestContext.SetPreference(aName, TempValue, TempError);
if not(Result) and (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('UpdatePreference error : ' + quotedstr(TempError));
if not(Result) then
OutputDebugMessage('TChromium.UpdatePreference error : ' + quotedstr(TempError));
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
OutputDebugMessage('TChromium.UpdatePreference error: ' + e.Message);
end;
end;
@ -1965,8 +1954,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.HandleDictionary error: ' + e.Message);
OutputDebugMessage('TChromium.HandleDictionary error: ' + e.Message);
end;
finally
if (TempKeys <> nil) then TempKeys.Free;
@ -1989,8 +1977,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.GetAllPreferences error: ' + e.Message);
OutputDebugMessage('TChromium.GetAllPreferences error: ' + e.Message);
end;
end;
@ -2023,8 +2010,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TChromium.ExecuteJavaScript error: ' + e.Message);
OutputDebugMessage('TChromium.ExecuteJavaScript error: ' + e.Message);
end;
end;

View File

@ -495,18 +495,25 @@ end;
destructor TVCLClientHandler.Destroy;
begin
if not(MultithreadApp) and not(ExternalMessagePump) then
begin
InterlockedDecrement(CefInstances);
if (CefInstances = 0) and (CefTimer <> 0) then
try
try
if not(MultithreadApp) and not(ExternalMessagePump) then
begin
KillTimer(0, CefTimer);
CefTimer := 0;
end;
end;
InterlockedDecrement(CefInstances);
inherited Destroy;
if (CefInstances = 0) and (CefTimer <> 0) then
begin
KillTimer(0, CefTimer);
CefTimer := 0;
end;
end;
except
on e : exception do
OutputDebugMessage('TVCLClientHandler.Destroy error: ' + e.Message);
end;
finally
inherited Destroy;
end;
end;
procedure TVCLClientHandler.ReleaseOtherInstances;
@ -530,8 +537,7 @@ begin
if (GlobalCEFApp <> nil) then Result := GlobalCEFApp.MultiThreadedMessageLoop;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TVCLClientHandler.GetMultithreadApp error: ' + e.Message);
OutputDebugMessage('TVCLClientHandler.GetMultithreadApp error: ' + e.Message);
end;
end;
@ -543,8 +549,7 @@ begin
if (GlobalCEFApp <> nil) then Result := GlobalCEFApp.ExternalMessagePump;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TVCLClientHandler.GetExternalMessagePump error: ' + e.Message);
OutputDebugMessage('TVCLClientHandler.GetExternalMessagePump error: ' + e.Message);
end;
end;

View File

@ -114,9 +114,14 @@ function CefCrashReportingEnabled : boolean;
procedure CefSetCrashKeyValue(const aKey, aValue : ustring);
procedure CefLog(const aFile : string; aLine, aSeverity : integer; const aMessage : string);
procedure OutputDebugMessage(const aMessage : string);
implementation
uses
uCEFConstants, uCEFApplication;
function CefColorGetA(color: TCefColor): Byte;
begin
Result := (color shr 24) and $FF;
@ -432,4 +437,16 @@ begin
end;
end;
procedure OutputDebugMessage(const aMessage : string);
const
DEFAULT_LINE = 1;
begin
{$IFDEF DEBUG}
OutputDebugString(PWideChar(aMessage + chr(0)));
if (GlobalCEFApp <> nil) and GlobalCEFApp.LibLoaded then
CefLog('CEF4Delphi', DEFAULT_LINE, CEF_LOG_SEVERITY_ERROR, aMessage);
{$ENDIF}
end;
end.

View File

@ -297,8 +297,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('cef_request_handler_on_select_client_certificate error: ' + e.Message);
OutputDebugMessage('uCEFRequestHandler.cef_request_handler_on_select_client_certificate error: ' + e.Message);
end;
finally
if (TempCertArray <> nil) then

View File

@ -122,8 +122,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TCefX509CertPrincipalRef.GetStreetAddresses error: ' + e.Message);
OutputDebugMessage('TCefX509CertPrincipalRef.GetStreetAddresses error: ' + e.Message);
end;
finally
if (TempList <> nil) then cef_string_list_free(TempList);
@ -146,8 +145,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TCefX509CertPrincipalRef.GetOrganizationNames error: ' + e.Message);
OutputDebugMessage('TCefX509CertPrincipalRef.GetOrganizationNames error: ' + e.Message);
end;
finally
if (TempList <> nil) then cef_string_list_free(TempList);
@ -170,8 +168,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TCefX509CertPrincipalRef.GetOrganizationUnitNames error: ' + e.Message);
OutputDebugMessage('TCefX509CertPrincipalRef.GetOrganizationUnitNames error: ' + e.Message);
end;
finally
if (TempList <> nil) then cef_string_list_free(TempList);
@ -194,8 +191,7 @@ begin
end;
except
on e : exception do
if (GlobalCEFApp <> nil) then
GlobalCEFApp.OutputDebugMessage('TCefX509CertPrincipalRef.GetDomainComponents error: ' + e.Message);
OutputDebugMessage('TCefX509CertPrincipalRef.GetDomainComponents error: ' + e.Message);
end;
finally
if (TempList <> nil) then cef_string_list_free(TempList);