fud0 / javacef

Automatically exported from code.google.com/p/javacef
0 stars 0 forks source link

Sending string msg from "browser" to "java" world #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is more of query than a bug.

In javachromiumembedded, there is a provision to send msg to Java world.
By invoking "window.cefQuery", it is possible to send a string to Java world in 
the above library.

I was looking for such a thing in javacef. So far I couldn't.

I thought, its better to post a query.

1) Is it possible to send such string msgs ? (in the current implementation)
2) If yes,..please provide some pointers.
3) If no, any tips to build that bridge (c/c++ -> jni -> java)
    such as 1) fixing any c++ file
            2) porting to latest cef runtime
            etc..

This is important for me to adopt this library. Please help.

Regards,
Chandra

Original issue reported on code.google.com by kscr...@gmail.com on 10 Jun 2014 at 4:54

GoogleCodeExporter commented 9 years ago
Currently javacef doesn't support this. The way to do this is different in 
newer version of cef. I'll have time to port the latest cef this weekend, and 
the method is in Issue 3.

For the latest runtime,
https://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/tests/cefcli
ent/binding_test.h
https://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/tests/cefcli
ent/binding_test.cpp
https://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/tests/cefcli
ent/client_handler.cpp    (line 649)
https://code.google.com/p/javachromiumembedded/source/browse/trunk/src/native/me
ssage_router_handler.cpp

For the current (old) runtime:
https://code.google.com/p/chromiumembedded/source/browse/branches/1547/cef3/test
s/cefclient/binding_test.h
https://code.google.com/p/chromiumembedded/source/browse/branches/1547/cef3/test
s/cefclient/binding_test.cpp
https://code.google.com/p/chromiumembedded/source/browse/branches/1547/cef3/test
s/cefclient/res/binding.html

I think you can implement a similar one as binding_test, register it, send the 
string to Java, return a true/false in the Java method and call the success or 
failure method in c++. 

Original comment by wjy...@gmail.com on 10 Jun 2014 at 1:29

GoogleCodeExporter commented 9 years ago
Hi,
I am eagerly waiting about porting cef to the latest.
If you don't mind, can you give me approx dates by when this can be completed. 
I will plan my work accordingly.

Thank you.

Original comment by kscr...@gmail.com on 17 Jun 2014 at 4:55

GoogleCodeExporter commented 9 years ago
Is there a any plan to support java to js / js to java communication ? I'm 
looking for something similar to org.eclipse.swt.browser.Browser.execute() and 
org.eclipse.swt.browser.BrowserFunction

Original comment by guil...@gmail.com on 26 Jan 2015 at 5:43

GoogleCodeExporter commented 9 years ago
@guillez, I don't have time to work on this now, so you may need to check the 
links of the latest runtime in comment #1 for js to java. You can add a native 
method to pass the string from java to c++ and call 
g_handler_local->GetBrowser()->GetMainFrame()->ExecuteJavaScript("js", 
frame->GetURL(), 0);

Original comment by wjyw...@gmail.com on 4 Feb 2015 at 3:04