Page 1 of 1

Custom low-level network functionality

PostPosted: Mon May 29, 2017 9:49 am
by ben
I want to use CEF to build a very basic Webviewer that should be able to load and display webpages.
The low level network access however is very specific. Because of sandbox restrictions this Webviewer cannot open his own TCP/UDP-sockets but gets them handed by a network blackbox. Whenever the user opens a new URL the Webviewer has to ask this network blackbox for permissions and then gets the necessary sockets handed to him. The open sockets get sent via a unix domain socket.

Q:
In which files of the CEF repository can I find the low-level-network stuff? I haven't found anything in the libcef/browser/net folder.
Q:
Is there a way to overwrite the default network access functions without compromising high-level functions like LoadURL()? I still want to be able to use the "normal" request functions, but only with my custom functions underneath?

Environment:
Fedora 25

Thanks for all your help! Sorry if the questions are trivial, I'm new to the project ;)

Re: Custom low-level network functionality

PostPosted: Mon May 29, 2017 10:14 am
by magreenblatt
You would need to implement this functionality in Chromium (src/net code). I suggest you start by downloading/building Chromium from source code and reviewing the code in that directory. If you have any specific questions you can ask on Chromium's net-dev mailing list.

Re: Custom low-level network functionality

PostPosted: Mon May 29, 2017 3:59 pm
by amaitland
What about implementing a scheme handler? You can register for http and HTTPS, intercepting every request, make your custom requests and populate the response stream when your done.

Re: Custom low-level network functionality

PostPosted: Tue May 30, 2017 1:14 am
by Czarek
You can control requests by implementing CefRequestHandler::GetResourceHandler. Use CefURLRequest/CefURLRequestClient to perform the requests.

Re: Custom low-level network functionality

PostPosted: Wed Jul 12, 2017 8:31 am
by ben
After some fiddling with a custom scheme handler I wonder if CEF provides any callbacks to hook into the socket setup process of chromium?
Are there any callbacks you can register to that are called when CEF opens a socket?

IMHO, modifying the Chromium source code seems a bit overkill for such a task.

Re: Custom low-level network functionality

PostPosted: Wed Jul 12, 2017 10:59 am
by magreenblatt
ben wrote:After some fiddling with a custom scheme handler I wonder if CEF provides any callbacks to hook into the socket setup process of chromium?
Are there any callbacks you can register to that are called when CEF opens a socket?

IMHO, modifying the Chromium source code seems a bit overkill for such a task.

No such callbacks exist.