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 967dd2cd21e0a91ca65631cfd8d26ecea4d3a5ba..a1e7d6f3e6dd1c43e8f35496998dbc1a681cb86d 100644 |
--- a/content/browser/devtools/protocol/input_handler.cc |
+++ b/content/browser/devtools/protocol/input_handler.cc |
@@ -200,6 +200,8 @@ InputHandler::InputHandler() |
} |
InputHandler::~InputHandler() { |
+ if (host_ && ignore_input_events_) |
dgozman
2017/05/22 18:35:54
Drop this.
|
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(false); |
} |
// static |
@@ -211,11 +213,17 @@ std::vector<InputHandler*> InputHandler::ForAgentHost( |
void InputHandler::SetRenderFrameHost(RenderFrameHostImpl* host) { |
ClearPendingKeyAndMouseCallbacks(); |
- if (host_) |
+ if (host_) { |
host_->GetRenderWidgetHost()->RemoveInputEventObserver(this); |
+ if (ignore_input_events_) |
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(false); |
+ } |
host_ = host; |
- if (host) |
+ if (host) { |
host->GetRenderWidgetHost()->AddInputEventObserver(this); |
+ if (ignore_input_events_) |
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(true); |
+ } |
} |
void InputHandler::OnInputEvent(const blink::WebInputEvent& event) { |
@@ -246,8 +254,12 @@ void InputHandler::OnSwapCompositorFrame( |
Response InputHandler::Disable() { |
ClearPendingKeyAndMouseCallbacks(); |
- if (host_) |
+ if (host_) { |
host_->GetRenderWidgetHost()->RemoveInputEventObserver(this); |
+ if (ignore_input_events_) |
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(false); |
+ } |
+ ignore_input_events_ = false; |
return Response::OK(); |
} |
@@ -458,6 +470,13 @@ Response InputHandler::EmulateTouchFromMouseEvent(const std::string& type, |
return Response::OK(); |
} |
+Response InputHandler::SetIgnoreInputEvents(bool ignore) { |
+ ignore_input_events_ = ignore; |
+ if (host_) |
+ host_->GetRenderWidgetHost()->SetIgnoreInputEvents(ignore); |
+ return Response::OK(); |
+} |
+ |
void InputHandler::SynthesizePinchGesture( |
int x, |
int y, |