| 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..7a327b1e1e0f9d139c952fd42e9a105e8b9561ce 100644
|
| --- a/content/browser/devtools/protocol/input_handler.cc
|
| +++ b/content/browser/devtools/protocol/input_handler.cc
|
| @@ -137,7 +137,36 @@ InputHandler::InputHandler()
|
| InputHandler::~InputHandler() {
|
| }
|
|
|
| +void InputHandler::OnInputEventAck(const blink::WebInputEvent& event,
|
| + bool is_synthetic) {
|
| + if (!is_synthetic)
|
| + return;
|
| +
|
| + if (blink::WebInputEvent::isKeyboardEventType(event.type) &&
|
| + !pending_key_event_ids_.empty()) {
|
| + SendDispatchKeyEventResponse(pending_key_event_ids_.front());
|
| + pending_key_event_ids_.pop_front();
|
| + } else if (blink::WebInputEvent::isMouseEventType(event.type) &&
|
| + !pending_mouse_event_ids_.empty()) {
|
| + SendDispatchMouseEventResponse(pending_mouse_event_ids_.front());
|
| + pending_mouse_event_ids_.pop_front();
|
| + }
|
| +}
|
| +
|
| void InputHandler::SetRenderWidgetHost(RenderWidgetHostImpl* host) {
|
| + for (const DevToolsCommandId& command_id : pending_key_event_ids_)
|
| + SendDispatchKeyEventResponse(command_id);
|
| + pending_key_event_ids_.clear();
|
| +
|
| + for (const DevToolsCommandId& command_id : pending_mouse_event_ids_)
|
| + SendDispatchMouseEventResponse(command_id);
|
| + pending_mouse_event_ids_.clear();
|
| +
|
| + if (host_)
|
| + host_->RemoveInputEventObserver(this);
|
| + if (host)
|
| + host->AddInputEventObserver(this);
|
| +
|
| host_ = host;
|
| }
|
|
|
| @@ -152,6 +181,7 @@ void InputHandler::OnSwapCompositorFrame(
|
| }
|
|
|
| Response InputHandler::DispatchKeyEvent(
|
| + DevToolsCommandId command_id,
|
| const std::string& type,
|
| const int* modifiers,
|
| const double* timestamp,
|
| @@ -167,6 +197,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,12 +243,14 @@ Response InputHandler::DispatchKeyEvent(
|
| if (!host_)
|
| return Response::ServerError("Could not connect to view");
|
|
|
| + pending_key_event_ids_.push_back(command_id);
|
| host_->Focus();
|
| host_->ForwardKeyboardEvent(event);
|
| return Response::OK();
|
| }
|
|
|
| Response InputHandler::DispatchMouseEvent(
|
| + DevToolsCommandId command_id,
|
| const std::string& type,
|
| int x,
|
| int y,
|
| @@ -248,6 +281,7 @@ Response InputHandler::DispatchMouseEvent(
|
| if (!host_)
|
| return Response::ServerError("Could not connect to view");
|
|
|
| + pending_mouse_event_ids_.push_back(command_id);
|
| host_->Focus();
|
| host_->ForwardMouseEvent(event);
|
| return Response::OK();
|
| @@ -471,6 +505,17 @@ Response InputHandler::SynthesizeTapGesture(
|
| return Response::OK();
|
| }
|
|
|
| +void InputHandler::SendDispatchKeyEventResponse(DevToolsCommandId command_id) {
|
| + client_->SendDispatchKeyEventResponse(
|
| + command_id, DispatchKeyEventResponse::Create());
|
| +}
|
| +
|
| +void InputHandler::SendDispatchMouseEventResponse(
|
| + DevToolsCommandId command_id) {
|
| + client_->SendDispatchMouseEventResponse(
|
| + command_id, DispatchMouseEventResponse::Create());
|
| +}
|
| +
|
| void InputHandler::SendSynthesizePinchGestureResponse(
|
| DevToolsCommandId command_id,
|
| SyntheticGesture::Result result) {
|
|
|