Add CefFrame::SendCommand(const CefString& command)

Think CEF could benefit from a new feature or capability? Discuss CEF feature requests here.

Add CefFrame::SendCommand(const CefString& command)

Postby amaitland » Tue Apr 03, 2018 10:49 pm

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.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

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

Postby magreenblatt » Wed Apr 04, 2018 12:00 pm

There's already Document.execCommand() in JavaScript. You could just use CefFrame::ExecuteJavaScript.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

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

Postby amaitland » Wed Apr 04, 2018 4:43 pm

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?
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

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

Postby magreenblatt » Wed Apr 04, 2018 5:16 pm

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.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

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

Postby amaitland » Wed Apr 04, 2018 6:25 pm

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.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am


Return to Feature Request Forum

Who is online

Users browsing this forum: No registered users and 17 guests