You've already forked CEF4Delphi
							
							
				mirror of
				https://github.com/salvadordf/CEF4Delphi.git
				synced 2025-10-30 23:07:52 +02:00 
			
		
		
		
	Update to CEF 3.3239.1700.g385b2d4
- New TCEFServerComponent. The new CEF3 includes a http and websockets server for communication between applications in localhost. - New JSDialogBrowser demo to showhow to use custom forms in javascript dialogs. - New SimpleServer demo which uses TCEFServerComponent. - Removed all the code that could be removed from the DPR files and moved to another units. - Now the GlogalCEFApp checks all the CEF3 binaries and stores the missing files in GlogalCEFApp.MissingLibFiles. The default error message gives a list of missing files. - New GlobalCEFApp.Status property. Use it with GlobalCEFApp.ShowMessageDlg set to False if you want to show customized error messages. - Now TCEFClient only creates the necessary handlers if you use any their events in TChromium. - Fixed a destruction bug in OSRExternalPumpBrowser - Added the procedures to handle WM_ENTERMENULOOP and WM_EXITMENULOOP to all the demos.
This commit is contained in:
		| @@ -138,11 +138,12 @@ function  GetDLLVersion(const aDLLFile : string; var aVersionInfo : TFileVersion | ||||
|  | ||||
| function SplitLongString(aSrcString : string) : string; | ||||
| function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean; | ||||
| function CheckLocales(const aLocalesDirPath : string; const aLocalesRequired : string = '') : boolean; | ||||
| function CheckResources(const aResourcesDirPath : string; aCheckDevResources: boolean = True) : boolean; | ||||
| function CheckDLLs(const aFrameworkDirPath : 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) : boolean; | ||||
| function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean; | ||||
| function CheckDLLVersion(const aDLLFile : string; aMajor, aMinor, aRelease, aBuild : uint16) : boolean; | ||||
| function FileVersionInfoToString(const aVersionInfo : TFileVersionInfo) : string; | ||||
| function CheckFilesExist(var aList : TStringList; var aMissingFiles : string) : boolean; | ||||
|  | ||||
| function  CefParseUrl(const url: ustring; var parts: TUrlParts): Boolean; | ||||
| function  CefCreateUrl(var parts: TUrlParts): ustring; | ||||
| @@ -604,42 +605,26 @@ begin | ||||
|     end; | ||||
| end; | ||||
|  | ||||
| function CheckLocaleFile(const aLocalesDirPath, aLocale : string) : boolean; | ||||
| function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean; | ||||
| begin | ||||
|   Result := FileExists(aLocalesDirPath + aLocale + '.pak'); | ||||
|   Result := True; | ||||
|  | ||||
|   if (length(aSrcPath) > 0) then | ||||
|     begin | ||||
|       aRsltPath := IncludeTrailingPathDelimiter(aSrcPath); | ||||
|  | ||||
|       if DirectoryExists(aSrcPath) then | ||||
|         begin | ||||
|           if CustomPathIsRelative(aRsltPath) then aRsltPath := GetModulePath + aRsltPath; | ||||
|         end | ||||
|        else | ||||
|         Result := False; | ||||
|     end | ||||
|    else | ||||
|     aRsltPath := ''; | ||||
| end; | ||||
|  | ||||
| function CheckLocaleFiles(const aLocalesDirPath, aLocalesRequired : string) : boolean; | ||||
| var | ||||
|   TempLocaleList : TStrings; | ||||
|   TempLocale     : string; | ||||
|   i, j           : integer; | ||||
| begin | ||||
|   Result         := True; | ||||
|   TempLocaleList := TStringList.Create; | ||||
|  | ||||
|   try | ||||
|     TempLocaleList.CommaText := aLocalesRequired; | ||||
|  | ||||
|     i := 0; | ||||
|     j := TempLocaleList.Count; | ||||
|  | ||||
|     while (i < j) and Result do | ||||
|       begin | ||||
|         TempLocale := trim(TempLocaleList[i]); | ||||
|  | ||||
|         // avoid typing mistakes | ||||
|         if (Length(TempLocale) > 0) then | ||||
|           Result := Result and CheckLocaleFile(aLocalesDirPath, TempLocale); | ||||
|  | ||||
|         inc(i); | ||||
|       end; | ||||
|   finally | ||||
|     FreeAndNil(TempLocaleList); | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function CheckLocales(const aLocalesDirPath, aLocalesRequired : string) : boolean; | ||||
| function CheckLocales(const aLocalesDirPath : string; var aMissingFiles : string; const aLocalesRequired : string) : boolean; | ||||
| const | ||||
|   LOCALES_REQUIRED_DEFAULT = | ||||
|     'am,' + | ||||
| @@ -696,100 +681,152 @@ const | ||||
|     'zh-CN,' + | ||||
|     'zh-TW'; | ||||
| var | ||||
|   TempDir             : string; | ||||
|   TempLocalesRequired : string; | ||||
|   i        : integer; | ||||
|   TempDir  : string; | ||||
|   TempList : TStringList; | ||||
| begin | ||||
|   Result := False; | ||||
|   Result   := False; | ||||
|   TempList := nil; | ||||
|  | ||||
|   try | ||||
|     if (length(aLocalesDirPath) > 0) then | ||||
|       TempDir := aLocalesDirPath | ||||
|      else | ||||
|       TempDir := 'locales'; | ||||
|  | ||||
|     if DirectoryExists(TempDir) then | ||||
|       begin | ||||
|         TempDir := IncludeTrailingPathDelimiter(TempDir); | ||||
|  | ||||
|         if (length(aLocalesRequired) > 0) then | ||||
|           TempLocalesRequired := aLocalesRequired | ||||
|          else | ||||
|           TempLocalesRequired := LOCALES_REQUIRED_DEFAULT; | ||||
|  | ||||
|         Result := CheckLocaleFiles(TempDir, TempLocalesRequired); | ||||
|       end; | ||||
|   except | ||||
|     on e : exception do | ||||
|       if CustomExceptionHandler('CheckLocales', e) then raise; | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function GetAbsoluteDirPath(const aSrcPath : string; var aRsltPath : string) : boolean; | ||||
| begin | ||||
|   Result := True; | ||||
|  | ||||
|   if (length(aSrcPath) > 0) then | ||||
|     begin | ||||
|       if DirectoryExists(aSrcPath) then | ||||
|         begin | ||||
|           aRsltPath := IncludeTrailingPathDelimiter(aSrcPath); | ||||
|           if CustomPathIsRelative(aRsltPath) then aRsltPath := GetModulePath + aRsltPath; | ||||
|         end | ||||
|     try | ||||
|       if (length(aLocalesDirPath) > 0) then | ||||
|         TempDir := IncludeTrailingPathDelimiter(aLocalesDirPath) | ||||
|        else | ||||
|         Result := False; | ||||
|     end | ||||
|    else | ||||
|     aRsltPath := ''; | ||||
|         TempDir := 'locales\'; | ||||
|  | ||||
|       TempList := TStringList.Create; | ||||
|  | ||||
|       if (length(aLocalesRequired) > 0) then | ||||
|         TempList.CommaText := aLocalesRequired | ||||
|        else | ||||
|         TempList.CommaText := LOCALES_REQUIRED_DEFAULT; | ||||
|  | ||||
|       i := 0; | ||||
|       while (i < TempList.Count) do | ||||
|         begin | ||||
|           TempList[i] := TempDir + TempList[i] + '.pak'; | ||||
|           inc(i); | ||||
|         end; | ||||
|  | ||||
|       if DirectoryExists(TempDir) then | ||||
|         Result := CheckFilesExist(TempList, aMissingFiles) | ||||
|        else | ||||
|         aMissingFiles := trim(aMissingFiles) + CRLF + TempList.Text; | ||||
|     except | ||||
|       on e : exception do | ||||
|         if CustomExceptionHandler('CheckLocales', e) then raise; | ||||
|     end; | ||||
|   finally | ||||
|     if (TempList <> nil) then FreeAndNil(TempList); | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function CheckResources(const aResourcesDirPath : string; aCheckDevResources: boolean) : boolean; | ||||
| function CheckResources(const aResourcesDirPath : string; var aMissingFiles : string; aCheckDevResources: boolean) : boolean; | ||||
| var | ||||
|   TempDir : string; | ||||
|   TempDir    : string; | ||||
|   TempList   : TStringList; | ||||
|   TempExists : boolean; | ||||
| begin | ||||
|   Result := False; | ||||
|  | ||||
|   try | ||||
|     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 | ||||
|       if CustomExceptionHandler('CheckResources', e) then raise; | ||||
|     try | ||||
|       TempExists := GetAbsoluteDirPath(aResourcesDirPath, TempDir); | ||||
|  | ||||
|       TempList := TStringList.Create; | ||||
|       TempList.Add(TempDir + 'natives_blob.bin'); | ||||
|       TempList.Add(TempDir + 'snapshot_blob.bin'); | ||||
|       TempList.Add(TempDir + 'v8_context_snapshot.bin'); | ||||
|       TempList.Add(TempDir + 'cef.pak'); | ||||
|       TempList.Add(TempDir + 'cef_100_percent.pak'); | ||||
|       TempList.Add(TempDir + 'cef_200_percent.pak'); | ||||
|       TempList.Add(TempDir + 'cef_extensions.pak'); | ||||
|  | ||||
|       if aCheckDevResources then TempList.Add(TempDir + 'devtools_resources.pak'); | ||||
|  | ||||
|       if TempExists then | ||||
|         Result := CheckFilesExist(TempList, aMissingFiles) | ||||
|        else | ||||
|         aMissingFiles := trim(aMissingFiles) + CRLF + TempList.Text; | ||||
|     except | ||||
|       on e : exception do | ||||
|         if CustomExceptionHandler('CheckResources', e) then raise; | ||||
|     end; | ||||
|   finally | ||||
|     if (TempList <> nil) then FreeAndNil(TempList); | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function CheckDLLs(const aFrameworkDirPath : string) : boolean; | ||||
| function CheckDLLs(const aFrameworkDirPath : string; var aMissingFiles : string) : boolean; | ||||
| var | ||||
|   TempDir : string; | ||||
|   TempDir    : string; | ||||
|   TempList   : TStringList; | ||||
|   TempExists : boolean; | ||||
| begin | ||||
|   Result := False; | ||||
|   Result   := False; | ||||
|   TempList := nil; | ||||
|  | ||||
|   try | ||||
|     // The icudtl.dat file must be placed next to libcef.dll | ||||
|     // http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=14503#p32263 | ||||
|     Result := GetAbsoluteDirPath(aFrameworkDirPath, TempDir)    and | ||||
|               FileExists(TempDir + CHROMEELF_DLL)               and | ||||
|               FileExists(TempDir + LIBCEF_DLL)                  and | ||||
|               FileExists(TempDir + 'd3dcompiler_43.dll')        and | ||||
|               FileExists(TempDir + 'd3dcompiler_47.dll')        and | ||||
|               FileExists(TempDir + 'libEGL.dll')                and | ||||
|               FileExists(TempDir + 'libGLESv2.dll')             and | ||||
|               FileExists(TempDir + 'swiftshader\libEGL.dll')    and | ||||
|               FileExists(TempDir + 'swiftshader\libGLESv2.dll') and | ||||
|               FileExists(TempDir + 'icudtl.dat')                and | ||||
|               FileExists(TempDir + 'widevinecdmadapter.dll'); | ||||
|   except | ||||
|     on e : exception do | ||||
|       if CustomExceptionHandler('CheckDLLs', e) then raise; | ||||
|     try | ||||
|       TempExists := GetAbsoluteDirPath(aFrameworkDirPath, TempDir); | ||||
|  | ||||
|       // The icudtl.dat file must be placed next to libcef.dll | ||||
|       // http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=14503#p32263 | ||||
|  | ||||
|       TempList := TStringList.Create; | ||||
|       TempList.Add(TempDir + CHROMEELF_DLL); | ||||
|       TempList.Add(TempDir + LIBCEF_DLL); | ||||
|       TempList.Add(TempDir + 'd3dcompiler_43.dll'); | ||||
|       TempList.Add(TempDir + 'd3dcompiler_47.dll'); | ||||
|       TempList.Add(TempDir + 'libEGL.dll'); | ||||
|       TempList.Add(TempDir + 'libGLESv2.dll'); | ||||
|       TempList.Add(TempDir + 'swiftshader\libEGL.dll'); | ||||
|       TempList.Add(TempDir + 'swiftshader\libGLESv2.dll'); | ||||
|       TempList.Add(TempDir + 'icudtl.dat'); | ||||
|       TempList.Add(TempDir + 'widevinecdmadapter.dll'); | ||||
|  | ||||
|       if TempExists then | ||||
|         Result := CheckFilesExist(TempList, aMissingFiles) | ||||
|        else | ||||
|         aMissingFiles := trim(aMissingFiles) + CRLF + TempList.Text; | ||||
|     except | ||||
|       on e : exception do | ||||
|         if CustomExceptionHandler('CheckDLLs', e) then raise; | ||||
|     end; | ||||
|   finally | ||||
|     if (TempList <> nil) then FreeAndNil(TempList); | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| function CheckFilesExist(var aList : TStringList; var aMissingFiles : string) : boolean; | ||||
| var | ||||
|   i : integer; | ||||
| begin | ||||
|   Result := True; | ||||
|  | ||||
|   try | ||||
|     if (aList <> nil) then | ||||
|       begin | ||||
|         i := 0; | ||||
|  | ||||
|         while (i < aList.Count) do | ||||
|           begin | ||||
|             if (length(aList[i]) > 0) and not(FileExists(aList[i])) then | ||||
|               begin | ||||
|                 Result        := False; | ||||
|                 aMissingFiles := aMissingFiles + aList[i] + CRLF; | ||||
|               end; | ||||
|  | ||||
|             inc(i); | ||||
|           end; | ||||
|       end; | ||||
|   except | ||||
|     on e : exception do | ||||
|       if CustomExceptionHandler('CheckFilesExist', e) then raise; | ||||
|   end; | ||||
| end; | ||||
|  | ||||
| procedure UInt64ToFileVersionInfo(const aVersion : uint64; var aVersionInfo : TFileVersionInfo); | ||||
| begin | ||||
|   aVersionInfo.MajorVer := uint16(aVersion shr 48); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user