Page 1 of 2
Migrating from DCEF3
Posted: Thu Aug 10, 2017 4:46 pm
by thefunkyjoint
Hello,
I'm in the process of migrating existing apps from DCEF3 to CEF4. Some changes in my code are needed and i'm doing this. Here are some questions i have at the moment, if anyone could help with these i'd appreciate very much :
1 - I could not open the examples because i'm using Delphi 2007, it won't open the .dproj file. Any hints ?
2 - It seems the way to get the website html source after loaded changed ; can you please post an example ?
Thanks in advance !
Re: Migrating from DCEF3
Posted: Thu Aug 10, 2017 5:50 pm
by thefunkyjoint
Nevermind for question 2, i already find it searching on the forum.
Re: Migrating from DCEF3
Posted: Thu Aug 10, 2017 5:56 pm
by salvadordf
Hi,
thefunkyjoint wrote: Thu Aug 10, 2017 4:46 pm
1 - I could not open the examples because i'm using Delphi 2007, it won't open the .dproj file. Any hints ?
Try opening the Delphi 7 project in the SimpleBrowser demo. I only have a Delphi 10 license and I can't create all the project files.
thefunkyjoint wrote: Thu Aug 10, 2017 4:46 pm
2 - It seems the way to get the website html source after loaded changed ; can you please post an example ?
Call TChromium.RetrieveHTML and get the results in the TChromium.OnTextResultAvailable event.
The MiniBrowser demo has the code to copy the HTML into the clipboard.
Re: Migrating from DCEF3
Posted: Thu Aug 10, 2017 7:21 pm
by thefunkyjoint
Thank you, i could open the simple browser project in Delphi 2007.
Another question, please : how do i manage cookies ? Ie, i open my app, login in a website. When i close and open again, i'm not logged anymore.
Here is my current code, but it's not working ; do i have to do anything to load the cookies at app startup and keep my session alive ?
Thanks in advance !
begin
GlobalCEFApp := TCefApplication.Create;
GlobalCEFApp.Cookies := 'c:\app\cookies';
GlobalCEFApp.MuteAudio := true;
if GlobalCEFApp.StartMainProcess then
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.Title := 'Myapp';
Application.CreateForm(TFrmprinc, Frmprinc);
frmsplash.free;
Application.Run;
end;
GlobalCEFApp.Free;
end.
Re: Migrating from DCEF3
Posted: Thu Aug 10, 2017 7:27 pm
by salvadordf
Hi,
You must set GlobalCEFApp.cache and GlobalCEFApp.cookies to remain logged in.
Re: Migrating from DCEF3
Posted: Fri Aug 11, 2017 7:23 pm
by thefunkyjoint
Thank you, it worked !
Is it normal when i run my app with multiple instances of TChromium inside only one app, i see multiple instances of my app EXE file on task manager ? This behaviour did not happen in DCEF3.
Re: Migrating from DCEF3
Posted: Sat Aug 12, 2017 8:39 am
by salvadordf
Hi,
Yes, it's normal. The default configuration uses multiple processes.
For more information about that read these pages :
https://www.briskbard.com/index.php?lang=en&pageid=cef
http://www.chromium.org/developers/design-documents
If you use multiple TChromium components in one application you should take a look at the MDIBrowser or the ToolBoxBroser demos.
You need to destroy them properly or you may have problems.
Re: Migrating from DCEF3
Posted: Mon Aug 14, 2017 12:25 pm
by thefunkyjoint
Is it possible to alter this behaviour, to use only one process ?
My users don't like to see many processes of my app on the task manager, they think it's a bug...
Re: Migrating from DCEF3
Posted: Mon Aug 14, 2017 12:41 pm
by salvadordf
Hi,
The Chromium Embedded Framework (CEF3) does not support the single process setting anymore. It's still possible to set GlobalCEFApp.SingleProcess to True but it's
NOT reliable and it should only be used for debugging.
I would suggest you to use a different executable for the subprocesses. Use the
SubProcess demo and create a
crash_reporter.cfg file as described here :
https://bitbucket.org/chromiumembedded/ ... porting.md
The crash_reporter.cfg file is needed to use a different executable for the subprocesses.
The latest versions of Chrome, Chromium and many other web browsers use multiple processes and it's perfectly normal.
Re: Migrating from DCEF3
Posted: Mon Aug 14, 2017 1:15 pm
by thefunkyjoint
Ok, will check.
Thank you for your kindness and interest in helping ! : )