Send data from chromium code to cef client

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Send data from chromium code to cef client

Postby YogeshTembe » Fri Jun 16, 2023 10:35 am

I have one cefclient app and I wanted to send data from chromium's browser process to cef client app's browser process. I have the data in chromium code and I want to send it to cefclient app.

I have few doubts related to this -
1) do I need to do a function callback from cef code to chromium code similar to what other function callbacks are written like "OnBeforeContextMenu" ?
2) I am not sure how does chromium code sends data to "OnBeforeContextMenu" function in cef code
3) How can I call some cef method from chromium code ?

If anyone has idea related to this topic then please let me know.
YogeshTembe
Techie
 
Posts: 23
Joined: Tue Sep 14, 2021 6:01 am

Re: Send data from chromium code to cef client

Postby magreenblatt » Fri Jun 16, 2023 1:25 pm

Sorry, I don’t understand. You’re launching two separate processes and you want to communicate between them? Are they both CEF-based processes?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Send data from chromium code to cef client

Postby YogeshTembe » Fri Jun 16, 2023 11:35 pm

Sorry for the confusion. Let me clarify the question further.

I have one application that uses cef. The cef code uses chromium internally.
I have some data in chromium code's renderer process and I want to send that data to my application's browser process.
So can you please help me in figuring out the right approach to do this ?
Do I need to use cef as intermediate step for this ?
YogeshTembe
Techie
 
Posts: 23
Joined: Tue Sep 14, 2021 6:01 am

Re: Send data from chromium code to cef client

Postby magreenblatt » Sat Jun 17, 2023 1:19 am

magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Send data from chromium code to cef client

Postby YogeshTembe » Sat Jun 17, 2023 3:25 am

Thanks for the response.

I have tried blink::mojom inside chromium code to send data from chromium's renderer process to chromium's browser process. And I am able to transfer data but all of it is inside chromium code and I want the data to go in my cef application.

The sending of the data from chromium's renderer process is right but to receive the data in my cef application I will have to include blink::mojom from chromium code in my cef application which wrong and it gives compilation / linking errors.

The document that you have suggested has ipc that can be used inside cef code or cef application. but I won't be able to include CefBrowser and CefFrame objects or any other ipc related classes from cef code inside chromium code, right ?

Are you suggesting that there is a way we can make ipc call in chromium's renderer process and receive the data directly in my cef application's browser process ?
YogeshTembe
Techie
 
Posts: 23
Joined: Tue Sep 14, 2021 6:01 am

Re: Send data from chromium code to cef client

Postby magreenblatt » Sat Jun 17, 2023 4:26 am

What do you mean by “chromium’s renderer process”? If your application is using CEF then the renderer process is also managed by CEF and you can use the CEF IPC APIs as documented.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Send data from chromium code to cef client

Postby YogeshTembe » Sat Jun 17, 2023 5:18 am

By "chromium’s renderer process" I mean renderer folder inside chromium code.
I have some data inside chromium code.

Using cef ipc api and its functions inside chromium code will not be good right? becasue we will have to include cef files inside chromium code.

By CEF IPC you mean "SendProcessMessage" and "OnProcessMessageRecived" right ?
YogeshTembe
Techie
 
Posts: 23
Joined: Tue Sep 14, 2021 6:01 am

Re: Send data from chromium code to cef client

Postby magreenblatt » Sat Jun 17, 2023 5:36 am

You will need to expose your data as a CEF callback (via CefRenderProcessHandler, for example). Look at the existing libcef/renderer code for examples.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 216 guests