Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.

TChromium control - Initialization issue

User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: TChromium control - Initialization issue

Post by salvadordf »

It's relatively easy to make mistakes when you "wrap" and "unwrap" CEF interfaces that could lead to unreleased instances and shutdown crashes.

I would suggest to replace that with a simple ID comparison. All the browsers have it and you can read it in TChromium.BrowserId or in the ICefBrowser.Identifier properties. Those properties refer to the same browser identifier and you can use them for this purpose.
john.augustine
Posts: 48
Joined: Fri Jul 10, 2020 1:33 pm

Re: TChromium control - Initialization issue

Post by john.augustine »

Sure, I will apply the same.

Thank you!
john.augustine
Posts: 48
Joined: Fri Jul 10, 2020 1:33 pm

Re: TChromium control - Initialization issue

Post by john.augustine »

Hi,

Any idea, why Delphi CEF4 browser is displaying black screen when i resize the form.

I used CEFWindowParent and TChromium.

Your thoughts please...

Thanks & Regards,
John Augustine
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: TChromium control - Initialization issue

Post by salvadordf »

Do you get a black screen when you resize the SimpleBrowser2 demo ?
john.augustine
Posts: 48
Joined: Fri Jul 10, 2020 1:33 pm

Re: TChromium control - Initialization issue

Post by john.augustine »

Hi

No, I don't see black screen in "SimpleBrowser2". Let me check my code....Thank you!

Thanks & Regards,
John Augustine
john.augustine
Posts: 48
Joined: Fri Jul 10, 2020 1:33 pm

Re: TChromium control - Initialization issue

Post by john.augustine »

Hi,

In folder "Locales", is all the .PAK files are required for the application. there are 53 PAK files are available in this folder. My application is not an international application :-). Just US-English is fine.

Kindly let me know how to set this because if i run my application only with "en-US.pak" then getting error message as missing with other 52 PAK files.

Thanks & Regards,
John Augustine
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: TChromium control - Initialization issue

Post by salvadordf »

Read the "README.txt" file of the CEF binaries package you are using to know what files can be omitted.

This is a copy of that file from the latest CEF version :
Chromium Embedded Framework (CEF) Standard Binary Distribution for Windows
-------------------------------------------------------------------------------

Date: July 21, 2020

CEF Version: 84.2.6+geeda28c+chromium-84.0.4147.89
CEF URL: https://bitbucket.org/chromiumembedded/cef.git
@eeda28cdc8c94a118528aec1054f666222506bf3

Chromium Version: 84.0.4147.89
Chromium URL: https://chromium.googlesource.com/chromium/src.git
@a4c2a1876a86e9d6247402907b48100e648cbfdc

This distribution contains all components necessary to build and distribute an
application using CEF on the Windows platform. Please see the LICENSING
section of this document for licensing terms and conditions.


CONTENTS
--------

cmake Contains CMake configuration files shared by all targets.

Debug Contains libcef.dll, libcef.lib and other components required to
build and run the debug version of CEF-based applications. By
default these files should be placed in the same directory as the
executable and will be copied there as part of the build process.

include Contains all required CEF header files.

libcef_dll Contains the source code for the libcef_dll_wrapper static library
that all applications using the CEF C++ API must link against.

Release Contains libcef.dll, libcef.lib and other components required to
build and run the release version of CEF-based applications. By
default these files should be placed in the same directory as the
executable and will be copied there as part of the build process.

Resources Contains resources required by libcef.dll. By default these files
should be placed in the same directory as libcef.dll and will be
copied there as part of the build process.

tests/ Directory of tests that demonstrate CEF usage.

cefclient Contains the cefclient sample application configured to build
using the files in this distribution. This application demonstrates
a wide range of CEF functionalities.

cefsimple Contains the cefsimple sample application configured to build
using the files in this distribution. This application demonstrates
the minimal functionality required to create a browser window.

ceftests Contains unit tests that exercise the CEF APIs.

gtest Contains the Google C++ Testing Framework used by the ceftests
target.

shared Contains source code shared by the cefclient and ceftests targets.


