failing to use ShowDevTools

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.

failing to use ShowDevTools

Postby lkitrossky » Thu May 14, 2015 4:23 pm

Hi! We are developing an application on the basis of CEF/Chromium instead of using Chrome. But Chrome has a debug/development tools console which makes it much easier to debug JavaScript. We have a string desire to open development tools also in our application. There is a test OnUncaughtExceptionDevTools which shows how to do it in
Code: Select all
 class V8TestHandler:
browser->GetHost()->ShowDevTools(windowInfo, this, settings,   CefPoint());

We tried to do the same, we have
Code: Select all
class MyApp: public CefApp, public CefRenderProcessHandler, public CefBrowserProcessHandler{…}
and we are trying to use
Code: Select all
browser->GetHost()->ShowDevTools(windowInfo, this, settings,   CefPoint());

from
Code: Select all
OnContextCreated(CefRefPtr<CefBrowser> browser…),
OnBrowserCreated(CefRefPtr<CefBrowser> browser), OnProcessMessageReceived(CefRefPtr<CefBrowser> browser…), OnFocusedNodeChanged(CefRefPtr<CefBrowser> browser,…), OnBeforeNavigation(CefRefPtr<CefBrowser> browser,…)

But every time browser->GetHost() returns NULL! I understand that it is because these methods are from CefRenderProcessHandler and not browser. So we attempted to use OnRenderProcessThreadCreated ( CefRefPtr<CefListValue> extra_info), which is from CefBrowserProcessHandler, but how to get browser in this method (and extra_info->GetSize() returned 0)? We found some discussion about it: (Allow synchronously sending extra_info to renderer at each browser creation), http://www.magpcss.org/ceforum/viewtopic.php?f=7&t=11019, https://code.google.com/p/chromiumembed ... il?id=1088 (Allow synchronously sending extra_info to renderer at each browser creation) but still do not understand how to apply browser->GetHost()->ShowDevTools, please, throw some light on it. Thanks, Levi
lkitrossky
Mentor
 
Posts: 66
Joined: Tue Mar 24, 2015 7:26 am

Re: failing to use ShowDevTools

Postby magreenblatt » Thu May 14, 2015 4:38 pm

When do you want to show DevTools? Why are you trying to do it from the renderer process?
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: failing to use ShowDevTools

Postby lkitrossky » Fri May 15, 2015 12:25 am

We would like to see DevTools opened all the time, just do not know how to do it for our class MyApp: public CefApp, public CefRenderProcessHandler, public CefBrowserProcessHandler{…}. Please, instruct.
lkitrossky
Mentor
 
Posts: 66
Joined: Tue Mar 24, 2015 7:26 am

Re: failing to use ShowDevTools

Postby magreenblatt » Fri May 15, 2015 7:22 am

There is a 1:1 relationship between DevTools windows and browser windows. You should be able to create the DevTools window from CefLifeSpanHandler::OnAfterCreated.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: failing to use ShowDevTools

Postby lkitrossky » Sun May 17, 2015 4:07 am

We use only CefApp and not CefClient (with CefLifeSpanHandler::OnAfterCreated). So, how to use ShowDevTools from CefApp only?
lkitrossky
Mentor
 
Posts: 66
Joined: Tue Mar 24, 2015 7:26 am

Re: failing to use ShowDevTools

Postby lkitrossky » Mon May 18, 2015 1:57 am

I still do not know how to open DevTools, but my boss found this helpful link viewtopic.php?f=6&t=12583#p24203 how to debug CEF application from Chrome.
Citation:
you can use remote debugging by passing the `--remote-debugging-port=8080` command-line flag and browsing to http://localhost:8080 in any Chromium-based browser.
lkitrossky
Mentor
 
Posts: 66
Joined: Tue Mar 24, 2015 7:26 am

Re: failing to use ShowDevTools

Postby magreenblatt » Mon May 18, 2015 11:13 am

lkitrossky wrote:We use only CefApp and not CefClient (with CefLifeSpanHandler::OnAfterCreated). So, how to use ShowDevTools from CefApp only?

You will need to implement CefClient.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 35 guests