Page 1 of 1

Add CefFrame::SendCommand(const CefString& command)

PostPosted: Tue Apr 03, 2018 10:49 pm
by amaitland
Chromium supports a lot of commands that aren't exposed in CEF. Rather than go through and add all the methods one by one, maybe it's worth making SendCommand accessible?

EditorCommand doesn't appear to have any public methods for validation (it doesn't internally from the quick check I did). So maybe just go without validation?

For my own reference later
https://cs.chromium.org/chromium/src/th ... Type&l=150
https://cs.chromium.org/chromium/src/th ... and.cpp&dr

I couldn't find any issues or old pull requests that addresses the topic. Feel free to ignore if it's already covered somewhere.

Re: Add CefFrame::SendCommand(const CefString& command)

PostPosted: Wed Apr 04, 2018 12:00 pm
by magreenblatt
There's already Document.execCommand() in JavaScript. You could just use CefFrame::ExecuteJavaScript.

Re: Add CefFrame::SendCommand(const CefString& command)

PostPosted: Wed Apr 04, 2018 4:43 pm
by amaitland
Thanks for the link and taking the time to answer, personally I'm quite comfortable executing JavaScript, sending mouse and keyboard commands, I find that others find it daunting.

Would you consider merging a PR that added a simple SendCommand method?

Re: Add CefFrame::SendCommand(const CefString& command)

PostPosted: Wed Apr 04, 2018 5:16 pm
by magreenblatt
If you want this functionality it's very easy to create a simple helper function that internally calls ExecuteJavaScript. I don't think we should add new native API that specializes what can already be achieved with existing API. Also, any attempt to document supported commands (using an enum, for example) would quickly become stale.

Re: Add CefFrame::SendCommand(const CefString& command)

PostPosted: Wed Apr 04, 2018 6:25 pm
by amaitland
Expanding the core CEF API makes more sense to me than having to implement a custom implementation.

I get that trying to maintain an enum would be a maintenance nightmare, hence the suggestion to simply accept a string, You could then access a larger subset of the commands for minimal code, the doco can make reference to the Chromium source, nothing fancy.

Anyways, it's totally up to you, just seems like a quick win to me.