Allow synchronously sending extra_info to renderer at each browser creation

Issue #1088 resolved
Former user created an issue

Original issue 1088 created by Daniel.Shaulov on 2013-09-25T20:29:16.000Z:

We will need to add an extra_info parameter to BrowserCreate[Sync] and OnBeforePopup (Those should cover all browser creations). People will set the info in those functions and get it in OnBrowserCreated on the renderer side.

This was discussed here:

I have seen somewhere in the forums/issues that OnBrowserCreated may be called multiple times for the same browser (In cross-origin navigations?).
I am thinking of perhaps just saving the info in the renderer side representation of the browser and having a "GetExtraInfo" call added to CefBrowser.

This aproach will be a bit better since otherwise users will need to keep a map from the browser ID to that extra_info, so they can acess it later. With this aproach, in each callback we imidiatly have acess to that extra_info object.

This has the immidiate oportunity to attach any other info the users have that is specific to a browser to that object. On the Browser process we have the GetClient for that (Users can have one to one relation between CefClient and CefBrowser objects, and keep all needed info in there).

What do you think, go for first aproach (extra_info in OnBrowserCreated) or the second one (GetExtraInfo added to CefBrowser)?

Comments (5)

  1. Marshall Greenblatt

    Should be possible to transfer the information using CefProcessHostMsg_GetNewBrowserInfo / CefBrowserMessageFilter::OnGetNewBrowserInfo which is called synchronously before OnBrowserCreated.

  2. Marshall Greenblatt

    Instead of adding another parameter to CreateBrowser, OnBeforePopup, ShowDevTools and CreateBrowserView now would probably be a good time to introduce a new object -- CefCreateBrowserParams -- and use that as the argument to those methods. These existing arguments should move to that object as well:

    const CefWindowInfo& windowInfo, CefRefPtr<CefClient> client, const CefBrowserSettings& settings

  3. Marshall Greenblatt

    Add |extra_info| parameter for browser creation (fixes issue #1088)

    The optional |extra_info| parameter provides an opportunity to specify extra information specific to the created browser that will be passed to CefRenderProcessHandler::OnBrowserCreated() in the render process.

    → <<cset 473c29a70dca>>

  4. Log in to comment