Chromium Code Reviews| Index: content/browser/devtools/protocol/input_handler.cc |
| diff --git a/content/browser/devtools/protocol/input_handler.cc b/content/browser/devtools/protocol/input_handler.cc |
| index 04be3a8e487ec7ff0f44b35f1fbaf1e5c8fc5e5e..d679d9dae95124a15a30c87c44a6691016d2bd61 100644 |
| --- a/content/browser/devtools/protocol/input_handler.cc |
| +++ b/content/browser/devtools/protocol/input_handler.cc |
| @@ -137,6 +137,15 @@ InputHandler::InputHandler() |
| InputHandler::~InputHandler() { |
| } |
| +void InputHandler::OnInputEventAck(const blink::WebInputEvent& event, |
| + bool was_synthetic) { |
|
tdresser
2016/10/12 19:49:36
We appear to switch between is_synthetic and was_s
samuong
2016/10/13 22:59:10
Done.
|
| + if (blink::WebInputEvent::isKeyboardEventType(event.type) && was_synthetic) { |
| + DCHECK(!pending_key_event_ids_.empty()); |
|
tdresser
2016/10/12 19:49:36
A compromised renderer could send bogus acks, and
samuong
2016/10/13 22:59:10
Done. That's a good point, I've added this to the
|
| + SendDispatchKeyEventResponse(pending_key_event_ids_.front()); |
| + pending_key_event_ids_.pop(); |
| + } |
| +} |
| + |
| void InputHandler::SetRenderWidgetHost(RenderWidgetHostImpl* host) { |
| host_ = host; |
| } |
| @@ -152,6 +161,7 @@ void InputHandler::OnSwapCompositorFrame( |
| } |
| Response InputHandler::DispatchKeyEvent( |
| + DevToolsCommandId command_id, |
| const std::string& type, |
| const int* modifiers, |
| const double* timestamp, |
| @@ -167,6 +177,7 @@ Response InputHandler::DispatchKeyEvent( |
| const bool* is_system_key) { |
| NativeWebKeyboardEvent event; |
| event.skip_in_browser = true; |
| + event.is_synthetic = true; |
| if (type == dispatch_key_event::kTypeKeyDown) { |
| event.type = blink::WebInputEvent::KeyDown; |
| @@ -212,6 +223,7 @@ Response InputHandler::DispatchKeyEvent( |
| if (!host_) |
| return Response::ServerError("Could not connect to view"); |
| + pending_key_event_ids_.push(command_id); |
| host_->Focus(); |
| host_->ForwardKeyboardEvent(event); |
| return Response::OK(); |
| @@ -471,6 +483,11 @@ Response InputHandler::SynthesizeTapGesture( |
| return Response::OK(); |
| } |
| +void InputHandler::SendDispatchKeyEventResponse(DevToolsCommandId command_id) { |
| + client_->SendDispatchKeyEventResponse( |
| + command_id, DispatchKeyEventResponse::Create()); |
| +} |
| + |
| void InputHandler::SendSynthesizePinchGestureResponse( |
| DevToolsCommandId command_id, |
| SyntheticGesture::Result result) { |