Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1680143002: Simulate click through gamepad BUTTON_A (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: simulate click Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index f6990c9423a5cfc00eba249c022d6da6348aa73e..c59615ef7366dcb1f240e795dbe047a9418a4d3d 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -1384,6 +1384,7 @@ bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed)
IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction,
OnCustomContextMenuAction)
+ IPC_MESSAGE_HANDLER(FrameMsg_ClickOnFocusedElement, OnClickFocusedElement)
IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo)
IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo)
IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut)
@@ -1666,6 +1667,19 @@ void RenderFrameImpl::OnCustomContextMenuAction(
}
}
+void RenderFrameImpl::OnClickFocusedElement() {
+ WebView* view = render_view_->webview();
+ WebFrame* focused_frame = view->focusedFrame();
+ if (focused_frame) {
+ WebDocument doc = focused_frame->document();
+ if (!doc.isNull()) {
+ WebElement element = doc.focusedElement();
+ if (!element.isNull())
+ element.simulateClick();
+ }
+ }
+}
+
void RenderFrameImpl::OnUndo() {
frame_->executeCommand(WebString::fromUTF8("Undo"), GetFocusedElement());
}
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698