Hi,
I've never tried that but it should be possible.
The SchemeRegistrationBrowser demo has synchronous responses but you should be able to make it asynchronous if you use the callbacks.
Read these pages for more info :
https://magpcss.org/ceforum/apidocs3/pr ... ndler.html
https://github.com/chromiumembedded/cef ... ler_capi.h
All the THelloScheme procedures and functions found in the SchemeRegistrationBrowser demo are explained in those links, including how to make it asynchronous.
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
Async Custom Scheme
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Async Custom Scheme
These are the code comments for process_request :
I would copy these values to use them later :
Later, I would use the URL from the request to check if that request can be handled and call callback.cont in case you can handle it. If you can't then call callback.cancel.
The comments for the read_response function :
If I understand this correctly, if you don't have the data when this function is called you have to :
Code: Select all
///
// Begin processing the request. To handle the request return true (1) and
// call cef_callback_t::cont() once the response header information is
// available (cef_callback_t::cont() can also be called from inside this
// function if header information is available immediately). To cancel the
// request return false (0).
///
int(CEF_CALLBACK* process_request)(struct _cef_resource_handler_t* self,
struct _cef_request_t* request,
struct _cef_callback_t* callback);
- callback
- request.url and maybe other request details but not the "request" instance.
Later, I would use the URL from the request to check if that request can be handled and call callback.cont in case you can handle it. If you can't then call callback.cancel.
The comments for the read_response function :
Code: Select all
///
// Read response data. If data is available immediately copy up to
// |bytes_to_read| bytes into |data_out|, set |bytes_read| to the number of
// bytes copied, and return true (1). To read the data at a later time set
// |bytes_read| to 0, return true (1) and call cef_callback_t::cont() when the
// data is available. To indicate response completion return false (0).
///
int(CEF_CALLBACK* read_response)(struct _cef_resource_handler_t* self,
void* data_out,
int bytes_to_read,
int* bytes_read,
struct _cef_callback_t* callback);
- Set bytesRead to 0
- Copy the callback parameter.
- Set Result to TRUE and exit the ReadResponse function.