Page 1 of 1

Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Sun Sep 22, 2013 3:23 am
by dshaulov
Hi,

In OnRenderProcessThreadCreated I need to send some extra_info that is specific to the browser object.
Is it possible to add a CefBrowser parameter to that method?
Specifically - I need to know if I should or should not add JS integration method in "OnContextCreated".
And I don't see how I can do that with async process messages.

Thanks, Daniel.

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Sun Sep 22, 2013 3:56 am
by dshaulov
Looking at the code - It seems even better to expose a "OnBeforeCreated" method in CefLifeSpanHandler that has an "extra_info" param - that will be passed to "OnBrowserCreated" on the renderer side.
This way - we also cover the case where a new browser is created in an old renderer process (for instance, because of the process limit).

This seems easy enough since we already have the CefProcessHostMsg_GetNewBrowserInfo message, which is sync and called before "OnBrowserCreated".

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Sun Sep 22, 2013 6:43 am
by magreenblatt
There may be multiple browser objects per render process. Also, in the case of popup windows the render process representation will be created before the browser process object so it doesn't know the new browser ID. In conclusion, the answer to your question is no. You need to use the IPC mechanism to transfer any browser-specific state after OnBrowserCreated is called in the render process.

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Tue Sep 24, 2013 6:00 pm
by dshaulov
Ok, how about moving it more backwards - sending the extra_info in "CreateBrowser" / "CreateBrowserSync", and getting it in the OnBrowserCreated on renderer side, does this make more sense?

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Wed Sep 25, 2013 2:29 am
by magreenblatt
dshaulov wrote:Ok, how about moving it more backwards - sending the extra_info in "CreateBrowser" / "CreateBrowserSync", and getting it in the OnBrowserCreated on renderer side, does this make more sense?

What about popup windows where CreateBrowser isn't called?

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Wed Sep 25, 2013 4:23 am
by dshaulov
Make it also a parameter for OnBeforePopup? (Same as for the rest of the parameters to CreateBrowser - CefClient, CefWindowInfo and CefBrowserSettings)

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Wed Sep 25, 2013 4:44 am
by magreenblatt
dshaulov wrote:Make it also a parameter for OnBeforePopup? (Same as for the rest of the parameters to CreateBrowser - CefClient, CefWindowInfo and CefBrowserSettings)

That should be possible. Feel free to create an issue in the issue tracker.

Re: Getting the CefBrowser in OnRenderProcessThreadCreated

PostPosted: Wed Sep 25, 2013 3:26 pm
by dshaulov