Using CEF for integration with Chromium

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

Using CEF for integration with Chromium

Postby enterit » Sun May 11, 2014 11:59 pm

I am thinking about using custom language as a replacement for JavaScript in Chromium browser.
My ultimate goal is having a full browser (not embedded), that would allow writing all the scripts in Groovy (or any other Java languages).
I like the idea of using JavaScript Integration of CEF. Can I use it in combination with Chromium browser?

I am very new to CEF code, so it would be very helpful if you could point me in the right direction.
Is it in principle possible to add CEF or CEF/based extension (native lib or something) to Chromium, and access Chromium tabs / document / JS context through CEF?
If yes, could you please describe briefly how would you do that? If not, could you please tell what you think would be a better approach?

Thanks a lot!
Sergey
enterit
Newbie
 
Posts: 4
Joined: Sun May 11, 2014 11:28 pm

Re: Using CEF for integration with Chromium

Postby magreenblatt » Mon May 12, 2014 9:57 am

enterit wrote:I am thinking about using custom language as a replacement for JavaScript in Chromium browser.

This will be a significant amount of work and will require changes to Chromium and Blink. You can see discussion related to Dart integration here: https://lists.webkit.org/pipermail/webk ... 18775.html
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Using CEF for integration with Chromium

Postby enterit » Mon May 12, 2014 2:31 pm

Why would it require a significant amount of work? Think I am fine with JS as a proxy. V8 already has native bindings exposed in CEF - so we should be able to define native functions, primitives and objects in the native code. Also we have callbacks from browsers that allow to hook into different page loading phases.
With Groovy dynamic method dispatching capabilities it should be easy to write such a proxy. This way JS code and Groovy code could even co-exist (instead of adding an alternative VM directly into browser).
Did I miss the point?
enterit
Newbie
 
Posts: 4
Joined: Sun May 11, 2014 11:28 pm

Re: Using CEF for integration with Chromium

Postby magreenblatt » Mon May 12, 2014 3:55 pm

enterit wrote:Did I miss the point?

Maybe I misunderstood :). I thought you wanted to completely replace JS in the browser. If instead you want to proxy from JS to some other language using the CEF API that should work fine.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Using CEF for integration with Chromium

Postby enterit » Mon May 12, 2014 4:48 pm

Sounds promising, though I still have only partial picture.
If I need to use Chromium as a standalone browser, what would be the best way to add CEF (JS Integration) into it, and then add my native code that would make use of CEF JS Integration?
After I have these two things working I should be able to hook into the page loading phase, parse <script> tags, load and execute "text/groovy" scripts.
Thanks for any additional info. I am not looking for a complete solution, I just need the right direction.
I.e. should I modify Chromium code in order to load CEF, or does it have a notion of native plugins?
If I understand correctly, main scenario of CEF usage is creating windows and instantiating browser processes from my app, whereas I need an opposite control flow - I need Chromium to load CEF and load my DLL/SO and start JVM.
enterit
Newbie
 
Posts: 4
Joined: Sun May 11, 2014 11:28 pm

Re: Using CEF for integration with Chromium

Postby magreenblatt » Mon May 12, 2014 5:09 pm

enterit wrote:If I understand correctly, main scenario of CEF usage is creating windows and instantiating browser processes from my app, whereas I need an opposite control flow - I need Chromium to load CEF and load my DLL/SO and start JVM.

I don't think that will work very well. You should look into creating an NaCL plugin instead.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Using CEF for integration with Chromium

Postby enterit » Tue May 13, 2014 10:20 pm

If my understanding is correct, NaCl works in a sandbox, that requires inter-process communication with native (trusted) part (in my case - Java process).
Does CEF JS integration work the same way? Or does it actually use native bindings (in-process calls)?
If it is native, how difficult could it be to create customized assembly of Chromium that would expose the same native API to plugins?
As you mentioned, it sounds like Dartium implemented this approach, but they did it in Chromium fork from scratch.
I would like to try to use CEF codebase for the same goal if possible.
enterit
Newbie
 
Posts: 4
Joined: Sun May 11, 2014 11:28 pm

Re: Using CEF for integration with Chromium

Postby magreenblatt » Tue May 13, 2014 10:50 pm

CEF wraps chromium. Having chromium embed CEF is very strange. I think you should reconsider what you're trying to accomplish. If your goal is to embed Java in the browser you can use an applet (Java plugin).
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 147 guests