Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Developer Tools to mouse context menu #22

Open
cztomczak opened this issue Jan 7, 2015 · 1 comment
Open

Add Developer Tools to mouse context menu #22

cztomczak opened this issue Jan 7, 2015 · 1 comment

Comments

@cztomczak
Copy link
Owner

Set CefSettings.remote_debugging_port to a random value between 49152 and 65535 to enable developer tools.

The C++ code for showing devtools is:

bool ShowDevTools(CefRefPtr<CefBrowser> browser) {
    CefWindowInfo windowInfo;
    CefBrowserSettings settings;
    #if defined(OS_WIN)
    windowInfo.SetAsPopup(browser->GetHost()->GetWindowHandle(), "DevTools");
    #endif
    browser->GetHost()->ShowDevTools(windowInfo, browser->GetHost()->GetClient(), settings);
    return true;
}

The C++ code for adding a menu item is:

CefContextMenuHandler::OnBeforeContextMenu() {
    model->AddItem(_MENU_ID_DEVTOOLS, "Show Developer Tools");
}
CefContextMenuHandler::OnContextMenuCommand() {
    if (command_id == _MENU_ID_DEVTOOLS) {
        ShowDevTools(browser);
        return true;
    }
}
@cztomczak
Copy link
Owner Author

In the meantime to enable remote debugging one would need to add this code:

cefSettings.remote_debugging_port = 8080

Here after line 125:
https://github.com/CzarekTomczak/cef2go/blob/f78983456b6c8a899d27f72ffe6923019ba92504/src/cef/cef.go#L125

This will allow to open the cef2go developer tools in Google Chrome at the http://127.0.0.1:8080/ address.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant