| 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 b963044209c287436628372f8df442313c35867a..cd1b8c03175ee4c034d32fe8a0f991e4d4459d22 100644
|
| --- a/content/browser/devtools/protocol/input_handler.cc
|
| +++ b/content/browser/devtools/protocol/input_handler.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "base/trace_event/trace_event.h"
|
| #include "cc/output/compositor_frame_metadata.h"
|
| +#include "content/browser/frame_host/render_frame_host_impl.h"
|
| #include "content/browser/renderer_host/render_widget_host_impl.h"
|
| #include "content/common/input/synthetic_pinch_gesture_params.h"
|
| #include "content/common/input/synthetic_smooth_scroll_gesture_params.h"
|
| @@ -137,7 +138,7 @@ InputHandler::InputHandler()
|
| InputHandler::~InputHandler() {
|
| }
|
|
|
| -void InputHandler::SetRenderWidgetHost(RenderWidgetHostImpl* host) {
|
| +void InputHandler::SetRenderFrameHost(RenderFrameHostImpl* host) {
|
| host_ = host;
|
| }
|
|
|
| @@ -209,11 +210,11 @@ Response InputHandler::DispatchKeyEvent(
|
| ui::KeycodeConverter::KeyStringToDomKey(*key));
|
| }
|
|
|
| - if (!host_)
|
| + if (!host_ || !host_->GetRenderWidgetHost())
|
| return Response::ServerError("Could not connect to view");
|
|
|
| - host_->Focus();
|
| - host_->ForwardKeyboardEvent(event);
|
| + host_->GetRenderWidgetHost()->Focus();
|
| + host_->GetRenderWidgetHost()->ForwardKeyboardEvent(event);
|
| return Response::OK();
|
| }
|
|
|
| @@ -245,11 +246,11 @@ Response InputHandler::DispatchMouseEvent(
|
| event.clickCount = click_count ? *click_count : 0;
|
| event.pointerType = blink::WebPointerProperties::PointerType::Mouse;
|
|
|
| - if (!host_)
|
| + if (!host_ || !host_->GetRenderWidgetHost())
|
| return Response::ServerError("Could not connect to view");
|
|
|
| - host_->Focus();
|
| - host_->ForwardMouseEvent(event);
|
| + host_->GetRenderWidgetHost()->Focus();
|
| + host_->GetRenderWidgetHost()->ForwardMouseEvent(event);
|
| return Response::OK();
|
| }
|
|
|
| @@ -294,13 +295,13 @@ Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type,
|
| event->clickCount = click_count ? *click_count : 0;
|
| event->pointerType = blink::WebPointerProperties::PointerType::Touch;
|
|
|
| - if (!host_)
|
| + if (!host_ || !host_->GetRenderWidgetHost())
|
| return Response::ServerError("Could not connect to view");
|
|
|
| if (event->type == blink::WebInputEvent::MouseWheel)
|
| - host_->ForwardWheelEvent(wheel_event);
|
| + host_->GetRenderWidgetHost()->ForwardWheelEvent(wheel_event);
|
| else
|
| - host_->ForwardMouseEvent(mouse_event);
|
| + host_->GetRenderWidgetHost()->ForwardMouseEvent(mouse_event);
|
| return Response::OK();
|
| }
|
|
|
| @@ -311,7 +312,7 @@ Response InputHandler::SynthesizePinchGesture(
|
| double scale_factor,
|
| const int* relative_speed,
|
| const std::string* gesture_source_type) {
|
| - if (!host_)
|
| + if (!host_ || !host_->GetRenderWidgetHost())
|
| return Response::ServerError("Could not connect to view");
|
|
|
| SyntheticPinchGestureParams gesture_params;
|
| @@ -328,7 +329,7 @@ Response InputHandler::SynthesizePinchGesture(
|
| return Response::InvalidParams("gestureSourceType");
|
| }
|
|
|
| - host_->QueueSyntheticGesture(
|
| + host_->GetRenderWidgetHost()->QueueSyntheticGesture(
|
| SyntheticGesture::Create(gesture_params),
|
| base::Bind(&InputHandler::SendSynthesizePinchGestureResponse,
|
| weak_factory_.GetWeakPtr(), command_id));
|
| @@ -350,7 +351,7 @@ Response InputHandler::SynthesizeScrollGesture(
|
| const int* repeat_count,
|
| const int* repeat_delay_ms,
|
| const std::string* interaction_marker_name) {
|
| - if (!host_)
|
| + if (!host_ || !host_->GetRenderWidgetHost())
|
| return Response::ServerError("Could not connect to view");
|
|
|
| SyntheticSmoothScrollGestureParams gesture_params;
|
| @@ -401,7 +402,7 @@ void InputHandler::SynthesizeRepeatingScroll(
|
| command_id.call_id);
|
| }
|
|
|
| - host_->QueueSyntheticGesture(
|
| + host_->GetRenderWidgetHost()->QueueSyntheticGesture(
|
| SyntheticGesture::Create(gesture_params),
|
| base::Bind(&InputHandler::OnScrollFinished, weak_factory_.GetWeakPtr(),
|
| gesture_params, repeat_count, repeat_delay,
|
| @@ -439,7 +440,7 @@ Response InputHandler::SynthesizeTapGesture(
|
| const int* duration,
|
| const int* tap_count,
|
| const std::string* gesture_source_type) {
|
| - if (!host_)
|
| + if (!host_ || !host_->GetRenderWidgetHost())
|
| return Response::ServerError("Could not connect to view");
|
|
|
| SyntheticTapGestureParams gesture_params;
|
| @@ -462,7 +463,7 @@ Response InputHandler::SynthesizeTapGesture(
|
| // If we're doing more than one tap, don't send the response to the client
|
| // until we've completed the last tap.
|
| bool is_last_tap = i == *tap_count - 1;
|
| - host_->QueueSyntheticGesture(
|
| + host_->GetRenderWidgetHost()->QueueSyntheticGesture(
|
| SyntheticGesture::Create(gesture_params),
|
| base::Bind(&InputHandler::SendSynthesizeTapGestureResponse,
|
| weak_factory_.GetWeakPtr(), command_id, is_last_tap));
|
|
|