USAGE
-----

Building using CMake:
CMake can be used to generate project files in many different formats. See
usage instructions at the top of the CMakeLists.txt file.

Please visit the CEF Website for additional usage information.

https://bitbucket.org/chromiumembedded/cef/


REDISTRIBUTION
--------------

This binary distribution contains the below components.

Required components:

The following components are required. CEF will not function without them.

* CEF core library.
* libcef.dll

* Crash reporting library.
* chrome_elf.dll

* Unicode support data.
* icudtl.dat

* V8 snapshot data.
* snapshot_blob.bin
* v8_context_snapshot.bin

Optional components:

The following components are optional. If they are missing CEF will continue to
run but any related functionality may become broken or disabled.

* Localized resources.
Locale file loading can be disabled completely using
CefSettings.pack_loading_disabled. The locales directory path can be
customized using CefSettings.locales_dir_path.

* locales/
Directory containing localized resources used by CEF, Chromium and Blink. A
.pak file is loaded from this directory based on the CefSettings.locale
value. Only configured locales need to be distributed. If no locale is
configured the default locale of "en-US" will be used. Without these files
arbitrary Web components may display incorrectly.

* Other resources.
Pack file loading can be disabled completely using
CefSettings.pack_loading_disabled. The resources directory path can be
customized using CefSettings.resources_dir_path.

* cef.pak
* cef_100_percent.pak
* cef_200_percent.pak
These files contain non-localized resources used by CEF, Chromium and Blink.
Without these files arbitrary Web components may display incorrectly.

* cef_extensions.pak
This file contains non-localized resources required for extension loading.
Pass the `--disable-extensions` command-line flag to disable use of this
file. Without this file components that depend on the extension system,
such as the PDF viewer, will not function.

* devtools_resources.pak
This file contains non-localized resources required for Chrome Developer
Tools. Without this file Chrome Developer Tools will not function.

* Angle and Direct3D support.
* d3dcompiler_47.dll (required for Windows Vista and newer)
* libEGL.dll
* libGLESv2.dll
Without these files HTML5 accelerated content like 2D canvas, 3D CSS and WebGL
will not function.

* SwiftShader support.
* swiftshader/libEGL.dll
* swiftshader/libGLESv2.dll
Without these files WebGL will not function in software-only mode when the GPU
is not available or disabled.


LICENSING
---------

The CEF project is BSD licensed. Please read the LICENSE.txt file included with
this binary distribution for licensing terms and conditions. Other software
included in this distribution is provided under other licenses. Please visit
"about:credits" in a CEF-based application for complete Chromium and third-party
licensing information.
If your application uses an installer to copy the CEF files then you can assume that all of them are correct and set GlobalCEFApp.CheckCEFFiles to False before the GlobalCEFApp.StartMainProcess call.

You can also call CheckLocales, CheckResources and CheckDLLs manually with a custom set of required locales. Those functions are available in uCEFMiscFunctions.pas
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: TChromium control - Initialization issue

Post by salvadordf »

I forgot to say that you always have to include the "en-US" locale file or you will have rendering issues.

cef_sandbox.lib and libcef.lib can be safely deleted because we can't use them in Delphi.
john.augustine
Posts: 48
Joined: Fri Jul 10, 2020 1:33 pm

Re: TChromium control - Initialization issue

Post by john.augustine »

Great!

As you suggested, I set "GlobalCEFApp.CheckCEFFiles := False;" before StartMainProcess. It works fine!

In the documentation, If no locale is configured the default locale of "en-US" will be used. Without these files arbitrary Web components may display incorrectly..

I am not getting this --> "Without these files arbitrary Web components may display incorrectly". So will this impact in my application/browser if i am not using these files (except "en-US").
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: TChromium control - Initialization issue

Post by salvadordf »

If I remember correctly those locale files are used to translate the default context menu entries and some other text strings.

The "en-US" locale file is always needed and you have to distribute it with your application. It's a dependency in Chromium's code.

This is an example of what could happen if you don't add that file :
viewtopic.php?f=10&t=239
Post Reply