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.

Converting to CEF4Delphi

Post Reply
hvassbotn
Posts: 29
Joined: Tue Apr 25, 2017 3:02 pm
Location: Oslo, Norway
Contact:

Converting to CEF4Delphi

Post by hvassbotn »

Hi Salvador,

Thanks for the great job you are doing with the open source work of CEF4Delphi!

As many others, I've just started the work of converting our embedded Chromium browser from dcef3.

Some issues and questions that have popped up so far:

* If at all possible we would prefer to have a all CEF-related files in a subfolder. But as you state in some other posts, here that does not seem possible for all files.

* Do you want suggestions and code-changes here or do you take pull-requests in Git?

* The browser part of our application is a detail and we would like to fail gracefully (by not making it available, or falling back to IE) if the DLLs are not available or fail to load for some reason. But with the current checks, exception handlers and MessageBox calls in CheckCEFLibrary, that does not seem possible. Ah - I just found the CheckCEFFiles property to avoid the checks - fine! :)

Can I suggest that you factor out the actual CheckXXX calls into a separate helper function, then the calling code can check it themselves before conditionally calling StartMainProcess.

* Code like:

if (TempDir[length(TempDir)] <> '\') then TempDir := TempDir + '\';

could be replaced by a simple call to IncludeTrailingPathDelimiter :).

* I'm not a great fan of unconditionally silencing all exceptions, even if logging them to the debug console:

except
on e : exception do
OutputDebugMessage('CheckLocales error: ' + e.Message);
end;

Maybe there could be a property or IFDEF to control this?

* CheckLocales requires that all .pak files for all locales must be present. Currently we only ship with the en-US.pak for dcef3, and that seem to work fine. Not a biggie, since you can turn off the checks, but maybe it could check that at least one language pak is available?

That's all for now. Initial testing looks good! :) It handles a site that the current version of dcef3 could not handle.

Best regards
Hallvard
User avatar
salvadordf
Posts: 4086
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Converting to CEF4Delphi

Post by salvadordf »

hvassbotn wrote: Tue Apr 25, 2017 3:45 pm Some issues and questions that have popped up so far:
* If at all possible we would prefer to have a all CEF-related files in a subfolder. But as you state in some other posts, here that does not seem possible for all files.
The CEF3 binaries have some hardcoded limitations. Read this :
https://github.com/salvadordf/CEF4Delphi/issues/13

It's an old conversation and the latest binaries could allow you to move more files. I haven't checked.
hvassbotn wrote: Tue Apr 25, 2017 3:45 pm * Do you want suggestions and code-changes here or do you take pull-requests in Git?
Please send your suggestions here. I'm still learning how GitHub works.
hvassbotn wrote: Tue Apr 25, 2017 3:45 pm * The browser part of our application is a detail and we would like to fail gracefully (by not making it available, or falling back to IE) if the DLLs are not available or fail to load for some reason. But with the current checks, exception handlers and MessageBox calls in CheckCEFLibrary, that does not seem possible. Ah - I just found the CheckCEFFiles property to avoid the checks - fine! :)
Can I suggest that you factor out the actual CheckXXX calls into a separate helper function, then the calling code can check it themselves before conditionally calling StartMainProcess.
All CheckXXX functions are in uCEFMiscFunctions.pas because other person asked precisely what you said. ;)
You can set CheckCEFFiles to False and use those functions (or different ones) before creating GlobalCEFApp.
hvassbotn wrote: Tue Apr 25, 2017 3:45 pm * Code like:
if (TempDir[length(TempDir)] <> '\') then TempDir := TempDir + '\';
could be replaced by a simple call to IncludeTrailingPathDelimiter :).
Thanks! I'll change it in the next version.
hvassbotn wrote: Tue Apr 25, 2017 3:45 pm * I'm not a great fan of unconditionally silencing all exceptions, even if logging them to the debug console:

except
on e : exception do
OutputDebugMessage('CheckLocales error: ' + e.Message);
end;

Maybe there could be a property or IFDEF to control this?
I'll add a new boolean property to GlobalCEFApp to re-raise all exceptions inside the OutputDebugMessage function.
hvassbotn wrote: Tue Apr 25, 2017 3:45 pm * CheckLocales requires that all .pak files for all locales must be present. Currently we only ship with the en-US.pak for dcef3, and that seem to work fine. Not a biggie, since you can turn off the checks, but maybe it could check that at least one language pak is available?
If you set CheckCEFFiles to False you can use any custom function you like to check the pak files before creating GlobalCEFApp.
Post Reply