Page 1 of 1

Chromium1.CreateBrowser question

Posted: Wed Jun 26, 2024 3:05 pm
by sodlf159
if not(Chromium1.CreateBrowser(CEFWindowParent1)) then

Timer1
if not(Chromium1.CreateBrowser(CEFWindowParent1)) and
not(Chromium1.Initialized) then

////////////
TempContext := TCefRequestContextRef.New('', '', '', False, False,False, Chromium1.ReqContextHandler);
Chromium1.CreateBrowser(CEFWindowParent1, '', TempContext);
//////////////

I'm curious about the difference between the two.

Proxy also seems to be affected. There is no problem if I do it the second time, but if I proxy it the first time and use it on another computer, I cannot connect because it is already connected. Is there a difference?

Re: Chromium1.CreateBrowser question

Posted: Thu Jun 27, 2024 10:03 am
by salvadordf
Hi,

All the browsers created with a aContext parameter set to NIL will use the global context and all of them will share the same settings, cache, etc.

Creating a browser with a new ICefRequestContext instance allows you to have an independent browser with different settings, cache, etc.

See the MDIBrowser demo :
https://github.com/salvadordf/CEF4Delphi/blob/be0efab35e624317514b6614f1771d7f4c446e8c/demos/Delphi_VCL/MDIBrowser/uChildForm.pas#L172

Re: Chromium1.CreateBrowser question

Posted: Fri Jul 05, 2024 10:38 am
by sodlf159
TempContext := TCefRequestContextRef.New('', '', '', False, False, True, nil);

TempContext := TCefRequestContextRef.New('', '', '', False, False, True, Chromium1.ReqContextHandler);

What's the difference?

Re: Chromium1.CreateBrowser question

Posted: Sat Jul 06, 2024 9:48 am
by salvadordf
The Handlers are used to expose Delphi events among other things.

Creating a TCefRequestContextRef instance with a Chromium1.ReqContextHandler means that the TChromiumCore instance will get TChromiumCore.OnRequestContextInitialized and TChromiumCore.OnGetResourceRequestHandler_ReqCtxHdlr events.