How to handle failed downloads

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.

Re: How to handle failed downloads

Postby magreenblatt » Mon May 24, 2021 9:55 am

michaelb wrote:The image does not fail to load using google chrome, just in our CEF application. Is there a way to hook up dev tools to our specific cef application (it's a headless browser)? I am aware of how to use in google chrome in general.

Yes, you can run with `--remote-debugging-port=XXXX` and then connect from http://localhost:XXXX using Google Chrome at the same Chromium version (required for compatibility reasons).
magreenblatt
Site Admin
 
Posts: 10931
Joined: Fri May 29, 2009 6:57 pm

Re: How to handle failed downloads

Postby amaitland » Mon May 24, 2021 2:11 pm

I'd suggest trying to create your own instance of CefRequestContext and implement CefRequestContextHandler::GetResourceRequestHandler

https://magpcss.org/ceforum/apidocs3/projects/(default)/CefRequestContextHandler.html#GetResourceRequestHandler(CefRefPtr%3CCefBrowser%3E,CefRefPtr%3CCefFrame%3E,CefRefPtr%3CCefRequest%3E,bool,bool,constCefString&,bool&)

I've seen instances where CefRequestHandler::GetResourceRequestHandler isn't called yet CefRequestContextHandler::GetResourceRequestHandler was.

This might be one of those cases.
Maintainer of the CefSharp project.
amaitland
Master
 
Posts: 967
Joined: Wed Jan 14, 2015 2:35 am

Re: How to handle failed downloads

Postby michaelb » Tue May 25, 2021 3:00 am

magreenblatt wrote:
michaelb wrote:The image does not fail to load using google chrome, just in our CEF application. Is there a way to hook up dev tools to our specific cef application (it's a headless browser)? I am aware of how to use in google chrome in general.

Yes, you can run with `--remote-debugging-port=XXXX` and then connect from http://localhost:XXXX using Google Chrome at the same Chromium version (required for compatibility reasons).


We have this enabled in our code, at a port, and yet it does not work when I go to http://localhost:XXXX (with XXXX being substituted with our port number obviously). Maybe it's the version issue. How do I find the chromium version, it's just the C++ API ?

Edit: Never mind, got it to work and see the DevTools. Was at the wrong port and will look into this. Thanks!
Last edited by michaelb on Tue May 25, 2021 3:05 am, edited 1 time in total.
michaelb
Techie
 
Posts: 20
Joined: Thu May 20, 2021 7:38 am

Re: How to handle failed downloads

Postby michaelb » Tue May 25, 2021 3:02 am

amaitland wrote:I'd suggest trying to create your own instance of CefRequestContext and implement CefRequestContextHandler::GetResourceRequestHandler

https://magpcss.org/ceforum/apidocs3/projects/(default)/CefRequestContextHandler.html#GetResourceRequestHandler(CefRefPtr%3CCefBrowser%3E,CefRefPtr%3CCefFrame%3E,CefRefPtr%3CCefRequest%3E,bool,bool,constCefString&,bool&)

I've seen instances where CefRequestHandler::GetResourceRequestHandler isn't called yet CefRequestContextHandler::GetResourceRequestHandler was.

This might be one of those cases.


Hmmm, we just have a handler class that implements the ResourceRequestHandler's OnResourceResponse method directly, without any instances. Is this the wrong approach?
class MyHandler : public CefClient,
public CefLifeSpanHandler,
public CefLoadHandler,
public CefResourceRequestHandler,
public CefDownloadHandler

and then within the class
virtual bool OnResourceResponse(
CefRefPtr< CefBrowser > browser,
CefRefPtr< CefFrame > frame,
CefRefPtr< CefRequest > request,
CefRefPtr< CefResponse > response)
{
michaelb
Techie
 
Posts: 20
Joined: Thu May 20, 2021 7:38 am


Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 21 guests